Title: [283000] branches/safari-612-branch
Revision
283000
Author
[email protected]
Date
2021-09-23 13:14:21 -0700 (Thu, 23 Sep 2021)

Log Message

Cherry-pick r282063. rdar://problem/83460750

    REGRESSION (r280017): Calling getBoundingClientRect() on an empty element with "break-before: column" in columns returns a rect with all zeros
    https://bugs.webkit.org/show_bug.cgi?id=229747

    Reviewed by Alan Bujtas.
    Source/WebCore:

    A zero-height element with `break-before: column` ends up with an offset which is exactly
    equal to the column height, and therefore logically can be positioned at the bottom of one
    column, or the top of the next. For elements with non-zero height, we have logic to avoid
    putting the bottom of the box into the next column. Fix this logic for zero-height elements
    to avoid the end column being less than the start column. This avoids an early return in
    RenderMultiColumnSet::fragmentRectsForFlowContentRect() which resulted in a zero client rect.

    Test: fast/multicol/newmulticol/client-rects-column-breakers.html

    * rendering/RenderMultiColumnSet.cpp:
    (WebCore::RenderMultiColumnSet::firstAndLastColumnsFromOffsets const):

    LayoutTests:

    * fast/multicol/newmulticol/client-rects-column-breakers-expected.txt: Added.
    * fast/multicol/newmulticol/client-rects-column-breakers.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-612-branch/LayoutTests/ChangeLog (282999 => 283000)


--- branches/safari-612-branch/LayoutTests/ChangeLog	2021-09-23 20:14:18 UTC (rev 282999)
+++ branches/safari-612-branch/LayoutTests/ChangeLog	2021-09-23 20:14:21 UTC (rev 283000)
@@ -1,5 +1,45 @@
 2021-09-23  Russell Epstein  <[email protected]>
 
+        Cherry-pick r282063. rdar://problem/83460750
+
+    REGRESSION (r280017): Calling getBoundingClientRect() on an empty element with "break-before: column" in columns returns a rect with all zeros
+    https://bugs.webkit.org/show_bug.cgi?id=229747
+    
+    Reviewed by Alan Bujtas.
+    Source/WebCore:
+    
+    A zero-height element with `break-before: column` ends up with an offset which is exactly
+    equal to the column height, and therefore logically can be positioned at the bottom of one
+    column, or the top of the next. For elements with non-zero height, we have logic to avoid
+    putting the bottom of the box into the next column. Fix this logic for zero-height elements
+    to avoid the end column being less than the start column. This avoids an early return in
+    RenderMultiColumnSet::fragmentRectsForFlowContentRect() which resulted in a zero client rect.
+    
+    Test: fast/multicol/newmulticol/client-rects-column-breakers.html
+    
+    * rendering/RenderMultiColumnSet.cpp:
+    (WebCore::RenderMultiColumnSet::firstAndLastColumnsFromOffsets const):
+    
+    LayoutTests:
+    
+    * fast/multicol/newmulticol/client-rects-column-breakers-expected.txt: Added.
+    * fast/multicol/newmulticol/client-rects-column-breakers.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282063 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-06  Simon Fraser  <[email protected]>
+
+            REGRESSION (r280017): Calling getBoundingClientRect() on an empty element with "break-before: column" in columns returns a rect with all zeros
+            https://bugs.webkit.org/show_bug.cgi?id=229747
+
+            Reviewed by Alan Bujtas.
+
+            * fast/multicol/newmulticol/client-rects-column-breakers-expected.txt: Added.
+            * fast/multicol/newmulticol/client-rects-column-breakers.html: Added.
+
+2021-09-23  Russell Epstein  <[email protected]>
+
         Cherry-pick r281650. rdar://problem/83460707
 
     Drawing small caps web fonts into canvas causes the GPU process to hang

Added: branches/safari-612-branch/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers-expected.txt (0 => 283000)


--- branches/safari-612-branch/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers-expected.txt	                        (rev 0)
+++ branches/safari-612-branch/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers-expected.txt	2021-09-23 20:14:21 UTC (rev 283000)
@@ -0,0 +1,6 @@
+bounding client rect x:288 y:11 width: 229 height:0
+bounding client rect x:19 y:651 width: 229 height:0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-612-branch/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers.html (0 => 283000)


