Changeset 145378 in webkit
- Timestamp:
- Mar 11, 2013 12:07:54 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r145364 r145378 1 2013-03-11 Julien Chaffraix <jchaffraix@webkit.org> 2 3 [CSS Grid Layout] Handle spanning grid items over specified grid tracks 4 https://bugs.webkit.org/show_bug.cgi?id=111918 5 6 Reviewed by Tony Chang. 7 8 * fast/css-grid-layout/grid-item-spanning-resolution-expected.txt: 9 We now pass all the tests. 10 1 11 2013-03-11 Christian Biesinger <cbiesinger@chromium.org> 2 12 -
trunk/LayoutTests/fast/css-grid-layout/grid-item-spanning-resolution-expected.txt
r145240 r145378 1 1 Test that spannig rows / columns inside percentage sized grid areas get properly sized. 2 2 3 FAIL: 4 Expected 400 for width, but got 160. 5 6 <div class="grid" data-expected-width="400" data-expected-height="300"> 7 <div class="sizedToGridArea firstRowBothColumn" data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="90"></div> 8 </div> 9 FAIL: 10 Expected 400 for width, but got 160. 11 12 <div class="grid" data-expected-width="400" data-expected-height="300"> 13 <div class="sizedToGridArea secondRowBothColumn" data-offset-x="0" data-offset-y="90" data-expected-width="400" data-expected-height="210"></div> 14 </div> 15 FAIL: 16 Expected 300 for height, but got 90. 17 18 <div class="grid" data-expected-width="400" data-expected-height="300"> 19 <div class="sizedToGridArea bothRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="160" data-expected-height="300"></div> 20 </div> 21 FAIL: 22 Expected 300 for height, but got 90. 23 24 <div class="grid" data-expected-width="400" data-expected-height="300"> 25 <div class="sizedToGridArea bothRowSecondColumn" data-offset-x="160" data-offset-y="0" data-expected-width="240" data-expected-height="300"></div> 26 </div> 27 FAIL: 28 Expected 400 for width, but got 160. 29 Expected 300 for height, but got 90. 30 31 <div class="grid" data-expected-width="400" data-expected-height="300"> 32 <div class="sizedToGridArea bothRowBothColumn" data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="300"></div> 33 </div> 3 PASS 4 PASS 5 PASS 6 PASS 7 PASS 34 8 PASS 35 9 PASS -
trunk/Source/WebCore/ChangeLog
r145377 r145378 1 2013-03-11 Julien Chaffraix <jchaffraix@webkit.org> 2 3 [CSS Grid Layout] Handle spanning grid items over specified grid tracks 4 https://bugs.webkit.org/show_bug.cgi?id=111918 5 6 Reviewed by Tony Chang. 7 8 This change updates the containing block override logic to handle multiple 9 spanned tracks. This makes the multiple specified grid tracks case work and 10 will enable us to handle the minmax case once the computation logic has been 11 updated. 12 13 Test: fast/css-grid-layout/grid-item-spanning-resolution.html 14 15 * rendering/RenderGrid.cpp: 16 (WebCore::RenderGrid::logicalContentHeightForChild): 17 (WebCore::RenderGrid::layoutGridItems): 18 Updated these functions to use gridAreaBreadthForChild. 19 20 (WebCore::RenderGrid::gridAreaBreadthForChild): 21 Added this helper function to handle multiple spanned grid tracks. 22 23 * rendering/RenderGrid.h: Added the previous function. 24 1 25 2013-03-11 Philip Rogers <pdr@google.com> 2 26 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r145297 r145378 360 360 child->setNeedsLayout(true, MarkOnlyThis); 361 361 362 const GridCoordinate& coordinate = cachedGridCoordinate(child); 363 child->setOverrideContainingBlockContentLogicalWidth(columnTracks[coordinate.columnIndex].m_usedBreadth); 362 child->setOverrideContainingBlockContentLogicalWidth(gridAreaBreadthForChild(child, ForColumns, columnTracks)); 364 363 child->clearOverrideContainingBlockContentLogicalHeight(); 365 364 child->layout(); … … 646 645 LayoutPoint childPosition = findChildLogicalPosition(child, columnTracks, rowTracks); 647 646 648 const GridCoordinate& childCoordinate = cachedGridCoordinate(child);649 650 647 // Because the grid area cannot be styled, we don't need to adjust 651 648 // the grid breadth to account for 'box-sizing'. … … 655 652 // FIXME: For children in a content sized track, we clear the overrideContainingBlockContentLogicalHeight 656 653 // in minContentForChild / maxContentForChild which means that we will always relayout the child. 657 if (oldOverrideContainingBlockContentLogicalWidth != columnTracks[childCoordinate.columnIndex].m_usedBreadth || oldOverrideContainingBlockContentLogicalHeight != rowTracks[childCoordinate.rowIndex].m_usedBreadth) 654 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForChild(child, ForColumns, columnTracks); 655 LayoutUnit overrideContainingBlockContentLogicalHeight = gridAreaBreadthForChild(child, ForRows, rowTracks); 656 if (oldOverrideContainingBlockContentLogicalWidth != overrideContainingBlockContentLogicalWidth || oldOverrideContainingBlockContentLogicalHeight != overrideContainingBlockContentLogicalHeight) 658 657 child->setNeedsLayout(true, MarkOnlyThis); 659 658 660 child->setOverrideContainingBlockContentLogicalWidth( columnTracks[childCoordinate.columnIndex].m_usedBreadth);661 child->setOverrideContainingBlockContentLogicalHeight( rowTracks[childCoordinate.rowIndex].m_usedBreadth);659 child->setOverrideContainingBlockContentLogicalWidth(overrideContainingBlockContentLogicalWidth); 660 child->setOverrideContainingBlockContentLogicalHeight(overrideContainingBlockContentLogicalHeight); 662 661 663 662 // FIXME: Grid items should stretch to fill their cells. Once we … … 741 740 ASSERT_NOT_REACHED(); 742 741 return 0; 742 } 743 744 LayoutUnit RenderGrid::gridAreaBreadthForChild(const RenderBox* child, TrackSizingDirection direction, const Vector<GridTrack>& tracks) const 745 { 746 const GridCoordinate& coordinate = cachedGridCoordinate(child); 747 size_t trackIndex = (direction == ForColumns) ? coordinate.columnIndex : coordinate.rowIndex; 748 OwnPtr<GridSpan> span = resolveGridPositionsFromStyle(child, direction); 749 if (!span) { 750 // FIXME: We don't support spanning with auto positions yet. Once we do, this is wrong. 751 span = adoptPtr(new GridSpan(trackIndex, trackIndex)); 752 } 753 754 ASSERT(span->initialPositionIndex == trackIndex); 755 LayoutUnit gridAreaBreadth = 0; 756 for (; trackIndex <= span->finalPositionIndex; ++trackIndex) 757 gridAreaBreadth += tracks[trackIndex].m_usedBreadth; 758 return gridAreaBreadth; 743 759 } 744 760 -
trunk/Source/WebCore/rendering/RenderGrid.h
r145297 r145378 126 126 size_t resolveGridPositionFromStyle(const GridPosition&, GridPositionSide) const; 127 127 128 LayoutUnit gridAreaBreadthForChild(const RenderBox* child, TrackSizingDirection, const Vector<GridTrack>&) const; 129 128 130 #ifndef NDEBUG 129 131 bool tracksAreWiderThanMinTrackBreadth(TrackSizingDirection, const Vector<GridTrack>&);
Note: See TracChangeset
for help on using the changeset viewer.