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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 if (style()->gridAutoFlow() != AutoFlowNone) { | 193 if (style()->gridAutoFlow() != AutoFlowNone) { |
194 // The grid needs to be recomputed as it might contain auto-placed items
that will change their position. | 194 // The grid needs to be recomputed as it might contain auto-placed items
that will change their position. |
195 dirtyGrid(); | 195 dirtyGrid(); |
196 return; | 196 return; |
197 } | 197 } |
198 | 198 |
199 RenderBox* newChildBox = toRenderBox(newChild); | 199 RenderBox* newChildBox = toRenderBox(newChild); |
200 OwnPtr<GridSpan> rowPositions = resolveGridPositionsFromStyle(newChildBox, F
orRows); | 200 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositionsFr
omStyle(*style(), *newChildBox, ForRows); |
201 OwnPtr<GridSpan> columnPositions = resolveGridPositionsFromStyle(newChildBox
, ForColumns); | 201 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosition
sFromStyle(*style(), *newChildBox, ForColumns); |
202 if (!rowPositions || !columnPositions) { | 202 if (!rowPositions || !columnPositions) { |
203 // The new child requires the auto-placement algorithm to run so we need
to recompute the grid fully. | 203 // The new child requires the auto-placement algorithm to run so we need
to recompute the grid fully. |
204 dirtyGrid(); | 204 dirtyGrid(); |
205 return; | 205 return; |
206 } else { | 206 } else { |
207 // Ensure that the grid is big enough to contain new grid item. | 207 // Ensure that the grid is big enough to contain new grid item. |
208 if (gridRowCount() <= rowPositions->finalPositionIndex) | 208 if (gridRowCount() <= rowPositions->resolvedFinalPosition.toInt()) |
209 growGrid(ForRows, rowPositions->finalPositionIndex); | 209 growGrid(ForRows, rowPositions->resolvedFinalPosition.toInt()); |
210 if (gridColumnCount() <= columnPositions->finalPositionIndex) | 210 if (gridColumnCount() <= columnPositions->resolvedFinalPosition.toInt()) |
211 growGrid(ForColumns, columnPositions->finalPositionIndex); | 211 growGrid(ForColumns, columnPositions->resolvedFinalPosition.toInt())
; |
212 | 212 |
213 insertItemIntoGrid(newChildBox, GridCoordinate(*rowPositions, *columnPos
itions)); | 213 insertItemIntoGrid(newChildBox, GridCoordinate(*rowPositions, *columnPos
itions)); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 void RenderGrid::removeChild(RenderObject* child) | 217 void RenderGrid::removeChild(RenderObject* child) |
218 { | 218 { |
219 RenderBlock::removeChild(child); | 219 RenderBlock::removeChild(child); |
220 | 220 |
221 if (gridIsDirty()) | 221 if (gridIsDirty()) |
222 return; | 222 return; |
223 | 223 |
224 ASSERT(child->isBox()); | 224 ASSERT(child->isBox()); |
225 | 225 |
226 if (style()->gridAutoFlow() != AutoFlowNone) { | 226 if (style()->gridAutoFlow() != AutoFlowNone) { |
227 // The grid needs to be recomputed as it might contain auto-placed items
that will change their position. | 227 // The grid needs to be recomputed as it might contain auto-placed items
that will change their position. |
228 dirtyGrid(); | 228 dirtyGrid(); |
229 return; | 229 return; |
230 } | 230 } |
231 | 231 |
232 const RenderBox* childBox = toRenderBox(child); | 232 const RenderBox* childBox = toRenderBox(child); |
233 GridCoordinate coordinate = m_gridItemCoordinate.take(childBox); | 233 GridCoordinate coordinate = m_gridItemCoordinate.take(childBox); |
234 | 234 |
235 for (size_t row = coordinate.rows.initialPositionIndex; row <= coordinate.ro
ws.finalPositionIndex; ++row) { | 235 for (GridResolvedPosition row = coordinate.rows.resolvedInitialPosition; row
<= coordinate.rows.resolvedFinalPosition; ++row) { |
236 for (size_t column = coordinate.columns.initialPositionIndex; column <=
coordinate.columns.finalPositionIndex; ++column) { | 236 for (GridResolvedPosition column = coordinate.columns.resolvedInitialPos
ition; column <= coordinate.columns.resolvedFinalPosition; ++column) { |
237 GridCell& cell = m_grid[row][column]; | 237 GridCell& cell = m_grid[row.toInt()][column.toInt()]; |
238 cell.remove(cell.find(childBox)); | 238 cell.remove(cell.find(childBox)); |
239 } | 239 } |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
e) | 243 void RenderGrid::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl
e) |
244 { | 244 { |
245 RenderBlock::styleDidChange(diff, oldStyle); | 245 RenderBlock::styleDidChange(diff, oldStyle); |
246 if (!oldStyle) | 246 if (!oldStyle) |
247 return; | 247 return; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 normalizedFractionBreadth = std::max(normalizedFractionBreadth, trac
ks[trackIndex].m_usedBreadth / trackSize.maxTrackBreadth().flex()); | 428 normalizedFractionBreadth = std::max(normalizedFractionBreadth, trac
ks[trackIndex].m_usedBreadth / trackSize.maxTrackBreadth().flex()); |
429 } | 429 } |
430 | 430 |
431 for (size_t i = 0; i < flexibleSizedTracksIndex.size(); ++i) { | 431 for (size_t i = 0; i < flexibleSizedTracksIndex.size(); ++i) { |
432 GridIterator iterator(m_grid, direction, flexibleSizedTracksIndex[i]
); | 432 GridIterator iterator(m_grid, direction, flexibleSizedTracksIndex[i]
); |
433 while (RenderBox* gridItem = iterator.nextGridItem()) { | 433 while (RenderBox* gridItem = iterator.nextGridItem()) { |
434 const GridCoordinate coordinate = cachedGridCoordinate(gridItem)
; | 434 const GridCoordinate coordinate = cachedGridCoordinate(gridItem)
; |
435 const GridSpan span = (direction == ForColumns) ? coordinate.col
umns : coordinate.rows; | 435 const GridSpan span = (direction == ForColumns) ? coordinate.col
umns : coordinate.rows; |
436 | 436 |
437 // Do not include already processed items. | 437 // Do not include already processed items. |
438 if (i > 0 && span.initialPositionIndex <= flexibleSizedTracksInd
ex[i - 1]) | 438 if (i > 0 && span.resolvedInitialPosition.toInt() <= flexibleSiz
edTracksIndex[i - 1]) |
439 continue; | 439 continue; |
440 | 440 |
441 double itemNormalizedFlexBreadth = computeNormalizedFractionBrea
dth(tracks, span, direction, maxContentForChild(gridItem, direction, sizingData.
columnTracks)); | 441 double itemNormalizedFlexBreadth = computeNormalizedFractionBrea
dth(tracks, span, direction, maxContentForChild(gridItem, direction, sizingData.
columnTracks)); |
442 normalizedFractionBreadth = std::max(normalizedFractionBreadth,
itemNormalizedFlexBreadth); | 442 normalizedFractionBreadth = std::max(normalizedFractionBreadth,
itemNormalizedFlexBreadth); |
443 } | 443 } |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 for (size_t i = 0; i < flexibleSizedTracksIndex.size(); ++i) { | 447 for (size_t i = 0; i < flexibleSizedTracksIndex.size(); ++i) { |
448 const size_t trackIndex = flexibleSizedTracksIndex[i]; | 448 const size_t trackIndex = flexibleSizedTracksIndex[i]; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track
1, const GridTrackForNormalization& track2) | 493 static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track
1, const GridTrackForNormalization& track2) |
494 { | 494 { |
495 return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue; | 495 return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue; |
496 } | 496 } |
497 | 497 |
498 double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, c
onst GridSpan& tracksSpan, GridTrackSizingDirection direction, LayoutUnit availa
bleLogicalSpace) const | 498 double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, c
onst GridSpan& tracksSpan, GridTrackSizingDirection direction, LayoutUnit availa
bleLogicalSpace) const |
499 { | 499 { |
500 // |availableLogicalSpace| already accounts for the used breadths so no need
to remove it here. | 500 // |availableLogicalSpace| already accounts for the used breadths so no need
to remove it here. |
501 | 501 |
502 Vector<GridTrackForNormalization> tracksForNormalization; | 502 Vector<GridTrackForNormalization> tracksForNormalization; |
503 for (size_t i = tracksSpan.initialPositionIndex; i <= tracksSpan.finalPositi
onIndex; ++i) { | 503 for (GridResolvedPosition resolvedPosition = tracksSpan.resolvedInitialPosit
ion; resolvedPosition <= tracksSpan.resolvedFinalPosition; ++resolvedPosition) { |
504 const GridTrackSize& trackSize = gridTrackSize(direction, i); | 504 const GridTrackSize& trackSize = gridTrackSize(direction, resolvedPositi
on.toInt()); |
505 if (!trackSize.maxTrackBreadth().isFlex()) | 505 if (!trackSize.maxTrackBreadth().isFlex()) |
506 continue; | 506 continue; |
507 | 507 |
508 tracksForNormalization.append(GridTrackForNormalization(tracks[i], track
Size.maxTrackBreadth().flex())); | 508 tracksForNormalization.append(GridTrackForNormalization(tracks[resolvedP
osition.toInt()], trackSize.maxTrackBreadth().flex())); |
509 } | 509 } |
510 | 510 |
511 // The function is not called if we don't have <flex> grid tracks | 511 // The function is not called if we don't have <flex> grid tracks |
512 ASSERT(!tracksForNormalization.isEmpty()); | 512 ASSERT(!tracksForNormalization.isEmpty()); |
513 | 513 |
514 std::sort(tracksForNormalization.begin(), tracksForNormalization.end(), sort
ByGridNormalizedFlexValue); | 514 std::sort(tracksForNormalization.begin(), tracksForNormalization.end(), sort
ByGridNormalizedFlexValue); |
515 | 515 |
516 // These values work together: as we walk over our grid tracks, we increase
fractionValueBasedOnGridItemsRatio | 516 // These values work together: as we walk over our grid tracks, we increase
fractionValueBasedOnGridItemsRatio |
517 // to match a grid track's usedBreadth to <flex> ratio until the total fract
ions sized grid tracks wouldn't | 517 // to match a grid track's usedBreadth to <flex> ratio until the total fract
ions sized grid tracks wouldn't |
518 // fit into availableLogicalSpaceIgnoringFractionTracks. | 518 // fit into availableLogicalSpaceIgnoringFractionTracks. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 Length logicalSize = direction == ForColumns ? style()->logicalWidth() :
style()->logicalHeight(); | 551 Length logicalSize = direction == ForColumns ? style()->logicalWidth() :
style()->logicalHeight(); |
552 if (logicalSize.isIntrinsicOrAuto()) { | 552 if (logicalSize.isIntrinsicOrAuto()) { |
553 DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Length(Auto))); | 553 DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Length(Auto))); |
554 return autoTrackSize; | 554 return autoTrackSize; |
555 } | 555 } |
556 } | 556 } |
557 | 557 |
558 return trackSize; | 558 return trackSize; |
559 } | 559 } |
560 | 560 |
561 size_t RenderGrid::explicitGridColumnCount() const | |
562 { | |
563 return style()->gridTemplateColumns().size(); | |
564 } | |
565 | |
566 size_t RenderGrid::explicitGridRowCount() const | |
567 { | |
568 return style()->gridTemplateRows().size(); | |
569 } | |
570 | |
571 size_t RenderGrid::explicitGridSizeForSide(GridPositionSide side) const | |
572 { | |
573 return (side == ColumnStartSide || side == ColumnEndSide) ? explicitGridColu
mnCount() : explicitGridRowCount(); | |
574 } | |
575 | |
576 LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox* child, Vector<Gri
dTrack>& columnTracks) | 561 LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox* child, Vector<Gri
dTrack>& columnTracks) |
577 { | 562 { |
578 SubtreeLayoutScope layoutScope(child); | 563 SubtreeLayoutScope layoutScope(child); |
579 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOverrid
eContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogicalWid
th() : LayoutUnit(); | 564 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOverrid
eContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogicalWid
th() : LayoutUnit(); |
580 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForCh
ild(child, ForColumns, columnTracks); | 565 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForCh
ild(child, ForColumns, columnTracks); |
581 if (child->style()->logicalHeight().isPercent() || oldOverrideContainingBloc
kContentLogicalWidth != overrideContainingBlockContentLogicalWidth) | 566 if (child->style()->logicalHeight().isPercent() || oldOverrideContainingBloc
kContentLogicalWidth != overrideContainingBlockContentLogicalWidth) |
582 layoutScope.setNeedsLayout(child); | 567 layoutScope.setNeedsLayout(child); |
583 | 568 |
584 child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlock
ContentLogicalWidth); | 569 child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlock
ContentLogicalWidth); |
585 // If |child| has a percentage logical height, we shouldn't let it override
its intrinsic height, which is | 570 // If |child| has a percentage logical height, we shouldn't let it override
its intrinsic height, which is |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 623 |
639 GridTrack& track = (direction == ForColumns) ? sizingData.columnTracks[i
] : sizingData.rowTracks[i]; | 624 GridTrack& track = (direction == ForColumns) ? sizingData.columnTracks[i
] : sizingData.rowTracks[i]; |
640 if (track.m_maxBreadth == infinity) | 625 if (track.m_maxBreadth == infinity) |
641 track.m_maxBreadth = track.m_usedBreadth; | 626 track.m_maxBreadth = track.m_usedBreadth; |
642 } | 627 } |
643 } | 628 } |
644 | 629 |
645 void RenderGrid::resolveContentBasedTrackSizingFunctionsForItems(GridTrackSizing
Direction direction, GridSizingData& sizingData, RenderBox* gridItem, FilterFunc
tion filterFunction, SizingFunction sizingFunction, AccumulatorGetter trackGette
r, AccumulatorGrowFunction trackGrowthFunction) | 630 void RenderGrid::resolveContentBasedTrackSizingFunctionsForItems(GridTrackSizing
Direction direction, GridSizingData& sizingData, RenderBox* gridItem, FilterFunc
tion filterFunction, SizingFunction sizingFunction, AccumulatorGetter trackGette
r, AccumulatorGrowFunction trackGrowthFunction) |
646 { | 631 { |
647 const GridCoordinate coordinate = cachedGridCoordinate(gridItem); | 632 const GridCoordinate coordinate = cachedGridCoordinate(gridItem); |
648 const size_t initialTrackIndex = (direction == ForColumns) ? coordinate.colu
mns.initialPositionIndex : coordinate.rows.initialPositionIndex; | 633 const GridResolvedPosition initialTrackPosition = (direction == ForColumns)
? coordinate.columns.resolvedInitialPosition : coordinate.rows.resolvedInitialPo
sition; |
649 const size_t finalTrackIndex = (direction == ForColumns) ? coordinate.column
s.finalPositionIndex : coordinate.rows.finalPositionIndex; | 634 const GridResolvedPosition finalTrackPosition = (direction == ForColumns) ?
coordinate.columns.resolvedFinalPosition : coordinate.rows.resolvedFinalPosition
; |
650 | 635 |
651 sizingData.filteredTracks.shrink(0); | 636 sizingData.filteredTracks.shrink(0); |
652 for (size_t trackIndex = initialTrackIndex; trackIndex <= finalTrackIndex; +
+trackIndex) { | 637 for (GridResolvedPosition trackPosition = initialTrackPosition; trackPositio
n <= finalTrackPosition; ++trackPosition) { |
653 const GridTrackSize& trackSize = gridTrackSize(direction, trackIndex); | 638 const GridTrackSize& trackSize = gridTrackSize(direction, trackPosition.
toInt()); |
654 if (!(trackSize.*filterFunction)()) | 639 if (!(trackSize.*filterFunction)()) |
655 continue; | 640 continue; |
656 | 641 |
657 GridTrack& track = (direction == ForColumns) ? sizingData.columnTracks[t
rackIndex] : sizingData.rowTracks[trackIndex]; | 642 GridTrack& track = (direction == ForColumns) ? sizingData.columnTracks[t
rackPosition.toInt()] : sizingData.rowTracks[trackPosition.toInt()]; |
658 sizingData.filteredTracks.append(&track); | 643 sizingData.filteredTracks.append(&track); |
659 } | 644 } |
660 | 645 |
661 if (sizingData.filteredTracks.isEmpty()) | 646 if (sizingData.filteredTracks.isEmpty()) |
662 return; | 647 return; |
663 | 648 |
664 LayoutUnit additionalBreadthSpace = (this->*sizingFunction)(gridItem, direct
ion, sizingData.columnTracks); | 649 LayoutUnit additionalBreadthSpace = (this->*sizingFunction)(gridItem, direct
ion, sizingData.columnTracks); |
665 for (size_t trackIndexForSpace = initialTrackIndex; trackIndexForSpace <= fi
nalTrackIndex; ++trackIndexForSpace) { | 650 for (GridResolvedPosition trackIndexForSpace = initialTrackPosition; trackIn
dexForSpace <= finalTrackPosition; ++trackIndexForSpace) { |
666 GridTrack& track = (direction == ForColumns) ? sizingData.columnTracks[t
rackIndexForSpace] : sizingData.rowTracks[trackIndexForSpace]; | 651 GridTrack& track = (direction == ForColumns) ? sizingData.columnTracks[t
rackIndexForSpace.toInt()] : sizingData.rowTracks[trackIndexForSpace.toInt()]; |
667 additionalBreadthSpace -= (track.*trackGetter)(); | 652 additionalBreadthSpace -= (track.*trackGetter)(); |
668 } | 653 } |
669 | 654 |
670 // FIXME: We should pass different values for |tracksForGrowthAboveMaxBreadt
h|. | 655 // FIXME: We should pass different values for |tracksForGrowthAboveMaxBreadt
h|. |
671 distributeSpaceToTracks(sizingData.filteredTracks, &sizingData.filteredTrack
s, trackGetter, trackGrowthFunction, sizingData, additionalBreadthSpace); | 656 distributeSpaceToTracks(sizingData.filteredTracks, &sizingData.filteredTrack
s, trackGetter, trackGrowthFunction, sizingData, additionalBreadthSpace); |
672 } | 657 } |
673 | 658 |
674 static bool sortByGridTrackGrowthPotential(const GridTrack* track1, const GridTr
ack* track2) | 659 static bool sortByGridTrackGrowthPotential(const GridTrack* track1, const GridTr
ack* track2) |
675 { | 660 { |
676 return (track1->m_maxBreadth - track1->m_usedBreadth) < (track2->m_maxBreadt
h - track2->m_usedBreadth); | 661 return (track1->m_maxBreadth - track1->m_usedBreadth) < (track2->m_maxBreadt
h - track2->m_usedBreadth); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 ASSERT(maximumPositionIndex >= m_grid.size()); | 720 ASSERT(maximumPositionIndex >= m_grid.size()); |
736 const size_t oldRowSize = m_grid.size(); | 721 const size_t oldRowSize = m_grid.size(); |
737 m_grid.grow(maximumPositionIndex + 1); | 722 m_grid.grow(maximumPositionIndex + 1); |
738 for (size_t row = oldRowSize; row < m_grid.size(); ++row) | 723 for (size_t row = oldRowSize; row < m_grid.size(); ++row) |
739 m_grid[row].grow(m_grid[0].size()); | 724 m_grid[row].grow(m_grid[0].size()); |
740 } | 725 } |
741 } | 726 } |
742 | 727 |
743 void RenderGrid::insertItemIntoGrid(RenderBox* child, const GridCoordinate& coor
dinate) | 728 void RenderGrid::insertItemIntoGrid(RenderBox* child, const GridCoordinate& coor
dinate) |
744 { | 729 { |
745 for (size_t row = coordinate.rows.initialPositionIndex; row <= coordinate.ro
ws.finalPositionIndex; ++row) { | 730 for (GridResolvedPosition row = coordinate.rows.resolvedInitialPosition; row
<= coordinate.rows.resolvedFinalPosition; ++row) { |
746 for (size_t column = coordinate.columns.initialPositionIndex; column <=
coordinate.columns.finalPositionIndex; ++column) | 731 for (GridResolvedPosition column = coordinate.columns.resolvedInitialPos
ition; column <= coordinate.columns.resolvedFinalPosition; ++column) |
747 m_grid[row][column].append(child); | 732 m_grid[row.toInt()][column.toInt()].append(child); |
748 } | 733 } |
749 | 734 |
750 m_gridItemCoordinate.set(child, coordinate); | 735 m_gridItemCoordinate.set(child, coordinate); |
751 } | 736 } |
752 | 737 |
753 void RenderGrid::insertItemIntoGrid(RenderBox* child, size_t rowTrack, size_t co
lumnTrack) | 738 void RenderGrid::insertItemIntoGrid(RenderBox* child, const GridResolvedPosition
& rowTrack, const GridResolvedPosition& columnTrack) |
754 { | 739 { |
755 const GridSpan& rowSpan = resolveGridPositionsFromAutoPlacementPosition(chil
d, ForRows, rowTrack); | 740 const GridSpan& rowSpan = GridResolvedPosition::resolveGridPositionsFromAuto
PlacementPosition(*child, ForRows, rowTrack); |
756 const GridSpan& columnSpan = resolveGridPositionsFromAutoPlacementPosition(c
hild, ForColumns, columnTrack); | 741 const GridSpan& columnSpan = GridResolvedPosition::resolveGridPositionsFromA
utoPlacementPosition(*child, ForColumns, columnTrack); |
757 insertItemIntoGrid(child, GridCoordinate(rowSpan, columnSpan)); | 742 insertItemIntoGrid(child, GridCoordinate(rowSpan, columnSpan)); |
758 } | 743 } |
759 | 744 |
760 void RenderGrid::placeItemsOnGrid() | 745 void RenderGrid::placeItemsOnGrid() |
761 { | 746 { |
762 if (!gridIsDirty()) | 747 if (!gridIsDirty()) |
763 return; | 748 return; |
764 | 749 |
765 ASSERT(m_gridItemCoordinate.isEmpty()); | 750 ASSERT(m_gridItemCoordinate.isEmpty()); |
766 | 751 |
767 populateExplicitGridAndOrderIterator(); | 752 populateExplicitGridAndOrderIterator(); |
768 | 753 |
769 // We clear the dirty bit here as the grid sizes have been updated, this mea
ns | 754 // We clear the dirty bit here as the grid sizes have been updated, this mea
ns |
770 // that we can safely call gridRowCount() / gridColumnCount(). | 755 // that we can safely call gridRowCount() / gridColumnCount(). |
771 m_gridIsDirty = false; | 756 m_gridIsDirty = false; |
772 | 757 |
773 Vector<RenderBox*> autoMajorAxisAutoGridItems; | 758 Vector<RenderBox*> autoMajorAxisAutoGridItems; |
774 Vector<RenderBox*> specifiedMajorAxisAutoGridItems; | 759 Vector<RenderBox*> specifiedMajorAxisAutoGridItems; |
775 GridAutoFlow autoFlow = style()->gridAutoFlow(); | 760 GridAutoFlow autoFlow = style()->gridAutoFlow(); |
776 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera
tor.next()) { | 761 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera
tor.next()) { |
777 // FIXME: We never re-resolve positions if the grid is grown during auto
-placement which may lead auto / <integer> | 762 // FIXME: We never re-resolve positions if the grid is grown during auto
-placement which may lead auto / <integer> |
778 // positions to not match the author's intent. The specification is uncl
ear on what should be done in this case. | 763 // positions to not match the author's intent. The specification is uncl
ear on what should be done in this case. |
779 OwnPtr<GridSpan> rowPositions = resolveGridPositionsFromStyle(child, For
Rows); | 764 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio
nsFromStyle(*style(), *child, ForRows); |
780 OwnPtr<GridSpan> columnPositions = resolveGridPositionsFromStyle(child,
ForColumns); | 765 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi
tionsFromStyle(*style(), *child, ForColumns); |
781 if (!rowPositions || !columnPositions) { | 766 if (!rowPositions || !columnPositions) { |
782 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() ==
ForColumns) ? columnPositions.get() : rowPositions.get(); | 767 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() ==
ForColumns) ? columnPositions.get() : rowPositions.get(); |
783 if (!majorAxisPositions) | 768 if (!majorAxisPositions) |
784 autoMajorAxisAutoGridItems.append(child); | 769 autoMajorAxisAutoGridItems.append(child); |
785 else | 770 else |
786 specifiedMajorAxisAutoGridItems.append(child); | 771 specifiedMajorAxisAutoGridItems.append(child); |
787 continue; | 772 continue; |
788 } | 773 } |
789 insertItemIntoGrid(child, GridCoordinate(*rowPositions, *columnPositions
)); | 774 insertItemIntoGrid(child, GridCoordinate(*rowPositions, *columnPositions
)); |
790 } | 775 } |
(...skipping 11 matching lines...) Expand all Loading... |
802 placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems); | 787 placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems); |
803 placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems); | 788 placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems); |
804 | 789 |
805 m_grid.shrinkToFit(); | 790 m_grid.shrinkToFit(); |
806 } | 791 } |
807 | 792 |
808 void RenderGrid::populateExplicitGridAndOrderIterator() | 793 void RenderGrid::populateExplicitGridAndOrderIterator() |
809 { | 794 { |
810 OrderIteratorPopulator populator(m_orderIterator); | 795 OrderIteratorPopulator populator(m_orderIterator); |
811 | 796 |
812 size_t maximumRowIndex = std::max<size_t>(1, explicitGridRowCount()); | 797 size_t maximumRowIndex = std::max<size_t>(1, GridResolvedPosition::explicitG
ridRowCount(*style())); |
813 size_t maximumColumnIndex = std::max<size_t>(1, explicitGridColumnCount()); | 798 size_t maximumColumnIndex = std::max<size_t>(1, GridResolvedPosition::explic
itGridColumnCount(*style())); |
814 | 799 |
815 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { | 800 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { |
816 populator.collectChild(child); | 801 populator.collectChild(child); |
817 | 802 |
818 // This function bypasses the cache (cachedGridCoordinate()) as it is us
ed to build it. | 803 // This function bypasses the cache (cachedGridCoordinate()) as it is us
ed to build it. |
819 OwnPtr<GridSpan> rowPositions = resolveGridPositionsFromStyle(child, For
Rows); | 804 OwnPtr<GridSpan> rowPositions = GridResolvedPosition::resolveGridPositio
nsFromStyle(*style(), *child, ForRows); |
820 OwnPtr<GridSpan> columnPositions = resolveGridPositionsFromStyle(child,
ForColumns); | 805 OwnPtr<GridSpan> columnPositions = GridResolvedPosition::resolveGridPosi
tionsFromStyle(*style(), *child, ForColumns); |
821 | 806 |
822 // |positions| is 0 if we need to run the auto-placement algorithm. Our
estimation ignores | 807 // |positions| is 0 if we need to run the auto-placement algorithm. Our
estimation ignores |
823 // this case as the auto-placement algorithm will grow the grid as neede
d. | 808 // this case as the auto-placement algorithm will grow the grid as neede
d. |
824 if (rowPositions) | 809 if (rowPositions) |
825 maximumRowIndex = std::max(maximumRowIndex, rowPositions->finalPosit
ionIndex + 1); | 810 maximumRowIndex = std::max<size_t>(maximumRowIndex, rowPositions->re
solvedFinalPosition.toInt() + 1); |
826 if (columnPositions) | 811 if (columnPositions) |
827 maximumColumnIndex = std::max(maximumColumnIndex, columnPositions->f
inalPositionIndex + 1); | 812 maximumColumnIndex = std::max<size_t>(maximumColumnIndex, columnPosi
tions->resolvedFinalPosition.toInt() + 1); |
828 } | 813 } |
829 | 814 |
830 m_grid.grow(maximumRowIndex); | 815 m_grid.grow(maximumRowIndex); |
831 for (size_t i = 0; i < m_grid.size(); ++i) | 816 for (size_t i = 0; i < m_grid.size(); ++i) |
832 m_grid[i].grow(maximumColumnIndex); | 817 m_grid[i].grow(maximumColumnIndex); |
833 } | 818 } |
834 | 819 |
835 void RenderGrid::placeSpecifiedMajorAxisItemsOnGrid(const Vector<RenderBox*>& au
toGridItems) | 820 void RenderGrid::placeSpecifiedMajorAxisItemsOnGrid(const Vector<RenderBox*>& au
toGridItems) |
836 { | 821 { |
837 for (size_t i = 0; i < autoGridItems.size(); ++i) { | 822 for (size_t i = 0; i < autoGridItems.size(); ++i) { |
838 OwnPtr<GridSpan> majorAxisPositions = resolveGridPositionsFromStyle(auto
GridItems[i], autoPlacementMajorAxisDirection()); | 823 OwnPtr<GridSpan> majorAxisPositions = GridResolvedPosition::resolveGridP
ositionsFromStyle(*style(), *autoGridItems[i], autoPlacementMajorAxisDirection()
); |
839 GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), majorAx
isPositions->initialPositionIndex); | 824 GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), majorAx
isPositions->resolvedInitialPosition.toInt()); |
840 if (OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridArea())
{ | 825 if (OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridArea())
{ |
841 insertItemIntoGrid(autoGridItems[i], emptyGridArea->rows.initialPosi
tionIndex, emptyGridArea->columns.initialPositionIndex); | 826 insertItemIntoGrid(autoGridItems[i], emptyGridArea->rows.resolvedIni
tialPosition, emptyGridArea->columns.resolvedInitialPosition); |
842 continue; | 827 continue; |
843 } | 828 } |
844 | 829 |
845 growGrid(autoPlacementMinorAxisDirection(), autoPlacementMinorAxisDirect
ion() == ForColumns ? m_grid[0].size() : m_grid.size()); | 830 growGrid(autoPlacementMinorAxisDirection(), autoPlacementMinorAxisDirect
ion() == ForColumns ? m_grid[0].size() : m_grid.size()); |
846 OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridArea(); | 831 OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridArea(); |
847 ASSERT(emptyGridArea); | 832 ASSERT(emptyGridArea); |
848 insertItemIntoGrid(autoGridItems[i], emptyGridArea->rows.initialPosition
Index, emptyGridArea->columns.initialPositionIndex); | 833 insertItemIntoGrid(autoGridItems[i], emptyGridArea->rows.resolvedInitial
Position, emptyGridArea->columns.resolvedInitialPosition); |
849 } | 834 } |
850 } | 835 } |
851 | 836 |
852 void RenderGrid::placeAutoMajorAxisItemsOnGrid(const Vector<RenderBox*>& autoGri
dItems) | 837 void RenderGrid::placeAutoMajorAxisItemsOnGrid(const Vector<RenderBox*>& autoGri
dItems) |
853 { | 838 { |
854 for (size_t i = 0; i < autoGridItems.size(); ++i) | 839 for (size_t i = 0; i < autoGridItems.size(); ++i) |
855 placeAutoMajorAxisItemOnGrid(autoGridItems[i]); | 840 placeAutoMajorAxisItemOnGrid(autoGridItems[i]); |
856 } | 841 } |
857 | 842 |
858 void RenderGrid::placeAutoMajorAxisItemOnGrid(RenderBox* gridItem) | 843 void RenderGrid::placeAutoMajorAxisItemOnGrid(RenderBox* gridItem) |
859 { | 844 { |
860 OwnPtr<GridSpan> minorAxisPositions = resolveGridPositionsFromStyle(gridItem
, autoPlacementMinorAxisDirection()); | 845 OwnPtr<GridSpan> minorAxisPositions = GridResolvedPosition::resolveGridPosit
ionsFromStyle(*style(), *gridItem, autoPlacementMinorAxisDirection()); |
861 ASSERT(!resolveGridPositionsFromStyle(gridItem, autoPlacementMajorAxisDirect
ion())); | 846 ASSERT(!GridResolvedPosition::resolveGridPositionsFromStyle(*style(), *gridI
tem, autoPlacementMajorAxisDirection())); |
862 size_t minorAxisIndex = 0; | 847 size_t minorAxisIndex = 0; |
863 if (minorAxisPositions) { | 848 if (minorAxisPositions) { |
864 minorAxisIndex = minorAxisPositions->initialPositionIndex; | 849 minorAxisIndex = minorAxisPositions->resolvedInitialPosition.toInt(); |
865 GridIterator iterator(m_grid, autoPlacementMinorAxisDirection(), minorAx
isIndex); | 850 GridIterator iterator(m_grid, autoPlacementMinorAxisDirection(), minorAx
isIndex); |
866 if (OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridArea())
{ | 851 if (OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridArea())
{ |
867 insertItemIntoGrid(gridItem, emptyGridArea->rows.initialPositionInde
x, emptyGridArea->columns.initialPositionIndex); | 852 insertItemIntoGrid(gridItem, emptyGridArea->rows.resolvedInitialPosi
tion, emptyGridArea->columns.resolvedInitialPosition); |
868 return; | 853 return; |
869 } | 854 } |
870 } else { | 855 } else { |
871 const size_t endOfMajorAxis = (autoPlacementMajorAxisDirection() == ForC
olumns) ? gridColumnCount() : gridRowCount(); | 856 const size_t endOfMajorAxis = (autoPlacementMajorAxisDirection() == ForC
olumns) ? gridColumnCount() : gridRowCount(); |
872 for (size_t majorAxisIndex = 0; majorAxisIndex < endOfMajorAxis; ++major
AxisIndex) { | 857 for (size_t majorAxisIndex = 0; majorAxisIndex < endOfMajorAxis; ++major
AxisIndex) { |
873 GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), maj
orAxisIndex); | 858 GridIterator iterator(m_grid, autoPlacementMajorAxisDirection(), maj
orAxisIndex); |
874 if (OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridAre
a()) { | 859 if (OwnPtr<GridCoordinate> emptyGridArea = iterator.nextEmptyGridAre
a()) { |
875 insertItemIntoGrid(gridItem, emptyGridArea->rows.initialPosition
Index, emptyGridArea->columns.initialPositionIndex); | 860 insertItemIntoGrid(gridItem, emptyGridArea->rows.resolvedInitial
Position, emptyGridArea->columns.resolvedInitialPosition); |
876 return; | 861 return; |
877 } | 862 } |
878 } | 863 } |
879 } | 864 } |
880 | 865 |
881 // We didn't find an empty grid area so we need to create an extra major axi
s line and insert our gridItem in it. | 866 // We didn't find an empty grid area so we need to create an extra major axi
s line and insert our gridItem in it. |
882 const size_t columnIndex = (autoPlacementMajorAxisDirection() == ForColumns)
? m_grid[0].size() : minorAxisIndex; | 867 const size_t columnIndex = (autoPlacementMajorAxisDirection() == ForColumns)
? m_grid[0].size() : minorAxisIndex; |
883 const size_t rowIndex = (autoPlacementMajorAxisDirection() == ForColumns) ?
minorAxisIndex : m_grid.size(); | 868 const size_t rowIndex = (autoPlacementMajorAxisDirection() == ForColumns) ?
minorAxisIndex : m_grid.size(); |
884 growGrid(autoPlacementMajorAxisDirection(), autoPlacementMajorAxisDirection(
) == ForColumns ? m_grid[0].size() : m_grid.size()); | 869 growGrid(autoPlacementMajorAxisDirection(), autoPlacementMajorAxisDirection(
) == ForColumns ? m_grid[0].size() : m_grid.size()); |
885 insertItemIntoGrid(gridItem, rowIndex, columnIndex); | 870 insertItemIntoGrid(gridItem, rowIndex, columnIndex); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 | 923 |
939 LayoutRect oldChildRect = child->frameRect(); | 924 LayoutRect oldChildRect = child->frameRect(); |
940 | 925 |
941 // FIXME: Grid items should stretch to fill their cells. Once we | 926 // FIXME: Grid items should stretch to fill their cells. Once we |
942 // implement grid-{column,row}-align, we can also shrink to fit. For | 927 // implement grid-{column,row}-align, we can also shrink to fit. For |
943 // now, just size as if we were a regular child. | 928 // now, just size as if we were a regular child. |
944 child->layoutIfNeeded(); | 929 child->layoutIfNeeded(); |
945 | 930 |
946 #ifndef NDEBUG | 931 #ifndef NDEBUG |
947 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 932 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
948 ASSERT(coordinate.columns.initialPositionIndex < sizingData.columnTracks
.size()); | 933 ASSERT(coordinate.columns.resolvedInitialPosition.toInt() < sizingData.c
olumnTracks.size()); |
949 ASSERT(coordinate.rows.initialPositionIndex < sizingData.rowTracks.size(
)); | 934 ASSERT(coordinate.rows.resolvedInitialPosition.toInt() < sizingData.rowT
racks.size()); |
950 #endif | 935 #endif |
951 child->setLogicalLocation(findChildLogicalPosition(child)); | 936 child->setLogicalLocation(findChildLogicalPosition(child)); |
952 | 937 |
953 // Keep track of children overflowing their grid area as we might need t
o paint them even if the grid-area is | 938 // Keep track of children overflowing their grid area as we might need t
o paint them even if the grid-area is |
954 // not visible | 939 // not visible |
955 if (child->logicalHeight() > overrideContainingBlockContentLogicalHeight | 940 if (child->logicalHeight() > overrideContainingBlockContentLogicalHeight |
956 || child->logicalWidth() > overrideContainingBlockContentLogicalWidt
h) | 941 || child->logicalWidth() > overrideContainingBlockContentLogicalWidt
h) |
957 m_gridItemsOverflowingGridArea.append(child); | 942 m_gridItemsOverflowingGridArea.append(child); |
958 | 943 |
959 // If the child moved, we have to repaint it as well as any floating/pos
itioned | 944 // If the child moved, we have to repaint it as well as any floating/pos
itioned |
(...skipping 10 matching lines...) Expand all Loading... |
970 | 955 |
971 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); | 956 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); |
972 } | 957 } |
973 | 958 |
974 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox* gridItem) const | 959 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox* gridItem) const |
975 { | 960 { |
976 ASSERT(m_gridItemCoordinate.contains(gridItem)); | 961 ASSERT(m_gridItemCoordinate.contains(gridItem)); |
977 return m_gridItemCoordinate.get(gridItem); | 962 return m_gridItemCoordinate.get(gridItem); |
978 } | 963 } |
979 | 964 |
980 GridSpan RenderGrid::resolveGridPositionsFromAutoPlacementPosition(const RenderB
ox*, GridTrackSizingDirection, size_t initialPosition) const | |
981 { | |
982 // FIXME: We don't support spanning with auto positions yet. Once we do, thi
s is wrong. Also we should make | |
983 // sure the grid can accomodate the new item as we only grow 1 position in a
given direction. | |
984 return GridSpan(initialPosition, initialPosition); | |
985 } | |
986 | |
987 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionsFromStyle(const RenderBox*
gridItem, GridTrackSizingDirection direction) const | |
988 { | |
989 GridPosition initialPosition = (direction == ForColumns) ? gridItem->style()
->gridColumnStart() : gridItem->style()->gridRowStart(); | |
990 const GridPositionSide initialPositionSide = (direction == ForColumns) ? Col
umnStartSide : RowStartSide; | |
991 GridPosition finalPosition = (direction == ForColumns) ? gridItem->style()->
gridColumnEnd() : gridItem->style()->gridRowEnd(); | |
992 const GridPositionSide finalPositionSide = (direction == ForColumns) ? Colum
nEndSide : RowEndSide; | |
993 | |
994 // We must handle the placement error handling code here instead of in the S
tyleAdjuster because we don't want to | |
995 // overwrite the specified values. | |
996 if (initialPosition.isSpan() && finalPosition.isSpan()) | |
997 finalPosition.setAutoPosition(); | |
998 | |
999 if (initialPosition.isNamedGridArea() && !style()->namedGridArea().contains(
initialPosition.namedGridLine())) | |
1000 initialPosition.setAutoPosition(); | |
1001 | |
1002 if (finalPosition.isNamedGridArea() && !style()->namedGridArea().contains(fi
nalPosition.namedGridLine())) | |
1003 finalPosition.setAutoPosition(); | |
1004 | |
1005 if (initialPosition.shouldBeResolvedAgainstOppositePosition() && finalPositi
on.shouldBeResolvedAgainstOppositePosition()) { | |
1006 if (style()->gridAutoFlow() == AutoFlowNone) | |
1007 return adoptPtr(new GridSpan(0, 0)); | |
1008 | |
1009 // We can't get our grid positions without running the auto placement al
gorithm. | |
1010 return nullptr; | |
1011 } | |
1012 | |
1013 if (initialPosition.shouldBeResolvedAgainstOppositePosition()) { | |
1014 // Infer the position from the final position ('auto / 1' or 'span 2 / 3
' case). | |
1015 const size_t finalResolvedPosition = resolveGridPositionFromStyle(finalP
osition, finalPositionSide); | |
1016 return resolveGridPositionAgainstOppositePosition(finalResolvedPosition,
initialPosition, initialPositionSide); | |
1017 } | |
1018 | |
1019 if (finalPosition.shouldBeResolvedAgainstOppositePosition()) { | |
1020 // Infer our position from the initial position ('1 / auto' or '3 / span
2' case). | |
1021 const size_t initialResolvedPosition = resolveGridPositionFromStyle(init
ialPosition, initialPositionSide); | |
1022 return resolveGridPositionAgainstOppositePosition(initialResolvedPositio
n, finalPosition, finalPositionSide); | |
1023 } | |
1024 | |
1025 size_t resolvedInitialPosition = resolveGridPositionFromStyle(initialPositio
n, initialPositionSide); | |
1026 size_t resolvedFinalPosition = resolveGridPositionFromStyle(finalPosition, f
inalPositionSide); | |
1027 | |
1028 // If 'grid-after' specifies a line at or before that specified by 'grid-bef
ore', it computes to 'span 1'. | |
1029 if (resolvedFinalPosition < resolvedInitialPosition) | |
1030 resolvedFinalPosition = resolvedInitialPosition; | |
1031 | |
1032 return adoptPtr(new GridSpan(resolvedInitialPosition, resolvedFinalPosition)
); | |
1033 } | |
1034 | |
1035 size_t RenderGrid::resolveNamedGridLinePositionFromStyle(const GridPosition& pos
ition, GridPositionSide side) const | |
1036 { | |
1037 ASSERT(!position.namedGridLine().isNull()); | |
1038 | |
1039 const NamedGridLinesMap& gridLinesNames = (side == ColumnStartSide || side =
= ColumnEndSide) ? style()->namedGridColumnLines() : style()->namedGridRowLines(
); | |
1040 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri
dLine()); | |
1041 if (it == gridLinesNames.end()) { | |
1042 if (position.isPositive()) | |
1043 return 0; | |
1044 const size_t lastLine = explicitGridSizeForSide(side); | |
1045 return GridPosition::adjustGridPositionForSide(lastLine, side); | |
1046 } | |
1047 | |
1048 size_t namedGridLineIndex; | |
1049 if (position.isPositive()) | |
1050 namedGridLineIndex = std::min<size_t>(position.integerPosition(), it->va
lue.size()) - 1; | |
1051 else | |
1052 namedGridLineIndex = std::max<int>(it->value.size() - abs(position.integ
erPosition()), 0); | |
1053 return GridPosition::adjustGridPositionForSide(it->value[namedGridLineIndex]
, side); | |
1054 } | |
1055 | |
1056 size_t RenderGrid::resolveGridPositionFromStyle(const GridPosition& position, Gr
idPositionSide side) const | |
1057 { | |
1058 switch (position.type()) { | |
1059 case ExplicitPosition: { | |
1060 ASSERT(position.integerPosition()); | |
1061 | |
1062 if (!position.namedGridLine().isNull()) | |
1063 return resolveNamedGridLinePositionFromStyle(position, side); | |
1064 | |
1065 // Handle <integer> explicit position. | |
1066 if (position.isPositive()) | |
1067 return GridPosition::adjustGridPositionForSide(position.integerPosit
ion() - 1, side); | |
1068 | |
1069 size_t resolvedPosition = abs(position.integerPosition()) - 1; | |
1070 const size_t endOfTrack = explicitGridSizeForSide(side); | |
1071 | |
1072 // Per http://lists.w3.org/Archives/Public/www-style/2013Mar/0589.html,
we clamp negative value to the first line. | |
1073 if (endOfTrack < resolvedPosition) | |
1074 return 0; | |
1075 | |
1076 return GridPosition::adjustGridPositionForSide(endOfTrack - resolvedPosi
tion, side); | |
1077 } | |
1078 case NamedGridAreaPosition: | |
1079 { | |
1080 NamedGridAreaMap::const_iterator it = style()->namedGridArea().find(posi
tion.namedGridLine()); | |
1081 // Unknown grid area should have been computed to 'auto' by now. | |
1082 ASSERT_WITH_SECURITY_IMPLICATION(it != style()->namedGridArea().end()); | |
1083 const GridCoordinate& gridAreaCoordinate = it->value; | |
1084 switch (side) { | |
1085 case ColumnStartSide: | |
1086 return gridAreaCoordinate.columns.initialPositionIndex; | |
1087 case ColumnEndSide: | |
1088 return gridAreaCoordinate.columns.finalPositionIndex; | |
1089 case RowStartSide: | |
1090 return gridAreaCoordinate.rows.initialPositionIndex; | |
1091 case RowEndSide: | |
1092 return gridAreaCoordinate.rows.finalPositionIndex; | |
1093 } | |
1094 ASSERT_NOT_REACHED(); | |
1095 return 0; | |
1096 } | |
1097 case AutoPosition: | |
1098 case SpanPosition: | |
1099 // 'auto' and span depend on the opposite position for resolution (e.g.
grid-row: auto / 1 or grid-column: span 3 / "myHeader"). | |
1100 ASSERT_NOT_REACHED(); | |
1101 return 0; | |
1102 } | |
1103 ASSERT_NOT_REACHED(); | |
1104 return 0; | |
1105 } | |
1106 | |
1107 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionAgainstOppositePosition(size
_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side
) const | |
1108 { | |
1109 if (position.isAuto()) | |
1110 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); | |
1111 | |
1112 ASSERT(position.isSpan()); | |
1113 ASSERT(position.spanPosition() > 0); | |
1114 | |
1115 if (!position.namedGridLine().isNull()) { | |
1116 // span 2 'c' -> we need to find the appropriate grid line before / afte
r our opposite position. | |
1117 return resolveNamedGridLinePositionAgainstOppositePosition(resolvedOppos
itePosition, position, side); | |
1118 } | |
1119 | |
1120 return GridSpan::createWithSpanAgainstOpposite(resolvedOppositePosition, pos
ition, side); | |
1121 } | |
1122 | |
1123 PassOwnPtr<GridSpan> RenderGrid::resolveNamedGridLinePositionAgainstOppositePosi
tion(size_t resolvedOppositePosition, const GridPosition& position, GridPosition
Side side) const | |
1124 { | |
1125 ASSERT(position.isSpan()); | |
1126 ASSERT(!position.namedGridLine().isNull()); | |
1127 // Negative positions are not allowed per the specification and should have
been handled during parsing. | |
1128 ASSERT(position.spanPosition() > 0); | |
1129 | |
1130 const NamedGridLinesMap& gridLinesNames = (side == ColumnStartSide || side =
= ColumnEndSide) ? style()->namedGridColumnLines() : style()->namedGridRowLines(
); | |
1131 NamedGridLinesMap::const_iterator it = gridLinesNames.find(position.namedGri
dLine()); | |
1132 | |
1133 // 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). | |
1134 // See http://lists.w3.org/Archives/Public/www-style/2013Jun/0394.html. | |
1135 if (it == gridLinesNames.end()) | |
1136 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); | |
1137 | |
1138 return GridSpan::createWithNamedSpanAgainstOpposite(resolvedOppositePosition
, position, side, it->value); | |
1139 } | |
1140 | |
1141 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox* child, GridTrack
SizingDirection direction, const Vector<GridTrack>& tracks) const | 965 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox* child, GridTrack
SizingDirection direction, const Vector<GridTrack>& tracks) const |
1142 { | 966 { |
1143 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 967 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
1144 const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coor
dinate.rows; | 968 const GridSpan& span = (direction == ForColumns) ? coordinate.columns : coor
dinate.rows; |
1145 LayoutUnit gridAreaBreadth = 0; | 969 LayoutUnit gridAreaBreadth = 0; |
1146 for (size_t trackIndex = span.initialPositionIndex; trackIndex <= span.final
PositionIndex; ++trackIndex) | 970 for (GridResolvedPosition trackPosition = span.resolvedInitialPosition; trac
kPosition <= span.resolvedFinalPosition; ++trackPosition) |
1147 gridAreaBreadth += tracks[trackIndex].m_usedBreadth; | 971 gridAreaBreadth += tracks[trackPosition.toInt()].m_usedBreadth; |
1148 return gridAreaBreadth; | 972 return gridAreaBreadth; |
1149 } | 973 } |
1150 | 974 |
1151 void RenderGrid::populateGridPositions(const GridSizingData& sizingData) | 975 void RenderGrid::populateGridPositions(const GridSizingData& sizingData) |
1152 { | 976 { |
1153 m_columnPositions.resize(sizingData.columnTracks.size() + 1); | 977 m_columnPositions.resize(sizingData.columnTracks.size() + 1); |
1154 m_columnPositions[0] = borderAndPaddingStart(); | 978 m_columnPositions[0] = borderAndPaddingStart(); |
1155 for (size_t i = 0; i < m_columnPositions.size() - 1; ++i) | 979 for (size_t i = 0; i < m_columnPositions.size() - 1; ++i) |
1156 m_columnPositions[i + 1] = m_columnPositions[i] + sizingData.columnTrack
s[i].m_usedBreadth; | 980 m_columnPositions[i + 1] = m_columnPositions[i] + sizingData.columnTrack
s[i].m_usedBreadth; |
1157 | 981 |
1158 m_rowPositions.resize(sizingData.rowTracks.size() + 1); | 982 m_rowPositions.resize(sizingData.rowTracks.size() + 1); |
1159 m_rowPositions[0] = borderAndPaddingBefore(); | 983 m_rowPositions[0] = borderAndPaddingBefore(); |
1160 for (size_t i = 0; i < m_rowPositions.size() - 1; ++i) | 984 for (size_t i = 0; i < m_rowPositions.size() - 1; ++i) |
1161 m_rowPositions[i + 1] = m_rowPositions[i] + sizingData.rowTracks[i].m_us
edBreadth; | 985 m_rowPositions[i + 1] = m_rowPositions[i] + sizingData.rowTracks[i].m_us
edBreadth; |
1162 } | 986 } |
1163 | 987 |
1164 LayoutUnit RenderGrid::startOfColumnForChild(const RenderBox* child) const | 988 LayoutUnit RenderGrid::startOfColumnForChild(const RenderBox* child) const |
1165 { | 989 { |
1166 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 990 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
1167 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.initialPosit
ionIndex]; | 991 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit
ialPosition.toInt()]; |
1168 // The grid items should be inside the grid container's border box, that's w
hy they need to be shifted. | 992 // The grid items should be inside the grid container's border box, that's w
hy they need to be shifted. |
1169 // FIXME: This should account for the grid item's <overflow-position>. | 993 // FIXME: This should account for the grid item's <overflow-position>. |
1170 return startOfColumn + marginStartForChild(child); | 994 return startOfColumn + marginStartForChild(child); |
1171 } | 995 } |
1172 | 996 |
1173 LayoutUnit RenderGrid::endOfColumnForChild(const RenderBox* child) const | 997 LayoutUnit RenderGrid::endOfColumnForChild(const RenderBox* child) const |
1174 { | 998 { |
1175 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 999 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
1176 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.initialPosit
ionIndex]; | 1000 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit
ialPosition.toInt()]; |
1177 // The grid items should be inside the grid container's border box, that's w
hy they need to be shifted. | 1001 // The grid items should be inside the grid container's border box, that's w
hy they need to be shifted. |
1178 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); | 1002 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); |
1179 | 1003 |
1180 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.finalPositionI
ndex + 1]; | 1004 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP
osition.toInt() + 1]; |
1181 // FIXME: This should account for the grid item's <overflow-position>. | 1005 // FIXME: This should account for the grid item's <overflow-position>. |
1182 return columnPosition + std::max<LayoutUnit>(0, endOfColumn - m_columnPositi
ons[coordinate.columns.initialPositionIndex] - child->logicalWidth()); | 1006 return columnPosition + std::max<LayoutUnit>(0, endOfColumn - m_columnPositi
ons[coordinate.columns.resolvedInitialPosition.toInt()] - child->logicalWidth())
; |
1183 } | 1007 } |
1184 | 1008 |
1185 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerStart(const RenderB
ox* child) const | 1009 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerStart(const RenderB
ox* child) const |
1186 { | 1010 { |
1187 if (style()->isLeftToRightDirection()) | 1011 if (style()->isLeftToRightDirection()) |
1188 return startOfColumnForChild(child); | 1012 return startOfColumnForChild(child); |
1189 | 1013 |
1190 return endOfColumnForChild(child); | 1014 return endOfColumnForChild(child); |
1191 } | 1015 } |
1192 | 1016 |
1193 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerEnd(const RenderBox
* child) const | 1017 LayoutUnit RenderGrid::columnPositionAlignedWithGridContainerEnd(const RenderBox
* child) const |
1194 { | 1018 { |
1195 if (!style()->isLeftToRightDirection()) | 1019 if (!style()->isLeftToRightDirection()) |
1196 return startOfColumnForChild(child); | 1020 return startOfColumnForChild(child); |
1197 | 1021 |
1198 return endOfColumnForChild(child); | 1022 return endOfColumnForChild(child); |
1199 } | 1023 } |
1200 | 1024 |
1201 LayoutUnit RenderGrid::centeredColumnPositionForChild(const RenderBox* child) co
nst | 1025 LayoutUnit RenderGrid::centeredColumnPositionForChild(const RenderBox* child) co
nst |
1202 { | 1026 { |
1203 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1027 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
1204 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.initialPosit
ionIndex]; | 1028 LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInit
ialPosition.toInt()]; |
1205 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.finalPositionI
ndex + 1]; | 1029 LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalP
osition.toInt() + 1]; |
1206 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); | 1030 LayoutUnit columnPosition = startOfColumn + marginStartForChild(child); |
1207 return columnPosition + std::max<LayoutUnit>(0, endOfColumn - startOfColumn
- child->logicalWidth()) / 2; | 1031 return columnPosition + std::max<LayoutUnit>(0, endOfColumn - startOfColumn
- child->logicalWidth()) / 2; |
1208 } | 1032 } |
1209 | 1033 |
1210 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox* child) const | 1034 LayoutUnit RenderGrid::columnPositionForChild(const RenderBox* child) const |
1211 { | 1035 { |
1212 ItemPosition childJustifySelf = child->style()->justifySelf(); | 1036 ItemPosition childJustifySelf = child->style()->justifySelf(); |
1213 switch (childJustifySelf) { | 1037 switch (childJustifySelf) { |
1214 case ItemPositionSelfStart: | 1038 case ItemPositionSelfStart: |
1215 // self-start is based on the child's direction. That's why we need to c
heck against the grid container's direction. | 1039 // self-start is based on the child's direction. That's why we need to c
heck against the grid container's direction. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 | 1088 |
1265 ASSERT_NOT_REACHED(); | 1089 ASSERT_NOT_REACHED(); |
1266 return 0; | 1090 return 0; |
1267 } | 1091 } |
1268 | 1092 |
1269 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox* child) const | 1093 LayoutUnit RenderGrid::rowPositionForChild(const RenderBox* child) const |
1270 { | 1094 { |
1271 const GridCoordinate& coordinate = cachedGridCoordinate(child); | 1095 const GridCoordinate& coordinate = cachedGridCoordinate(child); |
1272 | 1096 |
1273 // The grid items should be inside the grid container's border box, that's w
hy they need to be shifted. | 1097 // The grid items should be inside the grid container's border box, that's w
hy they need to be shifted. |
1274 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.initialPositionIndex]
; | 1098 LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPositi
on.toInt()]; |
1275 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); | 1099 LayoutUnit rowPosition = startOfRow + marginBeforeForChild(child); |
1276 | 1100 |
1277 // FIXME: This function should account for 'align-self'. | 1101 // FIXME: This function should account for 'align-self'. |
1278 | 1102 |
1279 return rowPosition; | 1103 return rowPosition; |
1280 } | 1104 } |
1281 | 1105 |
1282 LayoutPoint RenderGrid::findChildLogicalPosition(const RenderBox* child) const | 1106 LayoutPoint RenderGrid::findChildLogicalPosition(const RenderBox* child) const |
1283 { | 1107 { |
1284 return LayoutPoint(columnPositionForChild(child), rowPositionForChild(child)
); | 1108 return LayoutPoint(columnPositionForChild(child), rowPositionForChild(child)
); |
(...skipping 14 matching lines...) Expand all Loading... |
1299 | 1123 |
1300 class GridCoordinateSorter { | 1124 class GridCoordinateSorter { |
1301 public: | 1125 public: |
1302 GridCoordinateSorter(RenderGrid* renderer) : m_renderer(renderer) { } | 1126 GridCoordinateSorter(RenderGrid* renderer) : m_renderer(renderer) { } |
1303 | 1127 |
1304 bool operator()(const RenderBox* firstItem, const RenderBox* secondItem) con
st | 1128 bool operator()(const RenderBox* firstItem, const RenderBox* secondItem) con
st |
1305 { | 1129 { |
1306 GridCoordinate first = m_renderer->cachedGridCoordinate(firstItem); | 1130 GridCoordinate first = m_renderer->cachedGridCoordinate(firstItem); |
1307 GridCoordinate second = m_renderer->cachedGridCoordinate(secondItem); | 1131 GridCoordinate second = m_renderer->cachedGridCoordinate(secondItem); |
1308 | 1132 |
1309 if (first.rows.initialPositionIndex < second.rows.initialPositionIndex) | 1133 if (first.rows.resolvedInitialPosition < second.rows.resolvedInitialPosi
tion) |
1310 return true; | 1134 return true; |
1311 if (first.rows.initialPositionIndex > second.rows.initialPositionIndex) | 1135 if (first.rows.resolvedInitialPosition > second.rows.resolvedInitialPosi
tion) |
1312 return false; | 1136 return false; |
1313 return first.columns.finalPositionIndex < second.columns.finalPositionIn
dex; | 1137 return first.columns.resolvedFinalPosition < second.columns.resolvedFina
lPosition; |
1314 } | 1138 } |
1315 private: | 1139 private: |
1316 RenderGrid* m_renderer; | 1140 RenderGrid* m_renderer; |
1317 }; | 1141 }; |
1318 | 1142 |
1319 static inline bool isInSameRowBeforeDirtyArea(const GridCoordinate& coordinate,
size_t row, const GridSpan& dirtiedColumns) | 1143 static inline bool isInSameRowBeforeDirtyArea(const GridCoordinate& coordinate,
const GridResolvedPosition& row, const GridSpan& dirtiedColumns) |
1320 { | 1144 { |
1321 return coordinate.rows.initialPositionIndex == row && coordinate.columns.ini
tialPositionIndex < dirtiedColumns.initialPositionIndex; | 1145 return coordinate.rows.resolvedInitialPosition == row && coordinate.columns.
resolvedInitialPosition < dirtiedColumns.resolvedInitialPosition; |
1322 } | 1146 } |
1323 | 1147 |
1324 static inline bool isInSameRowAfterDirtyArea(const GridCoordinate& coordinate, s
ize_t row, const GridSpan& dirtiedColumns) | 1148 static inline bool isInSameRowAfterDirtyArea(const GridCoordinate& coordinate, c
onst GridResolvedPosition& row, const GridSpan& dirtiedColumns) |
1325 { | 1149 { |
1326 return coordinate.rows.initialPositionIndex == row && coordinate.columns.ini
tialPositionIndex >= dirtiedColumns.finalPositionIndex; | 1150 return coordinate.rows.resolvedInitialPosition == row && coordinate.columns.
resolvedInitialPosition >= dirtiedColumns.resolvedFinalPosition; |
1327 } | 1151 } |
1328 | 1152 |
1329 static inline bool rowIsBeforeDirtyArea(const GridCoordinate& coordinate, const
GridSpan& dirtiedRows) | 1153 static inline bool rowIsBeforeDirtyArea(const GridCoordinate& coordinate, const
GridSpan& dirtiedRows) |
1330 { | 1154 { |
1331 return coordinate.rows.initialPositionIndex < dirtiedRows.initialPositionInd
ex; | 1155 return coordinate.rows.resolvedInitialPosition < dirtiedRows.resolvedInitial
Position; |
1332 } | 1156 } |
1333 | 1157 |
1334 void RenderGrid::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) | 1158 void RenderGrid::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) |
1335 { | 1159 { |
1336 ASSERT_WITH_SECURITY_IMPLICATION(!gridIsDirty()); | 1160 ASSERT_WITH_SECURITY_IMPLICATION(!gridIsDirty()); |
1337 | 1161 |
1338 LayoutRect localRepaintRect = paintInfo.rect; | 1162 LayoutRect localRepaintRect = paintInfo.rect; |
1339 localRepaintRect.moveBy(-paintOffset); | 1163 localRepaintRect.moveBy(-paintOffset); |
1340 | 1164 |
1341 GridSpan dirtiedColumns = dirtiedGridAreas(m_columnPositions, localRepaintRe
ct.x(), localRepaintRect.maxX()); | 1165 GridSpan dirtiedColumns = dirtiedGridAreas(m_columnPositions, localRepaintRe
ct.x(), localRepaintRect.maxX()); |
1342 GridSpan dirtiedRows = dirtiedGridAreas(m_rowPositions, localRepaintRect.y()
, localRepaintRect.maxY()); | 1166 GridSpan dirtiedRows = dirtiedGridAreas(m_rowPositions, localRepaintRect.y()
, localRepaintRect.maxY()); |
1343 | 1167 |
1344 // Sort the overflowing grid items according to their positions in the grid.
We collect items during the layout | 1168 // Sort the overflowing grid items according to their positions in the grid.
We collect items during the layout |
1345 // process following DOM's order but we have to paint following grid's. | 1169 // process following DOM's order but we have to paint following grid's. |
1346 std::stable_sort(m_gridItemsOverflowingGridArea.begin(), m_gridItemsOverflow
ingGridArea.end(), GridCoordinateSorter(this)); | 1170 std::stable_sort(m_gridItemsOverflowingGridArea.begin(), m_gridItemsOverflow
ingGridArea.end(), GridCoordinateSorter(this)); |
1347 | 1171 |
1348 OrderIterator paintIterator(this); | 1172 OrderIterator paintIterator(this); |
1349 { | 1173 { |
1350 OrderIteratorPopulator populator(paintIterator); | 1174 OrderIteratorPopulator populator(paintIterator); |
1351 Vector<RenderBox*>::const_iterator overflowIterator = m_gridItemsOverflo
wingGridArea.begin(); | 1175 Vector<RenderBox*>::const_iterator overflowIterator = m_gridItemsOverflo
wingGridArea.begin(); |
1352 Vector<RenderBox*>::const_iterator end = m_gridItemsOverflowingGridArea.
end(); | 1176 Vector<RenderBox*>::const_iterator end = m_gridItemsOverflowingGridArea.
end(); |
1353 | 1177 |
1354 for (; overflowIterator != end && rowIsBeforeDirtyArea(cachedGridCoordin
ate(*overflowIterator), dirtiedRows); ++overflowIterator) { | 1178 for (; overflowIterator != end && rowIsBeforeDirtyArea(cachedGridCoordin
ate(*overflowIterator), dirtiedRows); ++overflowIterator) { |
1355 if ((*overflowIterator)->frameRect().intersects(localRepaintRect)) | 1179 if ((*overflowIterator)->frameRect().intersects(localRepaintRect)) |
1356 populator.storeChild(*overflowIterator); | 1180 populator.storeChild(*overflowIterator); |
1357 } | 1181 } |
1358 | 1182 |
1359 for (size_t row = dirtiedRows.initialPositionIndex; row < dirtiedRows.fi
nalPositionIndex; ++row) { | 1183 for (GridResolvedPosition row = dirtiedRows.resolvedInitialPosition; row
< dirtiedRows.resolvedFinalPosition; ++row) { |
1360 | 1184 |
1361 for (; overflowIterator != end && isInSameRowBeforeDirtyArea(cachedG
ridCoordinate(*overflowIterator), row, dirtiedColumns); ++overflowIterator) { | 1185 for (; overflowIterator != end && isInSameRowBeforeDirtyArea(cachedG
ridCoordinate(*overflowIterator), row, dirtiedColumns); ++overflowIterator) { |
1362 if ((*overflowIterator)->frameRect().intersects(localRepaintRect
)) | 1186 if ((*overflowIterator)->frameRect().intersects(localRepaintRect
)) |
1363 populator.storeChild(*overflowIterator); | 1187 populator.storeChild(*overflowIterator); |
1364 } | 1188 } |
1365 | 1189 |
1366 for (size_t column = dirtiedColumns.initialPositionIndex; column < d
irtiedColumns.finalPositionIndex; ++column) { | 1190 for (GridResolvedPosition column = dirtiedColumns.resolvedInitialPos
ition; column < dirtiedColumns.resolvedFinalPosition; ++column) { |
1367 const Vector<RenderBox*, 1>& children = m_grid[row][column]; | 1191 const Vector<RenderBox*, 1>& children = m_grid[row.toInt()][colu
mn.toInt()]; |
1368 // FIXME: If we start adding spanning children in all grid areas
they span, this | 1192 // FIXME: If we start adding spanning children in all grid areas
they span, this |
1369 // would make us paint them several times, which is wrong! | 1193 // would make us paint them several times, which is wrong! |
1370 for (size_t j = 0; j < children.size(); ++j) { | 1194 for (size_t j = 0; j < children.size(); ++j) { |
1371 populator.storeChild(children[j]); | 1195 populator.storeChild(children[j]); |
1372 // Do not paint overflowing grid items twice. | 1196 // Do not paint overflowing grid items twice. |
1373 if (overflowIterator != end && *overflowIterator == children
[j]) | 1197 if (overflowIterator != end && *overflowIterator == children
[j]) |
1374 ++overflowIterator; | 1198 ++overflowIterator; |
1375 } | 1199 } |
1376 } | 1200 } |
1377 | 1201 |
(...skipping 20 matching lines...) Expand all Loading... |
1398 if (isOutOfFlowPositioned()) | 1222 if (isOutOfFlowPositioned()) |
1399 return "RenderGrid (positioned)"; | 1223 return "RenderGrid (positioned)"; |
1400 if (isAnonymous()) | 1224 if (isAnonymous()) |
1401 return "RenderGrid (generated)"; | 1225 return "RenderGrid (generated)"; |
1402 if (isRelPositioned()) | 1226 if (isRelPositioned()) |
1403 return "RenderGrid (relative positioned)"; | 1227 return "RenderGrid (relative positioned)"; |
1404 return "RenderGrid"; | 1228 return "RenderGrid"; |
1405 } | 1229 } |
1406 | 1230 |
1407 } // namespace WebCore | 1231 } // namespace WebCore |
OLD | NEW |