Bug 1495169 - Remove cached measuring reflows if we aren't measuring the right thing because we got interrupted. r=dholbert

If we're waiting on an interrupt, then our child items haven't been totally
reflowed and our measures would be bogus.

This will probably regress performance in the cases bug 1209697 fixed, so we
should probably add an interrupt check somewhere in nsFlexContainerFrame to
avoid keeping reflowing flex containers indefinitely.

We could probably just bail out from our reflow if any kid reflow was
interrupted.

Filed bug 1495532 to consider that.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2018-10-04 20:24:04 +00:00
parent c4cd1af1d7
commit eed1014705
2 changed files with 20 additions and 0 deletions

View File

@ -4324,6 +4324,24 @@ FlexLine::PositionItemsInCrossAxis(nscoord aLineStartPosition,
}
}
void
nsFlexContainerFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput)
{
// Remove the cached values if we got an interrupt because the values will be
// the wrong ones for following reflows.
//
// 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()) {
for (nsIFrame* frame : mFrames) {
frame->DeleteProperty(CachedFlexMeasuringReflow());
}
}
nsContainerFrame::DidReflow(aPresContext, aReflowInput);
}
void
nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,

View File

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