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

Unified Diff: Source/core/rendering/RenderGrid.cpp

Issue 22759002: [CSS Grid Layout] Add support for named grid areas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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/grid-item-named-grid-area-resolution-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderGrid.cpp
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index 3a9e0a728995d5f6299b9e17e1de1a1cefc964eb..2fd00bdcd12d9b54421c9495005d1808fee93748 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -975,7 +975,6 @@ size_t RenderGrid::resolveNamedGridLinePositionFromStyle(const GridPosition& pos
size_t RenderGrid::resolveGridPositionFromStyle(const GridPosition& position, GridPositionSide side) const
{
- // FIXME: Handle other values for grid-{row,column} like ranges or line names.
switch (position.type()) {
case ExplicitPosition: {
ASSERT(position.integerPosition());
@@ -997,8 +996,24 @@ size_t RenderGrid::resolveGridPositionFromStyle(const GridPosition& position, Gr
return adjustGridPositionForSide(endOfTrack - resolvedPosition, side);
}
case NamedGridAreaPosition:
- // FIXME: Support resolving named grid area (crbug.com/258092).
+ {
+ NamedGridAreaMap::const_iterator it = style()->namedGridArea().find(position.namedGridLine());
+ // Unknown grid area should have been computed to 'auto' by now.
+ ASSERT(it != style()->namedGridArea().end());
+ const GridCoordinate& gridAreaCoordinate = it->value;
+ switch (side) {
+ case ColumnStartSide:
+ return gridAreaCoordinate.columns.initialPositionIndex;
+ case ColumnEndSide:
+ return gridAreaCoordinate.columns.finalPositionIndex;
+ case RowStartSide:
+ return gridAreaCoordinate.rows.initialPositionIndex;
+ case RowEndSide:
+ return gridAreaCoordinate.rows.finalPositionIndex;
+ }
+ ASSERT_NOT_REACHED();
return 0;
+ }
case AutoPosition:
case SpanPosition:
// 'auto' and span depend on the opposite position for resolution (e.g. grid-row: auto / 1 or grid-column: span 3 / "myHeader").
« no previous file with comments | « LayoutTests/fast/css-grid-layout/grid-item-named-grid-area-resolution-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698