Bug 1257688 part 5: Change "-webkit-box-flex" to alias its -moz equivalent, & change nsFlexContainerFrame to use it instead of flex-shrink & flex-grow in a -webkit-box. r=mats
MozReview-Commit-ID: DMA8cAoYMWq
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1169,19 +1169,25 @@ nsFlexContainerFrame::GenerateFlexItemFo
// main-size and the computed values of min / max main-size property.
// (This reflow state will _not_ be used for reflow.)
nsHTMLReflowState
childRS(aPresContext, aParentReflowState, aChildFrame,
aParentReflowState.ComputedSize(aChildFrame->GetWritingMode()));
// FLEX GROW & SHRINK WEIGHTS
// --------------------------
- const nsStylePosition* stylePos = aChildFrame->StylePosition();
- float flexGrow = stylePos->mFlexGrow;
- float flexShrink = stylePos->mFlexShrink;
+ float flexGrow, flexShrink;
+ if (IsLegacyBox(aParentReflowState.mStyleDisplay, mStyleContext)) {
+ flexGrow = flexShrink = aChildFrame->StyleXUL()->mBoxFlex;
+ } else {
+ const nsStylePosition* stylePos = aChildFrame->StylePosition();
+ flexGrow = stylePos->mFlexGrow;
+ flexShrink = stylePos->mFlexShrink;
+ }
+
WritingMode childWM = childRS.GetWritingMode();
// MAIN SIZES (flex base size, min/max size)
// -----------------------------------------
nscoord flexBaseSize = GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, childWM,
childRS.ComputedISize(),
childRS.ComputedBSize());
nscoord mainMinSize = GET_MAIN_COMPONENT_LOGICAL(aAxisTracker, childWM,
--- a/layout/style/nsCSSPropAliasList.h
+++ b/layout/style/nsCSSPropAliasList.h
@@ -323,20 +323,18 @@ CSS_PROP_ALIAS(-webkit-box-sizing,
WebkitBoxSizing,
WEBKIT_PREFIX_PREF)
// Alias -webkit-box properties to their -moz-box equivalents.
// (NOTE: Even though they're aliases, in practice these -webkit properties
// will behave a bit differently from their -moz versions, if they're
// accompanied by "display:-webkit-box", because we generate a different frame
// for those two display values.)
-// XXXdholbert Not all of these are converted yet, but they will be by the
-// end of this patch stack.
CSS_PROP_ALIAS(-webkit-box-flex,
- flex_grow,
+ box_flex,
WebkitBoxFlex,
WEBKIT_PREFIX_PREF)
CSS_PROP_ALIAS(-webkit-box-ordinal-group,
box_ordinal_group,
WebkitBoxOrdinalGroup,
WEBKIT_PREFIX_PREF)
CSS_PROP_ALIAS(-webkit-box-align,
box_align,
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -7190,18 +7190,18 @@ if (IsCSSPropertyPrefEnabled("layout.css
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
alias_for: "box-sizing",
subproperties: [ "box-sizing" ],
};
gCSSProperties["-webkit-box-flex"] = {
domProp: "webkitBoxFlex",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
- alias_for: "flex-grow",
- subproperties: [ "flex-grow" ],
+ alias_for: "-moz-box-flex",
+ subproperties: [ "-moz-box-flex" ],
};
gCSSProperties["-webkit-box-ordinal-group"] = {
domProp: "webkitBoxOrdinalGroup",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
alias_for: "-moz-box-ordinal-group",
subproperties: [ "-moz-box-ordinal-group" ],
};