OLD | NEW |
---|---|
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 "core/style/GridResolvedPosition.h" | 5 #include "core/style/GridResolvedPosition.h" |
6 | 6 |
7 #include "core/layout/LayoutBox.h" | 7 #include "core/layout/LayoutBox.h" |
8 #include "core/style/GridCoordinate.h" | 8 #include "core/style/GridCoordinate.h" |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... | |
40 static void initialAndFinalPositionsFromStyle(const ComputedStyle& gridContainer Style, const LayoutBox& gridItem, GridTrackSizingDirection direction, GridPositi on& initialPosition, GridPosition& finalPosition) | 40 static void initialAndFinalPositionsFromStyle(const ComputedStyle& gridContainer Style, const LayoutBox& gridItem, GridTrackSizingDirection direction, GridPositi on& initialPosition, GridPosition& finalPosition) |
41 { | 41 { |
42 initialPosition = (direction == ForColumns) ? gridItem.style()->gridColumnSt art() : gridItem.style()->gridRowStart(); | 42 initialPosition = (direction == ForColumns) ? gridItem.style()->gridColumnSt art() : gridItem.style()->gridRowStart(); |
43 finalPosition = (direction == ForColumns) ? gridItem.style()->gridColumnEnd( ) : gridItem.style()->gridRowEnd(); | 43 finalPosition = (direction == ForColumns) ? gridItem.style()->gridColumnEnd( ) : gridItem.style()->gridRowEnd(); |
44 | 44 |
45 // We must handle the placement error handling code here instead of in the S tyleAdjuster because we don't want to | 45 // We must handle the placement error handling code here instead of in the S tyleAdjuster because we don't want to |
46 // overwrite the specified values. | 46 // overwrite the specified values. |
47 if (initialPosition.isSpan() && finalPosition.isSpan()) | 47 if (initialPosition.isSpan() && finalPosition.isSpan()) |
48 finalPosition.setAutoPosition(); | 48 finalPosition.setAutoPosition(); |
49 | 49 |
50 // Try to early detect the case of non existing named grid lines. This way w e could assume later that | 50 if (gridItem.isOutOfFlowPositioned()) { |
51 // GridResolvedPosition::resolveGrisPositionFromStyle() always return a vali d resolved position. | 51 // Early detect the case of non existing named grid lines for positioned items. |
52 if (initialPosition.isNamedGridArea() && !GridResolvedPosition::isValidNamed LineOrArea(initialPosition.namedGridLine(), gridContainerStyle, GridResolvedPosi tion::initialPositionSide(direction))) | 52 if (initialPosition.isNamedGridArea() && !GridResolvedPosition::isValidN amedLineOrArea(initialPosition.namedGridLine(), gridContainerStyle, GridResolved Position::initialPositionSide(direction))) |
53 initialPosition.setAutoPosition(); | 53 initialPosition.setAutoPosition(); |
54 | 54 |
55 if (finalPosition.isNamedGridArea() && !GridResolvedPosition::isValidNamedLi neOrArea(finalPosition.namedGridLine(), gridContainerStyle, GridResolvedPosition ::finalPositionSide(direction))) | 55 if (finalPosition.isNamedGridArea() && !GridResolvedPosition::isValidNam edLineOrArea(finalPosition.namedGridLine(), gridContainerStyle, GridResolvedPosi tion::finalPositionSide(direction))) |
56 finalPosition.setAutoPosition(); | 56 finalPosition.setAutoPosition(); |
57 } | |
57 | 58 |
58 // 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. | 59 // 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. |
59 if (initialPosition.isAuto() && finalPosition.isSpan() && !finalPosition.nam edGridLine().isNull()) | 60 if (initialPosition.isAuto() && finalPosition.isSpan() && !finalPosition.nam edGridLine().isNull()) |
60 finalPosition.setSpanPosition(1, String()); | 61 finalPosition.setSpanPosition(1, String()); |
61 if (finalPosition.isAuto() && initialPosition.isSpan() && !initialPosition.n amedGridLine().isNull()) | 62 if (finalPosition.isAuto() && initialPosition.isSpan() && !initialPosition.n amedGridLine().isNull()) |
62 initialPosition.setSpanPosition(1, String()); | 63 initialPosition.setSpanPosition(1, String()); |
63 } | 64 } |
64 | 65 |
65 static GridSpan definiteGridSpanWithInitialNamedSpanAgainstOpposite(size_t resol vedOppositePosition, const GridPosition& position, const Vector<size_t>& gridLin es) | 66 static int lookAheadForNamedGridLine(int start, int numberOfLines, const Vector< size_t>& namedGridLinesIndexes, int gridLastLine) |
66 { | 67 { |
67 if (resolvedOppositePosition == 0) | 68 ASSERT(numberOfLines > 0); |
68 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + 1); | 69 if (start > gridLastLine) |
70 return start + (numberOfLines - 1); | |
71 if (start < 0) | |
72 start = 0; | |
svillar
2016/01/26 09:29:37
Not sure I understand this condition.
Manuel Rego
2016/01/26 11:07:35
This is needed because of the last change on the s
| |
69 | 73 |
70 size_t firstLineBeforeOppositePositionIndex = 0; | 74 for (int end = start; numberOfLines > 0; end++) { |
71 const size_t* firstLineBeforeOppositePosition = std::lower_bound(gridLines.b egin(), gridLines.end(), resolvedOppositePosition); | 75 if (end > gridLastLine || end < 0 || namedGridLinesIndexes.contains(stat ic_cast<size_t>(end))) { |
72 if (firstLineBeforeOppositePosition != gridLines.end()) | 76 numberOfLines--; |
73 firstLineBeforeOppositePositionIndex = firstLineBeforeOppositePosition - gridLines.begin(); | 77 if (!numberOfLines) |
74 size_t gridLineIndex = std::max<int>(0, firstLineBeforeOppositePositionIndex - position.spanPosition()); | 78 return end; |
75 size_t resolvedGridLinePosition = gridLines[gridLineIndex]; | 79 } |
76 if (resolvedGridLinePosition >= resolvedOppositePosition) | 80 } |
svillar
2016/01/26 09:29:37
This loop looks terribly confusing, we're using a
Manuel Rego
2016/01/26 11:07:35
I've tried a different approach, I think it's a bi
| |
77 resolvedGridLinePosition = resolvedOppositePosition - 1; | 81 ASSERT_NOT_REACHED(); |
78 return GridSpan::untranslatedDefiniteGridSpan(resolvedGridLinePosition, reso lvedOppositePosition); | 82 return 0; |
79 } | 83 } |
80 | 84 |
81 static GridSpan definiteGridSpanWithFinalNamedSpanAgainstOpposite(size_t resolve dOppositePosition, const GridPosition& position, const Vector<size_t>& gridLines ) | 85 static int lookBackForNamedGridLine(int end, int numberOfLines, const Vector<siz e_t>& namedGridLinesIndexes, int gridLastLine) |
82 { | 86 { |
83 ASSERT(gridLines.size()); | 87 ASSERT(numberOfLines > 0); |
84 size_t firstLineAfterOppositePositionIndex = gridLines.size() - 1; | 88 if (end < 0) |
85 const size_t* firstLineAfterOppositePosition = std::upper_bound(gridLines.be gin(), gridLines.end(), resolvedOppositePosition); | 89 return end - (numberOfLines - 1); |
86 if (firstLineAfterOppositePosition != gridLines.end()) | 90 if (end > gridLastLine) |
87 firstLineAfterOppositePositionIndex = firstLineAfterOppositePosition - g ridLines.begin(); | 91 end = gridLastLine; |
88 size_t gridLineIndex = std::min(gridLines.size() - 1, firstLineAfterOpposite PositionIndex + position.spanPosition() - 1); | |
89 size_t resolvedGridLinePosition = gridLines[gridLineIndex]; | |
90 if (resolvedGridLinePosition <= resolvedOppositePosition) | |
91 resolvedGridLinePosition = resolvedOppositePosition + 1; | |
92 | 92 |
93 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, reso lvedGridLinePosition); | 93 for (int start = end; numberOfLines > 0; start--) { |
94 if (start > gridLastLine || start < 0 || namedGridLinesIndexes.contains( static_cast<size_t>(start))) { | |
95 numberOfLines--; | |
96 if (!numberOfLines) | |
97 return start; | |
98 } | |
99 } | |
svillar
2016/01/26 09:29:37
Same comments than in lookAhead
Manuel Rego
2016/01/26 11:07:35
Acknowledged.
| |
100 ASSERT_NOT_REACHED(); | |
101 return 0; | |
94 } | 102 } |
95 | 103 |
96 static GridSpan definiteGridSpanWithNamedSpanAgainstOpposite(size_t resolvedOppo sitePosition, const GridPosition& position, GridPositionSide side, const Vector< size_t>& gridLines) | 104 static GridSpan definiteGridSpanWithNamedSpanAgainstOpposite(int resolvedOpposit ePosition, const GridPosition& position, GridPositionSide side, const Vector<siz e_t>& gridLines, int lastLine) |
97 { | 105 { |
98 if (side == RowStartSide || side == ColumnStartSide) | 106 int start, end; |
99 return definiteGridSpanWithInitialNamedSpanAgainstOpposite(resolvedOppos itePosition, position, gridLines); | |
100 | 107 |
101 return definiteGridSpanWithFinalNamedSpanAgainstOpposite(resolvedOppositePos ition, position, gridLines); | 108 if (side == RowStartSide || side == ColumnStartSide) { |
svillar
2016/01/26 09:29:37
I think we had a isStartSide() or something like t
Manuel Rego
2016/01/26 11:07:35
Mmmm, I cannot find it.
We can add it if needed,
| |
109 start = lookBackForNamedGridLine(resolvedOppositePosition - 1, position. spanPosition(), gridLines, lastLine); | |
110 end = resolvedOppositePosition; | |
111 } else { | |
112 start = resolvedOppositePosition; | |
113 end = lookAheadForNamedGridLine(resolvedOppositePosition + 1, position.s panPosition(), gridLines, lastLine); | |
114 } | |
115 | |
116 return GridSpan::untranslatedDefiniteGridSpan(start, end); | |
102 } | 117 } |
103 | 118 |
104 static GridSpan resolveNamedGridLinePositionAgainstOppositePosition(const Comput edStyle& gridContainerStyle, size_t resolvedOppositePosition, const GridPosition & position, GridPositionSide side) | 119 size_t GridResolvedPosition::explicitGridColumnCount(const ComputedStyle& gridCo ntainerStyle) |
120 { | |
121 return std::min<size_t>(gridContainerStyle.gridTemplateColumns().size(), kGr idMaxTracks); | |
122 } | |
123 | |
124 size_t GridResolvedPosition::explicitGridRowCount(const ComputedStyle& gridConta inerStyle) | |
125 { | |
126 return std::min<size_t>(gridContainerStyle.gridTemplateRows().size(), kGridM axTracks); | |
127 } | |
128 | |
129 static size_t explicitGridSizeForSide(const ComputedStyle& gridContainerStyle, G ridPositionSide side) | |
130 { | |
131 return (side == ColumnStartSide || side == ColumnEndSide) ? GridResolvedPosi tion::explicitGridColumnCount(gridContainerStyle) : GridResolvedPosition::explic itGridRowCount(gridContainerStyle); | |
132 } | |
133 | |
134 static GridSpan resolveNamedGridLinePositionAgainstOppositePosition(const Comput edStyle& gridContainerStyle, int resolvedOppositePosition, const GridPosition& p osition, GridPositionSide side) | |
105 { | 135 { |
106 ASSERT(position.isSpan()); | 136 ASSERT(position.isSpan()); |
107 ASSERT(!position.namedGridLine().isNull()); | 137 ASSERT(!position.namedGridLine().isNull()); |
108 // Negative positions are not allowed per the specification and should have been handled during parsing. | 138 // Negative positions are not allowed per the specification and should have been handled during parsing. |
109 ASSERT(position.spanPosition() > 0); | 139 ASSERT(position.spanPosition() > 0); |
110 | 140 |
111 const NamedGridLinesMap& gridLinesNames = gridLinesForSide(gridContainerStyl e, side); | 141 const NamedGridLinesMap& gridLinesNames = gridLinesForSide(gridContainerStyl e, side); |
112 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); | 142 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); |
113 | 143 size_t lastLine = explicitGridSizeForSide(gridContainerStyle, side); |
114 // 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). | 144 return definiteGridSpanWithNamedSpanAgainstOpposite(resolvedOppositePosition , position, side, it == gridLinesNames.end() ? Vector<size_t>() : it->value, las tLine); |
svillar
2016/01/26 09:29:37
Uhu, so each time it == gridLinesNames.end() then
Manuel Rego
2016/01/26 11:07:35
True, changed to use pointers.
| |
115 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. | |
116 if (it == gridLinesNames.end()) { | |
117 if ((side == ColumnStartSide || side == RowStartSide) && resolvedOpposit ePosition) | |
118 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePositi on - 1, resolvedOppositePosition); | |
119 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + 1); | |
120 } | |
121 | |
122 return definiteGridSpanWithNamedSpanAgainstOpposite(resolvedOppositePosition , position, side, it->value); | |
123 } | 145 } |
124 | 146 |
125 static GridSpan definiteGridSpanWithSpanAgainstOpposite(size_t resolvedOppositeP osition, const GridPosition& position, GridPositionSide side) | 147 static GridSpan definiteGridSpanWithSpanAgainstOpposite(size_t resolvedOppositeP osition, const GridPosition& position, GridPositionSide side) |
126 { | 148 { |
127 size_t positionOffset = position.spanPosition(); | 149 size_t positionOffset = position.spanPosition(); |
128 if (side == ColumnStartSide || side == RowStartSide) | 150 if (side == ColumnStartSide || side == RowStartSide) |
129 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition - positionOffset, resolvedOppositePosition); | 151 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition - positionOffset, resolvedOppositePosition); |
130 | 152 |
131 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, reso lvedOppositePosition + positionOffset); | 153 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, reso lvedOppositePosition + positionOffset); |
132 } | 154 } |
133 | 155 |
134 static GridSpan resolveGridPositionAgainstOppositePosition(const ComputedStyle& gridContainerStyle, size_t resolvedOppositePosition, const GridPosition& positio n, GridPositionSide side) | 156 static GridSpan resolveGridPositionAgainstOppositePosition(const ComputedStyle& gridContainerStyle, int resolvedOppositePosition, const GridPosition& position, GridPositionSide side) |
135 { | 157 { |
136 if (position.isAuto()) { | 158 if (position.isAuto()) { |
137 if (side == ColumnStartSide || side == RowStartSide) | 159 if (side == ColumnStartSide || side == RowStartSide) |
138 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePositi on - 1, resolvedOppositePosition); | 160 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePositi on - 1, resolvedOppositePosition); |
139 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + 1); | 161 return GridSpan::untranslatedDefiniteGridSpan(resolvedOppositePosition, resolvedOppositePosition + 1); |
140 } | 162 } |
141 | 163 |
142 ASSERT(position.isSpan()); | 164 ASSERT(position.isSpan()); |
143 ASSERT(position.spanPosition() > 0); | 165 ASSERT(position.spanPosition() > 0); |
144 | 166 |
(...skipping 15 matching lines...) Expand all Loading... | |
160 | 182 |
161 if (initialPosition.isAuto() && finalPosition.isAuto()) | 183 if (initialPosition.isAuto() && finalPosition.isAuto()) |
162 return 1; | 184 return 1; |
163 | 185 |
164 GridPosition position = initialPosition.isSpan() ? initialPosition : finalPo sition; | 186 GridPosition position = initialPosition.isSpan() ? initialPosition : finalPo sition; |
165 ASSERT(position.isSpan()); | 187 ASSERT(position.isSpan()); |
166 ASSERT(position.spanPosition()); | 188 ASSERT(position.spanPosition()); |
167 return position.spanPosition(); | 189 return position.spanPosition(); |
168 } | 190 } |
169 | 191 |
170 size_t GridResolvedPosition::explicitGridColumnCount(const ComputedStyle& gridCo ntainerStyle) | 192 static int resolveNamedGridLinePositionFromStyle(const ComputedStyle& gridContai nerStyle, const GridPosition& position, GridPositionSide side) |
171 { | |
172 return std::min<size_t>(gridContainerStyle.gridTemplateColumns().size(), kGr idMaxTracks); | |
173 } | |
174 | |
175 size_t GridResolvedPosition::explicitGridRowCount(const ComputedStyle& gridConta inerStyle) | |
176 { | |
177 return std::min<size_t>(gridContainerStyle.gridTemplateRows().size(), kGridM axTracks); | |
178 } | |
179 | |
180 static size_t explicitGridSizeForSide(const ComputedStyle& gridContainerStyle, G ridPositionSide side) | |
181 { | |
182 return (side == ColumnStartSide || side == ColumnEndSide) ? GridResolvedPosi tion::explicitGridColumnCount(gridContainerStyle) : GridResolvedPosition::explic itGridRowCount(gridContainerStyle); | |
183 } | |
184 | |
185 static size_t resolveNamedGridLinePositionFromStyle(const ComputedStyle& gridCon tainerStyle, const GridPosition& position, GridPositionSide side) | |
186 { | 193 { |
187 ASSERT(!position.namedGridLine().isNull()); | 194 ASSERT(!position.namedGridLine().isNull()); |
188 | 195 |
189 const NamedGridLinesMap& gridLinesNames = gridLinesForSide(gridContainerStyl e, side); | 196 const NamedGridLinesMap& gridLinesNames = gridLinesForSide(gridContainerStyl e, side); |
190 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); | 197 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); |
191 if (it == gridLinesNames.end()) { | 198 const Vector<size_t>& gridLines = it == gridLinesNames.end() ? Vector<size_t >() : it->value; |
svillar
2016/01/26 09:29:37
Same thing about creating Vectors.
Manuel Rego
2016/01/26 11:07:35
Done.
| |
192 if (position.isPositive()) | 199 size_t lastLine = explicitGridSizeForSide(gridContainerStyle, side); |
193 return 0; | |
194 size_t lastLine = explicitGridSizeForSide(gridContainerStyle, side); | |
195 return lastLine; | |
196 } | |
197 | |
198 size_t namedGridLineIndex; | |
199 if (position.isPositive()) | 200 if (position.isPositive()) |
200 namedGridLineIndex = std::min<size_t>(position.integerPosition(), it->va lue.size()) - 1; | 201 return lookAheadForNamedGridLine(0, abs(position.integerPosition()), gri dLines, lastLine); |
201 else | 202 else |
202 namedGridLineIndex = std::max<int>(it->value.size() - abs(position.integ erPosition()), 0); | 203 return lookBackForNamedGridLine(lastLine, abs(position.integerPosition() ), gridLines, lastLine); |
203 return it->value[namedGridLineIndex]; | |
204 } | 204 } |
205 | 205 |
206 static int resolveGridPositionFromStyle(const ComputedStyle& gridContainerStyle, const GridPosition& position, GridPositionSide side) | 206 static int resolveGridPositionFromStyle(const ComputedStyle& gridContainerStyle, const GridPosition& position, GridPositionSide side) |
207 { | 207 { |
208 switch (position.type()) { | 208 switch (position.type()) { |
209 case ExplicitPosition: { | 209 case ExplicitPosition: { |
210 ASSERT(position.integerPosition()); | 210 ASSERT(position.integerPosition()); |
211 | 211 |
212 if (!position.namedGridLine().isNull()) | 212 if (!position.namedGridLine().isNull()) |
213 return resolveNamedGridLinePositionFromStyle(gridContainerStyle, pos ition, side); | 213 return resolveNamedGridLinePositionFromStyle(gridContainerStyle, pos ition, side); |
214 | 214 |
215 // Handle <integer> explicit position. | 215 // Handle <integer> explicit position. |
216 if (position.isPositive()) | 216 if (position.isPositive()) |
217 return position.integerPosition() - 1; | 217 return position.integerPosition() - 1; |
218 | 218 |
219 size_t resolvedPosition = abs(position.integerPosition()) - 1; | 219 size_t resolvedPosition = abs(position.integerPosition()) - 1; |
220 size_t endOfTrack = explicitGridSizeForSide(gridContainerStyle, side); | 220 size_t endOfTrack = explicitGridSizeForSide(gridContainerStyle, side); |
221 | 221 |
222 return endOfTrack - resolvedPosition; | 222 return endOfTrack - resolvedPosition; |
223 } | 223 } |
224 case NamedGridAreaPosition: | 224 case NamedGridAreaPosition: |
225 { | 225 { |
226 // First attempt to match the grid area's edge to a named grid area: if there is a named line with the name | 226 // First attempt to match the grid area's edge to a named grid area: if there is a named line with the name |
227 // ''<custom-ident>-start (for grid-*-start) / <custom-ident>-end'' (for grid-*-end), contributes the first such | 227 // ''<custom-ident>-start (for grid-*-start) / <custom-ident>-end'' (for grid-*-end), contributes the first such |
228 // line to the grid item's placement. | 228 // line to the grid item's placement. |
229 String namedGridLine = position.namedGridLine(); | 229 String namedGridLine = position.namedGridLine(); |
230 ASSERT(GridResolvedPosition::isValidNamedLineOrArea(namedGridLine, gridC ontainerStyle, side)); | 230 ASSERT(!position.namedGridLine().isNull()); |
231 | 231 |
232 const NamedGridLinesMap& gridLineNames = gridLinesForSide(gridContainerS tyle, side); | 232 const NamedGridLinesMap& gridLineNames = gridLinesForSide(gridContainerS tyle, side); |
233 NamedGridLinesMap::const_iterator implicitLineIter = gridLineNames.find( implicitNamedGridLineForSide(namedGridLine, side)); | 233 NamedGridLinesMap::const_iterator implicitLineIter = gridLineNames.find( implicitNamedGridLineForSide(namedGridLine, side)); |
234 if (implicitLineIter != gridLineNames.end()) | 234 if (implicitLineIter != gridLineNames.end()) |
235 return implicitLineIter->value[0]; | 235 return implicitLineIter->value[0]; |
236 | 236 |
237 // Otherwise, if there is a named line with the specified name, contribu tes the first such line to the grid | 237 // Otherwise, if there is a named line with the specified name, contribu tes the first such line to the grid |
238 // item's placement. | 238 // item's placement. |
239 NamedGridLinesMap::const_iterator explicitLineIter = gridLineNames.find( namedGridLine); | 239 NamedGridLinesMap::const_iterator explicitLineIter = gridLineNames.find( namedGridLine); |
240 if (explicitLineIter != gridLineNames.end()) | 240 if (explicitLineIter != gridLineNames.end()) |
241 return explicitLineIter->value[0]; | 241 return explicitLineIter->value[0]; |
242 | 242 |
243 // If none of the above works specs mandate us to treat it as auto BUT w e should have detected it before calling | 243 ASSERT(!GridResolvedPosition::isValidNamedLineOrArea(namedGridLine, grid ContainerStyle, side)); |
244 // this function in GridResolvedPosition::resolveGridPositionsFromStyle( ). We should be also covered by the | 244 // If none of the above works specs mandate to assume that all the lines in the implicit grid have this name. |
245 // ASSERT at the beginning of this block. | 245 size_t lastLine = explicitGridSizeForSide(gridContainerStyle, side); |
246 ASSERT_NOT_REACHED(); | 246 return lastLine + 1; |
247 return 0; | |
248 } | 247 } |
249 case AutoPosition: | 248 case AutoPosition: |
250 case SpanPosition: | 249 case SpanPosition: |
251 // 'auto' and span depend on the opposite position for resolution (e.g. grid-row: auto / 1 or grid-column: span 3 / "myHeader"). | 250 // 'auto' and span depend on the opposite position for resolution (e.g. grid-row: auto / 1 or grid-column: span 3 / "myHeader"). |
252 ASSERT_NOT_REACHED(); | 251 ASSERT_NOT_REACHED(); |
253 return 0; | 252 return 0; |
254 } | 253 } |
255 ASSERT_NOT_REACHED(); | 254 ASSERT_NOT_REACHED(); |
256 return 0; | 255 return 0; |
257 } | 256 } |
(...skipping 28 matching lines...) Expand all Loading... | |
286 | 285 |
287 if (resolvedFinalPosition < resolvedInitialPosition) | 286 if (resolvedFinalPosition < resolvedInitialPosition) |
288 std::swap(resolvedFinalPosition, resolvedInitialPosition); | 287 std::swap(resolvedFinalPosition, resolvedInitialPosition); |
289 else if (resolvedFinalPosition == resolvedInitialPosition) | 288 else if (resolvedFinalPosition == resolvedInitialPosition) |
290 resolvedFinalPosition = resolvedInitialPosition + 1; | 289 resolvedFinalPosition = resolvedInitialPosition + 1; |
291 | 290 |
292 return GridSpan::untranslatedDefiniteGridSpan(resolvedInitialPosition, resol vedFinalPosition); | 291 return GridSpan::untranslatedDefiniteGridSpan(resolvedInitialPosition, resol vedFinalPosition); |
293 } | 292 } |
294 | 293 |
295 } // namespace blink | 294 } // namespace blink |
OLD | NEW |