Title: [272163] branches/safari-611-branch
Revision
272163
Author
[email protected]
Date
2021-02-01 12:12:03 -0800 (Mon, 01 Feb 2021)

Log Message

Cherry-pick r271933. rdar://problem/73838863

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271933 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (272162 => 272163)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-01 20:11:59 UTC (rev 272162)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-01 20:12:03 UTC (rev 272163)
@@ -1,5 +1,64 @@
 2021-02-01  Alan Coon  <[email protected]>
 
+        Cherry-pick r271933. rdar://problem/73838863
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-02-01  Alan Coon  <[email protected]>
+
         Cherry-pick r272059. rdar://problem/73838832
 
     REGRESSION(r262893): feComponentTransfer is not rendered correctly on Retina display

Added: branches/safari-611-branch/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html (0 => 272163)


--- branches/safari-611-branch/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float-expected.html	2021-02-01 20:12:03 UTC (rev 272163)
@@ -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: branches/safari-611-branch/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html (0 => 272163)


--- branches/safari-611-branch/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/compositing/scrolling/async-overflow-scrolling/self-painting-layer-float.html	2021-02-01 20:12:03 UTC (rev 272163)
@@ -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: branches/safari-611-branch/Source/WebCore/ChangeLog (272162 => 272163)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-01 20:11:59 UTC (rev 272162)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-01 20:12:03 UTC (rev 272163)
@@ -1,5 +1,90 @@
 2021-02-01  Alan Coon  <[email protected]>
 
+        Cherry-pick r271933. rdar://problem/73838863
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-02-01  Alan Coon  <[email protected]>
+
         Cherry-pick r271906. rdar://problem/73838863
 
     Make showRenderTree() dump FloatingObjects

Modified: branches/safari-611-branch/Source/WebCore/rendering/FloatingObjects.cpp (272162 => 272163)


--- branches/safari-611-branch/Source/WebCore/rendering/FloatingObjects.cpp	2021-02-01 20:11:59 UTC (rev 272162)
+++ branches/safari-611-branch/Source/WebCore/rendering/FloatingObjects.cpp	2021-02-01 20:12:03 UTC (rev 272163)
@@ -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: branches/safari-611-branch/Source/WebCore/rendering/FloatingObjects.h (272162 => 272163)


--- branches/safari-611-branch/Source/WebCore/rendering/FloatingObjects.h	2021-02-01 20:11:59 UTC (rev 272162)
+++ branches/safari-611-branch/Source/WebCore/rendering/FloatingObjects.h	2021-02-01 20:12:03 UTC (rev 272163)
@@ -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: branches/safari-611-branch/Source/WebCore/rendering/RenderBlockFlow.cpp (272162 => 272163)


--- branches/safari-611-branch/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-02-01 20:11:59 UTC (rev 272162)
+++ branches/safari-611-branch/Source/WebCore/rendering/RenderBlockFlow.cpp	2021-02-01 20:12:03 UTC (rev 272163)
@@ -2232,7 +2232,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);
         }
@@ -2263,8 +2263,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());
@@ -2342,9 +2341,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);
     }
@@ -2741,7 +2738,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.
@@ -2752,7 +2749,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
@@ -2759,7 +2756,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.
@@ -2973,7 +2970,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));
@@ -3045,8 +3042,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