Bug 1055665 part 2: Backout changeset af2a4fb980ad (i.e. backout bug 1032922 part 1). a=lmandel
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 03 Nov 2014 14:29:01 -0800
changeset 225947 d04d205b6c12
parent 225946 b4e9b4dab577
child 225948 a8edc81c39d5
push id4077
push userdholbert@mozilla.com
push date2014-11-05 21:33 +0000
treeherdermozilla-beta@d04d205b6c12 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslmandel
bugs1055665, 1032922
milestone34.0
Bug 1055665 part 2: Backout changeset af2a4fb980ad (i.e. backout bug 1032922 part 1). a=lmandel
layout/style/nsCSSParser.cpp
layout/style/nsCSSPropList.h
layout/style/nsCSSProps.cpp
layout/style/nsCSSProps.h
layout/style/nsComputedDOMStyle.cpp
layout/style/test/mochitest.ini
layout/style/test/test_flexbox_flex_basis_values.html
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -7448,17 +7448,17 @@ CSSParserImpl::ParseFlex()
   //
   // NOTE: if we encounter unitless 0 here, we *must* interpret it as a
   // 'flex-grow' value (a number), *not* as a 'flex-basis' value (a length).
   // Conveniently, that's the behavior this combined variant-mask gives us --
   // it'll treat unitless 0 as a number. The flexbox spec requires this:
   // "a unitless zero that is not already preceded by two flex factors must be
   //  interpreted as a flex factor.
   if (!ParseNonNegativeVariant(tmpVal, flexBasisVariantMask | VARIANT_NUMBER,
-                               nsCSSProps::kFlexBasisKTable)) {
+                               nsCSSProps::kWidthKTable)) {
     // First component was not a valid flex-basis or flex-grow value. Fail.
     return false;
   }
 
   // Record what we just parsed as either flex-basis or flex-grow:
   bool wasFirstComponentFlexBasis = (tmpVal.GetUnit() != eCSSUnit_Number);
   (wasFirstComponentFlexBasis ? flexBasis : flexGrow) = tmpVal;
 
@@ -7496,17 +7496,17 @@ CSSParserImpl::ParseFlex()
     // accepted this unitless 0 as the 'flex-shrink' value, up above (since
     // it's a valid flex-shrink value), and we'd have moved on to the next
     // token (if any). And of course, if we instead had a unitless 0 preceded
     // by *no* flex factors (if it were the first token), we would've already
     // parsed it in our very first call to ParseNonNegativeVariant().  So, any
     // unitless 0 encountered here *must* have been preceded by 2 flex factors.
     if (!wasFirstComponentFlexBasis &&
         ParseNonNegativeVariant(tmpVal, flexBasisVariantMask,
-                                nsCSSProps::kFlexBasisKTable)) {
+                                nsCSSProps::kWidthKTable)) {
       flexBasis = tmpVal;
     }
   }
 
   AppendValue(eCSSProperty_flex_grow,   flexGrow);
   AppendValue(eCSSProperty_flex_shrink, flexShrink);
   AppendValue(eCSSProperty_flex_basis,  flexBasis);
 
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -1652,17 +1652,17 @@ CSS_PROP_POSITION(
     CSS_PROPERTY_PARSE_VALUE |
         CSS_PROPERTY_VALUE_NONNEGATIVE |
         CSS_PROPERTY_STORES_CALC,
     "",
     // NOTE: The parsing implementation for the 'flex' shorthand property has
     // its own code to parse each subproperty. It does not depend on the
     // longhand parsing defined here.
     VARIANT_AHKLP | VARIANT_CALC,
-    kFlexBasisKTable,
+    kWidthKTable,
     offsetof(nsStylePosition, mFlexBasis),
     eStyleAnimType_Coord)
 CSS_PROP_POSITION(
     flex-direction,
     flex_direction,
     FlexDirection,
     CSS_PROPERTY_PARSE_VALUE,
     "",
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1120,24 +1120,16 @@ const KTableValue nsCSSProps::kAlignSelf
   eCSSKeyword_flex_end,   NS_STYLE_ALIGN_ITEMS_FLEX_END,
   eCSSKeyword_center,     NS_STYLE_ALIGN_ITEMS_CENTER,
   eCSSKeyword_baseline,   NS_STYLE_ALIGN_ITEMS_BASELINE,
   eCSSKeyword_stretch,    NS_STYLE_ALIGN_ITEMS_STRETCH,
   eCSSKeyword_auto,       NS_STYLE_ALIGN_SELF_AUTO,
   eCSSKeyword_UNKNOWN,-1
 };
 
