Title: [271933] trunk
Revision
271933
Author
[email protected]
Date
2021-01-26 20:56:57 -0800 (Tue, 26 Jan 2021)

Log Message

REGRESSION (r268947) Some table elements become blank when scroll-bar is toggled
https://bugs.webkit.org/show_bug.cgi?id=221016
<rdar://72881404>

Reviewed by Zalan Bujtas.
Source/WebCore:

FloatingObject aliased the state of layer->isSelfPainting() in its m_shouldPaint,
so when compositing code changed isSelfPaintingLayer() for a layer that is also
a float post-layout, FloatingObject was left in a state where it didn't paint.

Fix by dissociating FloatingObject's shouldPaint from the state of the layer.
Rename shouldPaint() to paintsFloat() for clarity (multiple FloatingObjects in
different block flows can represent the same float, and only one paints the float).

Test: compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html

* rendering/FloatingObjects.cpp:
(WebCore::FloatingObject::FloatingObject):
(WebCore::FloatingObject::create):
(WebCore::FloatingObject::cloneForNewParent const):
(WebCore::FloatingObject::shouldPaint const):
(WebCore::operator<<):
* rendering/FloatingObjects.h:
(WebCore::FloatingObject::paintsFloat const):
(WebCore::FloatingObject::setPaintsFloat):
(WebCore::FloatingObject::shouldPaint const): Deleted.
(WebCore::FloatingObject::setShouldPaint): Deleted.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::repaintOverhangingFloats):
(WebCore::RenderBlockFlow::paintFloats):
(WebCore::RenderBlockFlow::insertFloatingObject):
(WebCore::RenderBlockFlow::addOverhangingFloats):
(WebCore::RenderBlockFlow::hitTestFloats):
(WebCore::RenderBlockFlow::adjustForBorderFit const):

LayoutTests:

* compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html: Added.
* compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271932 => 271933)


--- trunk/LayoutTests/ChangeLog	2021-01-27 04:39:14 UTC (rev 271932)
+++ trunk/LayoutTests/ChangeLog	2021-01-27 04:56:57 UTC (rev 271933)
@@ -1,3 +1,14 @@
+2021-01-26  Simon Fraser  <[email protected]>
+
+        REGRESSION (r268947) Some table elements become blank when scroll-bar is toggled
+        https://bugs.webkit.org/show_bug.cgi?id=221016
+        <rdar://72881404>
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html: Added.
+        * compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html: Added.
+
 2021-01-26  Lauro Moura  <[email protected]>
 
         [GLIB] Gardening soup crashes and other timeouts

Added: trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html (0 => 271933)


--- trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html	2021-01-27 04:56:57 UTC (rev 271933)
@@ -0,0 +1,43 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        * {
+            box-sizing: border-box;
+        }
+        body {
+            display: grid;
+            grid-template-rows: auto;
+            grid-template-areas: "main"
+        }
+
+        .scroller {
+            float: left;
+            width: 100%;
+            height: 100%;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+
+        .content {
+            width: 100%;
+            height: 100%;
+            background-color: green;
+        }
+        
+        .box {
+            width: 100px;
+            height: 100px;
+        }
+    </style>
+</head>
+<body>
+    <div id="main">
+        <div class="scroller">
+           <div class="content">
+               <div class="box"></div>
+           </div>
+        </div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html (0 => 271933)


--- trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html	2021-01-27 04:56:57 UTC (rev 271933)
@@ -0,0 +1,58 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        * {
+            box-sizing: border-box;
+        }
+        body {
+            display: grid;
+            grid-template-rows: auto;
+            grid-template-areas: "main"
+        }
+
+        .scroller {
+            float: left;
+            width: 100%;
+            height: 100%;
+            border: 1px solid black;
+            overflow: scroll;
+        }
+
+        .content {
+            width: 200%;
+            height: 100%;
+            background-color: green;
+        }
+
+        body.changed .content {
+            width: 100%;
+        }
+        
+        .box {
+            width: 100px;
+            height: 100px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+        window.addEventListener('load', () => {
+            setTimeout(() => {
+                document.body.classList.add('changed');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }, false);
+    </script>
+</head>
+<body>
+    <div id="main">
+        <div class="scroller">
+           <div class="content">
+               <div class="box"></div>
+           </div>
+        </div>
+    </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (271932 => 271933)


--- trunk/Source/WebCore/ChangeLog	2021-01-27 04:39:14 UTC (rev 271932)
+++ trunk/Source/WebCore/ChangeLog	2021-01-27 04:56:57 UTC (rev 271933)
@@ -1,3 +1,40 @@
+2021-01-26  Simon Fraser  <[email protected]>
+
+        REGRESSION (r268947) Some table elements become blank when scroll-bar is toggled
+        https://bugs.webkit.org/show_bug.cgi?id=221016
+        <rdar://72881404>
+
+        Reviewed by Zalan Bujtas.
+        
+        FloatingObject aliased the state of layer->isSelfPainting() in its m_shouldPaint,
+        so when compositing code changed isSelfPaintingLayer() for a layer that is also
+        a float post-layout, FloatingObject was left in a state where it didn't paint.
+        
+        Fix by dissociating FloatingObject's shouldPaint from the state of the layer.
+        Rename shouldPaint() to paintsFloat() for clarity (multiple FloatingObjects in
+        different block flows can represent the same float, and only one paints the float).
+
+        Test: compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html
+
+        * rendering/FloatingObjects.cpp:
+        (WebCore::FloatingObject::FloatingObject):
+        (WebCore::FloatingObject::create):
+        (WebCore::FloatingObject::cloneForNewParent const):
+        (WebCore::FloatingObject::shouldPaint const):
+        (WebCore::operator<<):
+        * rendering/FloatingObjects.h:
+        (WebCore::FloatingObject::paintsFloat const):
+        (WebCore::FloatingObject::setPaintsFloat):
+        (WebCore::FloatingObject::shouldPaint const): Deleted.
+        (WebCore::FloatingObject::setShouldPaint): Deleted.
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::repaintOverhangingFloats):
+        (WebCore::RenderBlockFlow::paintFloats):
+        (WebCore::RenderBlockFlow::insertFloatingObject):
+        (WebCore::RenderBlockFlow::addOverhangingFloats):
+        (WebCore::RenderBlockFlow::hitTestFloats):
+        (WebCore::RenderBlockFlow::adjustForBorderFit const):
+
 2021-01-26  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Do not create empty runs for empty lines

Modified: trunk/Source/WebCore/rendering/FloatingObjects.cpp (271932 => 271933)


--- trunk/Source/WebCore/rendering/FloatingObjects.cpp	2021-01-27 04:39:14 UTC (rev 271932)
+++ trunk/Source/WebCore/rendering/FloatingObjects.cpp	2021-01-27 04:56:57 UTC (rev 271933)
@@ -45,7 +45,7 @@
 
 FloatingObject::FloatingObject(RenderBox& renderer)
     : m_renderer(makeWeakPtr(renderer))
-    , m_shouldPaint(true)
+    , m_paintsFloat(true)
     , m_isDescendant(false)
     , m_isPlaced(false)
 #if ASSERT_ENABLED
@@ -65,7 +65,7 @@
     , m_frameRect(frameRect)
     , m_marginOffset(marginOffset)
     , m_type(type)
-    , m_shouldPaint(shouldPaint)
+    , m_paintsFloat(shouldPaint)
     , m_isDescendant(isDescendant)
     , m_isPlaced(true)
 #if ASSERT_ENABLED
@@ -77,7 +77,6 @@
 std::unique_ptr<FloatingObject> FloatingObject::create(RenderBox& renderer)
 {
     auto object = makeUnique<FloatingObject>(renderer);
-    object->setShouldPaint(!renderer.hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will.
     object->setIsDescendant(true);
     return object;
 }
@@ -89,12 +88,20 @@
 
 std::unique_ptr<FloatingObject> FloatingObject::cloneForNewParent() const
 {
-    auto cloneObject = makeUnique<FloatingObject>(renderer(), type(), m_frameRect, m_marginOffset, m_shouldPaint, m_isDescendant);
+    auto cloneObject = makeUnique<FloatingObject>(renderer(), type(), m_frameRect, m_marginOffset, m_paintsFloat, m_isDescendant);
     cloneObject->m_paginationStrut = m_paginationStrut;
     cloneObject->m_isPlaced = m_isPlaced;
     return cloneObject;
 }
 
+bool FloatingObject::shouldPaint() const
+{
+    if (!m_renderer)
+        return false;
+
+    return !m_renderer->hasSelfPaintingLayer() && m_paintsFloat;
+}
+
 LayoutSize FloatingObject::translationOffsetToAncestor() const
 {
     return locationOffsetOfBorderBox() - renderer().locationOffset();
@@ -104,7 +111,7 @@
 
 TextStream& operator<<(TextStream& stream, const FloatingObject& object)
 {
-    return stream << &object << " renderer " << &object.renderer() << " " << object.frameRect() << " shouldPaint " << object.shouldPaint();
+    return stream << &object << " renderer " << &object.renderer() << " " << object.frameRect() << " paintsFloat " << object.paintsFloat() << " shouldPaint " << object.shouldPaint();
 }
 
 #endif

Modified: trunk/Source/WebCore/rendering/FloatingObjects.h (271932 => 271933)


--- trunk/Source/WebCore/rendering/FloatingObjects.h	2021-01-27 04:39:14 UTC (rev 271932)
+++ trunk/Source/WebCore/rendering/FloatingObjects.h	2021-01-27 04:56:57 UTC (rev 271933)
@@ -79,8 +79,11 @@
     void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; }
 #endif
 
-    bool shouldPaint() const { return m_shouldPaint; }
-    void setShouldPaint(bool shouldPaint) { m_shouldPaint = shouldPaint; }
+    bool shouldPaint() const;
+
+    bool paintsFloat() const { return m_paintsFloat; }
+    void setPaintsFloat(bool paintsFloat) { m_paintsFloat = paintsFloat; }
+
     bool isDescendant() const { return m_isDescendant; }
     void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; }
 
@@ -103,9 +106,8 @@
     LayoutRect m_frameRect;
     LayoutUnit m_paginationStrut;
     LayoutSize m_marginOffset;
-
     unsigned m_type : 2; // Type (left or right aligned)
-    unsigned m_shouldPaint : 1;
+    unsigned m_paintsFloat : 1;
     unsigned m_isDescendant : 1;
     unsigned m_isPlaced : 1;
 #if ASSERT_ENABLED

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (271932 => 271933)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-01-27 04:39:14 UTC (rev 271932)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-01-27 04:56:57 UTC (rev 271933)
@@ -2233,7 +2233,7 @@
         auto& renderer = floatingObject.renderer();
         if (logicalBottomForFloat(floatingObject) > logicalHeight()
             && !renderer.hasSelfPaintingLayer()
-            && (floatingObject.shouldPaint() || (paintAllDescendants && renderer.isDescendantOf(this)))) {
+            && (floatingObject.paintsFloat() || (paintAllDescendants && renderer.isDescendantOf(this)))) {
             renderer.repaint();
             renderer.repaintOverhangingFloats(false);
         }
@@ -2264,8 +2264,7 @@
     for (auto it = floatingObjectSet.begin(); it != end; ++it) {
         const auto& floatingObject = *it->get();
         auto& renderer = floatingObject.renderer();
-        // Only paint the object if our m_shouldPaint flag is set.
-        if (floatingObject.shouldPaint() && !renderer.hasSelfPaintingLayer()) {
+        if (floatingObject.shouldPaint()) {
             PaintInfo currentPaintInfo(paintInfo);
             currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhase::BlockBackground;
             LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, paintOffset + floatingObject.translationOffsetToAncestor());
@@ -2343,9 +2342,7 @@
     if (!needsBlockDirectionLocationSetBeforeLayout || isWritingModeRoot()) {
         // We are unsplittable if we're a block flow root.
         floatBox.layoutIfNeeded();
-        floatingObject->setShouldPaint(!floatBox.hasSelfPaintingLayer());
-    }
-    else {
+    } else {
         floatBox.updateLogicalWidth();
         floatBox.computeAndSetBlockDirectionMargins(*this);
     }
@@ -2742,7 +2739,7 @@
                 // far out as we can, to the outermost block that overlaps the float, stopping only
                 // if we hit a self-painting layer boundary.
                 if (floatingObject.renderer().enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) {
-                    floatingObject.setShouldPaint(false);
+                    floatingObject.setPaintsFloat(false);
                     shouldPaint = true;
                 }
                 // We create the floating object list lazily.
@@ -2753,7 +2750,7 @@
             }
         } else {
             const auto& renderer = floatingObject.renderer();
-            if (makeChildPaintOtherFloats && !floatingObject.shouldPaint() && !renderer.hasSelfPaintingLayer()
+            if (makeChildPaintOtherFloats && !floatingObject.paintsFloat() && !renderer.hasSelfPaintingLayer()
                 && renderer.isDescendantOf(&child) && renderer.enclosingFloatPaintingLayer() == child.enclosingFloatPaintingLayer()) {
                 // The float is not overhanging from this block, so if it is a descendant of the child, the child should
                 // paint it (the other case is that it is intruding into the child), unless it has its own layer or enclosing
@@ -2760,7 +2757,7 @@
                 // layer.
                 // If makeChildPaintOtherFloats is false, it means that the child must already know about all the floats
                 // it should paint.
-                floatingObject.setShouldPaint(true);
+                floatingObject.setPaintsFloat(true);
             }
             
             // Since the float doesn't overhang, it didn't get put into our list. We need to add its overflow in to the child now.
@@ -2974,7 +2971,7 @@
         --it;
         const auto& floatingObject = *it->get();
         auto& renderer = floatingObject.renderer();
-        if (floatingObject.shouldPaint() && !renderer.hasSelfPaintingLayer()) {
+        if (floatingObject.shouldPaint()) {
             LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + floatingObject.translationOffsetToAncestor());
             if (renderer.hitTest(request, result, locationInContainer, childPoint)) {
                 updateHitTestResult(result, locationInContainer.point() - toLayoutSize(childPoint));
@@ -3046,8 +3043,7 @@
         auto end = floatingObjectSet.end();
         for (auto it = floatingObjectSet.begin(); it != end; ++it) {
             const auto& floatingObject = *it->get();
-            // Only examine the object if our m_shouldPaint flag is set.
-            if (floatingObject.shouldPaint()) {
+            if (floatingObject.paintsFloat()) {
                 LayoutUnit floatLeft = floatingObject.translationOffsetToAncestor().width();
                 LayoutUnit floatRight = floatLeft + floatingObject.renderer().width();
                 left = std::min(left, floatLeft);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to