mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1313811 - [css-flexbox] Synthesize the flex container baseline per alignment context when needed. r=dholbert
This commit is contained in:
parent
0f65580223
commit
043abe72aa
@ -455,7 +455,7 @@ public:
|
||||
nsLayoutUtils::GetLastLineBaseline(mWM, mFrame, &mAscent);
|
||||
|
||||
if (!found) {
|
||||
mAscent = mFrame->GetLogicalBaseline(mWM);
|
||||
mAscent = mFrame->SynthesizeBaselineFromBorderBox(mWM);
|
||||
}
|
||||
}
|
||||
return mAscent;
|
||||
@ -2324,6 +2324,10 @@ nsFlexContainerFrame::GetLogicalBaseline(mozilla::WritingMode aWM) const
|
||||
NS_ASSERTION(mBaselineFromLastReflow != NS_INTRINSIC_WIDTH_UNKNOWN,
|
||||
"baseline has not been set");
|
||||
|
||||
if (HasAnyStateBits(NS_STATE_FLEX_SYNTHESIZE_BASELINE)) {
|
||||
// Return a baseline synthesized from our margin-box.
|
||||
return nsContainerFrame::GetLogicalBaseline(aWM);
|
||||
}
|
||||
return mBaselineFromLastReflow;
|
||||
}
|
||||
|
||||
@ -4259,6 +4263,14 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
||||
aStruts, aAxisTracker,
|
||||
placeholderKids, lines);
|
||||
|
||||
if (lines.getFirst()->IsEmpty() &&
|
||||
!lines.getFirst()->getNext()) {
|
||||
// We have no flex items, our parent should synthesize a baseline if needed.
|
||||
AddStateBits(NS_STATE_FLEX_SYNTHESIZE_BASELINE);
|
||||
} else {
|
||||
RemoveStateBits(NS_STATE_FLEX_SYNTHESIZE_BASELINE);
|
||||
}
|
||||
|
||||
aContentBoxMainSize =
|
||||
ResolveFlexContainerMainSize(aReflowInput, aAxisTracker,
|
||||
aContentBoxMainSize, aAvailableBSizeForContent,
|
||||
@ -4519,9 +4531,15 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
||||
flexContainerAscent = desiredSizeInFlexWM.BSize(flexWM);
|
||||
}
|
||||
|
||||
// XXXdholbert flexContainerAscent needs to be in terms of
|
||||
// our parent's writing-mode here. See bug 1155322.
|
||||
aDesiredSize.SetBlockStartAscent(flexContainerAscent);
|
||||
if (HasAnyStateBits(NS_STATE_FLEX_SYNTHESIZE_BASELINE)) {
|
||||
// This will force our parent to call GetLogicalBaseline, which will
|
||||
// synthesize a margin-box baseline.
|
||||
aDesiredSize.SetBlockStartAscent(ReflowOutput::ASK_FOR_BASELINE);
|
||||
} else {
|
||||
// XXXdholbert flexContainerAscent needs to be in terms of
|
||||
// our parent's writing-mode here. See bug 1155322.
|
||||
aDesiredSize.SetBlockStartAscent(flexContainerAscent);
|
||||
}
|
||||
|
||||
// Cache this baseline for use outside of this call.
|
||||
mBaselineFromLastReflow = flexContainerAscent;
|
||||
|
@ -312,7 +312,6 @@ FRAME_STATE_BIT(FlexContainer, 20, NS_STATE_FLEX_CHILDREN_REORDERED)
|
||||
FRAME_STATE_BIT(FlexContainer, 21, NS_STATE_FLEX_IS_LEGACY_WEBKIT_BOX)
|
||||
|
||||
// True if the container has no flex items; may lie if there is a pending reflow
|
||||
// XXX not used yet...
|
||||
FRAME_STATE_BIT(FlexContainer, 22, NS_STATE_FLEX_SYNTHESIZE_BASELINE)
|
||||
|
||||
// == Frame state bits that apply to grid container frames ====================
|
||||
|
Loading…
Reference in New Issue
Block a user