Title: [282340] trunk
Revision
282340
Author
[email protected]
Date
2021-09-13 11:15:52 -0700 (Mon, 13 Sep 2021)

Log Message

[css-grid] calling correct offset function for RTL for out of flow child
https://bugs.webkit.org/show_bug.cgi?id=229968

Reviewed by Javier Fernandez.

Handle RTL case to return the correct border values when calculating offsets for start and end edges
of a column for out of flow child.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::gridAreaPositionForOutOfFlowChild const):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016-expected.txt (282339 => 282340)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016-expected.txt	2021-09-13 18:06:30 UTC (rev 282339)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016-expected.txt	2021-09-13 18:15:52 UTC (rev 282340)
@@ -23,14 +23,7 @@
 XX XXX
 
 PASS .grid 1
-FAIL .grid 2 assert_equals:
-<div class="grid RTL">
-  <div data-offset-x="377" data-offset-y="3" data-expected-width="76" data-expected-height="20" class="firstRowFirstColumn">X XX X</div>
-  <div data-offset-x="86" data-offset-y="105" data-expected-width="86" data-expected-height="40" class="firstRowSecondColumn">XX X<br>X XXX X<br>XX XXX</div>
-  <div data-offset-x="377" data-offset-y="189" data-expected-width="76" data-expected-height="20" class="secondRowFirstColumn">X XX X</div>
-  <div data-offset-x="261" data-offset-y="195" data-expected-width="76" data-expected-height="50" class="secondRowSecondColumn">XX X<br>X XXX<br>X<br>XX XXX</div>
-</div>
-offsetLeft expected 377 but got 375
+PASS .grid 2
 PASS .grid 3
 PASS .grid 4
 

Modified: trunk/Source/WebCore/ChangeLog (282339 => 282340)


--- trunk/Source/WebCore/ChangeLog	2021-09-13 18:06:30 UTC (rev 282339)
+++ trunk/Source/WebCore/ChangeLog	2021-09-13 18:15:52 UTC (rev 282340)
@@ -1,3 +1,16 @@
+2021-09-13  Ziran Sun  <[email protected]>
+
+        [css-grid] calling correct offset function for RTL for out of flow child
+        https://bugs.webkit.org/show_bug.cgi?id=229968
+
+        Reviewed by Javier Fernandez.
+
+        Handle RTL case to return the correct border values when calculating offsets for start and end edges
+        of a column for out of flow child.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::gridAreaPositionForOutOfFlowChild const):
+
 2021-09-13  Antti Koivisto  <[email protected]>
 
         Expose TextBoxSelectableRange in the iterator

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (282339 => 282340)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2021-09-13 18:06:30 UTC (rev 282339)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2021-09-13 18:15:52 UTC (rev 282340)
@@ -1578,7 +1578,7 @@
     LayoutUnit end;
     auto& positions = isRowAxis ? m_columnPositions : m_rowPositions;
     auto& outOfFlowItemLine = isRowAxis ? m_outOfFlowItemColumn : m_outOfFlowItemRow;
-    LayoutUnit borderEdge = isRowAxis ? borderLogicalLeft() : borderBefore();
+    LayoutUnit borderEdge = isRowAxis ? (style().isLeftToRightDirection() ? borderLogicalLeft() : borderLogicalRight()) : borderBefore();
     if (startIsAuto)
         start = resolveAutoStartGridPosition(direction) + borderEdge;
     else {
@@ -1626,7 +1626,7 @@
     LayoutUnit trackBreadth = GridLayoutFunctions::overridingContainingBlockContentSizeForChild(child, direction).value();
     bool isRowAxis = direction == ForColumns;
     auto& outOfFlowItemLine = isRowAxis ? m_outOfFlowItemColumn : m_outOfFlowItemRow;
-    start = isRowAxis ? borderLogicalLeft() : borderBefore();
+    start = isRowAxis ? (style().isLeftToRightDirection() ? borderLogicalLeft() : borderLogicalRight()) : borderBefore();
     if (auto line = outOfFlowItemLine.get(&child)) {
         auto& positions = isRowAxis ? m_columnPositions : m_rowPositions;
         start = positions[line.value()];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to