Title: [261979] trunk
Revision
261979
Author
[email protected]
Date
2020-05-20 18:44:12 -0700 (Wed, 20 May 2020)

Log Message

Repaint issues when the login field collapses on music.apple.com
https://bugs.webkit.org/show_bug.cgi?id=212101
<rdar://problem/62874369>

Reviewed by Simon Fraser.

Source/WebCore:

RenderWidgets (e.g iframe) are painted on integral pixel boundaries. When we issue the repaints on such renderers, we need to
make sure that the repaint rectangles are also snapped to integral pixel values.
Currently trunk only covers the case when the renderer itself is positioned on a subpixel position (e.g when the containing block's content box has a non-integral position value).
This patch ensures that we repaint the RenderWidgets properly when a non-direct ancestor puts the renderer on a subpixel position.

Test: fast/repaint/iframe-on-subpixel-position.html

* page/FrameView.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeVisibleRectInContainer const):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::setContentsNeedDisplay):
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
* rendering/RenderObject.h:
* testing/Internals.cpp:
(WebCore::Internals::enableSubframeRepaintTracking): add subframe repaint tracking
(WebCore::Internals::disableSubframeRepaintTracking):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* fast/repaint/iframe-on-subpixel-position-expected.txt: Added.
* fast/repaint/iframe-on-subpixel-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261978 => 261979)


--- trunk/LayoutTests/ChangeLog	2020-05-21 01:19:54 UTC (rev 261978)
+++ trunk/LayoutTests/ChangeLog	2020-05-21 01:44:12 UTC (rev 261979)
@@ -1,3 +1,14 @@
+2020-05-20  Zalan Bujtas  <[email protected]>
+
+        Repaint issues when the login field collapses on music.apple.com
+        https://bugs.webkit.org/show_bug.cgi?id=212101
+        <rdar://problem/62874369>
+
+        Reviewed by Simon Fraser.
+
+        * fast/repaint/iframe-on-subpixel-position-expected.txt: Added.
+        * fast/repaint/iframe-on-subpixel-position.html: Added.
+
 2020-05-20  Kenneth Russell  <[email protected]>
 
         OES_texture_half_float_linear unavailable on WebGL 1.0 on iOS with ANGLE

Added: trunk/LayoutTests/fast/repaint/iframe-on-subpixel-position-expected.txt (0 => 261979)


--- trunk/LayoutTests/fast/repaint/iframe-on-subpixel-position-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/iframe-on-subpixel-position-expected.txt	2020-05-21 01:44:12 UTC (rev 261979)
@@ -0,0 +1,23 @@
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (bounds 301.00 151.00)
+          (drawsContent 1)
+          (repaint rects
+            (rect 0.00 0.00 101.00 101.00)
+            (rect 0.00 0.00 301.00 101.00)
+            (rect 0.00 0.00 301.00 101.00)
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/fast/repaint/iframe-on-subpixel-position.html (0 => 261979)


--- trunk/LayoutTests/fast/repaint/iframe-on-subpixel-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/iframe-on-subpixel-position.html	2020-05-21 01:44:12 UTC (rev 261979)
@@ -0,0 +1,53 @@
+<script>
+function runRepaintTest() {
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+setTimeout(function() {
+    let shrink = document.getElementById("subpixel_iframe").contentDocument.getElementById("shrink");
+    if (!window.testRunner) {
+        setTimeout('shrink.style.height = "0px"', 100);
+        return;
+    }
+
+    testRunner.dumpAsText();
+    document.body.offsetTop;
+    internals.startTrackingRepaints();
+
+    shrink.style.height = "0px";
+    document.getElementById("subpixel_iframe").contentDocument.body.offsetHeight;
+
+    let layerTreeAsText = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+    internals.stopTrackingRepaints();
+
+    let pre = document.createElement('pre');
+    document.body.appendChild(pre);
+    pre.innerHTML = layerTreeAsText;
+    testRunner.notifyDone();
+}, 0);
+
+}
+</script>
+<style>
+.container {
+  position: fixed;
+  left: 0px;
+  top: 0px;
+  padding: 0.5px;
+}
+</style>
+<body>
+<div class=container><div><iframe _onload_="runRepaintTest()" id=subpixel_iframe frameborder=no srcdoc="
+<style>
+body {
+  margin:0px;
+}
+div {
+  background-color: green;
+  height: 100px;
+  width: 100px;
+}
+</style>
+<div id=shrink></div>">
+</body>

Modified: trunk/Source/WebCore/ChangeLog (261978 => 261979)


--- trunk/Source/WebCore/ChangeLog	2020-05-21 01:19:54 UTC (rev 261978)
+++ trunk/Source/WebCore/ChangeLog	2020-05-21 01:44:12 UTC (rev 261979)
@@ -1,3 +1,31 @@
+2020-05-20  Zalan Bujtas  <[email protected]>
+
+        Repaint issues when the login field collapses on music.apple.com
+        https://bugs.webkit.org/show_bug.cgi?id=212101
+        <rdar://problem/62874369>
+
+        Reviewed by Simon Fraser.
+
+        RenderWidgets (e.g iframe) are painted on integral pixel boundaries. When we issue the repaints on such renderers, we need to
+        make sure that the repaint rectangles are also snapped to integral pixel values.
+        Currently trunk only covers the case when the renderer itself is positioned on a subpixel position (e.g when the containing block's content box has a non-integral position value).
+        This patch ensures that we repaint the RenderWidgets properly when a non-direct ancestor puts the renderer on a subpixel position.
+
+        Test: fast/repaint/iframe-on-subpixel-position.html
+
+        * page/FrameView.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeVisibleRectInContainer const):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::setContentsNeedDisplay):
+        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
+        * rendering/RenderObject.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::enableSubframeRepaintTracking): add subframe repaint tracking 
+        (WebCore::Internals::disableSubframeRepaintTracking):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2020-05-20  Oriol Brufau  <[email protected]>
 
         Computed min-width/height for auto depends on box

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (261978 => 261979)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2020-05-21 01:19:54 UTC (rev 261978)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2020-05-21 01:44:12 UTC (rev 261979)
@@ -2277,6 +2277,8 @@
     if (container == this) {
         if (container->style().isFlippedBlocksWritingMode())
             flipForWritingMode(adjustedRect);
+        if (context.descendantNeedsEnclosingIntRect)
+            adjustedRect = enclosingIntRect(adjustedRect);
         return adjustedRect;
     }
 
@@ -2313,6 +2315,7 @@
         LayoutSize flooredLocationOffset = toIntSize(flooredIntPoint(locationOffset));
         adjustedRect.expand(locationOffset - flooredLocationOffset);
         locationOffset = flooredLocationOffset;
+        context.descendantNeedsEnclosingIntRect = true;
     }
 
     if (is<RenderMultiColumnFlow>(this)) {

Modified: trunk/Source/WebCore/rendering/RenderObject.h (261978 => 261979)


--- trunk/Source/WebCore/rendering/RenderObject.h	2020-05-21 01:19:54 UTC (rev 261978)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2020-05-21 01:44:12 UTC (rev 261979)
@@ -624,8 +624,9 @@
             , options(options)
             {
             }
-        bool hasPositionFixedDescendant;
-        bool dirtyRectIsFlipped;
+        bool hasPositionFixedDescendant { false };
+        bool dirtyRectIsFlipped { false };
+        bool descendantNeedsEnclosingIntRect { false };
         OptionSet<VisibleRectContextOption> options;
     };
     virtual Optional<LayoutRect> computeVisibleRectInContainer(const LayoutRect&, const RenderLayerModelObject* repaintContainer, VisibleRectContext) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to