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

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

Issue 2166393002: [css-grid] grid-auto-flow|row should take a <track-size>+ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing v2 Created 4 years, 5 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 c310533d05364a05b7b3dded3c7ce4408e07dc38..96a357c208714f53d37fadddb49971ea9aa59770 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -848,7 +848,7 @@ const GridTrackSize& LayoutGrid::rawGridTrackSize(GridTrackSizingDirection direc
bool isRowAxis = direction == ForColumns;
const Vector<GridTrackSize>& trackStyles = isRowAxis ? styleRef().gridTemplateColumns() : styleRef().gridTemplateRows();
const Vector<GridTrackSize>& autoRepeatTrackStyles = isRowAxis ? styleRef().gridAutoRepeatColumns() : styleRef().gridAutoRepeatRows();
- const GridTrackSize& autoTrackSize = isRowAxis ? styleRef().gridAutoColumns() : styleRef().gridAutoRows();
+ const Vector<GridTrackSize>& autoTrackStyles = isRowAxis ? styleRef().gridAutoColumns() : styleRef().gridAutoRows();
size_t insertionPoint = isRowAxis ? styleRef().gridAutoRepeatColumnsInsertionPoint() : styleRef().gridAutoRepeatRowsInsertionPoint();
size_t repetitions = autoRepeatCountForDirection(direction);
@@ -858,12 +858,17 @@ const GridTrackSize& LayoutGrid::rawGridTrackSize(GridTrackSizingDirection direc
size_t explicitTracksCount = trackStyles.size() + repetitions;
int untranslatedIndexAsInt = translatedIndex + (isRowAxis ? m_smallestColumnStart : m_smallestRowStart);
- if (untranslatedIndexAsInt < 0)
- return autoTrackSize;
+ size_t autoTrackStylesSize = autoTrackStyles.size();
+ if (untranslatedIndexAsInt < 0) {
+ int index = untranslatedIndexAsInt % static_cast<int>(autoTrackStylesSize);
+ // We need to traspose the index because the first negative implicit line will get the last defined auto track and so on.
+ index += index ? autoTrackStylesSize : 0;
+ return autoTrackStyles[index];
+ }
size_t untranslatedIndex = static_cast<size_t>(untranslatedIndexAsInt);
if (untranslatedIndex >= explicitTracksCount)
- return autoTrackSize;
+ return autoTrackStyles[(untranslatedIndex - explicitTracksCount) % autoTrackStylesSize];
if (LIKELY(!repetitions) || untranslatedIndex < insertionPoint)
return trackStyles[untranslatedIndex];

Powered by Google App Engine
This is Rietveld 408576698