mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1037177 part 1: Make FlexItem() constructor take a reflow state as a parameter, to reduce arg-count and get faster access to style structs. r=mats
This commit is contained in:
parent
3531a3bed7
commit
eabd84853d
@ -258,11 +258,10 @@ class nsFlexContainerFrame::FlexItem : public LinkedListElement<FlexItem>
|
||||
{
|
||||
public:
|
||||
// Normal constructor:
|
||||
FlexItem(nsIFrame* aChildFrame,
|
||||
FlexItem(nsHTMLReflowState& aFlexItemReflowState,
|
||||
float aFlexGrow, float aFlexShrink, nscoord aMainBaseSize,
|
||||
nscoord aMainMinSize, nscoord aMainMaxSize,
|
||||
nscoord aCrossMinSize, nscoord aCrossMaxSize,
|
||||
nsMargin aMargin, nsMargin aBorderPadding,
|
||||
const FlexboxAxisTracker& aAxisTracker);
|
||||
|
||||
// Simplified constructor, to be used only for generating "struts":
|
||||
@ -1018,12 +1017,10 @@ nsFlexContainerFrame::GenerateFlexItemForChild(
|
||||
}
|
||||
|
||||
// Construct the flex item!
|
||||
FlexItem* item = new FlexItem(aChildFrame,
|
||||
FlexItem* item = new FlexItem(childRS,
|
||||
flexGrow, flexShrink, flexBaseSize,
|
||||
mainMinSize, mainMaxSize,
|
||||
crossMinSize, crossMaxSize,
|
||||
childRS.ComputedPhysicalMargin(),
|
||||
childRS.ComputedPhysicalBorderPadding(),
|
||||
aAxisTracker);
|
||||
|
||||
// If we're inflexible, we can just freeze to our hypothetical main-size
|
||||
@ -1147,17 +1144,16 @@ nsFlexContainerFrame::
|
||||
aFlexItem.SetHadMeasuringReflow();
|
||||
}
|
||||
|
||||
FlexItem::FlexItem(nsIFrame* aChildFrame,
|
||||
FlexItem::FlexItem(nsHTMLReflowState& aFlexItemReflowState,
|
||||
float aFlexGrow, float aFlexShrink, nscoord aFlexBaseSize,
|
||||
nscoord aMainMinSize, nscoord aMainMaxSize,
|
||||
nscoord aCrossMinSize, nscoord aCrossMaxSize,
|
||||
nsMargin aMargin, nsMargin aBorderPadding,
|
||||
const FlexboxAxisTracker& aAxisTracker)
|
||||
: mFrame(aChildFrame),
|
||||
: mFrame(aFlexItemReflowState.frame),
|
||||
mFlexGrow(aFlexGrow),
|
||||
mFlexShrink(aFlexShrink),
|
||||
mBorderPadding(aBorderPadding),
|
||||
mMargin(aMargin),
|
||||
mBorderPadding(aFlexItemReflowState.ComputedPhysicalBorderPadding()),
|
||||
mMargin(aFlexItemReflowState.ComputedPhysicalMargin()),
|
||||
mMainMinSize(aMainMinSize),
|
||||
mMainMaxSize(aMainMaxSize),
|
||||
mCrossMinSize(aCrossMinSize),
|
||||
@ -1173,7 +1169,7 @@ FlexItem::FlexItem(nsIFrame* aChildFrame,
|
||||
mHadMeasuringReflow(false),
|
||||
mIsStretched(false),
|
||||
mIsStrut(false),
|
||||
mAlignSelf(aChildFrame->StylePosition()->mAlignSelf)
|
||||
mAlignSelf(aFlexItemReflowState.mStylePosition->mAlignSelf)
|
||||
{
|
||||
MOZ_ASSERT(mFrame, "expecting a non-null child frame");
|
||||
MOZ_ASSERT(mFrame->GetType() != nsGkAtoms::placeholderFrame,
|
||||
@ -1187,7 +1183,8 @@ FlexItem::FlexItem(nsIFrame* aChildFrame,
|
||||
// (We'll resolve them later; until then, we want to treat them as 0-sized.)
|
||||
#ifdef DEBUG
|
||||
{
|
||||
const nsStyleSides& styleMargin = mFrame->StyleMargin()->mMargin;
|
||||
const nsStyleSides& styleMargin =
|
||||
aFlexItemReflowState.mStyleMargin->mMargin;
|
||||
NS_FOR_CSS_SIDES(side) {
|
||||
if (styleMargin.GetUnit(side) == eStyleUnit_Auto) {
|
||||
MOZ_ASSERT(GetMarginComponentForSide(side) == 0,
|
||||
|
Loading…
Reference in New Issue
Block a user