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 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 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 = child.nextInFlowSiblingBox(); |
| 256 bool lastSibling = !sibling; | 260 bool lastSibling = !sibling; |
| 257 | 261 |
| 258 if (lastSibling) | 262 if (lastSibling) |
| 259 sibling = child.previousSiblingBox(); | 263 sibling = child.previousInFlowSiblingBox(); |
| 260 | 264 |
| 261 size_t index = 0; | 265 size_t index = 0; |
| 262 if (sibling) | 266 if (sibling) |
| 263 index = lastSibling ? m_gridItemsIndexesMap.get(sibling) + 1 : m_gridIte msIndexesMap.get(sibling); | 267 index = lastSibling ? m_gridItemsIndexesMap.get(sibling) + 1 : m_gridIte msIndexesMap.get(sibling); |
| 264 | 268 |
| 265 if (sibling && !lastSibling) { | 269 if (sibling && !lastSibling) { |
| 266 for (; sibling; sibling = sibling->nextSiblingBox()) | 270 for (; sibling; sibling = sibling->nextInFlowSiblingBox()) |
| 267 m_gridItemsIndexesMap.set(sibling, m_gridItemsIndexesMap.get(sibling ) + 1); | 271 m_gridItemsIndexesMap.set(sibling, m_gridItemsIndexesMap.get(sibling ) + 1); |
| 268 } | 272 } |
| 269 | 273 |
| 270 m_gridItemsIndexesMap.set(&child, index); | 274 m_gridItemsIndexesMap.set(&child, index); |
| 271 } | 275 } |
| 272 | 276 |
| 273 void RenderGrid::removeChild(RenderObject* child) | 277 void RenderGrid::removeChild(RenderObject* child) |
| 274 { | 278 { |
| 275 RenderBlock::removeChild(child); | 279 RenderBlock::removeChild(child); |
| 276 | 280 |
| 277 if (gridIsDirty()) | 281 if (gridIsDirty()) |
| 278 return; | 282 return; |
| 279 | 283 |
| 280 ASSERT(child->isBox()); | 284 ASSERT(child->isBox()); |
| 281 | 285 |
| 282 // FIXME: Implement properly "stack" value in auto-placement algorithm. | 286 // FIXME: Implement properly "stack" value in auto-placement algorithm. |
| 283 if (!style()->isGridAutoFlowAlgorithmStack()) { | 287 if (!style()->isGridAutoFlowAlgorithmStack()) { |
| 284 // The grid needs to be recomputed as it might contain auto-placed items that will change their position. | 288 // The grid needs to be recomputed as it might contain auto-placed items that will change their position. |
| 285 dirtyGrid(); | 289 dirtyGrid(); |
| 286 return; | 290 return; |
| 287 } | 291 } |
| 288 | 292 |
| 293 if (child->isOutOfFlowPositioned()) | |
| 294 return; | |
| 295 | |
| 289 const RenderBox* childBox = toRenderBox(child); | 296 const RenderBox* childBox = toRenderBox(child); |
| 290 GridCoordinate coordinate = m_gridItemCoordinate.take(childBox); | 297 GridCoordinate coordinate = m_gridItemCoordinate.take(childBox); |
| 291 | 298 |
| 292 for (GridSpan::iterator row = coordinate.rows.begin(); row != coordinate.row s.end(); ++row) { | 299 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) { | 300 for (GridSpan::iterator column = coordinate.columns.begin(); column != c oordinate.columns.end(); ++column) { |
| 294 GridCell& cell = m_grid[row.toInt()][column.toInt()]; | 301 GridCell& cell = m_grid[row.toInt()][column.toInt()]; |
| 295 cell.remove(cell.find(childBox)); | 302 cell.remove(cell.find(childBox)); |
| 296 } | 303 } |
| 297 } | 304 } |
| 298 | 305 |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 891 | 898 |
| 892 populateExplicitGridAndOrderIterator(); | 899 populateExplicitGridAndOrderIterator(); |
| 893 | 900 |
| 894 // We clear the dirty bit here as the grid sizes have been updated, this mea ns | 901 // We clear the dirty bit here as the grid sizes have been updated, this mea ns |
| 895 // that we can safely call gridRowCount() / gridColumnCount(). | 902 // that we can safely call gridRowCount() / gridColumnCount(). |
| 896 m_gridIsDirty = false; | 903 m_gridIsDirty = false; |
| 897 | 904 |
| 898 Vector<RenderBox*> autoMajorAxisAutoGridItems; | 905 Vector<RenderBox*> autoMajorAxisAutoGridItems; |
| 899 Vector<RenderBox*> specifiedMajorAxisAutoGridItems; | 906 Vector<RenderBox*> specifiedMajorAxisAutoGridItems; |
| 900 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera tor.next()) { | 907 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera tor.next()) { |
| 908 if (child->isOutOfFlowPositioned()) | |
| 909 continue; | |
| 910 | |
| 901 // FIXME: We never re-resolve positions if the grid is grown during auto -placement which may lead auto / <integer> | 911 // 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. | 912 // 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); | 913 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio nsFromStyle(*style(), *child, ForRows); |
| 904 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); | 914 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); |
| 905 if (!rowPositions || !columnPositions) { | 915 if (!rowPositions || !columnPositions) { |
| 906 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() == ForColumns) ? columnPositions.get() : rowPositions.get(); | 916 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() == ForColumns) ? columnPositions.get() : rowPositions.get(); |
| 907 if (!majorAxisPositions) | 917 if (!majorAxisPositions) |
| 908 autoMajorAxisAutoGridItems.append(child); | 918 autoMajorAxisAutoGridItems.append(child); |
| 909 else | 919 else |
| 910 specifiedMajorAxisAutoGridItems.append(child); | 920 specifiedMajorAxisAutoGridItems.append(child); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 932 | 942 |
| 933 void RenderGrid::populateExplicitGridAndOrderIterator() | 943 void RenderGrid::populateExplicitGridAndOrderIterator() |
| 934 { | 944 { |
| 935 OrderIteratorPopulator populator(m_orderIterator); | 945 OrderIteratorPopulator populator(m_orderIterator); |
| 936 | 946 |
| 937 size_t maximumRowIndex = std::max<size_t>(1, GridResolvedPosition::explicitG ridRowCount(*style())); | 947 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())); | 948 size_t maximumColumnIndex = std::max<size_t>(1, GridResolvedPosition::explic itGridColumnCount(*style())); |
| 939 | 949 |
| 940 ASSERT(m_gridItemsIndexesMap.isEmpty()); | 950 ASSERT(m_gridItemsIndexesMap.isEmpty()); |
| 941 size_t childIndex = 0; | 951 size_t childIndex = 0; |
| 942 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { | 952 for (RenderBox* child = firstChildBox(); child; child = child->nextInFlowSib lingBox()) { |
| 953 | |
|
Julien - ping for review
2014/12/02 20:46:05
Unneeded space.
| |
| 943 populator.collectChild(child); | 954 populator.collectChild(child); |
| 944 m_gridItemsIndexesMap.set(child, childIndex++); | 955 m_gridItemsIndexesMap.set(child, childIndex++); |
| 945 | 956 |
| 946 // This function bypasses the cache (cachedGridCoordinate()) as it is us ed to build it. | 957 // This function bypasses the cache (cachedGridCoordinate()) as it is us ed to build it. |
| 947 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio nsFromStyle(*style(), *child, ForRows); | 958 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio nsFromStyle(*style(), *child, ForRows); |
| 948 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); | 959 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi tionsFromStyle(*style(), *child, ForColumns); |
| 949 | 960 |
| 950 // |positions| is 0 if we need to run the auto-placement algorithm. | 961 // |positions| is 0 if we need to run the auto-placement algorithm. |
| 951 if (rowPositions) { | 962 if (rowPositions) { |
| 952 maximumRowIndex = std::max<size_t>(maximumRowIndex, rowPositions->re solvedFinalPosition.next().toInt()); | 963 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); | 1102 computeUsedBreadthOfGridTracks(ForColumns, sizingData); |
| 1092 ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData.columnTracks )); | 1103 ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData.columnTracks )); |
| 1093 computeUsedBreadthOfGridTracks(ForRows, sizingData); | 1104 computeUsedBreadthOfGridTracks(ForRows, sizingData); |
| 1094 ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData.rowTracks)); | 1105 ASSERT(tracksAreWiderThanMinTrackBreadth(ForRows, sizingData.rowTracks)); |
| 1095 | 1106 |
| 1096 populateGridPositions(sizingData); | 1107 populateGridPositions(sizingData); |
| 1097 m_gridItemsOverflowingGridArea.resize(0); | 1108 m_gridItemsOverflowingGridArea.resize(0); |
| 1098 | 1109 |
| 1099 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { | 1110 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { |
| 1100 if (child->isOutOfFlowPositioned()) { | 1111 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); | 1112 child->containingBlock()->insertPositionedObject(child); |
| 1113 continue; | |
| 1105 } | 1114 } |
| 1106 | 1115 |
| 1107 // Because the grid area cannot be styled, we don't need to adjust | 1116 // Because the grid area cannot be styled, we don't need to adjust |
| 1108 // the grid breadth to account for 'box-sizing'. | 1117 // the grid breadth to account for 'box-sizing'. |
| 1109 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOve rrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogica lWidth() : LayoutUnit(); | 1118 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOve rrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogica lWidth() : LayoutUnit(); |
| 1110 LayoutUnit oldOverrideContainingBlockContentLogicalHeight = child->hasOv errideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogi calHeight() : LayoutUnit(); | 1119 LayoutUnit oldOverrideContainingBlockContentLogicalHeight = child->hasOv errideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogi calHeight() : LayoutUnit(); |
| 1111 | 1120 |
| 1112 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthF orChild(*child, ForColumns, sizingData.columnTracks); | 1121 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthF orChild(*child, ForColumns, sizingData.columnTracks); |
| 1113 LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadth ForChild(*child, ForRows, sizingData.rowTracks); | 1122 LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadth ForChild(*child, ForRows, sizingData.rowTracks); |
| 1114 | 1123 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1138 } | 1147 } |
| 1139 | 1148 |
| 1140 for (size_t i = 0; i < sizingData.rowTracks.size(); ++i) | 1149 for (size_t i = 0; i < sizingData.rowTracks.size(); ++i) |
| 1141 setLogicalHeight(logicalHeight() + sizingData.rowTracks[i].m_usedBreadth ); | 1150 setLogicalHeight(logicalHeight() + sizingData.rowTracks[i].m_usedBreadth ); |
| 1142 | 1151 |
| 1143 // Min / max logical height is handled by the call to updateLogicalHeight in layoutBlock. | 1152 // Min / max logical height is handled by the call to updateLogicalHeight in layoutBlock. |
| 1144 | 1153 |
| 1145 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); | 1154 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); |
| 1146 } | 1155 } |
| 1147 | 1156 |
| 1157 void RenderGrid::layoutPositionedObjects(bool relayoutChildren, PositionedLayout Behavior info) | |
| 1158 { | |
| 1159 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | |
| 1160 if (!positionedDescendants) | |
| 1161 return; | |
| 1162 | |
| 1163 bool containerHasHorizontalWritingMode = isHorizontalWritingMode(); | |
| 1164 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | |
| 1165 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { | |
| 1166 RenderBox* child = *it; | |
| 1167 | |
| 1168 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != cont ainerHasHorizontalWritingMode; | |
| 1169 if (hasOrthogonalWritingMode) { | |
| 1170 // FIXME: Properly support orthogonal writing mode. | |
| 1171 continue; | |
| 1172 } | |
| 1173 | |
| 1174 // FIXME: Detect properly if start/end is auto for inexistent named grid lines. | |
|
Julien - ping for review
2014/12/02 20:46:05
Should we refer to the www-style thread here for f
Manuel Rego
2014/12/03 09:48:58
Not sure if to the thread itself, as it's expected
| |
| 1175 bool columnStartIsAuto = child->style()->gridColumnStart().isAuto(); | |
| 1176 LayoutUnit columnBreadth = LayoutUnit(0); | |
| 1177 LayoutUnit columnOffset = offsetAndBreadthForPositionedChild(*child, For Columns, columnStartIsAuto, child->style()->gridColumnEnd().isAuto(), columnBrea dth); | |
| 1178 bool rowStartIsAuto = child->style()->gridRowStart().isAuto(); | |
| 1179 LayoutUnit rowBreadth = LayoutUnit(0); | |
| 1180 LayoutUnit rowOffset = offsetAndBreadthForPositionedChild(*child, ForRow s, rowStartIsAuto, child->style()->gridRowEnd().isAuto(), rowBreadth); | |
| 1181 | |
| 1182 child->setOverrideContainingBlockContentLogicalWidth(columnBreadth); | |
| 1183 child->setOverrideContainingBlockContentLogicalHeight(rowBreadth); | |
| 1184 child->setOverrideInlineOffset(columnOffset); | |
| 1185 child->setOverrideBlockOffset(rowOffset); | |
|
Julien - ping for review
2014/12/02 20:46:05
Those 2 fields are a lot cleaner of the previous v
Manuel Rego
2014/12/03 09:48:58
Yeah, I've changed the name.
| |
| 1186 | |
| 1187 if (child->parent() == this) { | |
|
Julien - ping for review
2014/12/02 20:46:05
I don't understand that check. It seems *very wron
Manuel Rego
2014/12/03 09:48:58
This was on purpose to differentiate grid items (d
| |
| 1188 RenderLayer* childLayer = child->layer(); | |
| 1189 if (columnStartIsAuto) | |
| 1190 childLayer->setStaticInlinePosition(borderAndPaddingStart()); | |
| 1191 else | |
| 1192 childLayer->setStaticInlinePosition(borderStart() + columnOffset ); | |
|
Julien - ping for review
2014/12/02 20:46:05
AFAICT the column starts in the content box so the
Manuel Rego
2014/12/03 09:48:58
This is for the case where we have grid-column-sta
Julien - ping for review
2014/12/05 00:32:55
Let's put a comment in this case. It's weird that
Manuel Rego
2014/12/05 10:47:08
Done.
| |
| 1193 if (rowStartIsAuto) | |
| 1194 childLayer->setStaticBlockPosition(borderAndPaddingBefore()); | |
| 1195 else | |
| 1196 childLayer->setStaticBlockPosition(borderBefore() + rowOffset); | |
| 1197 } | |
| 1198 } | |
| 1199 | |
| 1200 RenderBlock::layoutPositionedObjects(relayoutChildren, info); | |
| 1201 } | |
| 1202 | |
| 1203 LayoutUnit RenderGrid::offsetAndBreadthForPositionedChild(const RenderBox& child , GridTrackSizingDirection direction, bool startIsAuto, bool endIsAuto, LayoutUn it& breadth) | |
| 1204 { | |
| 1205 ASSERT(child.isHorizontalWritingMode() == isHorizontalWritingMode()); | |
| 1206 | |
| 1207 OwnPtr<GridSpan> positions = GridResolvedPosition::resolveGridPositionsFromS tyle(*style(), child, direction); | |
| 1208 if (!positions) { | |
| 1209 breadth = (direction == ForColumns) ? clientLogicalWidth() : clientLogic alHeight(); | |
| 1210 return LayoutUnit(0); | |
| 1211 } | |
| 1212 | |
| 1213 GridResolvedPosition firstPosition = GridResolvedPosition(0); | |
| 1214 GridResolvedPosition initialPosition = startIsAuto ? firstPosition : positio ns->resolvedInitialPosition; | |
| 1215 GridResolvedPosition lastPosition = GridResolvedPosition((direction == ForCo lumns ? gridColumnCount() : gridRowCount()) - 1); | |
| 1216 GridResolvedPosition finalPosition = endIsAuto ? lastPosition : positions->r esolvedFinalPosition; | |
| 1217 | |
| 1218 LayoutUnit start = startIsAuto ? LayoutUnit(0) : (direction == ForColumns) ? m_columnPositions[initialPosition.toInt()] : m_rowPositions[initialPosition.to Int()]; | |
| 1219 LayoutUnit end = endIsAuto ? (direction == ForColumns) ? logicalWidth() : lo gicalHeight() : (direction == ForColumns) ? m_columnPositions[finalPosition.nex t().toInt()] : m_rowPositions[finalPosition.next().toInt()]; | |
| 1220 | |
| 1221 breadth = end - start; | |
| 1222 | |
| 1223 if (startIsAuto) | |
| 1224 breadth -= (direction == ForColumns) ? borderStart() : borderBefore(); | |
| 1225 else | |
| 1226 start -= ((direction == ForColumns) ? borderStart() : borderBefore()); | |
| 1227 | |
| 1228 if (endIsAuto) { | |
| 1229 breadth -= (direction == ForColumns) ? borderEnd() : borderAfter(); | |
| 1230 breadth -= isHorizontalWritingMode() ? verticalScrollbarWidth() : horizo ntalScrollbarHeight(); | |
| 1231 } | |
| 1232 | |
| 1233 return start; | |
| 1234 } | |
| 1235 | |
| 1148 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox& gridItem) const | 1236 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox& gridItem) const |
| 1149 { | 1237 { |
| 1150 ASSERT(m_gridItemCoordinate.contains(&gridItem)); | 1238 ASSERT(m_gridItemCoordinate.contains(&gridItem)); |
| 1151 return m_gridItemCoordinate.get(&gridItem); | 1239 return m_gridItemCoordinate.get(&gridItem); |
| 1152 } | 1240 } |
| 1153 | 1241 |
| 1154 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox& child, GridTrack SizingDirection direction, const Vector<GridTrack>& tracks) const | 1242 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox& child, GridTrack SizingDirection direction, const Vector<GridTrack>& tracks) const |
| 1155 { | 1243 { |
| 1156 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1244 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
| 1157 const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coor dinate.rows; | 1245 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()) | 1601 if (isOutOfFlowPositioned()) |
| 1514 return "RenderGrid (positioned)"; | 1602 return "RenderGrid (positioned)"; |
| 1515 if (isAnonymous()) | 1603 if (isAnonymous()) |
| 1516 return "RenderGrid (generated)"; | 1604 return "RenderGrid (generated)"; |
| 1517 if (isRelPositioned()) | 1605 if (isRelPositioned()) |
| 1518 return "RenderGrid (relative positioned)"; | 1606 return "RenderGrid (relative positioned)"; |
| 1519 return "RenderGrid"; | 1607 return "RenderGrid"; |
| 1520 } | 1608 } |
| 1521 | 1609 |
| 1522 } // namespace blink | 1610 } // namespace blink |
| OLD | NEW |