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.)
This commit is contained in:
L. David Baron 2015-10-06 20:56:43 -07:00
parent f9a40f0200
commit cb29ef1f05
3 changed files with 140 additions and 0 deletions

View File

@ -3004,6 +3004,8 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
} 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;

View File

@ -179,3 +179,138 @@ 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

View File

@ -2298,6 +2298,9 @@ 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);