Bug 837211 - Add -webkit prefixed aliases for various CSS properties, behind an off-by-default preference. r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Tue, 06 Oct 2015 20:56:43 -0700
changeset 266484 e44fb274be902f321b12d899ac6a2717ea622f56
parent 266483 530c5bc61a02d1045101a7fdd91cc234e7ba558d
child 266485 798a47128b77bf682f5d67b13379f08c1a7d3dc1
push id29493
push userkwierso@gmail.com
push dateWed, 07 Oct 2015 17:31:17 +0000
treeherdermozilla-central@49d87bbe0122 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs837211
milestone44.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 837211 - Add -webkit prefixed aliases for various CSS properties, behind an off-by-default preference. r=bzbarsky Note that this does not emulate the WebKit quirk of supporting element.style["-webkit-animation"] or supporting the uppercase element.style.WebkitAnimation (etc.) as opposed to the lowercase (and enumerable) element.style.webkitAnimation. Note that this also does not add aliases for transition or animation events. (Patch has been minorly tweaked by dholbert, with dbaron's approval.)
layout/style/nsCSSParser.cpp
layout/style/nsCSSPropAliasList.h
modules/libpref/init/all.js
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -2999,16 +2999,18 @@ CSSParserImpl::ParseAtRule(RuleAppendFun
 
   } else if (mToken.mIdent.LowerCaseEqualsLiteral("page")) {
     parseFunc = &CSSParserImpl::ParsePageRule;
     newSection = eCSSSection_General;
 
   } else if ((nsCSSProps::IsEnabled(eCSSPropertyAlias_MozAnimation,
                                     PropertyEnabledState()) &&
               mToken.mIdent.LowerCaseEqualsLiteral("-moz-keyframes")) ||
+             (nsCSSProps::IsEnabled(eCSSPropertyAlias_WebkitAnimation) &&
+              mToken.mIdent.LowerCaseEqualsLiteral("-webkit-keyframes")) ||
              mToken.mIdent.LowerCaseEqualsLiteral("keyframes")) {
     parseFunc = &CSSParserImpl::ParseKeyframesRule;
     newSection = eCSSSection_General;
 
   } else if (mToken.mIdent.LowerCaseEqualsLiteral("supports")) {
     parseFunc = &CSSParserImpl::ParseSupportsRule;
     newSection = eCSSSection_General;
 
--- a/layout/style/nsCSSPropAliasList.h
+++ b/layout/style/nsCSSPropAliasList.h
@@ -174,8 +174,143 @@ CSS_PROP_ALIAS(-moz-border-start-style,
 CSS_PROP_ALIAS(-moz-border-start-width,
                border_inline_start_width,
                MozBorderStartWidth,
                "")
 CSS_PROP_ALIAS(-moz-hyphens,
                hyphens,
                MozHyphens,
                "")
+
+#define WEBKIT_PREFIX_PREF "layout.css.prefixes.webkit"
+
+// -webkit- prefixes
+CSS_PROP_ALIAS(-webkit-animation,
+               animation,
+               WebkitAnimation,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-delay,
+               animation_delay,
+               WebkitAnimationDelay,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-direction,
+               animation_direction,
+               WebkitAnimationDirection,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-duration,
+               animation_duration,
+               WebkitAnimationDuration,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-fill-mode,
+               animation_fill_mode,
+               WebkitAnimationFillMode,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-iteration-count,
+               animation_iteration_count,
+               WebkitAnimationIterationCount,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-name,
+               animation_name,
+               WebkitAnimationName,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-play-state,
+               animation_play_state,
+               WebkitAnimationPlayState,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-animation-timing-function,
+               animation_timing_function,
+               WebkitAnimationTimingFunction,
+               WEBKIT_PREFIX_PREF)
+
+CSS_PROP_ALIAS(-webkit-text-size-adjust,
+               text_size_adjust,
+               WebkitTextSizeAdjust,
+               WEBKIT_PREFIX_PREF)
+
+CSS_PROP_ALIAS(-webkit-transform,
+               transform,
+               WebkitTransform,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-transform-origin,
+               transform_origin,
+               WebkitTransformOrigin,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-transform-style,
+               transform_style,
+               WebkitTransformStyle,
+               WEBKIT_PREFIX_PREF)
+
+CSS_PROP_ALIAS(-webkit-transition,
+               transition,
+               WebkitTransition,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-transition-delay,
+               transition_delay,
+               WebkitTransitionDelay,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-transition-duration,
+               transition_duration,
+               WebkitTransitionDuration,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-transition-property,
+               transition_property,
+               WebkitTransitionProperty,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-transition-timing-function,
+               transition_timing_function,
+               WebkitTransitionTimingFunction,
+               WEBKIT_PREFIX_PREF)
+
+CSS_PROP_ALIAS(-webkit-border-radius,
+               border_radius,
+               WebkitBorderRadius,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-border-top-left-radius,
+               border_top_left_radius,
+               WebkitBorderTopLeftRadius, // really no dom property
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-border-top-right-radius,
+               border_top_right_radius,
+               WebkitBorderTopRightRadius, // really no dom property
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-border-bottom-left-radius,
+               border_bottom_left_radius,
+               WebkitBorderBottomLeftRadius, // really no dom property
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-border-bottom-right-radius,
+               border_bottom_right_radius,
+               WebkitBorderBottomRightRadius, // really no dom property
+               WEBKIT_PREFIX_PREF)
+
+CSS_PROP_ALIAS(-webkit-appearance,
+               appearance,
+               WebkitAppearance,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-background-clip,
+               background_clip,
+               WebkitBackgroundClip,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-background-origin,
+               background_origin,
+               WebkitBackgroundOrigin,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-background-size,
+               background_size,
+               WebkitBackgroundSize,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-border-image,
+               border_image,
+               WebkitBorderImage,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-box-shadow,
+               box_shadow,
+               WebkitBoxShadow,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-box-sizing,
+               box_sizing,
+               WebkitBoxSizing,
+               WEBKIT_PREFIX_PREF)
+CSS_PROP_ALIAS(-webkit-user-select,
+               user_select,
+               WebkitUserSelect,
+               WEBKIT_PREFIX_PREF)
+
+#undef WEBKIT_PREFIX_PREF
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2293,16 +2293,19 @@ pref("layout.css.image-orientation.enabl
 pref("layout.css.prefixes.border-image", true);
 pref("layout.css.prefixes.transforms", true);
 pref("layout.css.prefixes.transitions", true);
 pref("layout.css.prefixes.animations", true);
 pref("layout.css.prefixes.box-sizing", true);
 pref("layout.css.prefixes.font-features", true);
 pref("layout.css.prefixes.gradients", true);
 
+// Are webkit-prefixed properties & property-values supported?
+pref("layout.css.prefixes.webkit", false);
+
 // Is the CSS Unprefixing Service enabled? (This service emulates support
 // for certain vendor-prefixed properties & values, for sites on a "fixlist".)
 pref("layout.css.unprefixing-service.enabled", true);
 #ifdef NIGHTLY_BUILD
 // Is the CSS Unprefixing Service whitelisted for all domains?
 // (This pref is only honored in Nightly builds and can be removed when
 // Bug 1177263 is fixed.)
 pref("layout.css.unprefixing-service.globally-whitelisted", false);