Title: [279673] trunk
Revision
279673
Author
za...@apple.com
Date
2021-07-07 14:35:19 -0700 (Wed, 07 Jul 2021)

Log Message

[Legacy line layout] Inline content on subpixel position makes the table cell scroll
https://bugs.webkit.org/show_bug.cgi?id=227594
<rdar://74884402>

Reviewed by Simon Fraser.

Source/WebCore:

The root inlinebox is supposed to fit the [top, top + maxHeight] space as it is computed based
on the inline level boxes. However due to the integral rounding on the root inlinebox's logical top,
it may accidentally leak out of the containing block and trigger unintended layout overflow.
This patch ensures that we don't stretch the line (top/bottom) with the integral positioned root inlinebox.

Test: fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html

* rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::placeBoxesInBlockDirection):

LayoutTests:

* fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple-expected.html: Added.
* fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (279672 => 279673)


--- trunk/LayoutTests/ChangeLog	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/ChangeLog	2021-07-07 21:35:19 UTC (rev 279673)
@@ -1,3 +1,14 @@
+2021-07-07  Alan Bujtas  <za...@apple.com>
+
+        [Legacy line layout] Inline content on subpixel position makes the table cell scroll
+        https://bugs.webkit.org/show_bug.cgi?id=227594
+        <rdar://74884402>
+
+        Reviewed by Simon Fraser.
+
+        * fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple-expected.html: Added.
+        * fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html: Added.
+
 2021-07-07  Aditya Keerthi  <akeer...@apple.com>
 
         [iOS] Inconsistent styling for input[type="submit"] and button[type="submit"]

Added: trunk/LayoutTests/fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple-expected.html (0 => 279673)


--- trunk/LayoutTests/fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple-expected.html	2021-07-07 21:35:19 UTC (rev 279673)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<style>
+table {
+  border-collapse:collapse;
+}
+
+td {
+  border: 1px solid green;
+  padding-bottom: 0;
+  overflow-y: hidden;
+  width: 300px;
+}
+</style>
+<table>
+<tr><td>PASS if no scrollbar</td></tr>
+</table>

Added: trunk/LayoutTests/fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html (0 => 279673)


--- trunk/LayoutTests/fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html	2021-07-07 21:35:19 UTC (rev 279673)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<style>
+table {
+  border-collapse:collapse;
+}
+
+td {
+  border: 1px solid green;
+  padding-bottom: 0;
+  overflow-y: auto;
+  width: 300px;
+}
+</style>
+<table>
+<tr><td>PASS if no scrollbar</td></tr>
+</table>

Modified: trunk/LayoutTests/platform/ios/fast/multicol/vertical-lr/float-multicol-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/ios/fast/multicol/vertical-lr/float-multicol-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/ios/fast/multicol/vertical-lr/float-multicol-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -133,7 +133,7 @@
           text run at (20,331) width 33: "Bugs"
       RenderBlock {DD} at (56,40) size 508x439
         RenderBlock {P} at (0,0) size 508x439
