Bug 1208635 part 2: Extend existing parser code for CSSUnprefixingService "-webkit-box" handling to also activate if native unprefixing is enabled. r=heycam
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 04 Nov 2015 17:59:52 -0800
changeset 271240 8b1626ab504f17950e36ae4a7387c77b1edf49b3
parent 271239 e0317d4a7a0dae3dd7a9e10d752ef98e1d76d934
child 271241 073a8c4b51ef5916c4c953875bfb3d6f8a1afeab
push id29634
push usercbook@mozilla.com
push dateThu, 05 Nov 2015 10:59:26 +0000
treeherdermozilla-central@59c648a3f955 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1208635
milestone45.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 1208635 part 2: Extend existing parser code for CSSUnprefixingService "-webkit-box" handling to also activate if native unprefixing is enabled. r=heycam
layout/style/nsCSSParser.cpp
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -6782,39 +6782,40 @@ CSSParserImpl::ParseTreePseudoElement(ns
 nsCSSKeyword
 CSSParserImpl::LookupKeywordPrefixAware(nsAString& aKeywordStr,
                                         const KTableValue aKeywordTable[])
 {
   nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(aKeywordStr);
 
   if (aKeywordTable == nsCSSProps::kDisplayKTable) {
     if (keyword == eCSSKeyword_UNKNOWN &&
-        ShouldUseUnprefixingService() &&
+        (sWebkitPrefixedAliasesEnabled || ShouldUseUnprefixingService()) &&
         aKeywordStr.EqualsLiteral("-webkit-box")) {
       // Treat "display: -webkit-box" as "display: flex". In simple scenarios,
-      // they largely behave the same, as long as we use the CSS Unprefixing
-      // Service to also translate the associated properties.
+      // they largely behave the same, as long as we alias the associated
+      // properties to modern flexbox equivalents as well.
       if (mWebkitBoxUnprefixState == eHaveNotUnprefixed) {
         mWebkitBoxUnprefixState = eHaveUnprefixed;
       }
       return eCSSKeyword_flex;
     }
 
     // If we've seen "display: -webkit-box" in an earlier declaration and we
     // tried to unprefix it to emulate support for it, then we have to watch
     // out for later "display: -moz-box" declarations; they're likely just a
     // halfhearted attempt at compatibility, and they actually end up stomping
     // on our emulation of the earlier -webkit-box display-value, via the CSS
     // cascade. To prevent this problem, we also treat "display: -moz-box" as
     // "display: flex" (but only if we unprefixed an earlier "-webkit-box").
     if (mWebkitBoxUnprefixState == eHaveUnprefixed &&
         keyword == eCSSKeyword__moz_box) {
-      MOZ_ASSERT(ShouldUseUnprefixingService(),
+      MOZ_ASSERT(sWebkitPrefixedAliasesEnabled || ShouldUseUnprefixingService(),
                  "mDidUnprefixWebkitBoxInEarlierDecl should only be set if "
-                 "we're using the unprefixing service on this site");
+                 "we're supporting webkit-prefixed aliases, or if we're using "
+                 "the css unprefixing service on this site");
       return eCSSKeyword_flex;
     }
   }
 
   return keyword;
 }
 
 bool