Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: Source/core/rendering/RenderGrid.cpp

Issue 637033003: [CSS Grid Layout] Fix positioned grid children position and size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove FIXME Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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()) {
Julien - ping for review 2014/11/18 21:12:44 nextSiblingBox doesn't check the type and IIRC we
Manuel Rego 2014/11/19 15:18:29 We solved those issues directly in RenderGrid::add
Julien - ping for review 2014/11/19 18:46:43 I didn't have a good way forward, only mentioned t
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()) {
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
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
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()) {
Julien - ping for review 2014/11/18 21:12:44 FWIW that's the kind of code that makes me advocat
Manuel Rego 2014/11/19 15:18:29 Yeah, I understand what you mean, in several cases
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
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
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 bool containerHasHorizontalWritingMode = isHorizontalWritingMode();
1176 RenderLayer* childLayer = child->layer();
1177 childLayer->setStaticInlinePosition(containerHasHorizontalWritingMode ? bord erLeft() + paddingLeft() : borderTop() + paddingTop());
1178 childLayer->setStaticBlockPosition(containerHasHorizontalWritingMode ? borde rTop() + paddingTop() : borderLeft() + paddingLeft());
1179 }
1180
1181 void RenderGrid::layoutPositionedObjects(bool relayoutChildren, PositionedLayout Behavior info)
1182 {
1183 TrackedRendererListHashSet* positionedDescendants = positionedObjects();
1184 if (!positionedDescendants)
1185 return;
1186
1187 RenderBox* child;
Julien - ping for review 2014/11/18 21:12:44 Why is child defined outside the for-loop?
Manuel Rego 2014/11/19 15:18:29 A mistake, sorry.
1188 TrackedRendererListHashSet::iterator end = positionedDescendants->end();
1189 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) {
1190 child = *it;
1191
1192 if (child->style()->position() == AbsolutePosition) {
Julien - ping for review 2014/11/18 21:12:44 Fixed positioned elements are never handled here.
Manuel Rego 2014/11/19 15:18:29 Yeah, I think you're right. I've removed the if an
1193 LayoutUnit columnBreadth = clientLogicalWidth();
1194 LayoutUnit columnOffset = offsetForAbsolutelyPositionedChild(*child, ForColumns, columnBreadth);
1195 LayoutUnit rowBreadth = clientLogicalHeight();
1196 LayoutUnit rowOffset = offsetForAbsolutelyPositionedChild(*child, Fo rRows, rowBreadth);
1197
1198 bool containerHasHorizontalWritingMode = isHorizontalWritingMode();
1199 RenderLayer* childLayer = child->layer();
1200 childLayer->setStaticInlinePosition(childLayer->staticInlinePosition () + (containerHasHorizontalWritingMode ? columnOffset : rowOffset));
1201 childLayer->setStaticBlockPosition(childLayer->staticBlockPosition() + (containerHasHorizontalWritingMode ? rowOffset : columnOffset));
1202
1203 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth);
Julien - ping for review 2014/11/18 21:12:44 columnBreadth is the client box, which is the padd
Manuel Rego 2014/11/19 15:18:29 It's the padding box of the grid container, and it
Julien - ping for review 2014/11/19 18:46:43 You're totally right about the specification. I me
1204 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth);
1205 }
1206 }
1207
1208 RenderBlock::layoutPositionedObjects(relayoutChildren, info);
1209 }
1210
1211 LayoutUnit RenderGrid::offsetForAbsolutelyPositionedChild(const RenderBox& child , GridTrackSizingDirection direction, LayoutUnit& breadth)
1212 {
1213 LayoutUnit offset = LayoutUnit(0);
1214
1215 OwnPtr<GridSpan> positions = GridResolvedPosition::resolveGridPositionsFromS tyle(*style(), child, direction);
1216 if (!positions)
1217 return offset;
1218
1219 if ((direction == ForColumns && !child.style()->gridColumnStart().isAuto()) || (direction == ForRows && !child.style()->gridRowStart().isAuto())) {
1220 breadth -= (direction == ForColumns) ? paddingLeft() : paddingTop();
Julien - ping for review 2014/11/18 21:12:44 Columns / rows follow the logical order so those s
Manuel Rego 2014/11/19 15:18:29 Yes, you're totally right. I've added a new test t
1221
1222 GridResolvedPosition firstPosition = GridResolvedPosition(0);
1223 if (positions->resolvedInitialPosition != firstPosition) {
1224 for (GridResolvedPosition position = firstPosition; position < posit ions->resolvedInitialPosition; ++position) {
1225 LayoutUnit trackBreadth = (direction == ForColumns) ? m_columnPo sitions[position.toInt() + 1] - m_columnPositions[position.toInt()] : m_rowPosit ions[position.toInt() + 1] - m_rowPositions[position.toInt()];
1226 breadth -= trackBreadth;
1227 offset += trackBreadth;
1228 }
1229 }
1230 } else if ((direction == ForColumns && !child.style()->gridColumnEnd().isAut o()) || (direction == ForRows && !child.style()->gridRowEnd().isAuto())) {
1231 offset -= (direction == ForColumns) ? paddingLeft() : paddingTop();
Julien - ping for review 2014/11/18 21:12:44 Same comment, physical properties vs logical ones.
Manuel Rego 2014/11/19 15:18:29 Done.
1232 }
1233
1234 if ((direction == ForColumns && !child.style()->gridColumnEnd().isAuto()) || (direction == ForRows && !child.style()->gridRowEnd().isAuto())) {
1235 breadth -= (direction == ForColumns) ? paddingRight() : paddingBottom();
Julien - ping for review 2014/11/18 21:12:44 Ditto.
Manuel Rego 2014/11/19 15:18:29 Done.
1236
1237 GridResolvedPosition lastPosition = GridResolvedPosition(direction == Fo rColumns ? gridColumnCount() : gridRowCount());
1238 if (positions->resolvedFinalPosition.next() != lastPosition) {
1239 for (GridResolvedPosition position = positions->resolvedFinalPositio n.next(); position < lastPosition; ++position) {
1240 LayoutUnit trackBreadth = (direction == ForColumns) ? m_columnPo sitions[position.toInt() + 1] - m_columnPositions[position.toInt()] : m_rowPosit ions[position.toInt() + 1] - m_rowPositions[position.toInt()];
1241 breadth -= trackBreadth;
1242 }
1243 }
1244 }
1245
1246 return offset;
1247 }
1248
1148 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox& gridItem) const 1249 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox& gridItem) const
1149 { 1250 {
1150 ASSERT(m_gridItemCoordinate.contains(&gridItem)); 1251 ASSERT(m_gridItemCoordinate.contains(&gridItem));
1151 return m_gridItemCoordinate.get(&gridItem); 1252 return m_gridItemCoordinate.get(&gridItem);
1152 } 1253 }
1153 1254
1154 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox& child, GridTrack SizingDirection direction, const Vector<GridTrack>& tracks) const 1255 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox& child, GridTrack SizingDirection direction, const Vector<GridTrack>& tracks) const
1155 { 1256 {
1156 const GridCoordinate& coordinate = cachedGridCoordinate(child); 1257 const GridCoordinate& coordinate = cachedGridCoordinate(child);
1157 const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coor dinate.rows; 1258 const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coor dinate.rows;
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 if (isOutOfFlowPositioned()) 1614 if (isOutOfFlowPositioned())
1514 return "RenderGrid (positioned)"; 1615 return "RenderGrid (positioned)";
1515 if (isAnonymous()) 1616 if (isAnonymous())
1516 return "RenderGrid (generated)"; 1617 return "RenderGrid (generated)";
1517 if (isRelPositioned()) 1618 if (isRelPositioned())
1518 return "RenderGrid (relative positioned)"; 1619 return "RenderGrid (relative positioned)";
1519 return "RenderGrid"; 1620 return "RenderGrid";
1520 } 1621 }
1521 1622
1522 } // namespace blink 1623 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698