Changeset 173868 in webkit for trunk/Source/WebCore/rendering/RenderGrid.cpp
- Timestamp:
- Sep 23, 2014, 1:37:10 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/Source/WebCore/rendering/RenderGrid.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/rendering/RenderGrid.cpp
r173620 r173868 610 610 611 611 // FIXME: We should pass different values for |tracksForGrowthAboveMaxBreadth|. 612 distributeSpaceToTracks(sizingData.filteredTracks, &sizingData.filteredTracks, trackGetter, trackGrowthFunction, sizingData, additionalBreadthSpace); 612 // Specs mandate to floor additionalBreadthSpace (extra-space in specs) to 0. Instead we directly avoid the function 613 // call in those cases as it will be a noop in terms of track sizing. 614 if (additionalBreadthSpace > 0) 615 distributeSpaceToTracks(sizingData.filteredTracks, &sizingData.filteredTracks, trackGetter, trackGrowthFunction, sizingData, additionalBreadthSpace); 613 616 } 614 617 … … 620 623 void RenderGrid::distributeSpaceToTracks(Vector<GridTrack*>& tracks, Vector<GridTrack*>* tracksForGrowthAboveMaxBreadth, AccumulatorGetter trackGetter, AccumulatorGrowFunction trackGrowthFunction, GridSizingData& sizingData, LayoutUnit& availableLogicalSpace) 621 624 { 625 ASSERT(availableLogicalSpace > 0); 622 626 std::sort(tracks.begin(), tracks.end(), sortByGridTrackGrowthPotential); 623 627 … … 627 631 for (size_t i = 0; i < tracksSize; ++i) { 628 632 GridTrack& track = *tracks[i]; 629 LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksSize - i);630 633 LayoutUnit trackBreadth = (tracks[i]->*trackGetter)(); 631 LayoutUnit growthShare = std::max(LayoutUnit(), std::min(availableLogicalSpaceShare, track.m_maxBreadth - trackBreadth)); 632 // We should never shrink any grid track or else we can't guarantee we abide by our min-sizing function. 633 sizingData.distributeTrackVector[i] = trackBreadth + growthShare; 634 availableLogicalSpace -= growthShare; 634 LayoutUnit trackGrowthPotential = track.m_maxBreadth - trackBreadth; 635 sizingData.distributeTrackVector[i] = trackBreadth; 636 if (trackGrowthPotential > 0) { 637 LayoutUnit availableLogicalSpaceShare = availableLogicalSpace / (tracksSize - i); 638 LayoutUnit growthShare = std::min(availableLogicalSpaceShare, trackGrowthPotential); 639 // We should never shrink any grid track or else we can't guarantee we abide by our min-sizing function. 640 sizingData.distributeTrackVector[i] += growthShare; 641 availableLogicalSpace -= growthShare; 642 } 635 643 } 636 644
Note:
See TracChangeset
for help on using the changeset viewer.