From 7648075df12f6a2c5607335fa147fbddee6e1d58 Mon Sep 17 00:00:00 2001 From: Pale Moon Date: Fri, 21 Apr 2017 22:21:30 +0200 Subject: [PATCH] Invalidate the cached flow length when the next-in-flow/continuation changes. --- layout/generic/nsTextFrame.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index aeec4a13fa..151029b82f 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -87,6 +87,9 @@ public: mNextContinuation = aNextContinuation; if (aNextContinuation) aNextContinuation->RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION); + // Setting a non-fluid continuation might affect our flow length (they're + // quite rare so we assume it always does) so we delete our cached value: + GetContent()->DeleteProperty(nsGkAtoms::flowlength); } virtual nsIFrame* GetNextInFlowVirtual() const override { return GetNextInFlow(); } nsIFrame* GetNextInFlow() const { @@ -99,8 +102,15 @@ public: NS_ASSERTION (!nsSplittableFrame::IsInNextContinuationChain(aNextInFlow, this), "creating a loop in continuation chain!"); mNextContinuation = aNextInFlow; - if (aNextInFlow) + if (mNextContinuation && + !mNextContinuation->HasAnyStateBits(NS_FRAME_IS_FLUID_CONTINUATION)) { + // Changing from non-fluid to fluid continuation might affect our flow + // length, so we delete our cached value: + GetContent()->DeleteProperty(nsGkAtoms::flowlength); + } + if (aNextInFlow) { aNextInFlow->AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION); + } } virtual nsIFrame* LastInFlow() const override; virtual nsIFrame* LastContinuation() const override;