Bug 983175 - Part 0: Rename nsParsingStatus to CSSParseResult. r=dbaron
authorSimon Sapin <simon.sapin@exyr.org>
Thu, 27 Mar 2014 11:54:40 -0400
changeset 175654 acba6fd6fb2c1843beb5626308ceb31a6303fd0a
parent 175653 3f47bbd820a1e7fe17d2ef7b1a9a7caac5a7dbff
child 175655 63d2474f84f8d67744b7b3c829cf309d9b6e003a
push id26496
push userkwierso@gmail.com
push dateFri, 28 Mar 2014 02:28:34 +0000
treeherdermozilla-central@3c09159e01da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs983175
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 983175 - Part 0: Rename nsParsingStatus to CSSParseResult. r=dbaron
layout/style/nsCSSParser.cpp
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -61,24 +61,24 @@ nsCSSProps::kParserVariantTable[eCSSProp
 };
 
 // Length of the "var-" prefix of custom property names.
 #define VAR_PREFIX_LENGTH 4
 
 // End-of-array marker for mask arguments to ParseBitmaskValues
 #define MASK_END_VALUE  (-1)
 
-MOZ_BEGIN_ENUM_CLASS(nsParsingStatus, int32_t)
+MOZ_BEGIN_ENUM_CLASS(CSSParseResult, int32_t)
   // Parsed something successfully:
   Ok,
   // Did not find what we were looking for, but did not consume any token:
   NotFound,
   // Unexpected token or token value, too late for UngetToken() to be enough:
   Error
-MOZ_END_ENUM_CLASS(nsParsingStatus)
+MOZ_END_ENUM_CLASS(CSSParseResult)
 
 namespace {
 
 // Rule processing function
 typedef void (* RuleAppendFunc) (css::Rule* aRule, void* aData);
 static void AssignRuleToPointer(css::Rule* aRule, void* aPointer);
 static void AppendRuleToSheet(css::Rule* aRule, void* aParser);
 
@@ -650,17 +650,17 @@ protected:
   // If successful, leave aValue untouched,
   // to indicate that we parsed the empty list,
   // or set it to a eCSSUnit_List of eCSSUnit_Ident.
   // Not finding an open paren is considered the same as an empty list.
   //
   // If aValue is already a eCSSUnit_List, append to that list.
   bool ParseGridLineNames(nsCSSValue& aValue);
   bool ParseGridTrackBreadth(nsCSSValue& aValue);
-  nsParsingStatus ParseGridTrackSize(nsCSSValue& aValue);
+  CSSParseResult ParseGridTrackSize(nsCSSValue& aValue);
   bool ParseGridAutoColumnsRows(nsCSSProperty aPropID);
 
   // Assuming a [ <line-names>? ] has already been parsed,
   // parse the rest of a <track-list>.
   //
   // This exists because [ <line-names>? ] is ambiguous in the
   // 'grid-template' shorthand: it can be either the start of a <track-list>,
   // or of the intertwined syntax that sets both
@@ -7022,85 +7022,85 @@ CSSParserImpl::ParseGridTrackBreadth(nsC
     UngetToken();
     return false;
   }
   aValue.SetFloatValue(mToken.mNumber, eCSSUnit_FlexFraction);
   return true;
 }
 
 // Parse a <track-size>
