mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Backed out changeset 19b5e154c6f9 (bug 1176619)
This commit is contained in:
parent
f9f8218c5f
commit
9f58317c65
@ -494,55 +494,6 @@ struct MOZ_STACK_CLASS nsGridContainerFrame::Tracks
|
||||
CopyPlanToLimit(aPlan, aGrowableTracks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Distribute aAvailableSize to the tracks. This implements 12.6 at:
|
||||
* http://dev.w3.org/csswg/css-grid/#algo-grow-tracks
|
||||
*/
|
||||
void DistributeFreeSpace(nscoord aAvailableSize)
|
||||
{
|
||||
const uint32_t numTracks = mSizes.Length();
|
||||
if (MOZ_UNLIKELY(numTracks == 0 || aAvailableSize <= 0)) {
|
||||
return;
|
||||
}
|
||||
if (aAvailableSize == NS_UNCONSTRAINEDSIZE) {
|
||||
for (TrackSize& sz : mSizes) {
|
||||
sz.mBase = sz.mLimit;
|
||||
}
|
||||
} else {
|
||||
// Compute free space and count growable tracks.
|
||||
nscoord space = aAvailableSize;
|
||||
uint32_t numGrowable = numTracks;
|
||||
for (const TrackSize& sz : mSizes) {
|
||||
space -= sz.mBase;
|
||||
MOZ_ASSERT(sz.mBase <= sz.mLimit);
|
||||
if (sz.mBase == sz.mLimit) {
|
||||
--numGrowable;
|
||||
}
|
||||
}
|
||||
// Distribute the free space evenly to the growable tracks. If not exactly
|
||||
// divisable the remainder is added to the leading tracks.
|
||||
while (space > 0 && numGrowable) {
|
||||
nscoord spacePerTrack =
|
||||
std::max<nscoord>(space / numGrowable, 1);
|
||||
for (uint32_t i = 0; i < numTracks && space > 0; ++i) {
|
||||
TrackSize& sz = mSizes[i];
|
||||
if (sz.mBase == sz.mLimit) {
|
||||
continue;
|
||||
}
|
||||
nscoord newBase = sz.mBase + spacePerTrack;
|
||||
if (newBase >= sz.mLimit) {
|
||||
space -= sz.mLimit - sz.mBase;
|
||||
sz.mBase = sz.mLimit;
|
||||
--numGrowable;
|
||||
} else {
|
||||
space -= spacePerTrack;
|
||||
sz.mBase = newBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void Dump() const
|
||||
{
|
||||
@ -1699,9 +1650,6 @@ nsGridContainerFrame::CalculateTrackSizes(GridReflowState& aState,
|
||||
aState.mCols.ResolveIntrinsicSize(aState, mGridItems, colFunctions,
|
||||
&GridArea::mCols, colPercentageBasis,
|
||||
aConstraint);
|
||||
if (aConstraint != nsLayoutUtils::MIN_ISIZE) {
|
||||
aState.mCols.DistributeFreeSpace(aContentBox.ISize(wm));
|
||||
}
|
||||
|
||||
aState.mRows.mSizes.SetLength(mGridRowEnd);
|
||||
PodZero(aState.mRows.mSizes.Elements(), aState.mRows.mSizes.Length());
|
||||
@ -1715,9 +1663,6 @@ nsGridContainerFrame::CalculateTrackSizes(GridReflowState& aState,
|
||||
aState.mRows.ResolveIntrinsicSize(aState, mGridItems, rowFunctions,
|
||||
&GridArea::mRows, rowPercentageBasis,
|
||||
aConstraint);
|
||||
if (aConstraint != nsLayoutUtils::MIN_ISIZE) {
|
||||
aState.mRows.DistributeFreeSpace(aContentBox.BSize(wm));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -14,7 +14,7 @@
|
||||
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
|
||||
<link rel="stylesheet" type="text/css" href="support/ahem.css" />
|
||||
<style>
|
||||
div.a, div.b, div.grid { height: 100px; }
|
||||
div { height: 100px; }
|
||||
div.grid {
|
||||
white-space: pre;
|
||||
border: 1px dashed blue;
|
||||
|
Loading…
Reference in New Issue
Block a user