зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1744363 Part 2 - Make nsFlexContainerFrame::ReflowChildren() return nsReflowStatus of children. r=dholbert
This is a preparation for Part 4. We need to tell apart the children reflow status between incomplete and overflow-incomplete. Differential Revision: https://phabricator.services.mozilla.com/D188530
This commit is contained in:
Родитель
da3ecb3338
Коммит
c154a1dc54
|
@ -4653,7 +4653,7 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
const LogicalSize availableSizeForItems =
|
||||
ComputeAvailableSizeForItems(aReflowInput, borderPadding);
|
||||
const auto [maxBlockEndEdgeOfChildren, anyChildIncomplete] =
|
||||
const auto [maxBlockEndEdgeOfChildren, childrenStatus] =
|
||||
ReflowChildren(aReflowInput, containerSize, availableSizeForItems,
|
||||
borderPadding, axisTracker, flr, fragmentData);
|
||||
|
||||
|
@ -4689,8 +4689,8 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
PopulateReflowOutput(aReflowOutput, aReflowInput, aStatus, contentBoxSize,
|
||||
borderPadding, consumedBSize, mayNeedNextInFlow,
|
||||
maxBlockEndEdgeOfChildren, anyChildIncomplete,
|
||||
axisTracker, flr);
|
||||
maxBlockEndEdgeOfChildren, childrenStatus, axisTracker,
|
||||
flr);
|
||||
|
||||
if (wm.IsVerticalRL()) {
|
||||
// If the final border-box block-size is different from the tentative one,
|
||||
|
@ -5391,13 +5391,13 @@ struct FirstLineOrFirstItemBAxisMetrics final {
|
|||
Maybe<std::pair<nscoord, nscoord>> mMaxBEndEdge;
|
||||
};
|
||||
|
||||
std::tuple<nscoord, bool> nsFlexContainerFrame::ReflowChildren(
|
||||
std::tuple<nscoord, nsReflowStatus> nsFlexContainerFrame::ReflowChildren(
|
||||
const ReflowInput& aReflowInput, const nsSize& aContainerSize,
|
||||
const LogicalSize& aAvailableSizeForItems,
|
||||
const LogicalMargin& aBorderPadding, const FlexboxAxisTracker& aAxisTracker,
|
||||
FlexLayoutResult& aFlr, PerFragmentFlexData& aFragmentData) {
|
||||
if (HidesContentForLayout()) {
|
||||
return {0, false};
|
||||
return {0, nsReflowStatus()};
|
||||
}
|
||||
|
||||
// Before giving each child a final reflow, calculate the origin of the
|
||||
|
@ -5660,11 +5660,16 @@ std::tuple<nscoord, bool> nsFlexContainerFrame::ReflowChildren(
|
|||
containerContentBoxOrigin, aContainerSize);
|
||||
}
|
||||
|
||||
const bool anyChildIncomplete = PushIncompleteChildren(
|
||||
pushedItems, incompleteItems, overflowIncompleteItems);
|
||||
nsReflowStatus childrenStatus;
|
||||
if (!pushedItems.IsEmpty() || !incompleteItems.IsEmpty()) {
|
||||
childrenStatus.SetIncomplete();
|
||||
} else if (!overflowIncompleteItems.IsEmpty()) {
|
||||
childrenStatus.SetOverflowIncomplete();
|
||||
}
|
||||
PushIncompleteChildren(pushedItems, incompleteItems, overflowIncompleteItems);
|
||||
|
||||
// TODO: Try making this a fatal assertion after we fix bug 1751260.
|
||||
NS_ASSERTION(!anyChildIncomplete ||
|
||||
NS_ASSERTION(childrenStatus.IsFullyComplete() ||
|
||||
aAvailableSizeForItems.BSize(flexWM) != NS_UNCONSTRAINEDSIZE,
|
||||
"We shouldn't have any incomplete children if the available "
|
||||
"block-size is unconstrained!");
|
||||
|
@ -5677,7 +5682,7 @@ std::tuple<nscoord, bool> nsFlexContainerFrame::ReflowChildren(
|
|||
aFragmentData.mCumulativeBEndEdgeShift += bAxisMetrics.mBEndEdgeShift;
|
||||
}
|
||||
|
||||
return {maxBlockEndEdgeOfChildren, anyChildIncomplete};
|
||||
return {maxBlockEndEdgeOfChildren, childrenStatus};
|
||||
}
|
||||
|
||||
void nsFlexContainerFrame::PopulateReflowOutput(
|
||||
|
@ -5685,8 +5690,8 @@ void nsFlexContainerFrame::PopulateReflowOutput(
|
|||
nsReflowStatus& aStatus, const LogicalSize& aContentBoxSize,
|
||||
const LogicalMargin& aBorderPadding, const nscoord aConsumedBSize,
|
||||
const bool aMayNeedNextInFlow, const nscoord aMaxBlockEndEdgeOfChildren,
|
||||
const bool aAnyChildIncomplete, const FlexboxAxisTracker& aAxisTracker,
|
||||
FlexLayoutResult& aFlr) {
|
||||
const nsReflowStatus& aChildrenStatus,
|
||||
const FlexboxAxisTracker& aAxisTracker, FlexLayoutResult& aFlr) {
|
||||
const WritingMode flexWM = aReflowInput.GetWritingMode();
|
||||
|
||||
// Compute flex container's desired size (in its own writing-mode).
|
||||
|
@ -5720,7 +5725,7 @@ void nsFlexContainerFrame::PopulateReflowOutput(
|
|||
effectiveContentBSizeWithBStartBP, aMaxBlockEndEdgeOfChildren);
|
||||
|
||||
if ((aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE ||
|
||||
!aAnyChildIncomplete) &&
|
||||
aChildrenStatus.IsFullyComplete()) &&
|
||||
aMaxBlockEndEdgeOfChildren >= effectiveContentBSizeWithBStartBP) {
|
||||
// We have some tall unbreakable child that's sticking off the end of
|
||||
// our fragment, *and* forcing us to consume all of our remaining
|
||||
|
@ -5789,7 +5794,7 @@ void nsFlexContainerFrame::PopulateReflowOutput(
|
|||
// to add it in.
|
||||
desiredSizeInFlexWM.BSize(flexWM) += blockEndContainerBP;
|
||||
|
||||
if (aStatus.IsComplete() && aAnyChildIncomplete) {
|
||||
if (aStatus.IsComplete() && !aChildrenStatus.IsFullyComplete()) {
|
||||
aStatus.SetOverflowIncomplete();
|
||||
aStatus.SetNextInFlowNeedsReflow();
|
||||
}
|
||||
|
|
|
@ -531,9 +531,8 @@ class nsFlexContainerFrame final : public nsContainerFrame,
|
|||
* children of this fragment in this frame's
|
||||
* coordinate space (as returned by
|
||||
* ReflowChildren()).
|
||||
* @param aAnyChildIncomplete true if any child being reflowed is incomplete;
|
||||
* false otherwise (as returned by
|
||||
* ReflowChildren()).
|
||||
* @param aChildrenStatus the reflow status of children (as returned by
|
||||
* ReflowChildren()).
|
||||
* @param aFlr the result returned by DoFlexLayout.
|
||||
* Note: aFlr is mostly an "input" parameter, but we use
|
||||
* aFlr.mAscent as an "in/out" parameter; it's initially the
|
||||
|
@ -548,7 +547,8 @@ class nsFlexContainerFrame final : public nsContainerFrame,
|
|||
nsReflowStatus& aStatus, const mozilla::LogicalSize& aContentBoxSize,
|
||||
const mozilla::LogicalMargin& aBorderPadding,
|
||||
const nscoord aConsumedBSize, const bool aMayNeedNextInFlow,
|
||||
const nscoord aMaxBlockEndEdgeOfChildren, const bool aAnyChildIncomplete,
|
||||
const nscoord aMaxBlockEndEdgeOfChildren,
|
||||
const nsReflowStatus& aChildrenStatus,
|
||||
const FlexboxAxisTracker& aAxisTracker, FlexLayoutResult& aFlr);
|
||||
|
||||
/**
|
||||
|
@ -571,10 +571,13 @@ class nsFlexContainerFrame final : public nsContainerFrame,
|
|||
* updated and become our PerFragmentFlexData.
|
||||
* @return nscoord the maximum block-end edge of children of this fragment in
|
||||
* flex container's coordinate space.
|
||||
* @return bool true if any child being reflowed is incomplete; false
|
||||
* otherwise.
|
||||
* @return nsReflowStatus the reflow status of children (i.e. flex items). If
|
||||
* any child had an incomplete reflow status, then this
|
||||
* will be Incomplete. Otherwise, if any child had an
|
||||
* overflow-incomplete reflow status, this will be
|
||||
* OverflowIncomplete.
|
||||
*/
|
||||
std::tuple<nscoord, bool> ReflowChildren(
|
||||
std::tuple<nscoord, nsReflowStatus> ReflowChildren(
|
||||
const ReflowInput& aReflowInput, const nsSize& aContainerSize,
|
||||
const mozilla::LogicalSize& aAvailableSizeForItems,
|
||||
const mozilla::LogicalMargin& aBorderPadding,
|
||||
|
|
Загрузка…
Ссылка в новой задаче