Title: [230349] trunk
Revision
230349
Author
za...@apple.com
Date
2018-04-06 12:31:15 -0700 (Fri, 06 Apr 2018)

Log Message

Flex child does not get repainted when it is inserted back to the render tree.
https://bugs.webkit.org/show_bug.cgi?id=184361
<rdar://problem/34528716>

Reviewed by Antti Koivisto.

Source/WebCore:

As with any regular block children, we should issue full repaint for flexbox items on their
first layout (see RenderBlockFlow::layoutBlockChild()).

Test: fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):

LayoutTests:

* fast/flexbox/missing-repaint-when-flext-item-never-had-layout-expected.txt: Added.
* fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (230348 => 230349)


--- trunk/LayoutTests/ChangeLog	2018-04-06 19:20:35 UTC (rev 230348)
+++ trunk/LayoutTests/ChangeLog	2018-04-06 19:31:15 UTC (rev 230349)
@@ -1,3 +1,14 @@
+2018-04-06  Zalan Bujtas  <za...@apple.com>
+
+        Flex child does not get repainted when it is inserted back to the render tree.
+        https://bugs.webkit.org/show_bug.cgi?id=184361
+        <rdar://problem/34528716>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/flexbox/missing-repaint-when-flext-item-never-had-layout-expected.txt: Added.
+        * fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html: Added.
+
 2018-04-06  Daniel Bates  <daba...@apple.com>
 
         Emit a more informative message when a script is blocked due to "X-Content-Type: nosniff"

Added: trunk/LayoutTests/fast/flexbox/missing-repaint-when-flext-item-never-had-layout-expected.txt (0 => 230349)


--- trunk/LayoutTests/fast/flexbox/missing-repaint-when-flext-item-never-had-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/missing-repaint-when-flext-item-never-had-layout-expected.txt	2018-04-06 19:31:15 UTC (rev 230349)
@@ -0,0 +1,6 @@
+PASS if visible
+(repaint rects
+  (rect 8 8 200 18)
+  (rect 8 8 200 200)
+)
+

Added: trunk/LayoutTests/fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html (0 => 230349)


--- trunk/LayoutTests/fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html	2018-04-06 19:31:15 UTC (rev 230349)
@@ -0,0 +1,45 @@
+<style>
+  .parent {
+    width: 200px;
+    height: 200px;
+    background: red;
+    display: flex;
+  }
+
+  .child {
+    display: inline;
+    width: 200px;
+    height: 200px;
+    background: green;
+    border: 0;
+  }
+</style>
+
+
+<div class=parent><span class=child id=foobar>PASS if visible</span></div>
+<pre id=repaintRects></pre>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+setTimeout(function() {
+    foobar.style.display = "none";
+    document.body.offsetWidth;
+    setTimeout(function() {
+        if (window.internals)
+            internals.startTrackingRepaints();
+        
+        foobar.style.display = "inline";
+        document.body.offsetWidth;
+        
+        if (window.testRunner) {
+            if (window.internals) {
+                repaintRects.innerText = internals.repaintRectsAsText();
+                internals.stopTrackingRepaints();
+            }
+            testRunner.notifyDone();
+        }
+    }, 0);
+}, 0);
+</script>

Modified: trunk/Source/WebCore/ChangeLog (230348 => 230349)


--- trunk/Source/WebCore/ChangeLog	2018-04-06 19:20:35 UTC (rev 230348)
+++ trunk/Source/WebCore/ChangeLog	2018-04-06 19:31:15 UTC (rev 230349)
@@ -1,3 +1,19 @@
+2018-04-06  Zalan Bujtas  <za...@apple.com>
+
+        Flex child does not get repainted when it is inserted back to the render tree.
+        https://bugs.webkit.org/show_bug.cgi?id=184361
+        <rdar://problem/34528716>
+
+        Reviewed by Antti Koivisto.
+
+        As with any regular block children, we should issue full repaint for flexbox items on their
+        first layout (see RenderBlockFlow::layoutBlockChild()).
+
+        Test: fast/flexbox/missing-repaint-when-flext-item-never-had-layout.html
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
+
 2018-04-06  Ms2ger  <ms2...@igalia.com>
 
         Support transferring ImageBitmap objects

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (230348 => 230349)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2018-04-06 19:20:35 UTC (rev 230348)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2018-04-06 19:31:15 UTC (rev 230349)
@@ -1552,6 +1552,7 @@
     for (size_t i = 0; i < children.size(); ++i) {
         const auto& flexItem = children[i];
         auto& child = flexItem.box;
+        bool childHadLayout = child.everHadLayout();
 
         ASSERT(!flexItem.box.isOutOfFlowPositioned());
 
@@ -1582,6 +1583,10 @@
         if (child.needsLayout())
             m_relaidOutChildren.add(&child);
         child.layoutIfNeeded();
+        if (!childHadLayout && child.checkForRepaintDuringLayout()) {
+            child.repaint();
+            child.repaintOverhangingFloats(true);
+        }
 
         updateAutoMarginsInMainAxis(child, autoMarginOffset);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to