Title: [282063] trunk
- Revision
- 282063
- Author
- [email protected]
- Date
- 2021-09-06 12:30:19 -0700 (Mon, 06 Sep 2021)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (282062 => 282063)
--- trunk/LayoutTests/ChangeLog 2021-09-06 19:04:04 UTC (rev 282062)
+++ trunk/LayoutTests/ChangeLog 2021-09-06 19:30:19 UTC (rev 282063)
@@ -1,3 +1,13 @@
+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-06 Arcady Goldmints-Orlov <[email protected]>
[GLIB] Garden tests related to the experimetal <attachment> element
Added: trunk/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers-expected.txt (0 => 282063)
--- trunk/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers-expected.txt 2021-09-06 19:30:19 UTC (rev 282063)
@@ -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: trunk/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers.html (0 => 282063)
--- trunk/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/client-rects-column-breakers.html 2021-09-06 19:30:19 UTC (rev 282063)
@@ -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: trunk/Source/WebCore/ChangeLog (282062 => 282063)
--- trunk/Source/WebCore/ChangeLog 2021-09-06 19:04:04 UTC (rev 282062)
+++ trunk/Source/WebCore/ChangeLog 2021-09-06 19:30:19 UTC (rev 282063)
@@ -1,3 +1,22 @@
+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-06 Antti Koivisto <[email protected]>
[LFC][Integration] Use inline boxes in run vector for hit testing
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (282062 => 282063)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2021-09-06 19:04:04 UTC (rev 282062)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2021-09-06 19:30:19 UTC (rev 282063)
@@ -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