Bug 1597177: Make flex containers check for interruptions a bit earlier (right after the measurement whose interruption they care about). r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D53670

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daniel Holbert 2019-11-18 18:16:59 +00:00
parent eb4e9962a8
commit 757e4475d6
2 changed files with 14 additions and 19 deletions

View File

@ -1836,6 +1836,20 @@ nsFlexContainerFrame::MeasureAscentAndBSizeForFlexItem(
FinishReflowChild(aItem.Frame(), aPresContext, childDesiredSize,
&aChildReflowInput, 0, 0, flags);
// If we got an interrupt during or before that measuring reflow, we make a
// note that this & other cached measurements are potentially invalid,
// because our descendant block frames' reflows may have bailed out early due
// to the interrupt. We'll keep these invalid measurements for the rest of
// this reflow (to avoid repeating the same bogus measurement), and purge
// them on the next (non-interrupted) reflow.
//
// TODO(emilio): Can we do this only for the kids that are interrupted? We
// probably want to figure out what the right thing to do here is regarding
// interrupts, see bug 1495532.
if (aPresContext->HasPendingInterrupt()) {
AddStateBits(NS_STATE_FLEX_MEASUREMENTS_INTERRUPTED);
}
auto result =
new CachedMeasuringReflowResult(aChildReflowInput, childDesiredSize);
@ -4302,23 +4316,6 @@ void FlexLine::PositionItemsInCrossAxis(
}
}
void nsFlexContainerFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput) {
// If we got an interrupt, we make a note here that our cached measurements
// are potentially invalid, because our descendant block frames' reflows may
// have bailed out early due to the interrupt. We'll keep these invalid
// measurements for the rest of this reflow (to avoid repeating the same
// bogus measurement), and purge them on the next (non-interrupted) reflow.
//
// TODO(emilio): Can we do this only for the kids that are interrupted? We
// probably want to figure out what the right thing to do here is regarding
// interrupts, see bug 1495532.
if (aPresContext->HasPendingInterrupt()) {
AddStateBits(NS_STATE_FLEX_MEASUREMENTS_INTERRUPTED);
}
nsContainerFrame::DidReflow(aPresContext, aReflowInput);
}
void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,

View File

@ -120,8 +120,6 @@ class nsFlexContainerFrame final : public nsContainerFrame {
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void DidReflow(nsPresContext*, const ReflowInput*) final;
nscoord GetMinISize(gfxContext* aRenderingContext) override;
nscoord GetPrefISize(gfxContext* aRenderingContext) override;