зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1312379 part 2 - [css-flexbox] Improve support for CSS Alignment 'last baseline' alignment by exporting the last baseline when asked for. r=dholbert
This commit is contained in:
Родитель
ed15c70d6d
Коммит
deb52d2e03
|
@ -4542,9 +4542,6 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
|||
aDesiredSize.SetBlockStartAscent(flexContainerAscent);
|
||||
}
|
||||
|
||||
// Cache this baseline for use outside of this call.
|
||||
mBaselineFromLastReflow = flexContainerAscent;
|
||||
|
||||
// Now: If we're complete, add bottom border/padding to desired height (which
|
||||
// we skipped via skipSides) -- unless that pushes us over available height,
|
||||
// in which case we become incomplete (unless we already weren't asking for
|
||||
|
@ -4568,6 +4565,16 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
// Calculate the container baselines so that our parent can baseline-align us.
|
||||
mBaselineFromLastReflow = flexContainerAscent;
|
||||
mLastBaselineFromLastReflow = lines.getLast()->GetLastBaselineOffset();
|
||||
if (mLastBaselineFromLastReflow == nscoord_MIN) {
|
||||
// XXX we fall back to a mirrored first baseline here for now, but this
|
||||
// should probably use the last baseline of the last item or something.
|
||||
mLastBaselineFromLastReflow =
|
||||
desiredSizeInFlexWM.BSize(flexWM) - flexContainerAscent;
|
||||
}
|
||||
|
||||
// Convert flex container's final desired size to parent's WM, for outparam.
|
||||
aDesiredSize.SetSize(flexWM, desiredSizeInFlexWM);
|
||||
|
||||
|
|
|
@ -96,7 +96,8 @@ public:
|
|||
if (HasAnyStateBits(NS_STATE_FLEX_SYNTHESIZE_BASELINE)) {
|
||||
return false;
|
||||
}
|
||||
*aBaseline = GetLogicalBaseline(aWM);
|
||||
*aBaseline = aBaselineGroup == BaselineSharingGroup::eFirst ?
|
||||
mBaselineFromLastReflow : mLastBaselineFromLastReflow;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -133,6 +134,7 @@ protected:
|
|||
explicit nsFlexContainerFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext)
|
||||
, mBaselineFromLastReflow(NS_INTRINSIC_WIDTH_UNKNOWN)
|
||||
, mLastBaselineFromLastReflow(NS_INTRINSIC_WIDTH_UNKNOWN)
|
||||
{}
|
||||
virtual ~nsFlexContainerFrame();
|
||||
|
||||
|
@ -318,6 +320,8 @@ protected:
|
|||
// to satisfy their 'order' values?
|
||||
|
||||
nscoord mBaselineFromLastReflow;
|
||||
// Note: the last baseline is a distance from our border-box end edge.
|
||||
nscoord mLastBaselineFromLastReflow;
|
||||
};
|
||||
|
||||
#endif /* nsFlexContainerFrame_h___ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче