| 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 29 matching lines...) Expand all Loading... |
| 40 // We must handle the placement error handling code here instead of in the S
tyleAdjuster because we don't want to | 40 // We must handle the placement error handling code here instead of in the S
tyleAdjuster because we don't want to |
| 41 // overwrite the specified values. | 41 // overwrite the specified values. |
| 42 if (initialPosition.isSpan() && finalPosition.isSpan()) | 42 if (initialPosition.isSpan() && finalPosition.isSpan()) |
| 43 finalPosition.setAutoPosition(); | 43 finalPosition.setAutoPosition(); |
| 44 | 44 |
| 45 if (initialPosition.isNamedGridArea() && isNonExistentNamedLineOrArea(initia
lPosition.namedGridLine(), gridContainerStyle, initialPositionSide)) | 45 if (initialPosition.isNamedGridArea() && isNonExistentNamedLineOrArea(initia
lPosition.namedGridLine(), gridContainerStyle, initialPositionSide)) |
| 46 initialPosition.setAutoPosition(); | 46 initialPosition.setAutoPosition(); |
| 47 | 47 |
| 48 if (finalPosition.isNamedGridArea() && isNonExistentNamedLineOrArea(finalPos
ition.namedGridLine(), gridContainerStyle, finalPositionSide)) | 48 if (finalPosition.isNamedGridArea() && isNonExistentNamedLineOrArea(finalPos
ition.namedGridLine(), gridContainerStyle, finalPositionSide)) |
| 49 finalPosition.setAutoPosition(); | 49 finalPosition.setAutoPosition(); |
| 50 |
| 51 // 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. |
| 52 if (initialPosition.isAuto() && finalPosition.isSpan() && !finalPosition.nam
edGridLine().isNull()) |
| 53 finalPosition.setSpanPosition(1, String()); |
| 54 if (finalPosition.isAuto() && initialPosition.isSpan() && !initialPosition.n
amedGridLine().isNull()) |
| 55 initialPosition.setSpanPosition(1, String()); |
| 50 } | 56 } |
| 51 | 57 |
| 52 GridSpan GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(con
st RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDi
rection direction, const GridResolvedPosition& resolvedInitialPosition) | 58 GridSpan GridResolvedPosition::resolveGridPositionsFromAutoPlacementPosition(con
st RenderStyle& gridContainerStyle, const RenderBox& gridItem, GridTrackSizingDi
rection direction, const GridResolvedPosition& resolvedInitialPosition) |
| 53 { | 59 { |
| 54 GridPosition initialPosition, finalPosition; | 60 GridPosition initialPosition, finalPosition; |
| 55 initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, i
nitialPosition, finalPosition); | 61 initialAndFinalPositionsFromStyle(gridContainerStyle, gridItem, direction, i
nitialPosition, finalPosition); |
| 56 | 62 |
| 57 GridPositionSide finalPositionSide = calculateFinalPositionSide(direction); | 63 GridPositionSide finalPositionSide = calculateFinalPositionSide(direction); |
| 58 | 64 |
| 59 // This method will only be used when both positions need to be resolved aga
inst the opposite one. | 65 // This method will only be used when both positions need to be resolved aga
inst the opposite one. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 232 |
| 227 // 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). | 233 // 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). |
| 228 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. | 234 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. |
| 229 if (it == gridLinesNames.end()) | 235 if (it == gridLinesNames.end()) |
| 230 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); | 236 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); |
| 231 | 237 |
| 232 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition
, position, side, it->value); | 238 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition
, position, side, it->value); |
| 233 } | 239 } |
| 234 | 240 |
| 235 } // namespace WebCore | 241 } // namespace WebCore |
| OLD | NEW |