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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 RenderBlock::addChild(newChild, beforeChild); | 217 RenderBlock::addChild(newChild, beforeChild); |
218 | 218 |
219 if (gridIsDirty()) | 219 if (gridIsDirty()) |
220 return; | 220 return; |
221 | 221 |
222 if (!newChild->isBox()) { | 222 if (!newChild->isBox()) { |
223 dirtyGrid(); | 223 dirtyGrid(); |
224 return; | 224 return; |
225 } | 225 } |
226 | 226 |
227 // Positioned items that shouldn't take up space or otherwise participate in the layout of the grid. | |
228 if (newChild->isOutOfFlowPositioned()) | |
229 return; | |
230 | |
227 // If the new child has been inserted inside an existent anonymous block, we can simply ignore it as the anonymous | 231 // If the new child has been inserted inside an existent anonymous block, we can simply ignore it as the anonymous |
228 // block is an already known grid item. | 232 // block is an already known grid item. |
229 if (newChild->parent() != this) | 233 if (newChild->parent() != this) |
230 return; | 234 return; |
231 | 235 |
232 // FIXME: Implement properly "stack" value in auto-placement algorithm. | 236 // FIXME: Implement properly "stack" value in auto-placement algorithm. |
233 if (!style()->isGridAutoFlowAlgorithmStack()) { | 237 if (!style()->isGridAutoFlowAlgorithmStack()) { |
234 // The grid needs to be recomputed as it might contain auto-placed items that will change their position. | 238 // The grid needs to be recomputed as it might contain auto-placed items that will change their position. |
235 dirtyGrid(); | 239 dirtyGrid(); |
236 return; | 240 return; |
237 } | 241 } |
238 | 242 |
239 RenderBox* newChildBox = toRenderBox(newChild); | 243 RenderBox* newChildBox = toRenderBox(newChild); |
240 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositionsFr omStyle(*style(), *newChildBox, ForRows); | 244 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositionsFr omStyle(*style(), *newChildBox, ForRows); |
241 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosition sFromStyle(*style(), *newChildBox, ForColumns); | 245 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosition sFromStyle(*style(), *newChildBox, ForColumns); |
242 if (!rowPositions || !columnPositions) { | 246 if (!rowPositions || !columnPositions) { |
243 // The new child requires the auto-placement algorithm to run so we need to recompute the grid fully. | 247 // The new child requires the auto-placement algorithm to run so we need to recompute the grid fully. |
244 dirtyGrid(); | 248 dirtyGrid(); |
245 return; | 249 return; |
246 } else { | 250 } else { |
247 insertItemIntoGrid(*newChildBox, GridCoordinate(*rowPositions, *columnPo sitions)); | 251 insertItemIntoGrid(*newChildBox, GridCoordinate(*rowPositions, *columnPo sitions)); |
248 addChildToIndexesMap(*newChildBox); | 252 addChildToIndexesMap(*newChildBox); |
249 } | 253 } |
250 } | 254 } |
251 | 255 |
252 void RenderGrid::addChildToIndexesMap(RenderBox& child) | 256 void RenderGrid::addChildToIndexesMap(RenderBox& child) |
253 { | 257 { |
254 ASSERT(!m_gridItemsIndexesMap.contains(&child)); | 258 ASSERT(!m_gridItemsIndexesMap.contains(&child)); |
255 RenderBox* sibling = child.nextSiblingBox(); | 259 RenderBox* sibling; |
260 for (sibling = child.nextSiblingBox(); sibling; sibling = sibling->nextSibli ngBox()) { | |
261 if (!sibling->isOutOfFlowPositioned()) | |
262 break; | |
263 } | |
256 bool lastSibling = !sibling; | 264 bool lastSibling = !sibling; |
257 | 265 |
258 if (lastSibling) | 266 if (lastSibling) { |
259 sibling = child.previousSiblingBox(); | 267 for (sibling = child.previousSiblingBox(); sibling; sibling = sibling->p reviousSiblingBox()) { |
Julien - ping for review
2014/11/19 18:46:43
That would probably be nice to move into a helper
Manuel Rego
2014/11/19 23:26:23
Yes I agree, it makes the code easier to understan
| |
268 if (!sibling->isOutOfFlowPositioned()) | |
269 break; | |
270 } | |
271 } | |
260 | 272 |
261 size_t index = 0; | 273 size_t index = 0; |
262 if (sibling) | 274 if (sibling) |
263 index = lastSibling ? m_gridItemsIndexesMap.get(sibling) + 1 : m_gridIte msIndexesMap.get(sibling); | 275 index = lastSibling ? m_gridItemsIndexesMap.get(sibling) + 1 : m_gridIte msIndexesMap.get(sibling); |
264 | 276 |
265 if (sibling && !lastSibling) { | 277 if (sibling && !lastSibling) { |
266 for (; sibling; sibling = sibling->nextSiblingBox()) | 278 for (; sibling; sibling = sibling->nextSiblingBox()) { |
279 if (sibling->isOutOfFlowPositioned()) | |
280 continue; | |
267 m_gridItemsIndexesMap.set(sibling, m_gridItemsIndexesMap.get(sibling ) + 1); | 281 m_gridItemsIndexesMap.set(sibling, m_gridItemsIndexesMap.get(sibling ) + 1); |
282 } | |
268 } | 283 } |
269 | 284 |
270 m_gridItemsIndexesMap.set(&child, index); | 285 m_gridItemsIndexesMap.set(&child, index); |
271 } | 286 } |
272 | 287 |
273 void RenderGrid::removeChild(RenderObject* child) | 288 void RenderGrid::removeChild(RenderObject* child) |
274 { | 289 { |
275 RenderBlock::removeChild(child); | 290 RenderBlock::removeChild(child); |
276 | 291 |
277 if (gridIsDirty()) | 292 if (gridIsDirty()) |
278 return; | 293 return; |
279 | 294 |
280 ASSERT(child->isBox()); | 295 ASSERT(child->isBox()); |
281 | 296 |
282 // FIXME: Implement properly "stack" value in auto-placement algorithm. | 297 // FIXME: Implement properly "stack" value in auto-placement algorithm. |
283 if (!style()->isGridAutoFlowAlgorithmStack()) { | 298 if (!style()->isGridAutoFlowAlgorithmStack()) { |
284 // The grid needs to be recomputed as it might contain auto-placed items that will change their position. | 299 // The grid needs to be recomputed as it might contain auto-placed items that will change their position. |
285 dirtyGrid(); | 300 dirtyGrid(); |
286 return; | 301 return; |
287 } | 302 } |
288 | 303 |
304 if (child->isOutOfFlowPositioned()) | |
305 return; | |
306 | |
289 const RenderBox* childBox = toRenderBox(child); | 307 const RenderBox* childBox = toRenderBox(child); |
290 GridCoordinate coordinate = m_gridItemCoordinate.take(childBox); | 308 GridCoordinate coordinate = m_gridItemCoordinate.take(childBox); |
291 | 309 |
292 for (GridSpan::iterator row = coordinate.rows.begin(); row != coordinate.row s.end(); ++row) { | 310 for (GridSpan::iterator row = coordinate.rows.begin(); row != coordinate.row s.end(); ++row) { |
293 for (GridSpan::iterator column = coordinate.columns.begin(); column != c oordinate.columns.end(); ++column) { | 311 for (GridSpan::iterator column = coordinate.columns.begin(); column != c oordinate.columns.end(); ++column) { |
294 GridCell& cell = m_grid[row.toInt()][column.toInt()]; | 312 GridCell& cell = m_grid[row.toInt()][column.toInt()]; |
295 cell.remove(cell.find(childBox)); | 313 cell.remove(cell.find(childBox)); |
296 } | 314 } |
297 } | 315 } |
298 | 316 |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
891 | 909 |
892 populateExplicitGridAndOrderIterator(); | 910 populateExplicitGridAndOrderIterator(); |
893 | 911 |
894 // We clear the dirty bit here as the grid sizes have been updated, this mea ns | 912 // We clear the dirty bit here as the grid sizes have been updated, this mea ns |
895 // that we can safely call gridRowCount() / gridColumnCount(). | 913 // that we can safely call gridRowCount() / gridColumnCount(). |
896 m_gridIsDirty = false; | 914 m_gridIsDirty = false; |
897 | 915 |
898 Vector<RenderBox*> autoMajorAxisAutoGridItems; | 916 Vector<RenderBox*> autoMajorAxisAutoGridItems; |
899 Vector<RenderBox*> specifiedMajorAxisAutoGridItems; | 917 Vector<RenderBox*> specifiedMajorAxisAutoGridItems; |
900 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera tor.next()) { | 918 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera tor.next()) { |
919 if (child->isOutOfFlowPositioned()) { | |
920 continue; | |
921 } | |
922 | |
901 // FIXME: We never re-resolve positions if the grid is grown during auto -placement which may lead auto / <integer> | 923 // FIXME: We never re-resolve positions if the grid is grown during auto -placement which may lead auto / <integer> |
902 // positions to not match the author's intent. The specification is uncl ear on what should be done in this case. | 924 // positions to not match the author's intent. The specification is uncl ear on what should be done in this case. |
903 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio nsFromStyle(*style(), *child, ForRows); | 925 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio nsFromStyle(*style(), *child, ForRows); |
904 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); | 926 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); |
905 if (!rowPositions || !columnPositions) { | 927 if (!rowPositions || !columnPositions) { |
906 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() == ForColumns) ? columnPositions.get() : rowPositions.get(); | 928 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() == ForColumns) ? columnPositions.get() : rowPositions.get(); |
907 if (!majorAxisPositions) | 929 if (!majorAxisPositions) |
908 autoMajorAxisAutoGridItems.append(child); | 930 autoMajorAxisAutoGridItems.append(child); |
909 else | 931 else |
910 specifiedMajorAxisAutoGridItems.append(child); | 932 specifiedMajorAxisAutoGridItems.append(child); |
(...skipping 22 matching lines...) Expand all Loading... | |
933 void RenderGrid::populateExplicitGridAndOrderIterator() | 955 void RenderGrid::populateExplicitGridAndOrderIterator() |
934 { | 956 { |
935 OrderIteratorPopulator populator(m_orderIterator); | 957 OrderIteratorPopulator populator(m_orderIterator); |
936 | 958 |
937 size_t maximumRowIndex = std::max<size_t>(1, GridResolvedPosition::explicitG ridRowCount(*style())); | 959 size_t maximumRowIndex = std::max<size_t>(1, GridResolvedPosition::explicitG ridRowCount(*style())); |
938 size_t maximumColumnIndex = std::max<size_t>(1, GridResolvedPosition::explic itGridColumnCount(*style())); | 960 size_t maximumColumnIndex = std::max<size_t>(1, GridResolvedPosition::explic itGridColumnCount(*style())); |
939 | 961 |
940 ASSERT(m_gridItemsIndexesMap.isEmpty()); | 962 ASSERT(m_gridItemsIndexesMap.isEmpty()); |
941 size_t childIndex = 0; | 963 size_t childIndex = 0; |
942 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { | 964 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { |
965 if (child->isOutOfFlowPositioned()) { | |
966 continue; | |
967 } | |
968 | |
943 populator.collectChild(child); | 969 populator.collectChild(child); |
944 m_gridItemsIndexesMap.set(child, childIndex++); | 970 m_gridItemsIndexesMap.set(child, childIndex++); |
945 | 971 |
946 // This function bypasses the cache (cachedGridCoordinate()) as it is us ed to build it. | 972 // This function bypasses the cache (cachedGridCoordinate()) as it is us ed to build it. |
947 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio nsFromStyle(*style(), *child, ForRows); | 973 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio nsFromStyle(*style(), *child, ForRows); |
948 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); | 974 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); |
949 | 975 |
950 // |positions| is 0 if we need to run the auto-placement algorithm. | 976 // |positions| is 0 if we need to run the auto-placement algorithm. |
951 if (rowPositions) { | 977 if (rowPositions) { |
952 maximumRowIndex = std::max<size_t>(maximumRowIndex, rowPositions->re solvedFinalPosition.next().toInt()); | 978 maximumRowIndex = std::max<size_t>(maximumRowIndex, rowPositions->re solvedFinalPosition.next().toInt()); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1091 computeUsedBreadthOfGridTracks(ForColumns, sizingData); | 1117 computeUsedBreadthOfGridTracks(ForColumns, sizingData); |
1092 ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData.columnTracks )); | 1118 ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData.columnTracks )); |
1093 computeUsedBreadthOfGridTracks(ForRows, sizingData); | 1119 computeUsedBreadthOfGridTracks(ForRows, sizingData); |
1094 ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData.rowTracks)); | 1120 ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData.rowTracks)); |
1095 | 1121 |
1096 populateGridPositions(sizingData); | 1122 populateGridPositions(sizingData); |
1097 m_gridItemsOverflowingGridArea.resize(0); | 1123 m_gridItemsOverflowingGridArea.resize(0); |
1098 | 1124 |
1099 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { | 1125 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { |
1100 if (child->isOutOfFlowPositioned()) { | 1126 if (child->isOutOfFlowPositioned()) { |
1101 // FIXME: Absolute positioned grid items should have a special | |
1102 // behavior as described in the spec (crbug.com/273898): | |
1103 // http://www.w3.org/TR/css-grid-1/#abspos-items | |
1104 child->containingBlock()->insertPositionedObject(child); | 1127 child->containingBlock()->insertPositionedObject(child); |
1128 adjustPositionedGridItem(child); | |
1129 continue; | |
1105 } | 1130 } |
1106 | 1131 |
1107 // Because the grid area cannot be styled, we don't need to adjust | 1132 // Because the grid area cannot be styled, we don't need to adjust |
1108 // the grid breadth to account for 'box-sizing'. | 1133 // the grid breadth to account for 'box-sizing'. |
1109 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOve rrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogica lWidth() : LayoutUnit(); | 1134 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOve rrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogica lWidth() : LayoutUnit(); |
1110 LayoutUnit oldOverrideContainingBlockContentLogicalHeight = child->hasOv errideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogi calHeight() : LayoutUnit(); | 1135 LayoutUnit oldOverrideContainingBlockContentLogicalHeight = child->hasOv errideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogi calHeight() : LayoutUnit(); |
1111 | 1136 |
1112 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthF orChild(*child, ForColumns, sizingData.columnTracks); | 1137 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthF orChild(*child, ForColumns, sizingData.columnTracks); |
1113 LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadth ForChild(*child, ForRows, sizingData.rowTracks); | 1138 LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadth ForChild(*child, ForRows, sizingData.rowTracks); |
1114 | 1139 |
(...skipping 23 matching lines...) Expand all Loading... | |
1138 } | 1163 } |
1139 | 1164 |
1140 for (size_t i = 0; i < sizingData.rowTracks.size(); ++i) | 1165 for (size_t i = 0; i < sizingData.rowTracks.size(); ++i) |
1141 setLogicalHeight(logicalHeight() + sizingData.rowTracks[i].m_usedBreadth ); | 1166 setLogicalHeight(logicalHeight() + sizingData.rowTracks[i].m_usedBreadth ); |
1142 | 1167 |
1143 // Min / max logical height is handled by the call to updateLogicalHeight in layoutBlock. | 1168 // Min / max logical height is handled by the call to updateLogicalHeight in layoutBlock. |
1144 | 1169 |
1145 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); | 1170 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); |
1146 } | 1171 } |
1147 | 1172 |
1173 void RenderGrid::adjustPositionedGridItem(RenderBox* child) | |
1174 { | |
1175 RenderLayer* childLayer = child->layer(); | |
1176 childLayer->setStaticInlinePosition(borderAndPaddingStart()); | |
1177 childLayer->setStaticBlockPosition(borderAndPaddingBefore()); | |
1178 } | |
1179 | |
1180 void RenderGrid::layoutPositionedObjects(bool relayoutChildren, PositionedLayout Behavior info) | |
1181 { | |
1182 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | |
1183 if (!positionedDescendants) | |
1184 return; | |
1185 | |
1186 bool containerHasHorizontalWritingMode = isHorizontalWritingMode(); | |
1187 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | |
1188 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { | |
1189 RenderBox* child = *it; | |
1190 | |
1191 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != cont ainerHasHorizontalWritingMode; | |
1192 if (hasOrthogonalWritingMode) { | |
1193 // FIXME: Properly support orthogonal writing mode. | |
1194 continue; | |
1195 } | |
1196 | |
1197 LayoutUnit columnBreadth = clientLogicalWidth(); | |
1198 LayoutUnit columnOffset = offsetForPositionedChild(*child, ForColumns, c olumnBreadth); | |
1199 LayoutUnit rowBreadth = clientLogicalHeight(); | |
1200 LayoutUnit rowOffset = offsetForPositionedChild(*child, ForRows, rowBrea dth); | |
1201 | |
1202 RenderLayer* childLayer = child->layer(); | |
1203 childLayer->setStaticInlinePosition(childLayer->staticInlinePosition() + (containerHasHorizontalWritingMode ? columnOffset : rowOffset)); | |
1204 childLayer->setStaticBlockPosition(childLayer->staticBlockPosition() + ( containerHasHorizontalWritingMode ? rowOffset : columnOffset)); | |
1205 | |
1206 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth); | |
1207 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth); | |
1208 } | |
1209 | |
1210 RenderBlock::layoutPositionedObjects(relayoutChildren, info); | |
1211 } | |
1212 | |
1213 LayoutUnit RenderGrid::offsetForPositionedChild(const RenderBox& child, GridTrac kSizingDirection direction, LayoutUnit& breadth) | |
Julien - ping for review
2014/11/19 18:46:43
The API is weird: you wouldn't assume that it touc
Manuel Rego
2014/11/19 23:26:23
I added "andBreadth" but kept the return value, as
| |
1214 { | |
1215 ASSERT(child.isHorizontalWritingMode() == isHorizontalWritingMode()); | |
1216 | |
1217 LayoutUnit offset = LayoutUnit(0); | |
Julien - ping for review
2014/11/19 18:46:43
You don't use offset until below so we should move
Manuel Rego
2014/11/19 23:26:23
Done.
| |
1218 | |
1219 OwnPtr<GridSpan> positions = GridResolvedPosition::resolveGridPositionsFromS tyle(*style(), child, direction); | |
1220 if (!positions) | |
1221 return offset; | |
Julien - ping for review
2014/11/19 18:46:43
And explicitly return LayoutUnit(0) here (I like e
Manuel Rego
2014/11/19 23:26:24
Done.
| |
1222 | |
1223 if ((direction == ForColumns && !child.style()->gridColumnStart().isAuto()) || (direction == ForRows && !child.style()->gridRowStart().isAuto())) { | |
Julien - ping for review
2014/11/19 18:46:43
Unfortunately this doesn't handle correctly spanni
Manuel Rego
2014/11/19 23:26:24
I'm not sure if I'm getting what you mean.
For ex
Julien - ping for review
2014/11/24 21:44:40
This is the case I am thinking of:
grid-column: s
Manuel Rego
2014/12/01 11:10:36
I'm not sure about this one, so I've asked in www-
| |
1224 breadth -= (direction == ForColumns) ? paddingStart() : paddingBefore(); | |
1225 | |
1226 GridResolvedPosition firstPosition = GridResolvedPosition(0); | |
1227 if (positions->resolvedInitialPosition != firstPosition) { | |
1228 for (GridResolvedPosition position = firstPosition; position < posit ions->resolvedInitialPosition; ++position) { | |
1229 LayoutUnit trackBreadth = (direction == ForColumns) ? m_columnPo sitions[position.toInt() + 1] - m_columnPositions[position.toInt()] : m_rowPosit ions[position.toInt() + 1] - m_rowPositions[position.toInt()]; | |
1230 breadth -= trackBreadth; | |
1231 offset += trackBreadth; | |
1232 } | |
1233 } | |
1234 } else if ((direction == ForColumns && !child.style()->gridColumnEnd().isAut o()) || (direction == ForRows && !child.style()->gridRowEnd().isAuto())) { | |
Julien - ping for review
2014/11/19 18:46:43
Not sure why this is inside an 'else'. Nothing in
Manuel Rego
2014/11/19 23:26:23
Let me explain with an example. Imagine a grid wit
Manuel Rego
2014/11/21 10:11:00
I've removed the "else" as it was not needed at al
| |
1235 offset -= (direction == ForColumns) ? paddingStart() : paddingBefore(); | |
1236 } | |
1237 | |
1238 if ((direction == ForColumns && !child.style()->gridColumnEnd().isAuto()) || (direction == ForRows && !child.style()->gridRowEnd().isAuto())) { | |
1239 breadth -= (direction == ForColumns) ? paddingEnd() : paddingAfter(); | |
1240 | |
1241 GridResolvedPosition lastPosition = GridResolvedPosition(direction == Fo rColumns ? gridColumnCount() : gridRowCount()); | |
1242 if (positions->resolvedFinalPosition.next() != lastPosition) { | |
1243 for (GridResolvedPosition position = positions->resolvedFinalPositio n.next(); position < lastPosition; ++position) { | |
1244 LayoutUnit trackBreadth = (direction == ForColumns) ? m_columnPo sitions[position.toInt() + 1] - m_columnPositions[position.toInt()] : m_rowPosit ions[position.toInt() + 1] - m_rowPositions[position.toInt()]; | |
1245 breadth -= trackBreadth; | |
1246 } | |
1247 } | |
1248 } | |
1249 | |
1250 return offset; | |
1251 } | |
1252 | |
1148 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox& gridItem) const | 1253 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox& gridItem) const |
1149 { | 1254 { |
1150 ASSERT(m_gridItemCoordinate.contains(&gridItem)); | 1255 ASSERT(m_gridItemCoordinate.contains(&gridItem)); |
1151 return m_gridItemCoordinate.get(&gridItem); | 1256 return m_gridItemCoordinate.get(&gridItem); |
1152 } | 1257 } |
1153 | 1258 |
1154 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox& child, GridTrack SizingDirection direction, const Vector<GridTrack>& tracks) const | 1259 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox& child, GridTrack SizingDirection direction, const Vector<GridTrack>& tracks) const |
1155 { | 1260 { |
1156 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1261 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
1157 const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coor dinate.rows; | 1262 const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coor dinate.rows; |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1513 if (isOutOfFlowPositioned()) | 1618 if (isOutOfFlowPositioned()) |
1514 return "RenderGrid (positioned)"; | 1619 return "RenderGrid (positioned)"; |
1515 if (isAnonymous()) | 1620 if (isAnonymous()) |
1516 return "RenderGrid (generated)"; | 1621 return "RenderGrid (generated)"; |
1517 if (isRelPositioned()) | 1622 if (isRelPositioned()) |
1518 return "RenderGrid (relative positioned)"; | 1623 return "RenderGrid (relative positioned)"; |
1519 return "RenderGrid"; | 1624 return "RenderGrid"; |
1520 } | 1625 } |
1521 | 1626 |
1522 } // namespace blink | 1627 } // namespace blink |
OLD | NEW |