| 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 if (gridContainerStyle.gridAutoFlow() == AutoFlowNone) | 97 // FIXME: Implement properly "stack" value in auto-placement algorithm. |
| 98 if (gridContainerStyle.isGridAutoFlowAlgorithmStack()) |
| 98 return adoptPtr(new GridSpan(0, 0)); | 99 return adoptPtr(new GridSpan(0, 0)); |
| 99 | 100 |
| 100 // We can't get our grid positions without running the auto placement al
gorithm. | 101 // We can't get our grid positions without running the auto placement al
gorithm. |
| 101 return nullptr; | 102 return nullptr; |
| 102 } | 103 } |
| 103 | 104 |
| 104 if (initialPosition.shouldBeResolvedAgainstOppositePosition()) { | 105 if (initialPosition.shouldBeResolvedAgainstOppositePosition()) { |
| 105 // Infer the position from the final position ('auto / 1' or 'span 2 / 3
' case). | 106 // Infer the position from the final position ('auto / 1' or 'span 2 / 3
' case). |
| 106 GridResolvedPosition finalResolvedPosition = resolveGridPositionFromStyl
e(gridContainerStyle, finalPosition, finalPositionSide); | 107 GridResolvedPosition finalResolvedPosition = resolveGridPositionFromStyl
e(gridContainerStyle, finalPosition, finalPositionSide); |
| 107 return resolveGridPositionAgainstOppositePosition(gridContainerStyle, fi
nalResolvedPosition, initialPosition, initialPositionSide); | 108 return resolveGridPositionAgainstOppositePosition(gridContainerStyle, fi
nalResolvedPosition, initialPosition, initialPositionSide); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 245 |
| 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). | 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). |
| 246 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. | 247 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. |
| 247 if (it == gridLinesNames.end()) | 248 if (it == gridLinesNames.end()) |
| 248 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); | 249 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); |
| 249 | 250 |
| 250 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition
, position, side, it->value); | 251 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition
, position, side, it->value); |
| 251 } | 252 } |
| 252 | 253 |
| 253 } // namespace WebCore | 254 } // namespace WebCore |
| OLD | NEW |