Title: [238441] trunk
Revision
238441
Author
[email protected]
Date
2018-11-22 00:45:48 -0800 (Thu, 22 Nov 2018)

Log Message

Tables with vertical-lr writing-mode doesn't apply correctly vertical-align: baseline
https://bugs.webkit.org/show_bug.cgi?id=191881

Reviewed by Manuel Rego Casasnovas.

Source/WebCore:

We should use the font's descent value when wriring-mode flips line flow (vertical-lr).

This change also fixes bug 170175, since Flexbox use the same code to determine the first
line baseline of a flex item.

Test: fast/writing-mode/vertical-align-table-baseline-latin.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::firstLineBaseline const):

LayoutTests:

Tests to verify that columns of a vertical-lr table vertically aligned by baseline work like
in the case of horizontal tables.
Also added tests to verify flexbox baseline alignment works as expected in vertical-lr mode.

The vertical-align-table-baseline.html test has been rebaselined due to the new behavior.

* fast/writing-mode/vertical-align-table-baseline-latin-expected.html: Added.
* fast/writing-mode/vertical-align-table-baseline-latin.html: Added.
* fast/writing-mode/vertical-align-flex-baseline-expected.html: Added.
* fast/writing-mode/vertical-align-flex-baseline-html: Added.
* platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.txt: Rebaseline.
* platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.png: Rebaseline.
* platform/win/fast/writing-mode/vertical-align-table-baseline-expected.txt: Rebaseline.
* platform/win/fast/writing-mode/vertical-align-table-baseline-expected.png: Rebaseline.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238440 => 238441)


--- trunk/LayoutTests/ChangeLog	2018-11-22 06:39:15 UTC (rev 238440)
+++ trunk/LayoutTests/ChangeLog	2018-11-22 08:45:48 UTC (rev 238441)
@@ -1,3 +1,25 @@
+2018-11-22  Javier Fernandez  <[email protected]>
+
+        Tables with vertical-lr writing-mode doesn't apply correctly vertical-align: baseline
+        https://bugs.webkit.org/show_bug.cgi?id=191881
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        Tests to verify that columns of a vertical-lr table vertically aligned by baseline work like
+        in the case of horizontal tables.
+        Also added tests to verify flexbox baseline alignment works as expected in vertical-lr mode.
+
+        The vertical-align-table-baseline.html test has been rebaselined due to the new behavior.
+
+        * fast/writing-mode/vertical-align-table-baseline-latin-expected.html: Added.
+        * fast/writing-mode/vertical-align-table-baseline-latin.html: Added.
+        * fast/writing-mode/vertical-align-flex-baseline-expected.html: Added.
+        * fast/writing-mode/vertical-align-flex-baseline-html: Added.
+        * platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.txt: Rebaseline.
+        * platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.png: Rebaseline.
+        * platform/win/fast/writing-mode/vertical-align-table-baseline-expected.txt: Rebaseline.
+        * platform/win/fast/writing-mode/vertical-align-table-baseline-expected.png: Rebaseline.
+
 2018-11-21  Wenson Hsieh  <[email protected]>
 
         [Cocoa] [WebKit2] Add support for replacing find-in-page text matches

Added: trunk/LayoutTests/fast/writing-mode/vertical-align-flexbox-baseline-expected.html (0 => 238441)


--- trunk/LayoutTests/fast/writing-mode/vertical-align-flexbox-baseline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/vertical-align-flexbox-baseline-expected.html	2018-11-22 08:45:48 UTC (rev 238441)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<style>
+.block {
+   background: grey;
+   margin: 5px;
+   padding: 5px 10px 10px 5px;
+   width: 200px;
+   writing-mode: vertical-lr;
+   flex-flow: row;
+   align-items: baseline;
+}
+.block > :nth-child(1) { font-size:48px; }
+.block > :nth-child(2) { font-size:64px; }
+.block > :nth-child(3) { font-size:96px; }
+.block > :nth-child(4) { font-size:128px; }
+.block > div {
+   display: inline-block;
+   border-width: 4px 2px 2px 4px;
+   border-style: solid;
+   padding: 6px 4px 4px 6px;
+   margin: 10px 4px 4px 10px;
+}
+</style>
+
+<p>Vertical-LR flexbox with 1x4 with parallel items.<br>Items should use 'alphabetic' as dominant baseline for self-baseline alignment.</p>
+<div class="block verticalLR"><div>A</div><div>A</div><div>A</div><div>A</div></div>

