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 draft
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 04 Apr 2016 15:23:06 -0700
changeset 347455 c9d39bc82aad793c1a66e182bffa8cffc2eca487
parent 347454 87848bc4863be6175a41d243da36ed509460f652
child 347456 02c723924f780f7b802ea756bce05e25d6062973
child 347458 0c6f96de71440cdbf33909697eaeab3e12317366
push id14582
push userdholbert@mozilla.com
push dateMon, 04 Apr 2016 22:23:15 +0000
reviewersmats
bugs1257688
milestone48.0a1
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
layout/generic/nsFlexContainerFrame.cpp
layout/style/nsCSSPropAliasList.h
layout/style/test/property_database.js
--- 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" ],
   };