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

Side by Side Diff: Source/core/rendering/style/GridResolvedPosition.cpp

Issue 320093002: [CSS Grid Layout] Named grid line span not allowed for automatic positions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@span-named-grid-line-to-upload
Patch Set: Patch for landing Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/style/GridCoordinate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/rendering/style/GridResolvedPosition.h" 6 #include "core/rendering/style/GridResolvedPosition.h"
7 7
8 #include "core/rendering/RenderBox.h" 8 #include "core/rendering/RenderBox.h"
9 #include "core/rendering/style/GridCoordinate.h" 9 #include "core/rendering/style/GridCoordinate.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if (initialPosition.isSpan() && finalPosition.isSpan()) 49 if (initialPosition.isSpan() && finalPosition.isSpan())
50 finalPosition.setAutoPosition(); 50 finalPosition.setAutoPosition();
51 51
52 // Try to early detect the case of non existing named grid lines. This way w e could assume later that 52 // Try to early detect the case of non existing named grid lines. This way w e could assume later that
53 // GridResolvedPosition::resolveGrisPositionFromStyle() always return a vali d resolved position. 53 // GridResolvedPosition::resolveGrisPositionFromStyle() always return a vali d resolved position.
54 if (initialPosition.isNamedGridArea() && !isValidNamedLineOrArea(initialPosi tion.namedGridLine(), gridContainerStyle, initialPositionSide)) 54 if (initialPosition.isNamedGridArea() && !isValidNamedLineOrArea(initialPosi tion.namedGridLine(), gridContainerStyle, initialPositionSide))
55 initialPosition.setAutoPosition(); 55 initialPosition.setAutoPosition();
56 56
57 if (finalPosition.isNamedGridArea() && !isValidNamedLineOrArea(finalPosition .namedGridLine(), gridContainerStyle, finalPositionSide)) 57 if (finalPosition.isNamedGridArea() && !isValidNamedLineOrArea(finalPosition .namedGridLine(), gridContainerStyle, finalPositionSide))
58 finalPosition.setAutoPosition(); 58 finalPosition.setAutoPosition();
59
60 // If the grid item has an automatic position and a grid span for a named li ne in a given dimension, instead treat the grid span as one.
61 if (initialPosition.isAuto() && finalPosition.isSpan() && !finalPosition.nam edGridLine().isNull())
62 finalPosition.setSpanPosition(1, String());
63 if (finalPosition.isAuto() && initialPosition.isSpan() && !initialPosition.n amedGridLine().isNull())
64 initialPosition.setSpanPosition(1, String());
59 } 65 }
60 66
61 GridSpan GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(con st RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDi rection direction, const GridResolvedPosition& resolvedInitialPosition) 67 GridSpan GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(con st RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDi rection direction, const GridResolvedPosition& resolvedInitialPosition)
62 { 68 {
63 GridPosition initialPosition, finalPosition; 69 GridPosition initialPosition, finalPosition;
64 initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, i nitialPosition, finalPosition); 70 initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, i nitialPosition, finalPosition);
65 71
66 GridPositionSide finalPositionSide = calculateFinalPositionSide(direction); 72 GridPositionSide finalPositionSide = calculateFinalPositionSide(direction);
67 73
68 // This method will only be used when both positions need to be resolved aga inst the opposite one. 74 // This method will only be used when both positions need to be resolved aga inst the opposite one.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 244
239 // If there is no named grid line of that name, we resolve the position to ' auto' (which is equivalent to 'span 1' in this case). 245 // If there is no named grid line of that name, we resolve the position to ' auto' (which is equivalent to 'span 1' in this case).
240 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. 246 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html.
241 if (it == gridLinesNames.end()) 247 if (it == gridLinesNames.end())
242 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi on); 248 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi on);
243 249
244 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition , position, side, it->value); 250 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition , position, side, it->value);
245 } 251 }
246 252
247 } // namespace WebCore 253 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/style/GridCoordinate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698