-nsParsingStatus
+CSSParseResult
 CSSParserImpl::ParseGridTrackSize(nsCSSValue& aValue)
 {
   // Attempt to parse 'auto' or a single <track-breadth>
   if (ParseGridTrackBreadth(aValue) ||
       ParseVariant(aValue, VARIANT_AUTO, nullptr)) {
-    return nsParsingStatus::Ok;
+    return CSSParseResult::Ok;
   }
 
   // Attempt to parse a minmax() function
   if (!GetToken(true)) {
-    return nsParsingStatus::NotFound;
+    return CSSParseResult::NotFound;
   }
   if (!(eCSSToken_Function == mToken.mType &&
         mToken.mIdent.LowerCaseEqualsLiteral("minmax"))) {
     UngetToken();
-    return nsParsingStatus::NotFound;
+    return CSSParseResult::NotFound;
   }
   nsCSSValue::Array* func = aValue.InitFunction(eCSSKeyword_minmax, 2);
   if (ParseGridTrackBreadth(func->Item(1)) &&
       ExpectSymbol(',', true) &&
       ParseGridTrackBreadth(func->Item(2)) &&
       ExpectSymbol(')', true)) {
-    return nsParsingStatus::Ok;
+    return CSSParseResult::Ok;
   }
   SkipUntil(')');
-  return nsParsingStatus::Error;
+  return CSSParseResult::Error;
 }
 
 bool
 CSSParserImpl::ParseGridAutoColumnsRows(nsCSSProperty aPropID)
 {
   nsCSSValue value;
   if (ParseVariant(value, VARIANT_INHERIT, nullptr) ||
-      ParseGridTrackSize(value) == nsParsingStatus::Ok) {
+      ParseGridTrackSize(value) == CSSParseResult::Ok) {
     AppendValue(aPropID, value);
     return true;
   }
   return false;
 }
 
 bool
 CSSParserImpl::ParseGridTrackListWithFirstLineNames(nsCSSValue& aValue,
                                                     const nsCSSValue& aFirstLineNames)
 {
   nsAutoPtr<nsCSSValueList> firstTrackSizeItem(new nsCSSValueList);
 
   // FIXME: add repeat()
-  if (ParseGridTrackSize(firstTrackSizeItem->mValue) != nsParsingStatus::Ok) {
+  if (ParseGridTrackSize(firstTrackSizeItem->mValue) != CSSParseResult::Ok) {
     // We need at least one <track-size>,
-    // so even nsParsingStatus::NotFound is an error here.
+    // so even CSSParseResult::NotFound is an error here.
     return false;
   }
 
   nsCSSValueList* item = firstTrackSizeItem;
   for (;;) {
     item->mNext = new nsCSSValueList;
     item = item->mNext;
     if (!ParseGridLineNames(item->mValue)) {
       return false;
     }
 
     // FIXME: add repeat()
     nsCSSValue trackSize;
-    nsParsingStatus result = ParseGridTrackSize(trackSize);
-    if (result == nsParsingStatus::Error) {
-      return false;
-    }
-    if (result == nsParsingStatus::NotFound) {
+    CSSParseResult result = ParseGridTrackSize(trackSize);
+    if (result == CSSParseResult::Error) {
+      return false;
+    }
+    if (result == CSSParseResult::NotFound) {
       // What we've parsed so far is a valid <track-list>. Stop here.
       break;
     }
     item->mNext = new nsCSSValueList;
     item = item->mNext;
     item->mValue = trackSize;
   }
 
@@ -7357,21 +7357,21 @@ CSSParserImpl::ParseGridTemplateAfterStr
   for (;;) {
     if (!ParseGridTemplateAreasLine(mToken.mIdent, areas, areaIndices)) {
       return false;
     }
 
     rowsItem->mNext = new nsCSSValueList;
     rowsItem = rowsItem->mNext;
     // TODO: add repeat()
-    nsParsingStatus result = ParseGridTrackSize(rowsItem->mValue);
-    if (result == nsParsingStatus::Error) {
-      return false;
-    }
-    if (result == nsParsingStatus::NotFound) {
+    CSSParseResult result = ParseGridTrackSize(rowsItem->mValue);
+    if (result == CSSParseResult::Error) {
+      return false;
+    }
+    if (result == CSSParseResult::NotFound) {
       rowsItem->mValue.SetAutoValue();
     }
 
     rowsItem->mNext = new nsCSSValueList;
     rowsItem = rowsItem->mNext;
     if (!ParseGridLineNames(rowsItem->mValue)) {
       return false;
     }
@@ -7463,27 +7463,27 @@ CSSParserImpl::ParseGrid()
 // Parse [ <'grid-auto-columns'> [ / <'grid-auto-rows'> ]? ]?
 // for the 'grid' shorthand.
 // Assumes that <'grid-auto-flow'> was already parsed by the caller.
 bool
 CSSParserImpl::ParseGridShorthandAutoProps()
 {
   nsCSSValue autoColumnsValue;
   nsCSSValue autoRowsValue;
-  nsParsingStatus result = ParseGridTrackSize(autoColumnsValue);
-  if (result == nsParsingStatus::Error) {
-    return false;
-  }
-  if (result == nsParsingStatus::NotFound) {
+  CSSParseResult result = ParseGridTrackSize(autoColumnsValue);
+  if (result == CSSParseResult::Error) {
+    return false;
+  }
+  if (result == CSSParseResult::NotFound) {
     autoColumnsValue.SetAutoValue();
     autoRowsValue.SetAutoValue();
   } else {
     if (!ExpectSymbol('/', true)) {
       autoRowsValue.SetAutoValue();
-    } else if (ParseGridTrackSize(autoRowsValue) != nsParsingStatus::Ok) {
+    } else if (ParseGridTrackSize(autoRowsValue) != CSSParseResult::Ok) {
       return false;
     }
   }
   AppendValue(eCSSProperty_grid_auto_columns, autoColumnsValue);
   AppendValue(eCSSProperty_grid_auto_rows, autoRowsValue);
   nsCSSValue templateValue(eCSSUnit_None);  // Initial values
   AppendValue(eCSSProperty_grid_template_areas, templateValue);
   AppendValue(eCSSProperty_grid_template_columns, templateValue);