From f2e0c89b68ed5f6f227f2eeae65241f2edac15fb Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Fri, 2 Dec 2016 01:02:00 -0800 Subject: [PATCH] Bug 1321698 part 1: Set a frame state bit on nsFlexContainerFrame if it's emulating -webkit-box. r=mats MozReview-Commit-ID: 5eL55atUBnT --HG-- extra : rebase_source : c947804edfadd1b9aa3630e1f1e57484b98adb59 --- layout/generic/nsFlexContainerFrame.cpp | 17 +++++++++++++++++ layout/generic/nsFlexContainerFrame.h | 4 ++++ layout/generic/nsFrameStateBits.h | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 6b1840785adb..9706ce9d5e98 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -87,6 +87,8 @@ IsDisplayValueLegacyBox(const nsStyleDisplay* aStyleDisp) aStyleDisp->mDisplay == mozilla::StyleDisplay::WebkitInlineBox; } +// XXXdholbert This will be merged into Init(), in a later patch in this series +// (after all callers have been converted to check frame state bit). /* static */ bool nsFlexContainerFrame::IsLegacyBox(const nsIFrame* aFrame) { @@ -2274,6 +2276,21 @@ nsFlexContainerFrame::~nsFlexContainerFrame() { } +/* virtual */ +void +nsFlexContainerFrame::Init(nsIContent* aContent, + nsContainerFrame* aParent, + nsIFrame* aPrevInFlow) +{ + nsContainerFrame::Init(aContent, aParent, aPrevInFlow); + + if (nsFlexContainerFrame::IsLegacyBox(this)) { + // Toggle frame state bit to indicate that this frame represents a + // legacy -webkit-{inline-}box container: + AddStateBits(NS_STATE_FLEX_IS_LEGACY_WEBKIT_BOX); + } +} + template /* static */ bool nsFlexContainerFrame::SortChildrenIfNeeded() diff --git a/layout/generic/nsFlexContainerFrame.h b/layout/generic/nsFlexContainerFrame.h index 334a1693e423..49260589fe9d 100644 --- a/layout/generic/nsFlexContainerFrame.h +++ b/layout/generic/nsFlexContainerFrame.h @@ -58,6 +58,10 @@ public: struct StrutInfo; // nsIFrame overrides + void Init(nsIContent* aContent, + nsContainerFrame* aParent, + nsIFrame* aPrevInFlow) override; + virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) override; diff --git a/layout/generic/nsFrameStateBits.h b/layout/generic/nsFrameStateBits.h index c45e4cfb52d2..82e787091e9d 100644 --- a/layout/generic/nsFrameStateBits.h +++ b/layout/generic/nsFrameStateBits.h @@ -307,6 +307,10 @@ FRAME_STATE_GROUP(FlexContainer, nsFlexContainerFrame) // (Means that we have to be more thorough about checking them for sortedness.) FRAME_STATE_BIT(FlexContainer, 20, NS_STATE_FLEX_CHILDREN_REORDERED) +// Set for a flex container that is emulating a legacy +// 'display:-webkit-{inline-}box' container. +FRAME_STATE_BIT(FlexContainer, 21, NS_STATE_FLEX_IS_LEGACY_WEBKIT_BOX) + // == Frame state bits that apply to grid container frames ==================== FRAME_STATE_GROUP(GridContainer, nsGridContainerFrame)