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 9f538821e67418d11cc5f8fc6fef418f1c31d3ea..7f427529f36cae48ad6d23dbb6cf0d512d35ba40 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp |
@@ -1522,23 +1522,36 @@ void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid |
|| (endLine < firstExplicitLine) |
|| (endLine > lastExplicitLine); |
- LayoutUnit start = startIsAuto ? LayoutUnit() : isForColumns ? m_columnPositions[startLine] : m_rowPositions[startLine]; |
- LayoutUnit end = endIsAuto ? isForColumns ? logicalWidth() : logicalHeight() : isForColumns ? m_columnPositions[endLine] : m_rowPositions[endLine]; |
- |
- breadth = end - start; |
- |
- if (startIsAuto) |
- breadth -= isForColumns ? borderStart() : borderBefore(); |
- else |
- start -= isForColumns ? borderStart() : borderBefore(); |
+ LayoutUnit start; |
+ if (!startIsAuto) { |
svillar
2016/03/29 10:17:58
This deserves a comment about how positions are st
|
+ if (isForColumns) |
+ start = m_columnPositions[startLine] - m_columnPositions[0] + paddingStart(); |
+ else |
+ start = m_rowPositions[startLine] - m_rowPositions[0] + paddingBefore(); |
+ } |
- if (endIsAuto) { |
- breadth -= isForColumns ? borderEnd() : borderAfter(); |
- breadth -= scrollbarLogicalWidth(); |
+ LayoutUnit end = isForColumns ? clientLogicalWidth() : clientLogicalHeight(); |
svillar
2016/03/29 10:17:58
The previous code was using logicalXXX. Is the cli
Manuel Rego
2016/03/29 10:34:51
Previous code was subtracting the border and we ca
|
+ if (!endIsAuto) { |
+ if (isForColumns) |
+ end = m_columnPositions[endLine] - m_columnPositions[0] + paddingStart(); |
+ else |
+ end = m_rowPositions[endLine] - m_rowPositions[0] + paddingBefore(); |
} |
+ breadth = end - start; |
offset = start; |
+ if (isForColumns && !styleRef().isLeftToRightDirection() && !child.styleRef().hasStaticInlinePosition(child.isHorizontalWritingMode())) { |
+ // If the child doesn't have a static inline position, we need to calculate the offset from the left (even if we're in RTL). |
cbiesinger
2016/03/23 19:50:48
Sorry, why do we need to calculate anything when t
Manuel Rego
2016/03/28 08:57:29
Let's use an example.
Imagine that we've a grid wi
svillar
2016/03/29 10:17:58
Perhaps the comment could be improved. Saying "if
Manuel Rego
2016/03/29 10:34:51
Not sure if I agree as the term "static position"
|
+ 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(); |