Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 RenderBlock::removeChild(child); | 212 RenderBlock::removeChild(child); |
| 213 | 213 |
| 214 if (gridIsDirty()) | 214 if (gridIsDirty()) |
| 215 return; | 215 return; |
| 216 | 216 |
| 217 ASSERT(child->isBox()); | 217 ASSERT(child->isBox()); |
| 218 // FIXME: We could avoid dirtying the grid in some cases (e.g. if it's an ex plicitly positioned element). | 218 // FIXME: We could avoid dirtying the grid in some cases (e.g. if it's an ex plicitly positioned element). |
| 219 dirtyGrid(); | 219 dirtyGrid(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void RenderGrid::createGridLineNamesMapsForDirection(GridTrackSizingDirection di rection) | |
| 223 { | |
| 224 NamedGridLinesMap& gridLinesMap = (direction == ForColumns) ? m_namedGridCol umnLines : m_namedGridRowLines; | |
| 225 const OrderedNamedGridLines& orderedLinesMap = (direction == ForColumns) ? s tyle()->orderedNamedGridColumnLines() : style()->orderedNamedGridRowLines(); | |
| 226 | |
| 227 gridLinesMap.clear(); | |
| 228 OrderedNamedGridLines::const_iterator orderedLinesEnd = orderedLinesMap.end( ); | |
| 229 for (OrderedNamedGridLines::const_iterator it = orderedLinesMap.begin(); it != orderedLinesEnd; ++it) { | |
| 230 const Vector<String> gridLineNames = it->value; | |
| 231 for (size_t i = 0; i < gridLineNames.size(); ++i) { | |
| 232 NamedGridLinesMap::AddResult result = gridLinesMap.add(gridLineNames [i], Vector<size_t>()); | |
| 233 result.storedValue->value.append(it->key); | |
| 234 } | |
| 235 } | |
| 236 | |
| 237 NamedGridAreaMap::const_iterator gridAreasEnd = style()->namedGridArea().end (); | |
| 238 for (NamedGridAreaMap::const_iterator it = style()->namedGridArea().begin(); it != gridAreasEnd; ++it) { | |
| 239 GridSpan areaSpan = direction == ForRows ? it->value.rows : it->value.co lumns; | |
| 240 | |
| 241 NamedGridLinesMap::AddResult startResult = gridLinesMap.add(it->key + "- start", Vector<size_t>()); | |
| 242 startResult.storedValue->value.append(areaSpan.initialPositionIndex); | |
| 243 NamedGridLinesMap::AddResult endResult = gridLinesMap.add(it->key + "-en d", Vector<size_t>()); | |
| 244 endResult.storedValue->value.append(areaSpan.finalPositionIndex + 1); | |
| 245 } | |
| 246 | |
| 247 NamedGridLinesMap::const_iterator namedLinesEnd = gridLinesMap.end(); | |
| 248 for (NamedGridLinesMap::iterator it = gridLinesMap.begin(); it != namedLine sEnd; ++it) | |
| 249 std::sort(it->value.begin(), it->value.end()); | |
| 250 } | |
| 251 | |
| 222 void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl e) | 252 void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl e) |
| 223 { | 253 { |
| 224 RenderBlock::styleDidChange(diff, oldStyle); | 254 RenderBlock::styleDidChange(diff, oldStyle); |
| 255 | |
| 256 bool gridLinesDefinitionChanged = namedGridLinesDefinitionDidChange(oldStyle ); | |
| 257 if (gridLinesDefinitionChanged) { | |
| 258 createGridLineNamesMapsForDirection(ForColumns); | |
| 259 createGridLineNamesMapsForDirection(ForRows); | |
| 260 } | |
| 261 | |
| 225 if (!oldStyle) | 262 if (!oldStyle) |
| 226 return; | 263 return; |
| 227 | 264 |
| 228 // FIXME: The following checks could be narrowed down if we kept track of wh ich type of grid items we have: | 265 // FIXME: The following checks could be narrowed down if we kept track of wh ich type of grid items we have: |
| 229 // - explicit grid size changes impact negative explicitely positioned and a uto-placed grid items. | 266 // - explicit grid size changes impact negative explicitely positioned and a uto-placed grid items. |
| 230 // - named grid lines only impact grid items with named grid lines. | 267 // - named grid lines only impact grid items with named grid lines. |
| 231 // - auto-flow changes only impacts auto-placed children. | 268 // - auto-flow changes only impacts auto-placed children. |
| 232 | 269 |
| 233 if (explicitGridDidResize(oldStyle) | 270 if (explicitGridDidResize(oldStyle) || gridLinesDefinitionChanged || oldStyl e->gridAutoFlow() != style()->gridAutoFlow()) |
| 234 || namedGridLinesDefinitionDidChange(oldStyle) | |
| 235 || oldStyle->gridAutoFlow() != style()->gridAutoFlow()) | |
| 236 dirtyGrid(); | 271 dirtyGrid(); |
| 237 } | 272 } |
| 238 | 273 |
| 239 bool RenderGrid::explicitGridDidResize(const RenderStyle* oldStyle) const | 274 bool RenderGrid::explicitGridDidResize(const RenderStyle* oldStyle) const |
| 240 { | 275 { |
| 241 return oldStyle->gridTemplateColumns().size() != style()->gridTemplateColumn s().size() | 276 return oldStyle->gridTemplateColumns().size() != style()->gridTemplateColumn s().size() |
| 242 || oldStyle->gridTemplateRows().size() != style()->gridTemplateRows().si ze(); | 277 || oldStyle->gridTemplateRows().size() != style()->gridTemplateRows().si ze(); |
| 243 } | 278 } |
| 244 | 279 |
| 245 bool RenderGrid::namedGridLinesDefinitionDidChange(const RenderStyle* oldStyle) const | 280 bool RenderGrid::namedGridLinesDefinitionDidChange(const RenderStyle* oldStyle) const |
| 246 { | 281 { |
| 247 return oldStyle->namedGridRowLines() != style()->namedGridRowLines() | 282 if (!oldStyle) |
| 248 || oldStyle->namedGridColumnLines() != style()->namedGridColumnLines(); | 283 return true; |
| 284 | |
| 285 return oldStyle->orderedNamedGridRowLines() != style()->orderedNamedGridRowL ines() | |
| 286 || oldStyle->orderedNamedGridColumnLines() != style()->orderedNamedGridC olumnLines() | |
| 287 || oldStyle->namedGridArea() != style()->namedGridArea(); | |
| 249 } | 288 } |
| 250 | 289 |
| 251 void RenderGrid::layoutBlock(bool relayoutChildren) | 290 void RenderGrid::layoutBlock(bool relayoutChildren) |
| 252 { | 291 { |
| 253 ASSERT(needsLayout()); | 292 ASSERT(needsLayout()); |
| 254 | 293 |
| 255 if (!relayoutChildren && simplifiedLayout()) | 294 if (!relayoutChildren && simplifiedLayout()) |
| 256 return; | 295 return; |
| 257 | 296 |
| 258 // FIXME: Much of this method is boiler plate that matches RenderBox::layout Block and Render*FlexibleBox::layoutBlock. | 297 // FIXME: Much of this method is boiler plate that matches RenderBox::layout Block and Render*FlexibleBox::layoutBlock. |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 961 return m_gridItemCoordinate.get(gridItem); | 1000 return m_gridItemCoordinate.get(gridItem); |
| 962 } | 1001 } |
| 963 | 1002 |
| 964 GridSpan RenderGrid::resolveGridPositionsFromAutoPlacementPosition(const RenderB ox*, GridTrackSizingDirection, size_t initialPosition) const | 1003 GridSpan RenderGrid::resolveGridPositionsFromAutoPlacementPosition(const RenderB ox*, GridTrackSizingDirection, size_t initialPosition) const |
| 965 { | 1004 { |
| 966 // FIXME: We don't support spanning with auto positions yet. Once we do, thi s is wrong. Also we should make | 1005 // FIXME: We don't support spanning with auto positions yet. Once we do, thi s is wrong. Also we should make |
| 967 // sure the grid can accomodate the new item as we only grow 1 position in a given direction. | 1006 // sure the grid can accomodate the new item as we only grow 1 position in a given direction. |
| 968 return GridSpan(initialPosition, initialPosition); | 1007 return GridSpan(initialPosition, initialPosition); |
| 969 } | 1008 } |
| 970 | 1009 |
| 1010 static bool isNonExistentNamedLineOrArea(GridPosition& position, RenderStyle& st yle, const NamedGridLinesMap& gridLinesMap) | |
| 1011 { | |
| 1012 ASSERT(position.isNamedGridArea()); | |
| 1013 String lineName = position.namedGridLine(); | |
| 1014 | |
| 1015 return !style.namedGridArea().contains(lineName) && !gridLinesMap.contains(l ineName); | |
| 1016 } | |
| 1017 | |
| 971 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionsFromStyle(const RenderBox* gridItem, GridTrackSizingDirection direction) const | 1018 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionsFromStyle(const RenderBox* gridItem, GridTrackSizingDirection direction) const |
| 972 { | 1019 { |
| 973 GridPosition initialPosition = (direction == ForColumns) ? gridItem->style() ->gridColumnStart() : gridItem->style()->gridRowStart(); | 1020 GridPosition initialPosition = (direction == ForColumns) ? gridItem->style() ->gridColumnStart() : gridItem->style()->gridRowStart(); |
| 974 const GridPositionSide initialPositionSide = (direction == ForColumns) ? Col umnStartSide : RowStartSide; | 1021 const GridPositionSide initialPositionSide = (direction == ForColumns) ? Col umnStartSide : RowStartSide; |
| 975 GridPosition finalPosition = (direction == ForColumns) ? gridItem->style()-> gridColumnEnd() : gridItem->style()->gridRowEnd(); | 1022 GridPosition finalPosition = (direction == ForColumns) ? gridItem->style()-> gridColumnEnd() : gridItem->style()->gridRowEnd(); |
| 976 const GridPositionSide finalPositionSide = (direction == ForColumns) ? Colum nEndSide : RowEndSide; | 1023 const GridPositionSide finalPositionSide = (direction == ForColumns) ? Colum nEndSide : RowEndSide; |
| 1024 const NamedGridLinesMap& gridLines = (direction == ForColumns) ? m_namedGrid ColumnLines : m_namedGridRowLines; | |
| 977 | 1025 |
| 978 // We must handle the placement error handling code here instead of in the S tyleAdjuster because we don't want to | 1026 // We must handle the placement error handling code here instead of in the S tyleAdjuster because we don't want to |
| 979 // overwrite the specified values. | 1027 // overwrite the specified values. |
| 980 if (initialPosition.isSpan() && finalPosition.isSpan()) | 1028 if (initialPosition.isSpan() && finalPosition.isSpan()) |
| 981 finalPosition.setAutoPosition(); | 1029 finalPosition.setAutoPosition(); |
| 982 | 1030 |
| 983 if (initialPosition.isNamedGridArea() && !style()->namedGridArea().contains( initialPosition.namedGridLine())) | 1031 if (initialPosition.isNamedGridArea() && isNonExistentNamedLineOrArea(initia lPosition, *style(), gridLines)) |
| 984 initialPosition.setAutoPosition(); | 1032 initialPosition.setAutoPosition(); |
| 985 | 1033 |
| 986 if (finalPosition.isNamedGridArea() && !style()->namedGridArea().contains(fi nalPosition.namedGridLine())) | 1034 if (finalPosition.isNamedGridArea() && isNonExistentNamedLineOrArea(finalPos ition, *style(), gridLines)) |
| 987 finalPosition.setAutoPosition(); | 1035 finalPosition.setAutoPosition(); |
| 988 | 1036 |
| 989 if (initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPositi on.shouldBeResolvedAgainstOppositePosition()) { | 1037 if (initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPositi on.shouldBeResolvedAgainstOppositePosition()) { |
| 990 if (style()->gridAutoFlow() == AutoFlowNone) | 1038 if (style()->gridAutoFlow() == AutoFlowNone) |
| 991 return adoptPtr(new GridSpan(0, 0)); | 1039 return adoptPtr(new GridSpan(0, 0)); |
| 992 | 1040 |
| 993 // We can't get our grid positions without running the auto placement al gorithm. | 1041 // We can't get our grid positions without running the auto placement al gorithm. |
| 994 return nullptr; | 1042 return nullptr; |
| 995 } | 1043 } |
| 996 | 1044 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1013 if (resolvedFinalPosition < resolvedInitialPosition) | 1061 if (resolvedFinalPosition < resolvedInitialPosition) |
| 1014 resolvedFinalPosition = resolvedInitialPosition; | 1062 resolvedFinalPosition = resolvedInitialPosition; |
| 1015 | 1063 |
| 1016 return adoptPtr(new GridSpan(resolvedInitialPosition, resolvedFinalPosition) ); | 1064 return adoptPtr(new GridSpan(resolvedInitialPosition, resolvedFinalPosition) ); |
| 1017 } | 1065 } |
| 1018 | 1066 |
| 1019 size_t RenderGrid::resolveNamedGridLinePositionFromStyle(const GridPosition& pos ition, GridPositionSide side) const | 1067 size_t RenderGrid::resolveNamedGridLinePositionFromStyle(const GridPosition& pos ition, GridPositionSide side) const |
| 1020 { | 1068 { |
| 1021 ASSERT(!position.namedGridLine().isNull()); | 1069 ASSERT(!position.namedGridLine().isNull()); |
| 1022 | 1070 |
| 1023 const NamedGridLinesMap& gridLinesNames = (side == ColumnStartSide || side = = ColumnEndSide) ? style()->namedGridColumnLines() : style()->namedGridRowLines( ); | 1071 const NamedGridLinesMap& gridLinesNames = gridLinesForSide(side); |
| 1024 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); | 1072 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); |
| 1025 if (it == gridLinesNames.end()) { | 1073 if (it == gridLinesNames.end()) { |
| 1026 if (position.isPositive()) | 1074 if (position.isPositive()) |
| 1027 return 0; | 1075 return 0; |
| 1028 const size_t lastLine = explicitGridSizeForSide(side); | 1076 const size_t lastLine = explicitGridSizeForSide(side); |
| 1029 return GridPosition::adjustGridPositionForSide(lastLine, side); | 1077 return GridPosition::adjustGridPositionForSide(lastLine, side); |
| 1030 } | 1078 } |
| 1031 | 1079 |
| 1032 size_t namedGridLineIndex; | 1080 size_t namedGridLineIndex; |
| 1033 if (position.isPositive()) | 1081 if (position.isPositive()) |
| 1034 namedGridLineIndex = std::min<size_t>(position.integerPosition(), it->va lue.size()) - 1; | 1082 namedGridLineIndex = std::min<size_t>(position.integerPosition(), it->va lue.size()) - 1; |
| 1035 else | 1083 else |
| 1036 namedGridLineIndex = std::max<int>(it->value.size() - abs(position.integ erPosition()), 0); | 1084 namedGridLineIndex = std::max<int>(it->value.size() - abs(position.integ erPosition()), 0); |
| 1037 return GridPosition::adjustGridPositionForSide(it->value[namedGridLineIndex] , side); | 1085 return GridPosition::adjustGridPositionForSide(it->value[namedGridLineIndex] , side); |
| 1038 } | 1086 } |
| 1039 | 1087 |
| 1040 size_t RenderGrid::resolveGridPositionFromStyle(const GridPosition& position, Gr idPositionSide side) const | 1088 size_t RenderGrid::resolveGridPositionFromStyle(const GridPosition& position, Gr idPositionSide side) const |
| 1041 { | 1089 { |
| 1042 switch (position.type()) { | 1090 ASSERT(position.type() == NamedGridAreaPosition || position.type() == Explic itPosition); |
| 1043 case ExplicitPosition: { | |
| 1044 ASSERT(position.integerPosition()); | |
| 1045 | 1091 |
| 1046 if (!position.namedGridLine().isNull()) | 1092 GridPosition adjustedPosition = position; |
| 1047 return resolveNamedGridLinePositionFromStyle(position, side); | |
| 1048 | 1093 |
| 1049 // Handle <integer> explicit position. | 1094 if (position.type() == NamedGridAreaPosition) { |
| 1050 if (position.isPositive()) | 1095 NamedGridAreaMap::const_iterator areaIter = style()->namedGridArea().fin d(position.namedGridLine()); |
|
Julien - ping for review
2014/03/20 18:14:42
I think it would be worth a FIXME / comment about
| |
| 1051 return GridPosition::adjustGridPositionForSide(position.integerPosit ion() - 1, side); | 1096 if (areaIter != style()->namedGridArea().end()) { |
| 1097 String implicitNamedGridLine = position.namedGridLine() + ((side == ColumnStartSide || side == RowStartSide) ? "-start" : "-end"); | |
| 1098 const NamedGridLinesMap& gridLineNames = gridLinesForSide(side); | |
| 1099 NamedGridLinesMap::const_iterator lineIter = gridLineNames.find(impl icitNamedGridLine); | |
| 1052 | 1100 |
| 1053 size_t resolvedPosition = abs(position.integerPosition()) - 1; | 1101 if (lineIter != gridLineNames.end()) |
| 1054 const size_t endOfTrack = explicitGridSizeForSide(side); | 1102 return GridPosition::adjustGridPositionForSide(lineIter->value[0 ], side); |
| 1055 | 1103 |
| 1056 // Per http://lists.w3.org/Archives/Public/www-style/2013Mar/0589.html, we clamp negative value to the first line. | 1104 return areaIter->value.positionForSide(side); |
| 1057 if (endOfTrack < resolvedPosition) | 1105 } |
| 1058 return 0; | 1106 // Fallback to a grid line position if there is no grid area with that n ame. |
| 1107 adjustedPosition.setExplicitPosition(1, position.namedGridLine()); | |
| 1108 } | |
| 1059 | 1109 |
| 1060 return GridPosition::adjustGridPositionForSide(endOfTrack - resolvedPosi tion, side); | 1110 ASSERT(adjustedPosition.integerPosition()); |
|
Julien - ping for review
2014/03/20 18:14:42
This really looks like we should move it to a func
| |
| 1061 } | 1111 |
| 1062 case NamedGridAreaPosition: | 1112 if (!adjustedPosition.namedGridLine().isNull()) |
| 1063 { | 1113 return resolveNamedGridLinePositionFromStyle(adjustedPosition, side); |
| 1064 NamedGridAreaMap::const_iterator it = style()->namedGridArea().find(posi tion.namedGridLine()); | 1114 |
| 1065 // Unknown grid area should have been computed to 'auto' by now. | 1115 // Handle <integer> explicit position. |
| 1066 ASSERT_WITH_SECURITY_IMPLICATION(it != style()->namedGridArea().end()); | 1116 if (adjustedPosition.isPositive()) |
| 1067 const GridCoordinate& gridAreaCoordinate = it->value; | 1117 return GridPosition::adjustGridPositionForSide(adjustedPosition.integerP osition() - 1, side); |
| 1068 switch (side) { | 1118 |
| 1069 case ColumnStartSide: | 1119 size_t resolvedPosition = abs(adjustedPosition.integerPosition()) - 1; |
| 1070 return gridAreaCoordinate.columns.initialPositionIndex; | 1120 const size_t endOfTrack = explicitGridSizeForSide(side); |
| 1071 case ColumnEndSide: | 1121 |
| 1072 return gridAreaCoordinate.columns.finalPositionIndex; | 1122 // Per http://lists.w3.org/Archives/Public/www-style/2013Mar/0589.html, we c lamp negative value to the first line. |
| 1073 case RowStartSide: | 1123 if (endOfTrack < resolvedPosition) |
| 1074 return gridAreaCoordinate.rows.initialPositionIndex; | |
| 1075 case RowEndSide: | |
| 1076 return gridAreaCoordinate.rows.finalPositionIndex; | |
| 1077 } | |
| 1078 ASSERT_NOT_REACHED(); | |
| 1079 return 0; | 1124 return 0; |
| 1080 } | 1125 |
| 1081 case AutoPosition: | 1126 return GridPosition::adjustGridPositionForSide(endOfTrack - resolvedPosition , side); |
| 1082 case SpanPosition: | |
| 1083 // 'auto' and span depend on the opposite position for resolution (e.g. grid-row: auto / 1 or grid-column: span 3 / "myHeader"). | |
|
Julien - ping for review
2014/03/20 18:14:42
I liked this comment as it explained why we should
| |
| 1084 ASSERT_NOT_REACHED(); | |
| 1085 return 0; | |
| 1086 } | |
| 1087 ASSERT_NOT_REACHED(); | |
| 1088 return 0; | |
| 1089 } | 1127 } |
| 1090 | 1128 |
| 1091 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionAgainstOppositePosition(size _t resolvedOppositePosition, const GridPosition& position, GridPositionSide side ) const | 1129 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionAgainstOppositePosition(size _t resolvedOppositePosition, const GridPosition& position, GridPositionSide side ) const |
| 1092 { | 1130 { |
| 1093 if (position.isAuto()) | 1131 if (position.isAuto()) |
| 1094 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi on); | 1132 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi on); |
| 1095 | 1133 |
| 1096 ASSERT(position.isSpan()); | 1134 ASSERT(position.isSpan()); |
| 1097 ASSERT(position.spanPosition() > 0); | 1135 ASSERT(position.spanPosition() > 0); |
| 1098 | 1136 |
| 1099 if (!position.namedGridLine().isNull()) { | 1137 if (!position.namedGridLine().isNull()) { |
| 1100 // span 2 'c' -> we need to find the appropriate grid line before / afte r our opposite position. | 1138 // span 2 'c' -> we need to find the appropriate grid line before / afte r our opposite position. |
| 1101 return resolveNamedGridLinePositionAgainstOppositePosition(resolvedOppos itePosition, position, side); | 1139 return resolveNamedGridLinePositionAgainstOppositePosition(resolvedOppos itePosition, position, side); |
| 1102 } | 1140 } |
| 1103 | 1141 |
| 1104 return GridSpan::createWithSpanAgainstOpposite(resolvedOppositePosition, pos ition, side); | 1142 return GridSpan::createWithSpanAgainstOpposite(resolvedOppositePosition, pos ition, side); |
| 1105 } | 1143 } |
| 1106 | 1144 |
| 1107 PassOwnPtr<GridSpan> RenderGrid::resolveNamedGridLinePositionAgainstOppositePosi tion(size_t resolvedOppositePosition, const GridPosition& position, GridPosition Side side) const | 1145 PassOwnPtr<GridSpan> RenderGrid::resolveNamedGridLinePositionAgainstOppositePosi tion(size_t resolvedOppositePosition, const GridPosition& position, GridPosition Side side) const |
| 1108 { | 1146 { |
| 1109 ASSERT(position.isSpan()); | 1147 ASSERT(position.isSpan()); |
| 1110 ASSERT(!position.namedGridLine().isNull()); | 1148 ASSERT(!position.namedGridLine().isNull()); |
| 1111 // Negative positions are not allowed per the specification and should have been handled during parsing. | 1149 // Negative positions are not allowed per the specification and should have been handled during parsing. |
| 1112 ASSERT(position.spanPosition() > 0); | 1150 ASSERT(position.spanPosition() > 0); |
| 1113 | 1151 |
| 1114 const NamedGridLinesMap& gridLinesNames = (side == ColumnStartSide || side = = ColumnEndSide) ? style()->namedGridColumnLines() : style()->namedGridRowLines( ); | 1152 const NamedGridLinesMap& gridLinesNames = gridLinesForSide(side); |
| 1115 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); | 1153 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri dLine()); |
| 1116 | 1154 |
| 1117 // 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). | 1155 // 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). |
| 1118 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. | 1156 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. |
| 1119 if (it == gridLinesNames.end()) | 1157 if (it == gridLinesNames.end()) |
| 1120 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi on); | 1158 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi on); |
| 1121 | 1159 |
| 1122 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition , position, side, it->value); | 1160 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition , position, side, it->value); |
| 1123 } | 1161 } |
| 1124 | 1162 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1382 if (isOutOfFlowPositioned()) | 1420 if (isOutOfFlowPositioned()) |
| 1383 return "RenderGrid (positioned)"; | 1421 return "RenderGrid (positioned)"; |
| 1384 if (isAnonymous()) | 1422 if (isAnonymous()) |
| 1385 return "RenderGrid (generated)"; | 1423 return "RenderGrid (generated)"; |
| 1386 if (isRelPositioned()) | 1424 if (isRelPositioned()) |
| 1387 return "RenderGrid (relative positioned)"; | 1425 return "RenderGrid (relative positioned)"; |
| 1388 return "RenderGrid"; | 1426 return "RenderGrid"; |
| 1389 } | 1427 } |
| 1390 | 1428 |
| 1391 } // namespace WebCore | 1429 } // namespace WebCore |
| OLD | NEW |