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

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

Issue 1945203002: [css-grid] Refactor code to manage positioned items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/Source/core/layout/LayoutBoxModelObject.h ('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 72ec0b6556e97cb5efda44566a305a761ecb5ed9..3b90d11e1fb559c8dd4177a2688311182ed79a31 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -1696,21 +1696,28 @@ void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid
|| (endLine < firstExplicitLine)
|| (endLine > lastExplicitLine);
- // 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)
- start = m_columnPositions[startLine] - m_columnPositions[0] + paddingStart();
- else
- start = m_rowPositions[startLine] - m_rowPositions[0] + paddingBefore();
+ if (isForColumns) {
+ if (styleRef().isLeftToRightDirection())
+ start = m_columnPositions[startLine] - borderLogicalLeft();
+ else
+ start = logicalWidth() - translateRTLCoordinate(m_columnPositions[startLine]) - borderLogicalRight();
+ } else {
+ start = m_rowPositions[startLine] - borderBefore();
+ }
}
LayoutUnit end = isForColumns ? clientLogicalWidth() : clientLogicalHeight();
if (!endIsAuto) {
- if (isForColumns)
- end = m_columnPositions[endLine] - m_columnPositions[0] + paddingStart();
- else
- end = m_rowPositions[endLine] - m_rowPositions[0] + paddingBefore();
+ if (isForColumns) {
+ if (styleRef().isLeftToRightDirection())
+ end = m_columnPositions[endLine] - borderLogicalLeft();
+ else
+ end = logicalWidth() - translateRTLCoordinate(m_columnPositions[endLine]) - borderLogicalRight();
+ } else {
+ end = m_rowPositions[endLine] - borderBefore();
+ }
// These vectors store line positions including gaps, but we shouldn't consider them for the edges of the grid.
if (endLine > firstExplicitLine && endLine < lastExplicitLine) {
@@ -1719,15 +1726,6 @@ void LayoutGrid::offsetAndBreadthForPositionedChild(const LayoutBox& child, Grid
}
}
- LayoutUnit alignmentOffset = isForColumns ? m_columnPositions[0] - borderAndPaddingLogicalLeft() : m_rowPositions[0] - borderAndPaddingBefore();
- if (isForColumns && !styleRef().isLeftToRightDirection())
- alignmentOffset = contentLogicalWidth() - (m_columnPositions[m_columnPositions.size() - 1] - borderAndPaddingLogicalLeft());
-
- if (!startIsAuto)
- start += alignmentOffset;
- if (!endIsAuto)
- end += alignmentOffset;
-
breadth = end - start;
offset = start;
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698