mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 939901 part 3.5: Honor "page-break-before" and "page-break-after" as flex line breaking requests. r=mats
This commit is contained in:
parent
e944d16e76
commit
281ff2e646
@ -1989,12 +1989,15 @@ nsFlexContainerFrame::GenerateFlexLines(
|
||||
{
|
||||
MOZ_ASSERT(aLines.IsEmpty(), "Expecting outparam to start out empty");
|
||||
|
||||
const bool isSingleLine =
|
||||
NS_STYLE_FLEX_WRAP_NOWRAP == aReflowState.mStylePosition->mFlexWrap;
|
||||
|
||||
// We have at least one FlexLine. Even an empty flex container has a single
|
||||
// (empty) flex line.
|
||||
FlexLine* curLine = aLines.AppendElement();
|
||||
|
||||
nscoord wrapThreshold;
|
||||
if (NS_STYLE_FLEX_WRAP_NOWRAP == aReflowState.mStylePosition->mFlexWrap) {
|
||||
if (isSingleLine) {
|
||||
// Not wrapping. Set threshold to sentinel value that tells us not to wrap.
|
||||
wrapThreshold = NS_UNCONSTRAINEDSIZE;
|
||||
|
||||
@ -2026,8 +2029,16 @@ nsFlexContainerFrame::GenerateFlexLines(
|
||||
}
|
||||
|
||||
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
|
||||
nsIFrame* childFrame = e.get();
|
||||
|
||||
// Honor "page-break-before", if we're multi-line and this line isn't empty:
|
||||
if (!isSingleLine && !curLine->mItems.IsEmpty() &&
|
||||
childFrame->StyleDisplay()->mBreakBefore) {
|
||||
curLine = aLines.AppendElement();
|
||||
}
|
||||
|
||||
FlexItem* item = curLine->mItems.AppendElement(
|
||||
GenerateFlexItemForChild(aPresContext, e.get(),
|
||||
GenerateFlexItemForChild(aPresContext, childFrame,
|
||||
aReflowState, aAxisTracker));
|
||||
|
||||
nsresult rv = ResolveFlexItemMaxContentSizing(aPresContext, *item,
|
||||
@ -2064,6 +2075,12 @@ nsFlexContainerFrame::GenerateFlexLines(
|
||||
|
||||
curLine->AddToMainSizeTotals(itemInnerHypotheticalMainSize,
|
||||
itemOuterHypotheticalMainSize);
|
||||
|
||||
// Honor "page-break-after", if we're multi-line and have more children:
|
||||
if (!isSingleLine && childFrame->GetNextSibling() &&
|
||||
childFrame->StyleDisplay()->mBreakAfter) {
|
||||
curLine = aLines.AppendElement();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user