Added: trunk/LayoutTests/fast/writing-mode/vertical-align-flexbox-baseline.html (0 => 238441)


--- trunk/LayoutTests/fast/writing-mode/vertical-align-flexbox-baseline.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/vertical-align-flexbox-baseline.html	2018-11-22 08:45:48 UTC (rev 238441)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<style>
+.flex {
+   display: flex;
+   flex-flow: row;
+   align-items: baseline;
+}
+.block {
+   background: grey;
+   margin: 5px;
+   padding: 5px 10px 10px 5px;
+   width: 200px;
+   writing-mode: vertical-lr;
+}
+.block > :nth-child(1) { font-size:48px; }
+.block > :nth-child(2) { font-size:64px; }
+.block > :nth-child(3) { font-size:96px; }
+.block > :nth-child(4) { font-size:128px; }
+.block > div {
+   border-width: 4px 2px 2px 4px;
+   border-style: solid;
+   padding: 6px 4px 4px 6px;
+   margin: 10px 4px 4px 10px;
+}
+</style>
+
+<p>Vertical-LR flexbox with 1x4 with parallel items.<br>Items should use 'alphabetic' as dominant baseline for self-baseline alignment.</p>
+<div class="flex block verticalLR"><div>A</div><div>A</div><div>A</div><div>A</div></div>

Added: trunk/LayoutTests/fast/writing-mode/vertical-align-table-baseline-latin-expected.html (0 => 238441)


--- trunk/LayoutTests/fast/writing-mode/vertical-align-table-baseline-latin-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/vertical-align-table-baseline-latin-expected.html	2018-11-22 08:45:48 UTC (rev 238441)
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<style>
+.item {
+  display: inline-block;
+  font-size: 50px;
+}
+.large { font-size: 100px; }
+</style>
+<p>This test passes if text in both columns are aligned using their alhabetic baseline, like it happens in horizontal mode.</p>
+<div style="writing-mode: vertical-lr;">
+  <div class="item">foo</div><div class="large item">foo</div>
+</div>

Added: trunk/LayoutTests/fast/writing-mode/vertical-align-table-baseline-latin.html (0 => 238441)


--- trunk/LayoutTests/fast/writing-mode/vertical-align-table-baseline-latin.html	                        (rev 0)
+++ trunk/LayoutTests/fast/writing-mode/vertical-align-table-baseline-latin.html	2018-11-22 08:45:48 UTC (rev 238441)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<style>
+td {
+  font-size: 50px;
+  vertical-align: baseline;
+  padding: 0px;
+  transform-origin: 0px 0px;
+}
+.large { font-size: 100px; }
+</style>
+<p>This test passes if text in both columns are aligned using their alhabetic baseline, like it happens in horizontal mode.</p>
+<table style="writing-mode: vertical-lr; border-spacing: 0px;">
+  <td>foo</td><td class="large">foo</td>
+</table>

Modified: trunk/LayoutTests/platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.txt (238440 => 238441)


