Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 1841073002: [css-grid] Fix positioned children in RTL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutGrid.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index 5d4d1b5aecffc220bdf8d3fd441f2e39c24ddce2..ac6717df3c10aaeaf3018ac450a0efde495a3224 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -1542,6 +1542,18 @@ void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid
breadth = end - start;
offset = start;
+ if (isForColumns && !styleRef().isLeftToRightDirection() && !child.styleRef().hasStaticInlinePosition(child.isHorizontalWritingMode())) {
+ // If the child doesn't have a static inline position (i.e. "left" and/or "right" aren't "auto",
+ // we need to calculate the offset from the left (even if we're in RTL).
+ if (endIsAuto) {
+ offset = LayoutUnit();
+ } else {
+ LayoutUnit alignmentOffset = m_columnPositions[0] - borderAndPaddingStart();
+ LayoutUnit offsetFromLastLine = m_columnPositions[m_columnPositions.size() - 1] - m_columnPositions[endLine];
+ offset = paddingLeft() + alignmentOffset + offsetFromLastLine;
+ }
+ }
+
if (child.parent() == this && !startIsAuto) {
// If column/row start is "auto" the static position has been already set in prepareChildForPositionedLayout().
PaintLayer* childLayer = child.layer();

Powered by Google App Engine
This is Rietveld 408576698