--- branches/safari-612-branch/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers.html	                        (rev 0)
+++ branches/safari-612-branch/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers.html	2021-09-23 20:14:21 UTC (rev 283000)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .columns {
+            margin: 10px;
+            width: 500px;
+            height: 400px;
+            column-count: 2;
+            column-gap: 40px;
+            column-fill: auto;
+            border: 1px solid gray;
+            box-sizing:border-box;
+        }
+        
+        .box {
+            margin: 10px;
+            width: 100px;
+            height: 100px;
+            background-color: silver;
+        }
+        
+    </style>
+    <script src=""
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        function logClientRect(elementId)
+        {
+            let target = document.getElementById(elementId);
+            var bounds = target.getBoundingClientRect();
+            debug('bounding client rect x:' + bounds.x + ' y:' + bounds.y + ' width: ' + bounds.width + ' height:'+ bounds.height);
+        }
+    </script>
+</head>
+<body>
+    <div class='columns'>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div id="target-before" style="break-before: column;"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+    </div>
+
+    <div class='columns'>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div id="target-after" style="break-after: column;"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+        <div class="box"></div>
+    </div>
+    <div id="console"></div>
+    <script>
+        logClientRect('target-before');
+        logClientRect('target-after');
+    </script>
+    <script src=""
+</body>
+</html>

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (282999 => 283000)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-23 20:14:18 UTC (rev 282999)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-23 20:14:21 UTC (rev 283000)
@@ -1,5 +1,54 @@
 2021-09-23  Russell Epstein  <[email protected]>
 
+        Cherry-pick r282063. rdar://problem/83460750
+
+    REGRESSION (r280017): Calling getBoundingClientRect() on an empty element with "break-before: column" in columns returns a rect with all zeros
+    https://bugs.webkit.org/show_bug.cgi?id=229747
+    
+    Reviewed by Alan Bujtas.
+    Source/WebCore:
+    
+    A zero-height element with `break-before: column` ends up with an offset which is exactly
+    equal to the column height, and therefore logically can be positioned at the bottom of one
+    column, or the top of the next. For elements with non-zero height, we have logic to avoid
+    putting the bottom of the box into the next column. Fix this logic for zero-height elements
+    to avoid the end column being less than the start column. This avoids an early return in
+    RenderMultiColumnSet::fragmentRectsForFlowContentRect() which resulted in a zero client rect.
+    
+    Test: fast/multicol/newmulticol/client-rects-column-breakers.html
+    
+    * rendering/RenderMultiColumnSet.cpp:
+    (WebCore::RenderMultiColumnSet::firstAndLastColumnsFromOffsets const):
+    
+    LayoutTests:
+    
+    * fast/multicol/newmulticol/client-rects-column-breakers-expected.txt: Added.
+    * fast/multicol/newmulticol/client-rects-column-breakers.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282063 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-09-06  Simon Fraser  <[email protected]>
+
+            REGRESSION (r280017): Calling getBoundingClientRect() on an empty element with "break-before: column" in columns returns a rect with all zeros
+            https://bugs.webkit.org/show_bug.cgi?id=229747
+
+            Reviewed by Alan Bujtas.
+
+            A zero-height element with `break-before: column` ends up with an offset which is exactly
+            equal to the column height, and therefore logically can be positioned at the bottom of one
+            column, or the top of the next. For elements with non-zero height, we have logic to avoid
+            putting the bottom of the box into the next column. Fix this logic for zero-height elements
+            to avoid the end column being less than the start column. This avoids an early return in
+            RenderMultiColumnSet::fragmentRectsForFlowContentRect() which resulted in a zero client rect.
+
+            Test: fast/multicol/newmulticol/client-rects-column-breakers.html
+
+            * rendering/RenderMultiColumnSet.cpp:
+            (WebCore::RenderMultiColumnSet::firstAndLastColumnsFromOffsets const):
+
+2021-09-23  Russell Epstein  <[email protected]>
+
         Cherry-pick r281996. rdar://problem/83460851
 
     [iOS] Media playback continues after backgrounding Safari

Modified: branches/safari-612-branch/Source/WebCore/rendering/RenderMultiColumnSet.cpp (282999 => 283000)


--- branches/safari-612-branch/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2021-09-23 20:14:18 UTC (rev 282999)
+++ branches/safari-612-branch/Source/WebCore/rendering/RenderMultiColumnSet.cpp	2021-09-23 20:14:21 UTC (rev 283000)
@@ -543,7 +543,7 @@
             return 0;
 
         auto columnIndex = static_cast<float>(offset - fragmentedFlowLogicalTop) / columnHeight;
-        if (isBottom && WTF::isIntegral(columnIndex) && columnIndex > 0)
+        if (isBottom && WTF::isIntegral(columnIndex) && bottomOffset > topOffset && columnIndex > 0)
             columnIndex -= 1;
 
         return static_cast<unsigned>(columnIndex);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to