Bug 1209697: Cache flex measuring reflows to avoid exponential behavior

This commit is contained in:
janekptacijarabaci 2018-04-24 20:18:05 +02:00 • committed by Roy Tam
commit 95b1132e04
2 changed files with 114 additions and 39 deletions

View file

@ -56,6 +56,7 @@ public:
class FlexLine;
class FlexboxAxisTracker;
struct StrutInfo;
struct CachedMeasuringReflowResult;
// nsIFrame overrides
void Init(nsIContent* aContent,
@ -66,6 +67,8 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
void MarkIntrinsicISizesDirty() override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
@ -194,6 +197,18 @@ protected:
const ReflowInput& aParentReflowInput,
const FlexboxAxisTracker& aAxisTracker);
/**
* This method gets a cached measuring reflow for a flex item, or does it and
* caches it.
*
* This avoids exponential reflows, see the comment on
* CachedMeasuringReflowResult.
*/
const CachedMeasuringReflowResult& MeasureAscentAndHeightForFlexItem(
FlexItem& aItem,
nsPresContext* aPresContext,
ReflowInput& aChildReflowInput);
/**
* This method performs a "measuring" reflow to get the content height of
* aFlexItem.Frame() (treating it as if it had auto-height), & returns the