Bug 1597177: Make flex containers check for interruptions a bit earlier (right after the measurement whose interruption they care about). r=emilio
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 18 Nov 2019 18:16:59 +0000
changeset 502449 b42230b2ad6e97d7399a608d5297348a1906a754
parent 502448 eb382c9e27fb60efddc8061d9e2837f33056cf33
child 502450 82ba763a36a7940c8980a2f7262a97defb074399
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1597177
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFlexContainerFrame.h
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1831,16 +1831,30 @@ nsFlexContainerFrame::MeasureAscentAndBS
              "We gave flex item unconstrained available height, so it "
              "should be complete");
 
   // Tell the child we're done with its initial reflow.
   // (Necessary for e.g. GetBaseline() to work below w/out asserting)
   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);
 
   aItem.Frame()->SetProperty(CachedFlexMeasuringReflow(), result);
   return *result;
 }
 
 /* virtual */
@@ -4297,33 +4311,16 @@ void FlexLine::PositionItemsInCrossAxis(
     item->SetCrossPosition(aLineStartPosition +
                            lineCrossAxisPosnTracker.GetPosition());
 
     // Back out to cross-axis edge of the line.
     lineCrossAxisPosnTracker.ResetPosition();
   }
 }
 
-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,
                                   nsReflowStatus& aStatus) {
   MarkInReflow();
   DO_GLOBAL_REFLOW_COUNT("nsFlexContainerFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
   MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
--- a/layout/generic/nsFlexContainerFrame.h
+++ b/layout/generic/nsFlexContainerFrame.h
@@ -115,18 +115,16 @@ class nsFlexContainerFrame final : publi
                         const nsDisplayListSet& aLists) override;
 
   void MarkIntrinsicISizesDirty() override;
 
   void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
               const ReflowInput& aReflowInput,
               nsReflowStatus& aStatus) override;
 
-  void DidReflow(nsPresContext*, const ReflowInput*) final;
-
   nscoord GetMinISize(gfxContext* aRenderingContext) override;
   nscoord GetPrefISize(gfxContext* aRenderingContext) override;
 
 #ifdef DEBUG_FRAME_DUMP
   nsresult GetFrameName(nsAString& aResult) const override;
 #endif
 
   nscoord GetLogicalBaseline(mozilla::WritingMode aWM) const override;