-          RenderText {#text} at (0,291) size 346x142
+          RenderText {#text} at (0,291) size 347x142
             text run at (0,291) width 44: "You've"
             text run at (20,291) width 48: "already"
             text run at (207,291) width 131: "downloaded a build."
@@ -147,12 +147,12 @@
             text run at (327,291) width 70: "build with "
             text run at (327,360) width 63: "Talkback,"
           RenderInline {EM} at (0,0) size 19x106
-            RenderText {#text} at (347,291) size 19x106
-              text run at (347,291) width 45: "please "
+            RenderText {#text} at (347,291) size 20x106
+              text run at (347,291) width 46: "please "
               text run at (347,336) width 60: "turn it on"
-          RenderText {#text} at (347,396) size 139x437
+          RenderText {#text} at (347,396) size 140x437
             text run at (347,396) width 39: " when"
-            text run at (367,208) width 191: "it asks. Talkback reports give "
+            text run at (367,208) width 192: "it asks. Talkback reports give "
             text run at (367,399) width 15: "us"
             text run at (387,208) width 130: "really valuable data "
             text run at (387,338) width 60: "on which"
@@ -159,54 +159,54 @@
             text run at (407,208) width 210: "crashes are the most serious, and"
             text run at (427,0) width 32: "how "
             text run at (427,31) width 195: "often people are encountering "
-            text run at (427,226) width 201: "them. And all you have to do is"
+            text run at (427,226) width 202: "them. And all you have to do is"
             text run at (447,0) width 80: "click \"OK\". "
             text run at (447,79) width 358: "If you find something you think is a bug, check to see if"
             text run at (467,0) width 98: "it's not already "
           RenderInline {A} at (0,0) size 19x84 [color=#0000EE]
-            RenderText {#text} at (467,97) size 19x84
+            RenderText {#text} at (467,97) size 20x84
               text run at (467,97) width 84: "known about"
-          RenderText {#text} at (467,180) size 19x181
+          RenderText {#text} at (467,180) size 20x181
             text run at (467,180) width 111: ", and then please "
             text run at (467,291) width 70: "follow the "
           RenderInline {A} at (0,0) size 39x385 [color=#0000EE]
-            RenderText {#text} at (467,360) size 39x385
-              text run at (467,360) width 24: "bug"
-              text run at (487,0) width 140: "submission procedure"
-          RenderText {#text} at (487,139) size 19x5
-            text run at (487,139) width 4: "."
+            RenderText {#text} at (467,360) size 40x385
+              text run at (467,360) width 25: "bug"
+              text run at (487,0) width 141: "submission procedure"
+          RenderText {#text} at (487,139) size 20x5
+            text run at (487,139) width 5: "."
       RenderBlock (floating) {DIV} at (579,0) size 408x83 [bgcolor=#008000]
         RenderBlock {P} at (16,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 1"
-        RenderBlock {P} at (46,0) size 21x83
+        RenderBlock {P} at (47,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 2"
-        RenderBlock {P} at (82,0) size 21x83
+        RenderBlock {P} at (83,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 3"
-        RenderBlock {P} at (118,0) size 21x83
+        RenderBlock {P} at (119,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 4"
-        RenderBlock {P} at (154,0) size 21x83
+        RenderBlock {P} at (155,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 5"
-        RenderBlock {P} at (190,0) size 21x83
+        RenderBlock {P} at (191,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 6"
-        RenderBlock {P} at (226,0) size 21x83
+        RenderBlock {P} at (227,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 7"
-        RenderBlock {P} at (262,0) size 21x83
+        RenderBlock {P} at (263,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 8"
-        RenderBlock {P} at (298,0) size 21x83
+        RenderBlock {P} at (299,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 9"
-        RenderBlock {P} at (334,0) size 21x83
+        RenderBlock {P} at (335,0) size 20x83
           RenderText {#text} at (0,0) size 19x83
             text run at (0,0) width 83: "Hola hola 10"
-        RenderBlock {P} at (370,0) size 21x83
+        RenderBlock {P} at (371,0) size 20x83
           RenderText {#text} at (0,0) size 19x83
             text run at (0,0) width 83: "Hola hola 11"
       RenderBlock {DT} at (579,0) size 21x479

Modified: trunk/LayoutTests/platform/ios/fast/multicol/vertical-lr/nested-columns-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/ios/fast/multicol/vertical-lr/nested-columns-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/ios/fast/multicol/vertical-lr/nested-columns-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -27,7 +27,7 @@
       RenderText {#text} at (1,0) size 36x167
         text run at (1,0) width 167: "Header Two"
     RenderBlock (anonymous) at (381,0) size 239x367
-      RenderText {#text} at (0,0) size 237x367
+      RenderText {#text} at (0,0) size 238x367
         text run at (0,0) width 364: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
         text run at (20,0) width 362: "Nulla varius enim ac mi. Curabitur sollicitudin felis quis"
         text run at (40,0) width 332: "lectus. Quisque adipiscing rhoncus sem. Proin nulla"

Modified: trunk/LayoutTests/platform/ios/fast/multicol/vertical-rl/float-multicol-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/ios/fast/multicol/vertical-rl/float-multicol-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/ios/fast/multicol/vertical-rl/float-multicol-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -137,7 +137,7 @@
             text run at (0,291) width 44: "You've"
             text run at (20,291) width 48: "already"
             text run at (207,291) width 131: "downloaded a build."
-            text run at (227,291) width 135: "All you have to do is"
+            text run at (227,291) width 134: "All you have to do is"
             text run at (247,291) width 39: "use it "
             text run at (247,329) width 18: "as "
             text run at (247,347) width 30: "your"
@@ -179,34 +179,34 @@
         RenderBlock {P} at (16,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 1"
-        RenderBlock {P} at (46,0) size 21x83
+        RenderBlock {P} at (47,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 2"
-        RenderBlock {P} at (82,0) size 21x83
+        RenderBlock {P} at (83,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 3"
-        RenderBlock {P} at (118,0) size 21x83
+        RenderBlock {P} at (119,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 4"
-        RenderBlock {P} at (154,0) size 21x83
+        RenderBlock {P} at (155,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 5"
-        RenderBlock {P} at (190,0) size 21x83
+        RenderBlock {P} at (191,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 6"
-        RenderBlock {P} at (226,0) size 21x83
+        RenderBlock {P} at (227,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 7"
-        RenderBlock {P} at (262,0) size 21x83
+        RenderBlock {P} at (263,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 8"
-        RenderBlock {P} at (298,0) size 21x83
+        RenderBlock {P} at (299,0) size 20x83
           RenderText {#text} at (0,0) size 19x75
             text run at (0,0) width 75: "Hola hola 9"
-        RenderBlock {P} at (334,0) size 21x83
+        RenderBlock {P} at (335,0) size 20x83
           RenderText {#text} at (0,0) size 19x83
             text run at (0,0) width 83: "Hola hola 10"
-        RenderBlock {P} at (370,0) size 21x83
+        RenderBlock {P} at (371,0) size 20x83
           RenderText {#text} at (0,0) size 19x83
             text run at (0,0) width 83: "Hola hola 11"
       RenderBlock {DT} at (579,0) size 21x479

Modified: trunk/LayoutTests/platform/ios/fast/table/border-collapsing/002-vertical-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/ios/fast/table/border-collapsing/002-vertical-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/ios/fast/table/border-collapsing/002-vertical-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -68,54 +68,54 @@
           RenderTableSection {TBODY} at (2,2) size 278x154
             RenderTableRow {TR} at (0,0) size 57x153
               RenderTableCell {TD} at (0,1) size 57x50 [border: (2.50px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
-                RenderText {#text} at (20,17) size 19x9
-                  text run at (20,17) width 8: "1"
+                RenderText {#text} at (19,17) size 20x9
+                  text run at (19,17) width 9: "1"
               RenderTableCell {TD} at (0,52) size 57x50 [border: (1.50px solid #FF0000)] [r=0 c=1 rs=1 cs=1]
-                RenderText {#text} at (19,17) size 19x9
-                  text run at (19,17) width 8: "2"
+                RenderText {#text} at (18,17) size 20x9
+                  text run at (18,17) width 9: "2"
               RenderTableCell {TD} at (0,102) size 57x51 [border: (0.50px solid #FF0000)] [r=0 c=2 rs=1 cs=1]
-                RenderText {#text} at (19,16) size 19x9
-                  text run at (19,16) width 8: "3"
+                RenderText {#text} at (18,16) size 20x9
+                  text run at (18,16) width 9: "3"
             RenderTableRow {TR} at (0,57) size 57x153
               RenderTableCell {TD} at (57,2) size 57x48 [border: (2.50px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
-                RenderText {#text} at (19,16) size 19x9
-                  text run at (19,16) width 8: "4"
+                RenderText {#text} at (18,16) size 20x9
+                  text run at (18,16) width 9: "4"
               RenderTableCell {TD} at (57,52) size 57x50 [border: (2.50px dashed #0000FF)] [r=1 c=1 rs=1 cs=1]
-                RenderText {#text} at (19,18) size 19x9
-                  text run at (19,18) width 8: "5"
+                RenderText {#text} at (18,18) size 20x9
+                  text run at (18,18) width 9: "5"
               RenderTableCell {TD} at (57,102) size 57x51 [border: (2.50px solid #008000)] [r=1 c=2 rs=1 cs=1]
-                RenderText {#text} at (19,18) size 19x9
-                  text run at (19,18) width 8: "6"
+                RenderText {#text} at (18,18) size 20x9
+                  text run at (18,18) width 9: "6"
             RenderTableRow {TR} at (0,114) size 55x153
               RenderTableCell {TD} at (114,1) size 55x50 [border: (2.50px solid #FF0000)] [r=2 c=0 rs=1 cs=1]
-                RenderText {#text} at (18,17) size 19x9
-                  text run at (18,17) width 8: "7"
+                RenderText {#text} at (17,17) size 20x9
+                  text run at (17,17) width 9: "7"
               RenderTableCell {TD} at (114,52) size 55x50 [border: (1.50px solid #FF0000)] [r=2 c=1 rs=1 cs=1]
-                RenderText {#text} at (19,17) size 19x9
-                  text run at (19,17) width 8: "8"
+                RenderText {#text} at (18,17) size 20x9
+                  text run at (18,17) width 9: "8"
               RenderTableCell {TD} at (114,102) size 55x51 [border: (0.50px solid #FF0000)] [r=2 c=2 rs=1 cs=1]
-                RenderText {#text} at (19,16) size 19x9
-                  text run at (19,16) width 8: "9"
+                RenderText {#text} at (18,16) size 20x9
+                  text run at (18,16) width 9: "9"
             RenderTableRow {TR} at (0,169) size 53x153
               RenderTableCell {TD} at (169,0) size 53x52 [border: (2.50px solid #FF0000)] [r=3 c=0 rs=1 cs=1]
-                RenderText {#text} at (17,18) size 19x17
-                  text run at (17,18) width 16: "10"
+                RenderText {#text} at (16,18) size 20x17
+                  text run at (16,18) width 17: "10"
               RenderTableCell {TD} at (169,52) size 53x50 [border: (1.50px solid #FF0000)] [r=3 c=1 rs=1 cs=1]
-                RenderText {#text} at (17,17) size 19x16
-                  text run at (17,17) width 16: "11"
+                RenderText {#text} at (16,17) size 20x16
+                  text run at (16,17) width 16: "11"
               RenderTableCell {TD} at (169,102) size 53x51 [border: (0.50px solid #FF0000)] [r=3 c=2 rs=1 cs=1]
-                RenderText {#text} at (17,16) size 19x17
-                  text run at (17,16) width 16: "12"
+                RenderText {#text} at (16,16) size 20x17
+                  text run at (16,16) width 17: "12"
             RenderTableRow {TR} at (0,222) size 55x153
               RenderTableCell {TD} at (222,0) size 55x52 [border: (2.50px solid #FF0000)] [r=4 c=0 rs=1 cs=1]
-                RenderText {#text} at (17,18) size 19x17
-                  text run at (17,18) width 16: "13"
+                RenderText {#text} at (16,18) size 20x17
+                  text run at (16,18) width 17: "13"
               RenderTableCell {TD} at (222,52) size 55x50 [border: (1.50px solid #FF0000)] [r=4 c=1 rs=1 cs=1]
-                RenderText {#text} at (17,17) size 19x17
-                  text run at (17,17) width 16: "14"
+                RenderText {#text} at (16,17) size 20x17
+                  text run at (16,17) width 17: "14"
               RenderTableCell {TD} at (222,102) size 55x51 [border: (0.50px solid #FF0000)] [r=4 c=2 rs=1 cs=1]
-                RenderText {#text} at (17,16) size 19x17
-                  text run at (17,16) width 16: "15"
+                RenderText {#text} at (16,16) size 20x17
+                  text run at (16,16) width 17: "15"
         RenderTable {TABLE} at (0,316) size 158x282 [border: (2.50px solid #FFFF00)]
           RenderTableCol {COLGROUP} at (0,0) size 0x0
             RenderTableCol {COL} at (0,0) size 0x0 [border: (3px solid #000000)]
@@ -124,51 +124,51 @@
           RenderTableSection {TBODY} at (2,2) size 154x278
             RenderTableRow {TR} at (0,0) size 153x57
               RenderTableCell {TD} at (0,1) size 52x55 [border: (0.50px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
-                RenderText {#text} at (18,19) size 9x19
-                  text run at (18,19) width 9: "1"
+                RenderText {#text} at (18,18) size 9x19
+                  text run at (18,18) width 9: "1"
               RenderTableCell {TD} at (52,0) size 50x57 [border: (2.50px solid #FF0000)] [r=0 c=1 rs=1 cs=1]
-                RenderText {#text} at (17,19) size 9x19
-                  text run at (17,19) width 9: "2"
+                RenderText {#text} at (17,18) size 9x19
+                  text run at (17,18) width 9: "2"
               RenderTableCell {TD} at (102,0) size 51x57 [border: (2.50px solid #FF0000)] [r=0 c=2 rs=1 cs=1]
-                RenderText {#text} at (16,19) size 9x19
-                  text run at (16,19) width 9: "3"
+                RenderText {#text} at (16,18) size 9x19
+                  text run at (16,18) width 9: "3"
             RenderTableRow {TR} at (0,57) size 153x57
               RenderTableCell {TD} at (0,59) size 52x53 [border: (0.50px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
-                RenderText {#text} at (18,17) size 9x19
-                  text run at (18,17) width 9: "4"
+                RenderText {#text} at (18,16) size 9x19
+                  text run at (18,16) width 9: "4"
               RenderTableCell {TD} at (52,57) size 50x57 [border: (2.50px dashed #0000FF)] [r=1 c=1 rs=1 cs=1]
-                RenderText {#text} at (18,19) size 9x19
-                  text run at (18,19) width 9: "5"
+                RenderText {#text} at (18,18) size 9x19
+                  text run at (18,18) width 9: "5"
               RenderTableCell {TD} at (102,57) size 51x57 [border: (2.50px solid #008000)] [r=1 c=2 rs=1 cs=1]
-                RenderText {#text} at (18,19) size 9x19
-                  text run at (18,19) width 9: "6"
+                RenderText {#text} at (18,18) size 9x19
+                  text run at (18,18) width 9: "6"
             RenderTableRow {TR} at (0,114) size 153x55
               RenderTableCell {TD} at (0,115) size 52x53 [border: (0.50px solid #FF0000)] [r=2 c=0 rs=1 cs=1]
-                RenderText {#text} at (18,17) size 9x19
-                  text run at (18,17) width 9: "7"
+                RenderText {#text} at (18,16) size 9x19
+                  text run at (18,16) width 9: "7"
               RenderTableCell {TD} at (52,114) size 50x55 [border: (0.50px solid #FF0000)] [r=2 c=1 rs=1 cs=1]
-                RenderText {#text} at (17,19) size 9x19
-                  text run at (17,19) width 9: "8"
+                RenderText {#text} at (17,18) size 9x19
+                  text run at (17,18) width 9: "8"
               RenderTableCell {TD} at (102,114) size 51x55 [border: (0.50px solid #FF0000)] [r=2 c=2 rs=1 cs=1]
-                RenderText {#text} at (16,19) size 9x19
-                  text run at (16,19) width 9: "9"
+                RenderText {#text} at (16,18) size 9x19
+                  text run at (16,18) width 9: "9"
             RenderTableRow {TR} at (0,169) size 153x53
               RenderTableCell {TD} at (0,169) size 52x53 [border: (0.50px solid #FF0000)] [r=3 c=0 rs=1 cs=1]
-                RenderText {#text} at (18,17) size 17x19
-                  text run at (18,17) width 17: "10"
+                RenderText {#text} at (18,16) size 17x19
+                  text run at (18,16) width 17: "10"
               RenderTableCell {TD} at (52,169) size 50x53 [border: (0.50px solid #FF0000)] [r=3 c=1 rs=1 cs=1]
-                RenderText {#text} at (17,17) size 16x19
-                  text run at (17,17) width 16: "11"
+                RenderText {#text} at (17,16) size 16x19
+                  text run at (17,16) width 16: "11"
               RenderTableCell {TD} at (102,169) size 51x53 [border: (0.50px solid #FF0000)] [r=3 c=2 rs=1 cs=1]
-                RenderText {#text} at (16,17) size 17x19
-                  text run at (16,17) width 17: "12"
+                RenderText {#text} at (16,16) size 17x19
+                  text run at (16,16) width 17: "12"
             RenderTableRow {TR} at (0,222) size 153x55
               RenderTableCell {TD} at (0,222) size 52x55 [border: (2.50px solid #FF0000)] [r=4 c=0 rs=1 cs=1]
-                RenderText {#text} at (18,17) size 17x19
-                  text run at (18,17) width 17: "13"
+                RenderText {#text} at (18,16) size 17x19
+                  text run at (18,16) width 17: "13"
               RenderTableCell {TD} at (52,222) size 50x55 [border: (2.50px solid #FF0000)] [r=4 c=1 rs=1 cs=1]
-                RenderText {#text} at (17,17) size 17x19
-                  text run at (17,17) width 17: "14"
+                RenderText {#text} at (17,16) size 17x19
+                  text run at (17,16) width 17: "14"
               RenderTableCell {TD} at (102,222) size 51x55 [border: (2.50px solid #FF0000)] [r=4 c=2 rs=1 cs=1]
-                RenderText {#text} at (16,17) size 17x19
-                  text run at (16,17) width 17: "15"
+                RenderText {#text} at (16,16) size 17x19
+                  text run at (16,16) width 17: "15"

Modified: trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -300,7 +300,7 @@
         text run at (0,162) width 333: "nec felis. Sed varius turpis vitae pede. Lorem ipsum"
         text run at (0,180) width 275: "dolor sit amet, consectetuer adipiscing elit."
 layer at (8,2511) size 760x435
-  RenderBlock {DIV} at (0,2495) size 760x436 [border: (5px solid #800000)]
+  RenderBlock {DIV} at (0,2495) size 760x435 [border: (5px solid #800000)]
     RenderMultiColumnSet at (5,5) size 750x329
     RenderBlock {H2} at (5,353) size 750x57 [bgcolor=#EEEEEE]
       RenderText {#text} at (0,0) size 709x56
@@ -350,7 +350,7 @@
         text run at (0,180) width 275: "dolor sit amet, consectetuer adipiscing elit."
     RenderMultiColumnSpannerPlaceholder at (0,658) size 0x0
 layer at (8,2962) size 760x452
-  RenderBlock {DIV} at (0,2946) size 760x452 [border: (5px solid #800000)]
+  RenderBlock {DIV} at (0,2945) size 760x453 [border: (5px solid #800000)]
     RenderMultiColumnSet at (5,5) size 750x222
     RenderBlock {H2} at (5,246) size 750x57 [bgcolor=#EEEEEE]
       RenderText {#text} at (0,0) size 743x56

Modified: trunk/LayoutTests/platform/mac/fast/multicol/vertical-lr/float-multicol-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/mac/fast/multicol/vertical-lr/float-multicol-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/mac/fast/multicol/vertical-lr/float-multicol-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -133,7 +133,7 @@
           text run at (18,331) width 33: "Bugs"
       RenderBlock {DD} at (52,40) size 469x439
         RenderBlock {P} at (0,0) size 469x439
-          RenderText {#text} at (0,291) size 324x142
+          RenderText {#text} at (0,291) size 325x142
             text run at (0,291) width 44: "You've"
             text run at (18,291) width 48: "already"
             text run at (198,291) width 131: "downloaded a build."
@@ -147,12 +147,12 @@
             text run at (306,291) width 70: "build with "
             text run at (306,360) width 63: "Talkback,"
           RenderInline {EM} at (0,0) size 18x106
-            RenderText {#text} at (324,291) size 18x106
-              text run at (324,291) width 45: "please "
+            RenderText {#text} at (324,291) size 19x106
+              text run at (324,291) width 46: "please "
               text run at (324,336) width 60: "turn it on"
-          RenderText {#text} at (324,396) size 126x435
+          RenderText {#text} at (324,396) size 127x435
             text run at (324,396) width 39: " when"
-            text run at (342,208) width 191: "it asks. Talkback reports give "
+            text run at (342,208) width 192: "it asks. Talkback reports give "
             text run at (342,399) width 15: "us"
             text run at (360,208) width 130: "really valuable data "
             text run at (360,338) width 60: "on which"
@@ -163,49 +163,49 @@
             text run at (414,284) width 139: "If you find something"
             text run at (432,0) width 317: "you think is a bug, check to see if it's not already "
           RenderInline {A} at (0,0) size 18x84 [color=#0000EE]
-            RenderText {#text} at (432,316) size 18x84
+            RenderText {#text} at (432,316) size 19x84
               text run at (432,316) width 84: "known about"
-          RenderText {#text} at (432,399) size 36x431
+          RenderText {#text} at (432,399) size 37x431
             text run at (432,399) width 32: ", and"
             text run at (450,0) width 76: "then please "
             text run at (450,75) width 70: "follow the "
           RenderInline {A} at (0,0) size 18x169 [color=#0000EE]
-            RenderText {#text} at (450,144) size 18x169
-              text run at (450,144) width 168: "bug submission procedure"
-          RenderText {#text} at (450,312) size 18x5
-            text run at (450,312) width 4: "."
+            RenderText {#text} at (450,144) size 19x169
+              text run at (450,144) width 169: "bug submission procedure"
+          RenderText {#text} at (450,312) size 19x5
+            text run at (450,312) width 5: "."
       RenderBlock (floating) {DIV} at (536,0) size 401x83 [bgcolor=#008000]
         RenderBlock {P} at (16,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 1"
-        RenderBlock {P} at (59,0) size 19x83
+        RenderBlock {P} at (60,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 2"
-        RenderBlock {P} at (93,0) size 19x83
+        RenderBlock {P} at (94,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 3"
-        RenderBlock {P} at (127,0) size 19x83
+        RenderBlock {P} at (128,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 4"
-        RenderBlock {P} at (161,0) size 19x83
+        RenderBlock {P} at (162,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 5"
-        RenderBlock {P} at (195,0) size 19x83
+        RenderBlock {P} at (196,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 6"
-        RenderBlock {P} at (229,0) size 19x83
+        RenderBlock {P} at (230,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 7"
-        RenderBlock {P} at (263,0) size 19x83
+        RenderBlock {P} at (264,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 8"
-        RenderBlock {P} at (297,0) size 19x83
+        RenderBlock {P} at (298,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 9"
-        RenderBlock {P} at (331,0) size 19x83
+        RenderBlock {P} at (332,0) size 18x83
           RenderText {#text} at (0,0) size 18x83
             text run at (0,0) width 83: "Hola hola 10"
-        RenderBlock {P} at (365,0) size 19x83
+        RenderBlock {P} at (366,0) size 18x83
           RenderText {#text} at (0,0) size 18x83
             text run at (0,0) width 83: "Hola hola 11"
       RenderBlock {DT} at (536,0) size 19x479
@@ -225,8 +225,8 @@
           RenderText {#text} at (0,190) size 116x368
             text run at (0,190) width 4: " "
             text run at (0,194) width 215: "dedicated to ways to get involved"
-            text run at (25,42) width 223: "with helping. This doesn't involve "
-            text run at (25,264) width 144: "knowing how to code,"
+            text run at (26,42) width 222: "with helping. This doesn't involve "
+            text run at (26,264) width 143: "knowing how to code,"
             text run at (44,42) width 351: "although a little knowledge of HTML is helpful. Being"
             text run at (62,42) width 134: "involved with QA is "
             text run at (62,176) width 234: "good for people wanting to get more"

Modified: trunk/LayoutTests/platform/mac/fast/multicol/vertical-lr/nested-columns-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/mac/fast/multicol/vertical-lr/nested-columns-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/mac/fast/multicol/vertical-lr/nested-columns-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -27,7 +27,7 @@
       RenderText {#text} at (0,0) size 37x167
         text run at (0,0) width 167: "Header Two"
     RenderBlock (anonymous) at (357,0) size 215x367
-      RenderText {#text} at (0,0) size 214x367
+      RenderText {#text} at (0,0) size 215x367
         text run at (0,0) width 364: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
         text run at (18,0) width 362: "Nulla varius enim ac mi. Curabitur sollicitudin felis quis"
         text run at (36,0) width 332: "lectus. Quisque adipiscing rhoncus sem. Proin nulla"

Modified: trunk/LayoutTests/platform/mac/fast/multicol/vertical-rl/float-multicol-expected.txt (279672 => 279673)


--- trunk/LayoutTests/platform/mac/fast/multicol/vertical-rl/float-multicol-expected.txt	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/LayoutTests/platform/mac/fast/multicol/vertical-rl/float-multicol-expected.txt	2021-07-07 21:35:19 UTC (rev 279673)
@@ -137,7 +137,7 @@
             text run at (0,291) width 44: "You've"
             text run at (18,291) width 48: "already"
             text run at (198,291) width 131: "downloaded a build."
-            text run at (216,291) width 135: "All you have to do is"
+            text run at (216,291) width 134: "All you have to do is"
             text run at (234,291) width 39: "use it "
             text run at (234,329) width 18: "as "
             text run at (234,347) width 30: "your"
@@ -178,34 +178,34 @@
         RenderBlock {P} at (16,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 1"
-        RenderBlock {P} at (59,0) size 19x83
+        RenderBlock {P} at (60,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 2"
-        RenderBlock {P} at (93,0) size 19x83
+        RenderBlock {P} at (94,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 3"
-        RenderBlock {P} at (127,0) size 19x83
+        RenderBlock {P} at (128,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 4"
-        RenderBlock {P} at (161,0) size 19x83
+        RenderBlock {P} at (162,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 5"
-        RenderBlock {P} at (195,0) size 19x83
+        RenderBlock {P} at (196,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 6"
-        RenderBlock {P} at (229,0) size 19x83
+        RenderBlock {P} at (230,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 7"
-        RenderBlock {P} at (263,0) size 19x83
+        RenderBlock {P} at (264,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 8"
-        RenderBlock {P} at (297,0) size 19x83
+        RenderBlock {P} at (298,0) size 18x83
           RenderText {#text} at (0,0) size 18x75
             text run at (0,0) width 75: "Hola hola 9"
-        RenderBlock {P} at (331,0) size 19x83
+        RenderBlock {P} at (332,0) size 18x83
           RenderText {#text} at (0,0) size 18x83
             text run at (0,0) width 83: "Hola hola 10"
-        RenderBlock {P} at (365,0) size 19x83
+        RenderBlock {P} at (366,0) size 18x83
           RenderText {#text} at (0,0) size 18x83
             text run at (0,0) width 83: "Hola hola 11"
       RenderBlock {DT} at (536,0) size 19x479
@@ -225,17 +225,17 @@
           RenderText {#text} at (0,190) size 116x368
             text run at (0,190) width 4: " "
             text run at (0,194) width 215: "dedicated to ways to get involved"
-            text run at (25,42) width 223: "with helping. This doesn't involve "
-            text run at (25,264) width 144: "knowing how to code,"
-            text run at (43,42) width 352: "although a little knowledge of HTML is helpful. Being"
-            text run at (61,42) width 135: "involved with QA is "
-            text run at (61,176) width 235: "good for people wanting to get more"
-            text run at (79,42) width 88: "familiar with "
-            text run at (79,129) width 278: "Mozilla, and there's a strong community. A"
-            text run at (97,42) width 246: "particularly good way to get involved "
-            text run at (97,287) width 81: "is to join the"
+            text run at (26,42) width 222: "with helping. This doesn't involve "
+            text run at (26,264) width 143: "knowing how to code,"
+            text run at (44,42) width 351: "although a little knowledge of HTML is helpful. Being"
+            text run at (62,42) width 134: "involved with QA is "
+            text run at (62,176) width 234: "good for people wanting to get more"
+            text run at (80,42) width 88: "familiar with "
+            text run at (80,129) width 277: "Mozilla, and there's a strong community. A"
+            text run at (98,42) width 245: "particularly good way to get involved "
+            text run at (98,287) width 80: "is to join the"
           RenderInline {A} at (0,0) size 18x71 [color=#0000EE]
-            RenderText {#text} at (115,42) size 19x71
-              text run at (115,42) width 72: "BugAThon"
-          RenderText {#text} at (115,112) size 19x5
-            text run at (115,112) width 5: "."
+            RenderText {#text} at (116,42) size 18x71
+              text run at (116,42) width 71: "BugAThon"
+          RenderText {#text} at (116,112) size 18x5
+            text run at (116,112) width 4: "."

Modified: trunk/Source/WebCore/ChangeLog (279672 => 279673)


--- trunk/Source/WebCore/ChangeLog	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/Source/WebCore/ChangeLog	2021-07-07 21:35:19 UTC (rev 279673)
@@ -1,3 +1,21 @@
+2021-07-07  Alan Bujtas  <za...@apple.com>
+
+        [Legacy line layout] Inline content on subpixel position makes the table cell scroll
+        https://bugs.webkit.org/show_bug.cgi?id=227594
+        <rdar://74884402>
+
+        Reviewed by Simon Fraser.
+
+        The root inlinebox is supposed to fit the [top, top + maxHeight] space as it is computed based
+        on the inline level boxes. However due to the integral rounding on the root inlinebox's logical top,
+        it may accidentally leak out of the containing block and trigger unintended layout overflow.
+        This patch ensures that we don't stretch the line (top/bottom) with the integral positioned root inlinebox.
+
+        Test: fast/inline/hidpi-root-inlinebox-integral-rounding-table-simple.html
+
+        * rendering/LegacyInlineFlowBox.cpp:
+        (WebCore::LegacyInlineFlowBox::placeBoxesInBlockDirection):
+
 2021-07-07  Chris Dumez  <cdu...@apple.com>
 
         IDBIndex.keyPath should keep returning the same object

Modified: trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp (279672 => 279673)


--- trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp	2021-07-07 21:35:07 UTC (rev 279672)
+++ trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp	2021-07-07 21:35:19 UTC (rev 279673)
@@ -646,29 +646,21 @@
     }
 }
 
-void LegacyInlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop,
+static void placeChildInlineBoxesInBlockDirection(LegacyInlineFlowBox& inlineBox, LayoutUnit top, LayoutUnit maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop,
     LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType)
 {
-    bool isRootBox = isRootInlineBox();
-    if (isRootBox) {
-        const FontMetrics& fontMetrics = lineStyle().fontMetrics();
-        // RootInlineBoxes are always placed on at pixel boundaries in their logical y direction. Not doing
-        // so results in incorrect rendering of text decorations, most notably underlines.
-        setLogicalTop(roundToInt(top + maxAscent - fontMetrics.ascent(baselineType)));
-    }
-
     LayoutUnit adjustmentForChildrenWithSameLineHeightAndBaseline;
-    if (descendantsHaveSameLineHeightAndBaseline()) {
-        adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop();
-        if (parent())
-            adjustmentForChildrenWithSameLineHeightAndBaseline += renderer().borderAndPaddingBefore();
+    if (inlineBox.descendantsHaveSameLineHeightAndBaseline()) {
+        adjustmentForChildrenWithSameLineHeightAndBaseline = inlineBox.logicalTop();
+        if (inlineBox.parent())
+            adjustmentForChildrenWithSameLineHeightAndBaseline += inlineBox.renderer().borderAndPaddingBefore();
     }
 
-    for (auto* child = firstChild(); child; child = child->nextOnLine()) {
+    for (auto* child = inlineBox.firstChild(); child; child = child->nextOnLine()) {
         if (child->renderer().isOutOfFlowPositioned())
             continue; // Positioned placeholders don't affect calculations.
 
-        if (descendantsHaveSameLineHeightAndBaseline()) {
+        if (inlineBox.descendantsHaveSameLineHeightAndBaseline()) {
             child->adjustBlockDirectionPosition(adjustmentForChildrenWithSameLineHeightAndBaseline);
             continue;
         }
@@ -721,7 +713,7 @@
                 // Treat the leading on the first and last lines of ruby runs as not being part of the overall lineTop/lineBottom.
                 // Really this is a workaround hack for the fact that ruby should have been done as line layout and not done using
                 // inline-block.
-                if (renderer().style().isFlippedLinesWritingMode() == (child->renderer().style().rubyPosition() == RubyPosition::After))
+                if (inlineBox.renderer().style().isFlippedLinesWritingMode() == (child->renderer().style().rubyPosition() == RubyPosition::After))
                     hasAnnotationsBefore = true;
                 else
                     hasAnnotationsAfter = true;
@@ -730,7 +722,7 @@
                 if (RenderRubyBase* rubyBase = rubyRun.rubyBase()) {
                     LayoutUnit bottomRubyBaseLeading { (child->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : 0_lu) };
                     LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : 0_lu);
-                    newLogicalTop += !renderer().style().isFlippedLinesWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading;
+                    newLogicalTop += !inlineBox.renderer().style().isFlippedLinesWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading;
                     boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading);
                 }
             }
@@ -762,18 +754,42 @@
                 lineTopIncludingMargins, lineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineType);
         }
     }
+}
 
+void LegacyInlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHeight, int maxAscent, bool strictMode, LayoutUnit& lineTop, LayoutUnit& lineBottom, bool& setLineTop,
+    LayoutUnit& lineTopIncludingMargins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool& hasAnnotationsAfter, FontBaseline baselineType)
+{
+    bool isRootBox = isRootInlineBox();
+    LayoutUnit rootInlineBoxRoundedOverflow;
     if (isRootBox) {
+        const FontMetrics& fontMetrics = lineStyle().fontMetrics();
+        // RootInlineBoxes are always placed on at pixel boundaries in their logical y direction. Not doing
+        // so results in incorrect rendering of text decorations, most notably underlines.
+        auto logicalTop = top + maxAscent - fontMetrics.ascent(baselineType);
+        // FIXME: Let's do device pixel snapping at paint time instead (webkit.org/b/227751).
+        auto adjustedLogicalTop = roundToInt(logicalTop);
+        setLogicalTop(adjustedLogicalTop);
+        rootInlineBoxRoundedOverflow = LayoutUnit { adjustedLogicalTop } - logicalTop;
+    }
+
+    placeChildInlineBoxesInBlockDirection(*this, top, maxHeight, maxAscent, strictMode, lineTop, lineBottom, setLineTop, lineTopIncludingMargins, lineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineType);
+
+    if (isRootBox) {
         if (strictMode || hasTextChildren() || (descendantsHaveSameLineHeightAndBaseline() && hasTextDescendants())) {
+            // The root inlinebox is supposed to fit the [top, top + maxHeight] space. However due to the integral rounding on the root inlinebox's logical top,
+            // it may accidentally leak out of the containing block and trigger unintended layout overflow (see above).
+            // Make sure we don't stretch the line with the rounded root inlinebox.
+            auto rootInlineBoxLogicalTop = LayoutUnit { logicalTop() } - rootInlineBoxRoundedOverflow;
+            auto rootInlineBoxLogicalBottom = LayoutUnit { logicalBottom() } - rootInlineBoxRoundedOverflow;
             if (!setLineTop) {
                 setLineTop = true;
-                lineTop = logicalTop();
+                lineTop = rootInlineBoxLogicalTop;
                 lineTopIncludingMargins = lineTop;
             } else {
-                lineTop = std::min(lineTop, LayoutUnit(logicalTop()));
+                lineTop = std::min(lineTop, rootInlineBoxLogicalTop);
                 lineTopIncludingMargins = std::min(lineTop, lineTopIncludingMargins);
             }
-            lineBottom = std::max(lineBottom, LayoutUnit(logicalBottom()));
+            lineBottom = std::max(lineBottom, rootInlineBoxLogicalBottom);
             lineBottomIncludingMargins = std::max(lineBottom, lineBottomIncludingMargins);
         }
         
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to