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

Unified Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 548263002: [CSSGridLayout] Resolved value of grid-template-* to include every track (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 | « LayoutTests/fast/css-grid-layout/resources/grid-definitions-parsing-utils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index d2aae7dff888c26e3357ccb41d925bf2ef766978..b764569d33f6cb7c011fd7d07e24c6adce3ae218 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -887,21 +887,30 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
{
const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gridTemplateColumns() : style.gridTemplateRows();
const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines();
+ bool isRenderGrid = renderer && renderer->isRenderGrid();
+
+ // Handle the 'none' case.
+ bool trackListIsEmpty = trackSizes.isEmpty();
+ if (isRenderGrid && trackListIsEmpty) {
+ // For grids we should consider every listed track, whether implicitly or explicitly created. If we don't have
+ // any explicit track and there are no children then there are no implicit tracks. We cannot simply check the
+ // number of rows/columns in our internal grid representation because it's always at least 1x1 (see r143331).
+ trackListIsEmpty = !toRenderBlock(renderer)->firstChild();
+ }
- // Handle the 'none' case here.
- if (!trackSizes.size()) {
+ if (trackListIsEmpty) {
ASSERT(orderedNamedGridLines.isEmpty());
return cssValuePool().createIdentifierValue(CSSValueNone);
}
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- if (renderer && renderer->isRenderGrid()) {
+ if (isRenderGrid) {
const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toRenderGrid(renderer)->columnPositions() : toRenderGrid(renderer)->rowPositions();
// There are at least #tracks + 1 grid lines (trackPositions). Apart from that, the grid container can generate implicit grid tracks,
// so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
ASSERT(trackPositions.size() - 1 >= trackSizes.size());
- for (size_t i = 0; i < trackSizes.size(); ++i) {
+ for (size_t i = 0; i < trackPositions.size() - 1; ++i) {
addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPositions[i], style));
}
« no previous file with comments | « LayoutTests/fast/css-grid-layout/resources/grid-definitions-parsing-utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698