Title: [260828] trunk
Revision
260828
Author
[email protected]
Date
2020-04-28 09:05:36 -0700 (Tue, 28 Apr 2020)

Log Message

msn.com: Header flickers when scrolling articles
https://bugs.webkit.org/show_bug.cgi?id=211126
<rdar://problem/56439177>

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/fixed-with-clip-stability.html

In case of fixed positioned elements the decision to create backing depends on clip rect.
However RenderLayer::localClipRect() tests for backing in call to clippingRootForPainting(). This creates
instability since clipping depends on backing decision, and backing decision depends on clipping.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::localClipRect const):

Specifically the result of clipExceedsBounds test here is affected by computed offsetFromRoot:
"clipRect.contains(cssClipRect)" test fails for zero sized clips with different offsets.

Compute clipExceedsBounds by looking at the clip sizes only and ignoring the position (which should match).

LayoutTests:

* compositing/fixed-with-clip-stability-expected.txt: Added.
* compositing/fixed-with-clip-stability.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260827 => 260828)


--- trunk/LayoutTests/ChangeLog	2020-04-28 15:25:11 UTC (rev 260827)
+++ trunk/LayoutTests/ChangeLog	2020-04-28 16:05:36 UTC (rev 260828)
@@ -1,3 +1,14 @@
+2020-04-28  Antti Koivisto  <[email protected]>
+
+        msn.com: Header flickers when scrolling articles
+        https://bugs.webkit.org/show_bug.cgi?id=211126
+        <rdar://problem/56439177>
+
+        Reviewed by Simon Fraser.
+
+        * compositing/fixed-with-clip-stability-expected.txt: Added.
+        * compositing/fixed-with-clip-stability.html: Added.
+
 2020-04-28  Jason Lawrence  <[email protected]>
 
         [ Mac wk2 ] tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-padding.html is flaky failing.

Added: trunk/LayoutTests/compositing/fixed-with-clip-stability-expected.txt (0 => 260828)


--- trunk/LayoutTests/compositing/fixed-with-clip-stability-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-with-clip-stability-expected.txt	2020-04-28 16:05:36 UTC (rev 260828)
@@ -0,0 +1,2 @@
+text
+PASS

Added: trunk/LayoutTests/compositing/fixed-with-clip-stability.html (0 => 260828)


--- trunk/LayoutTests/compositing/fixed-with-clip-stability.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-with-clip-stability.html	2020-04-28 16:05:36 UTC (rev 260828)
@@ -0,0 +1,21 @@
+<style>
+body { height: 10000px; }
+.fixed { position:fixed; background-color: green; width: 200px; height:200px; left: 100px;}
+.clipped-fixed { position: fixed; top: 50px; left: 40px; width: 200px; height:20px; clip:rect(0,0,0,0)}
+</style>
+<div class=fixed><div class=clipped-fixed>text</div></div>
+<pre id=results></pre>
+<script>
+if (window.internals) {
+    testRunner.dumpAsText();
+
+    const result1 = internals.layerTreeAsText(document);
+    document.querySelector('.fixed').style.color = "blue";
+    const result2 = internals.layerTreeAsText(document);
+
+    const pass = result1 == result2;
+    results.textContent = pass ? "PASS" : "FAIL";
+    if (!pass)
+        results.textContent +=  "\n" + result1 + "\n" + result2;
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (260827 => 260828)


--- trunk/Source/WebCore/ChangeLog	2020-04-28 15:25:11 UTC (rev 260827)
+++ trunk/Source/WebCore/ChangeLog	2020-04-28 16:05:36 UTC (rev 260828)
@@ -1,3 +1,25 @@
+2020-04-28  Antti Koivisto  <[email protected]>
+
+        msn.com: Header flickers when scrolling articles
+        https://bugs.webkit.org/show_bug.cgi?id=211126
+        <rdar://problem/56439177>
+
+        Reviewed by Simon Fraser.
+
+        Test: compositing/fixed-with-clip-stability.html
+
+        In case of fixed positioned elements the decision to create backing depends on clip rect.
+        However RenderLayer::localClipRect() tests for backing in call to clippingRootForPainting(). This creates
+        instability since clipping depends on backing decision, and backing decision depends on clipping.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::localClipRect const):
+
+        Specifically the result of clipExceedsBounds test here is affected by computed offsetFromRoot:
+        "clipRect.contains(cssClipRect)" test fails for zero sized clips with different offsets.
+
+        Compute clipExceedsBounds by looking at the clip sizes only and ignoring the position (which should match).
+
 2020-04-28  Zalan Bujtas  <[email protected]>
 
         [LFC] Introduce FormattingContext::ConstraintsForOutOfFlowContent

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (260827 => 260828)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-04-28 15:25:11 UTC (rev 260827)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-04-28 16:05:36 UTC (rev 260828)
@@ -5978,8 +5978,8 @@
 
     if (renderer().hasClip()) {
         // CSS clip may be larger than our border box.
-        LayoutRect cssClipRect = downcast<RenderBox>(renderer()).clipRect(toLayoutPoint(offsetFromRoot), nullptr);
-        clipExceedsBounds = !clipRect.contains(cssClipRect);
+        LayoutRect cssClipRect = downcast<RenderBox>(renderer()).clipRect({ }, nullptr);
+        clipExceedsBounds = !cssClipRect.isEmpty() && (clipRect.width() < cssClipRect.width() || clipRect.height() < cssClipRect.height());
     }
 
     clipRect.move(-offsetFromRoot);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to