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(); |