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

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

Issue 1838173002: [css-grid] Refactor positioned children code (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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cf284585ba917805f3d5a477636df36208b44243 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -1522,21 +1522,24 @@ 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();
+ // We're normalizing the positions to avoid issues with RTL (as they're stored in the same order than LTR but adding an offset).
+ LayoutUnit start;
+ if (!startIsAuto) {
+ if (isForColumns)
jfernandez 2016/03/29 12:24:35 I think we must use an isXXAxis terminologym, inst
+ 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();
+ if (!endIsAuto) {
+ if (isForColumns)
jfernandez 2016/03/29 12:24:35 Ditto
+ end = m_columnPositions[endLine] - m_columnPositions[0] + paddingStart();
+ else
+ end = m_rowPositions[endLine] - m_rowPositions[0] + paddingBefore();
}
+ breadth = end - start;
offset = start;
if (child.parent() == this && !startIsAuto) {
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698