--- trunk/LayoutTests/platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.txt	2018-11-22 06:39:15 UTC (rev 238440)
+++ trunk/LayoutTests/platform/gtk/fast/writing-mode/vertical-align-table-baseline-expected.txt	2018-11-22 08:45:48 UTC (rev 238441)
@@ -6,10 +6,10 @@
       RenderTable {TABLE} at (0,0) size 234x584 [border: (2px outset #808080)]
         RenderTableSection {TBODY} at (2,2) size 230x580
           RenderTableRow {TR} at (0,2) size 226x580
-            RenderTableCell {TD} at (2,46) size 226x80 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-              RenderText {#text} at (47,-42) size 108x144
-                text run at (47,-42) width 144: "\x{7B2C}\x{4E00}\x{6BB5}"
-                text run at (102,-42) width 48: "\x{843D}"
+            RenderTableCell {TD} at (2,14) size 226x80 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (15,-10) size 108x144
+                text run at (15,-10) width 144: "\x{7B2C}\x{4E00}\x{6BB5}"
+                text run at (70,-10) width 48: "\x{843D}"
             RenderTableCell {TD} at (2,195) size 226x384 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
               RenderText {#text} at (4,2) size 218x291
                 text run at (4,2) width 291: "\x{7B2C}\x{4E8C}\x{6BB5}"

Modified: trunk/LayoutTests/platform/win/fast/writing-mode/vertical-align-table-baseline-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/win/fast/writing-mode/vertical-align-table-baseline-expected.txt (238440 => 238441)


--- trunk/LayoutTests/platform/win/fast/writing-mode/vertical-align-table-baseline-expected.txt	2018-11-22 06:39:15 UTC (rev 238440)
+++ trunk/LayoutTests/platform/win/fast/writing-mode/vertical-align-table-baseline-expected.txt	2018-11-22 08:45:48 UTC (rev 238441)
@@ -6,10 +6,10 @@
       RenderTable {TABLE} at (0,0) size 232x584 [border: (2px outset #808080)]
         RenderTableSection {TBODY} at (2,2) size 228x580
           RenderTableRow {TR} at (0,2) size 224x580
-            RenderTableCell {TD} at (2,45) size 224x83 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-              RenderText {#text} at (45,-41) size 110x144
-                text run at (45,-41) width 144: "\x{7B2C}\x{4E00}\x{6BB5}"
-                text run at (100,-41) width 48: "\x{843D}"
+            RenderTableCell {TD} at (2,14) size 224x83 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (14,-10) size 110x144
+                text run at (14,-10) width 144: "\x{7B2C}\x{4E00}\x{6BB5}"
+                text run at (69,-10) width 48: "\x{843D}"
             RenderTableCell {TD} at (2,196) size 224x383 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
               RenderText {#text} at (2,2) size 220x288
                 text run at (2,2) width 288: "\x{7B2C}\x{4E8C}\x{6BB5}"

Modified: trunk/Source/WebCore/ChangeLog (238440 => 238441)


--- trunk/Source/WebCore/ChangeLog	2018-11-22 06:39:15 UTC (rev 238440)
+++ trunk/Source/WebCore/ChangeLog	2018-11-22 08:45:48 UTC (rev 238441)
@@ -1,3 +1,20 @@
+2018-11-22  Javier Fernandez  <[email protected]>
+
+        Tables with vertical-lr writing-mode doesn't apply correctly vertical-align: baseline
+        https://bugs.webkit.org/show_bug.cgi?id=191881
+
+        Reviewed by Manuel Rego Casasnovas.
+
+        We should use the font's descent value when wriring-mode flips line flow (vertical-lr).
+
+        This change also fixes bug 170175, since Flexbox use the same code to determine the first
+        line baseline of a flex item.
+
+        Test: fast/writing-mode/vertical-align-table-baseline-latin.html
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::firstLineBaseline const):
+
 2018-11-21  Ryosuke Niwa  <[email protected]>
 
         Phantom focus/blur events fire on clicking between text input fields when listening with addEventListener

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (238440 => 238441)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2018-11-22 06:39:15 UTC (rev 238440)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2018-11-22 08:45:48 UTC (rev 238441)
@@ -3013,6 +3013,8 @@
         return std::optional<int>(SimpleLineLayout::computeFlowFirstLineBaseline(*this, *simpleLineLayout));
 
     ASSERT(firstRootBox());
+    if (style().isFlippedLinesWritingMode())
+        return firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().descent(firstRootBox()->baselineType());
     return firstRootBox()->logicalTop() + firstLineStyle().fontMetrics().ascent(firstRootBox()->baselineType());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to