-const KTableValue nsCSSProps::kFlexBasisKTable[] = {
-  eCSSKeyword__moz_max_content, NS_STYLE_WIDTH_MAX_CONTENT,
-  eCSSKeyword__moz_min_content, NS_STYLE_WIDTH_MIN_CONTENT,
-  eCSSKeyword__moz_fit_content, NS_STYLE_WIDTH_FIT_CONTENT,
-  eCSSKeyword__moz_available,   NS_STYLE_WIDTH_AVAILABLE,
-  eCSSKeyword_UNKNOWN,-1
-};
-
 const KTableValue nsCSSProps::kFlexDirectionKTable[] = {
   eCSSKeyword_row,            NS_STYLE_FLEX_DIRECTION_ROW,
   eCSSKeyword_row_reverse,    NS_STYLE_FLEX_DIRECTION_ROW_REVERSE,
   eCSSKeyword_column,         NS_STYLE_FLEX_DIRECTION_COLUMN,
   eCSSKeyword_column_reverse, NS_STYLE_FLEX_DIRECTION_COLUMN_REVERSE,
   eCSSKeyword_UNKNOWN,-1
 };
 
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -561,17 +561,16 @@ public:
   // Not const because we modify its entries when the pref
   // "layout.css.grid.enabled" changes:
   static KTableValue kDisplayKTable[];
   static const KTableValue kElevationKTable[];
   static const KTableValue kEmptyCellsKTable[];
   static const KTableValue kAlignContentKTable[];
   static const KTableValue kAlignItemsKTable[];
   static const KTableValue kAlignSelfKTable[];
-  static const KTableValue kFlexBasisKTable[];
   static const KTableValue kFlexDirectionKTable[];
   static const KTableValue kFlexWrapKTable[];
   static const KTableValue kJustifyContentKTable[];
   static const KTableValue kFloatKTable[];
   static const KTableValue kFloatEdgeKTable[];
   static const KTableValue kFontKTable[];
   static const KTableValue kFontKerningKTable[];
   static const KTableValue kFontSizeKTable[];
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -3666,17 +3666,17 @@ nsComputedDOMStyle::DoGetFlexBasis()
   //     if (my flex container is horizontal) {
   //       percentageBaseGetter = &nsComputedDOMStyle::GetCBContentWidth;
   //     } else {
   //       percentageBaseGetter = &nsComputedDOMStyle::GetCBContentHeight;
   //     }
   //   }
 
   SetValueToCoord(val, StylePosition()->mFlexBasis, true,
-                  nullptr, nsCSSProps::kFlexBasisKTable);
+                  nullptr, nsCSSProps::kWidthKTable);
   return val;
 }
 
 CSSValue*
 nsComputedDOMStyle::DoGetFlexDirection()
 {
   nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
   val->SetIdent(
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -119,17 +119,16 @@ skip-if = toolkit == 'android' #bug 5366
 [test_css_supports_variables.html]
 [test_default_bidi_css.html]
 [test_descriptor_storage.html]
 [test_descriptor_syntax_errors.html]
 [test_dont_use_document_colors.html]
 [test_extra_inherit_initial.html]
 [test_flexbox_align_self_auto.html]
 [test_flexbox_child_display_values.xhtml]
-[test_flexbox_flex_basis_values.html]
 [test_flexbox_flex_grow_and_shrink.html]
 [test_flexbox_flex_shorthand.html]
 [test_flexbox_layout.html]
 support-files = flexbox_layout_testcases.js
 [test_flexbox_min_size_auto.html]
 [test_flexbox_order.html]
 [test_flexbox_order_table.html]
 [test_font_face_parser.html]
deleted file mode 100644
--- a/layout/style/test/test_flexbox_flex_basis_values.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1032922
--->
-<head>
-  <meta charset="utf-8">
-  <title>
-    Test that 'flex-basis' accepts all valid values for 'width' and 'height'
-    (helper for Bug 1032922)
-  </title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="property_database.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-<div id="testnode"></div>
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.7">
-"use strict";
-
-/**
- * Test that 'flex-basis' accepts all valid values for 'width' and 'height'
- * (helper for Bug 1032922)
- *
- * PEDANTIC NOTE: Technically, the flexbox spec's "value" definition for
- * "flex-basis" only says it accepts "main-size | <'width'>" -- there's no
- * mention of <'height'>.
- *
- * However, the prose later on is clear that all valid "height" values are
- * supposed to be accepted as well:
- *  # The flex-basis property [...] accepts the same values
- *  # as the 'width' and 'height' property.
- * http://dev.w3.org/csswg/css-flexbox/#propdef-flex-basis
- *
- * Presumably the spec's value-definition omits <'height'> just for brevity's
- * sake, since <'width'> already covers the full range of valid "height"
- * values (for now at least; and probably forever).
- *
- * In any case: in this test, we ensure that flex-basis really does accept all
- * of property_database's valid sample-values for both "width" *and* "height",
- * to be on the safe side.
- */
-
-function check_accepted(decl, origPropName, val)
-{
-  decl.setProperty("flex-basis", val, "");
-
-  // Note: decl.getPropertyValue() will return something non-empty here if the
-  // value was parsed successfully. Otherwise (i.e. if the value is rejected),
-  // it'll return the empty string.
-  isnot(decl.getPropertyValue("flex-basis"), "",
-       "value '" + val + "' which is valid for '" + origPropName +
-       "' should also be valid for 'flex-basis' ");
-
-  decl.removeProperty("flex-basis");
-}
-
-function main()
-{
-  let decl = document.getElementById("testnode").style;
-
-  let props = [ "width", "height" ];
-  props.forEach(function(prop) {
-    let info = gCSSProperties[prop];
-    let all_values = info.initial_values.concat(info.other_values);
-    all_values.forEach(function(value) {
-      check_accepted(decl, prop, value);
-    });
-  });
-}
-
-main();
-
-</script>
-</pre>
-</body>
-</html>