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
This commit is contained in:
Daniel Holbert 2016-12-02 01:02:00 -08:00
parent e4bfa61848
commit f2e0c89b68
3 changed files with 25 additions and 0 deletions

View File

@ -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<bool IsLessThanOrEqual(nsIFrame*, nsIFrame*)>
/* static */ bool
nsFlexContainerFrame::SortChildrenIfNeeded()

View File

@ -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;

View File

@ -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)