Title: [239661] trunk
- Revision
- 239661
- Author
- za...@apple.com
- Date
- 2019-01-05 19:54:25 -0800 (Sat, 05 Jan 2019)
Log Message
Incorrect clipping across compositing boundary.
https://bugs.webkit.org/show_bug.cgi?id=193172
<rdar://problem/44693008>
Reviewed by Simon Fraser.
Source/WebCore:
Use temporary cliprect type when crossing compositing boundary to prevent cliprect caching.
The issue here is that RenderLayer::backgroundClipRect() could cross compositing boundary by calling parentClipRects() which triggers
clip rect update using the wrong painting root. This happens when the layer hierarchy and the compositing context do not match.
For clip rect computation, we need to climb up on the layer hierarchy (calling parent layer's cliprect functions)
but we also need to make sure that the computed cliprects on any given layer are cached only when the painting root is correct.
It ensures that when we paint a layer (with the painting root as entry point), the cached cliprects are always based on its onw painting root.
Test: compositing/clipping/cached-cliprect-with-compositing-boundary.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
LayoutTests:
* compositing/clipping/cached-cliprect-with-compositing-boundary-expected.html: Added.
* compositing/clipping/cached-cliprect-with-compositing-boundary.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (239660 => 239661)
--- trunk/LayoutTests/ChangeLog 2019-01-06 01:19:00 UTC (rev 239660)
+++ trunk/LayoutTests/ChangeLog 2019-01-06 03:54:25 UTC (rev 239661)
@@ -1,3 +1,14 @@
+2019-01-05 Zalan Bujtas <za...@apple.com>
+
+ Incorrect clipping across compositing boundary.
+ https://bugs.webkit.org/show_bug.cgi?id=193172
+ <rdar://problem/44693008>
+
+ Reviewed by Simon Fraser.
+
+ * compositing/clipping/cached-cliprect-with-compositing-boundary-expected.html: Added.
+ * compositing/clipping/cached-cliprect-with-compositing-boundary.html: Added.
+
2019-01-05 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r239607.
Added: trunk/LayoutTests/compositing/clipping/cached-cliprect-with-compositing-boundary-expected.html (0 => 239661)
--- trunk/LayoutTests/compositing/clipping/cached-cliprect-with-compositing-boundary-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/clipping/cached-cliprect-with-compositing-boundary-expected.html 2019-01-06 03:54:25 UTC (rev 239661)
@@ -0,0 +1,56 @@
+<iframe style="width: 400px; height: 400px;" frameborder="0" src=""
+<style>
+.overlap {
+ position: absolute;
+ top: 10px;
+ left: 10px;
+ width: 100px;
+ height: 100px;
+ background-color: silver;
+}
+
+.outer {
+ border: 5px solid green;
+ position: relative;
+ top: 50px;
+ left: 50px;
+ height: 250px;
+ width: 250px;
+}
+
+.middle {
+ overflow-y: scroll;
+ border: 5px solid orange;
+}
+
+.overflow-scroll {
+ height: 100%;
+ overflow-y: scroll;
+}
+
+.item {
+ height: 200px;
+ border: 5px solid blue;
+ background-color: yellow;
+}
+
+.layery {
+ position: relative;
+ padding: 10px;
+}
+</style>
+
+<div class=overlap></div>
+<div class=outer>
+ <div class=middle>
+ <div class=overflow-scroll>
+ <div class=item>Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ <div class=layery>Thing with RenderLayer</div>
+ </div>
+</div>
+"></iframe>
Added: trunk/LayoutTests/compositing/clipping/cached-cliprect-with-compositing-boundary.html (0 => 239661)
--- trunk/LayoutTests/compositing/clipping/cached-cliprect-with-compositing-boundary.html (rev 0)
+++ trunk/LayoutTests/compositing/clipping/cached-cliprect-with-compositing-boundary.html 2019-01-06 03:54:25 UTC (rev 239661)
@@ -0,0 +1,56 @@
+<iframe style="width: 400px; height: 400px;" frameborder="0" src=""
+<style>
+.overlap {
+ position: fixed;
+ top: 10px;
+ left: 10px;
+ width: 100px;
+ height: 100px;
+ background-color: silver;
+}
+
+.outer {
+ border: 5px solid green;
+ position: relative;
+ top: 50px;
+ left: 50px;
+ height: 250px;
+ width: 250px;
+}
+
+.middle {
+ overflow-y: scroll;
+ border: 5px solid orange;
+}
+
+.overflow-scroll {
+ height: 100%;
+ overflow-y: scroll;
+}
+
+.item {
+ height: 200px;
+ border: 5px solid blue;
+ background-color: yellow;
+}
+
+.layery {
+ position: relative;
+ padding: 10px;
+}
+</style>
+
+<div class=overlap></div>
+<div class=outer>
+ <div class=middle>
+ <div class=overflow-scroll>
+ <div class=item>Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible. Pass if this text is visible.
+ <div class=layery>Thing with RenderLayer</div>
+ </div>
+</div>
+"></iframe>
Modified: trunk/Source/WebCore/ChangeLog (239660 => 239661)
--- trunk/Source/WebCore/ChangeLog 2019-01-06 01:19:00 UTC (rev 239660)
+++ trunk/Source/WebCore/ChangeLog 2019-01-06 03:54:25 UTC (rev 239661)
@@ -1,3 +1,24 @@
+2019-01-05 Zalan Bujtas <za...@apple.com>
+
+ Incorrect clipping across compositing boundary.
+ https://bugs.webkit.org/show_bug.cgi?id=193172
+ <rdar://problem/44693008>
+
+ Reviewed by Simon Fraser.
+
+ Use temporary cliprect type when crossing compositing boundary to prevent cliprect caching.
+
+ The issue here is that RenderLayer::backgroundClipRect() could cross compositing boundary by calling parentClipRects() which triggers
+ clip rect update using the wrong painting root. This happens when the layer hierarchy and the compositing context do not match.
+ For clip rect computation, we need to climb up on the layer hierarchy (calling parent layer's cliprect functions)
+ but we also need to make sure that the computed cliprects on any given layer are cached only when the painting root is correct.
+ It ensures that when we paint a layer (with the painting root as entry point), the cached cliprects are always based on its onw painting root.
+
+ Test: compositing/clipping/cached-cliprect-with-compositing-boundary.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::calculateClipRects const):
+
2019-01-05 Youenn Fablet <you...@apple.com>
Service Worker fetch should obey its referrer policy
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (239660 => 239661)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-01-06 01:19:00 UTC (rev 239660)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2019-01-06 03:54:25 UTC (rev 239661)
@@ -5478,16 +5478,18 @@
ClipRect RenderLayer::backgroundClipRect(const ClipRectsContext& clipRectsContext) const
{
ASSERT(parent());
- auto computeParentRects = [this, &clipRectsContext] () {
- // If we cross into a different pagination context, then we can't rely on the cache.
- // Just switch over to using TemporaryClipRects.
- if (clipRectsContext.clipRectsType != TemporaryClipRects
- && parent()->enclosingPaginationLayer(IncludeCompositedPaginatedLayers) != enclosingPaginationLayer(IncludeCompositedPaginatedLayers)) {
- ClipRectsContext tempContext(clipRectsContext);
- tempContext.clipRectsType = TemporaryClipRects;
- return parentClipRects(tempContext);
- }
- return parentClipRects(clipRectsContext);
+ auto computeParentRects = [&] {
+ if (clipRectsContext.clipRectsType == TemporaryClipRects)
+ return parentClipRects(clipRectsContext);
+ // If we cross into a different composition/pagination context, then we can't rely on the cache since the root layer differs.
+ bool crossesPaginationBoundary = parent()->enclosingPaginationLayer(IncludeCompositedPaginatedLayers) != enclosingPaginationLayer(IncludeCompositedPaginatedLayers);
+ bool crossesCompositingBoundary = parent()->enclosingCompositingLayerForRepaint() != enclosingCompositingLayerForRepaint();
+ if (!crossesPaginationBoundary && !crossesCompositingBoundary)
+ return parentClipRects(clipRectsContext);
+
+ ClipRectsContext tempContext(clipRectsContext);
+ tempContext.clipRectsType = TemporaryClipRects;
+ return parentClipRects(tempContext);
};
auto parentRects = computeParentRects();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes