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 "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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 PassOwnPtr<GridSpan> GridResolvedPosition::resolveGridPositionsFromStyle(const R
enderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirect
ion direction) | 88 PassOwnPtr<GridSpan> GridResolvedPosition::resolveGridPositionsFromStyle(const R
enderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDirect
ion direction) |
89 { | 89 { |
90 GridPosition initialPosition, finalPosition; | 90 GridPosition initialPosition, finalPosition; |
91 initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, i
nitialPosition, finalPosition); | 91 initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, i
nitialPosition, finalPosition); |
92 | 92 |
93 GridPositionSide initialPositionSide = calculateInitialPositionSide(directio
n); | 93 GridPositionSide initialPositionSide = calculateInitialPositionSide(directio
n); |
94 GridPositionSide finalPositionSide = calculateFinalPositionSide(direction); | 94 GridPositionSide finalPositionSide = calculateFinalPositionSide(direction); |
95 | 95 |
96 if (initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPositi
on.shouldBeResolvedAgainstOppositePosition()) { | 96 if (initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPositi
on.shouldBeResolvedAgainstOppositePosition()) { |
97 // FIXME: Implement properly "stack" value in auto-placement algorithm. | |
98 if (gridContainerStyle.isGridAutoFlowAlgorithmStack()) | |
99 return adoptPtr(new GridSpan(0, 0)); | |
100 | |
101 // We can't get our grid positions without running the auto placement al
gorithm. | 97 // We can't get our grid positions without running the auto placement al
gorithm. |
102 return nullptr; | 98 return nullptr; |
103 } | 99 } |
104 | 100 |
105 if (initialPosition.shouldBeResolvedAgainstOppositePosition()) { | 101 if (initialPosition.shouldBeResolvedAgainstOppositePosition()) { |
106 // Infer the position from the final position ('auto / 1' or 'span 2 / 3
' case). | 102 // Infer the position from the final position ('auto / 1' or 'span 2 / 3
' case). |
107 GridResolvedPosition finalResolvedPosition = resolveGridPositionFromStyl
e(gridContainerStyle, finalPosition, finalPositionSide); | 103 GridResolvedPosition finalResolvedPosition = resolveGridPositionFromStyl
e(gridContainerStyle, finalPosition, finalPositionSide); |
108 return resolveGridPositionAgainstOppositePosition(gridContainerStyle, fi
nalResolvedPosition, initialPosition, initialPositionSide); | 104 return resolveGridPositionAgainstOppositePosition(gridContainerStyle, fi
nalResolvedPosition, initialPosition, initialPositionSide); |
109 } | 105 } |
110 | 106 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 241 |
246 // 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). | 242 // 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). |
247 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. | 243 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. |
248 if (it == gridLinesNames.end()) | 244 if (it == gridLinesNames.end()) |
249 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); | 245 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); |
250 | 246 |
251 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition
, position, side, it->value); | 247 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition
, position, side, it->value); |
252 } | 248 } |
253 | 249 |
254 } // namespace blink | 250 } // namespace blink |
OLD | NEW |