Add other property aliases

This commit is contained in:
Xidorn Quan 2017-01-10 20:22:36 +11:00
parent 2f2044e4b7
commit 8a8ef48fb3
16 changed files with 68 additions and 34 deletions

View file

@ -203,17 +203,17 @@ ${helpers.single_keyword("background-attachment",
${helpers.single_keyword("background-clip",
"border-box padding-box content-box",
vector=True,
vector=True, extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip",
animatable=False)}
${helpers.single_keyword("background-origin",
"padding-box border-box content-box",
vector=True,
vector=True, extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin",
animatable=False)}
<%helpers:vector_longhand name="background-size" animatable="True"
<%helpers:vector_longhand name="background-size" animatable="True" extra_prefixes="webkit"
spec="https://drafts.csswg.org/css-backgrounds/#the-background-size">
use cssparser::Token;
use std::ascii::AsciiExt;

View file

@ -64,7 +64,7 @@
% for corner in ["top-left", "top-right", "bottom-right", "bottom-left"]:
${helpers.predefined_type("border-" + corner + "-radius", "BorderRadiusSize",
"computed::BorderRadiusSize::zero()",
"parse",
"parse", extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-backgrounds/#border-%s-radius" % corner,
animatable=True)}
% endfor

View file

@ -436,6 +436,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:vector_longhand name="transition-duration"
need_index="True"
animatable="False"
extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-duration">
use values::specified::Time;
@ -461,6 +462,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:vector_longhand name="transition-timing-function"
need_index="True"
animatable="False"
extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function">
use self::computed_value::StartEnd;
@ -722,6 +724,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
allow_empty="True"
need_index="True"
animatable="False"
extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property">
use values::computed::ComputedValueAsSpecified;
@ -750,6 +753,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:vector_longhand name="transition-delay"
need_index="True"
animatable="False"
extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-delay">
pub use properties::longhands::transition_duration::single_value::SpecifiedValue;
pub use properties::longhands::transition_duration::single_value::computed_value;
@ -760,6 +764,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
allow_empty="True"
need_index="True"
animatable="False",
extra_prefixes="moz webkit"
allowed_in_keyframe_block="False"
spec="https://drafts.csswg.org/css-animations/#propdef-animation-name">
use Atom;
@ -811,6 +816,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:vector_longhand name="animation-duration"
need_index="True"
animatable="False",
extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-animations/#propdef-animation-duration",
allowed_in_keyframe_block="False">
pub use properties::longhands::transition_duration::single_value::computed_value;
@ -821,6 +827,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:vector_longhand name="animation-timing-function"
need_index="True"
animatable="False",
extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-animations/#propdef-animation-timing-function",
allowed_in_keyframe_block="False">
pub use properties::longhands::transition_timing_function::single_value::computed_value;
@ -833,6 +840,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:vector_longhand name="animation-iteration-count"
need_index="True"
animatable="False",
extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count",
allowed_in_keyframe_block="False">
use std::fmt;
@ -899,6 +907,7 @@ ${helpers.single_keyword("animation-direction",
vector=True,
gecko_enum_prefix="PlaybackDirection",
custom_consts=animation_direction_custom_consts,
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-direction",
allowed_in_keyframe_block=False)}
@ -910,6 +919,7 @@ ${helpers.single_keyword("animation-play-state",
need_index=True,
animatable=False,
vector=True,
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-play-state",
allowed_in_keyframe_block=True)}
@ -919,12 +929,14 @@ ${helpers.single_keyword("animation-fill-mode",
animatable=False,
vector=True,
gecko_enum_prefix="FillMode",
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-fill-mode",
allowed_in_keyframe_block=False)}
<%helpers:vector_longhand name="animation-delay"
need_index="True"
animatable="False",
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-delay",
allowed_in_keyframe_block="False">
pub use properties::longhands::transition_duration::single_value::computed_value;
@ -1037,7 +1049,8 @@ ${helpers.single_keyword("animation-fill-mode",
<%helpers:longhand name="transform" products="gecko servo" animatable="${product == 'servo'}"
<%helpers:longhand name="transform" products="gecko servo" extra_prefixes="webkit"
animatable="${product == 'servo'}"
spec="https://drafts.csswg.org/css-transforms/#propdef-transform">
use app_units::Au;
use style_traits::ToCss;
@ -1625,10 +1638,11 @@ ${helpers.predefined_type("perspective",
"Either::Second(None_)",
gecko_ffi_name="mChildPerspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
extra_prefixes="moz webkit",
animatable=True)}
// FIXME: This prop should be animatable
<%helpers:longhand name="perspective-origin" animatable="False"
<%helpers:longhand name="perspective-origin" animatable="False" extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-transforms/#perspective-origin-property">
use std::fmt;
use style_traits::ToCss;
@ -1718,6 +1732,7 @@ ${helpers.predefined_type("perspective",
${helpers.single_keyword("backface-visibility",
"visible hidden",
spec="https://drafts.csswg.org/css-transforms/#backface-visibility-property",
extra_prefixes="moz webkit",
animatable=False)}
${helpers.single_keyword("transform-box",
@ -1731,9 +1746,10 @@ ${helpers.single_keyword("transform-style",
"auto flat preserve-3d" if product == "servo" else
"flat preserve-3d",
spec="https://drafts.csswg.org/css-transforms/#transform-style-property",
extra_prefixes="moz webkit",
animatable=False)}
<%helpers:longhand name="transform-origin" animatable="True"
<%helpers:longhand name="transform-origin" animatable="True" extra_prefixes="moz webkit"
spec="https://drafts.csswg.org/css-transforms/#transform-origin-property">
use app_units::Au;
use std::fmt;

View file

@ -11,13 +11,14 @@ ${helpers.predefined_type("column-width",
"length::LengthOrAuto",
"Either::Second(Auto)",
parse_method="parse_non_negative_length",
extra_prefixes="moz",
animatable=False,
experimental=True,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")}
// FIXME: This prop should be animatable.
<%helpers:longhand name="column-count" experimental="True" animatable="False"
<%helpers:longhand name="column-count" experimental="True" animatable="False" extra_prefixes="moz"
spec="https://drafts.csswg.org/css-multicol/#propdef-column-count">
use std::fmt;
use style_traits::ToCss;
@ -102,16 +103,17 @@ ${helpers.predefined_type("column-gap",
"length::LengthOrNormal",
"Either::Second(Normal)",
parse_method='parse_non_negative_length',
extra_prefixes="moz",
experimental=True,
animatable=False,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")}
${helpers.single_keyword("column-fill", "auto balance",
${helpers.single_keyword("column-fill", "auto balance", extra_prefixes="moz",
products="gecko", animatable=False,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")}
// https://drafts.csswg.org/css-multicol-1/#propdef-column-rule-width
<%helpers:longhand name="column-rule-width" products="gecko" animatable="True"
<%helpers:longhand name="column-rule-width" products="gecko" animatable="True" extra_prefixes="moz"
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width">
use app_units::Au;
use std::fmt;
@ -144,7 +146,7 @@ ${helpers.single_keyword("column-fill", "auto balance",
// https://drafts.csswg.org/css-multicol-1/#crc
${helpers.predefined_type("column-rule-color", "CSSColor",
"::cssparser::Color::CurrentColor",
products="gecko", animatable=True,
products="gecko", animatable=True, extra_prefixes="moz",
complex_color=True, need_clone=True,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-color")}
@ -155,7 +157,7 @@ ${helpers.single_keyword("column-span", "none all",
${helpers.single_keyword("column-rule-style",
"none hidden dotted dashed solid double groove ridge inset outset",
products="gecko",
products="gecko", extra_prefixes="moz",
gecko_constant_prefix="NS_STYLE_BORDER_STYLE",
animatable=False,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-style")}

View file

@ -13,7 +13,8 @@ ${helpers.predefined_type("opacity",
animatable=True,
spec="https://drafts.csswg.org/css-color/#opacity")}
<%helpers:vector_longhand name="box-shadow" allow_empty="True" animatable="True"
<%helpers:vector_longhand name="box-shadow" allow_empty="True"
animatable="True" extra_prefixes="webkit"
spec="https://drafts.csswg.org/css-backgrounds/#box-shadow">
use cssparser;
use std::fmt;
@ -290,7 +291,7 @@ ${helpers.predefined_type("opacity",
</%helpers:longhand>
// FIXME: This prop should be animatable
<%helpers:longhand name="filter" animatable="False"
<%helpers:longhand name="filter" animatable="False" extra_prefixes="webkit"
spec="https://drafts.fxtf.org/filters/#propdef-filter">
//pub use self::computed_value::T as SpecifiedValue;
use cssparser;

View file

@ -526,7 +526,7 @@ ${helpers.single_keyword("font-variant-position",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-position",
animatable=False)}
<%helpers:longhand name="font-feature-settings" products="none" animatable="False"
<%helpers:longhand name="font-feature-settings" products="none" animatable="False" extra_prefixes="moz"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-feature-settings">
use std::fmt;
use style_traits::ToCss;
@ -637,7 +637,7 @@ ${helpers.single_keyword("font-variant-position",
</%helpers:longhand>
// https://www.w3.org/TR/css-fonts-3/#propdef-font-language-override
<%helpers:longhand name="font-language-override" products="none" animatable="False"
<%helpers:longhand name="font-language-override" products="none" animatable="False" extra_prefixes="moz"
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font-language-override">
use values::NoViewportPercentage;
use values::computed::ComputedValueAsSpecified;

View file

@ -156,7 +156,7 @@ ${helpers.single_keyword("text-transform",
${helpers.single_keyword("hyphens", "none manual auto",
gecko_enum_prefix="StyleHyphens",
products="gecko", animatable=False,
products="gecko", animatable=False, extra_prefixes="moz",
spec="https://drafts.csswg.org/css-text/#propdef-hyphens")}
${helpers.predefined_type("text-indent",

View file

@ -78,17 +78,18 @@
// Flex container properties
${helpers.single_keyword("flex-direction", "row row-reverse column column-reverse",
spec="https://drafts.csswg.org/css-flexbox/#flex-direction-property",
animatable=False)}
extra_prefixes="webkit", animatable=False)}
${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property",
animatable=False)}
extra_prefixes="webkit", animatable=False)}
// FIXME(stshine): The type of 'justify-content' and 'align-content' is uint16_t in gecko
// FIXME(stshine): Its higher bytes are used to store fallback value. Disable them in geckolib for now
${helpers.single_keyword("justify-content", "flex-start flex-end center space-between space-around",
gecko_constant_prefix="NS_STYLE_JUSTIFY",
products="servo",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#justify-content-property",
animatable=False)}
@ -97,6 +98,7 @@ ${helpers.single_keyword("justify-content", "flex-start flex-end center space-be
${helpers.single_keyword("align-items", "stretch flex-start flex-end center baseline" if product == "servo"
else "normal stretch flex-start flex-end center baseline",
need_clone=True,
extra_prefixes="webkit",
gecko_constant_prefix="NS_STYLE_ALIGN",
spec="https://drafts.csswg.org/css-flexbox/#align-items-property",
animatable=False)}
@ -104,6 +106,7 @@ ${helpers.single_keyword("align-items", "stretch flex-start flex-end center base
${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around",
gecko_constant_prefix="NS_STYLE_ALIGN",
products="servo",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#align-content-property",
animatable=False)}
@ -111,12 +114,14 @@ ${helpers.single_keyword("align-content", "stretch flex-start flex-end center sp
${helpers.predefined_type("flex-grow", "Number",
"0.0", "parse_non_negative",
spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property",
extra_prefixes="webkit",
needs_context=False,
animatable=True)}
${helpers.predefined_type("flex-shrink", "Number",
"1.0", "parse_non_negative",
spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property",
extra_prefixes="webkit",
needs_context=False,
animatable=True)}
@ -124,13 +129,14 @@ ${helpers.predefined_type("flex-shrink", "Number",
// FIXME: We don't support the Gecko value 'normal' yet.
${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center baseline",
need_clone=True,
extra_prefixes="webkit",
extra_gecko_values="normal",
gecko_constant_prefix="NS_STYLE_ALIGN",
spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self",
animatable=False)}
// https://drafts.csswg.org/css-flexbox/#propdef-order
<%helpers:longhand name="order" animatable="True"
<%helpers:longhand name="order" animatable="True" extra_prefixes="webkit"
spec="https://drafts.csswg.org/css-flexbox/#order-property">
use values::computed::ComputedValueAsSpecified;
@ -157,6 +163,7 @@ ${helpers.predefined_type("flex-basis",
"LengthOrPercentageOrAutoOrContent",
"computed::LengthOrPercentageOrAutoOrContent::Auto",
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
extra_prefixes="webkit",
animatable=False)}
% for (size, logical) in ALL_SIZES:
@ -195,6 +202,7 @@ ${helpers.predefined_type("flex-basis",
${helpers.single_keyword("box-sizing",
"content-box border-box",
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing",
animatable=False)}

View file

@ -99,10 +99,11 @@ ${helpers.single_keyword("mask-repeat",
"repeat repeat-x repeat-y space round no-repeat",
vector=True,
products="gecko",
extra_prefixes="webkit",
animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-repeat")}
<%helpers:vector_longhand name="mask-position" products="gecko" animatable="True"
<%helpers:vector_longhand name="mask-position" products="gecko" animatable="True" extra_prefixes="webkit"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position">
use std::fmt;
use style_traits::ToCss;
@ -163,6 +164,7 @@ ${helpers.single_keyword("mask-clip",
"content-box padding-box border-box",
vector=True,
products="gecko",
extra_prefixes="webkit",
animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-clip")}
@ -172,10 +174,11 @@ ${helpers.single_keyword("mask-origin",
"content-box padding-box border-box",
vector=True,
products="gecko",
extra_prefixes="webkit",
animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin")}
<%helpers:longhand name="mask-size" products="gecko" animatable="True"
<%helpers:longhand name="mask-size" products="gecko" animatable="True" extra_prefixes="webkit"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size">
use properties::longhands::background_size;
pub use ::properties::longhands::background_size::SpecifiedValue;
@ -196,10 +199,11 @@ ${helpers.single_keyword("mask-composite",
"add subtract intersect exclude",
vector=True,
products="gecko",
extra_prefixes="webkit",
animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-composite")}
<%helpers:vector_longhand name="mask-image" products="gecko" animatable="False"
<%helpers:vector_longhand name="mask-image" products="gecko" animatable="False" extra_prefixes="webkit"
has_uncacheable_values="${product == 'gecko'}",
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image">
use std::fmt;

View file

@ -17,6 +17,7 @@ ${helpers.single_keyword("ime-mode", "normal auto active disabled inactive",
spec="https://drafts.csswg.org/css-ui/#input-method-editor")}
${helpers.single_keyword("-moz-user-select", "auto text none all", products="gecko",
alias="-webkit-user-select",
gecko_ffi_name="mUserSelect",
gecko_enum_prefix="StyleUserSelect",
gecko_inexhaustive=True,

View file

@ -13,10 +13,12 @@ ${helpers.single_keyword("-moz-box-align", "stretch start center baseline end",
gecko_enum_prefix="StyleBoxAlign",
gecko_inexhaustive=True,
animatable=False,
alias="-webkit-box-align",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-align)")}
${helpers.predefined_type("-moz-box-flex", "Number", "0.0", "parse_non_negative",
products="gecko", gecko_ffi_name="mBoxFlex",
needs_context=False,
animatable=False,
alias="-webkit-box-flex",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)")}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import to_rust_ident, ALL_SIDES %>
<% from data import to_rust_ident, ALL_SIDES, maybe_moz_logical_alias %>
${helpers.four_sides_shorthand("border-color", "border-%s-color", "specified::CSSColor::parse",
spec="https://drafts.csswg.org/css-backgrounds/#border-color")}
@ -99,7 +99,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
<%helpers:shorthand name="border-${side}" sub_properties="${' '.join(
'border-%s-%s' % (side, prop)
for prop in ['color', 'style', 'width']
)}" spec="${spec}">
)}" alias=maybe_moz_logical_alias(product, side, "-moz-border-%s") spec="${spec}">
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
let (color, style, width) = try!(super::parse_border(context, input));
@ -159,7 +159,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
<%helpers:shorthand name="border-radius" sub_properties="${' '.join(
'border-%s-radius' % (corner)
for corner in ['top-left', 'top-right', 'bottom-right', 'bottom-left']
)}" spec="https://drafts.csswg.org/css-backgrounds/#border-radius">
)}" extra_prefixes="webkit" spec="https://drafts.csswg.org/css-backgrounds/#border-radius">
use values::specified::basic_shape::BorderRadius;
use parser::Parse;
@ -194,7 +194,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
<%helpers:shorthand name="border-image" products="gecko" sub_properties="border-image-outset
border-image-repeat border-image-slice border-image-source border-image-width"
spec="https://drafts.csswg.org/css-backgrounds-3/#border-image">
extra_prefixes="moz webkit" spec="https://drafts.csswg.org/css-backgrounds-3/#border-image">
use properties::longhands::{border_image_outset, border_image_repeat, border_image_slice};
use properties::longhands::{border_image_source, border_image_width};

View file

@ -94,7 +94,7 @@ macro_rules! try_parse_one {
};
}
<%helpers:shorthand name="transition"
<%helpers:shorthand name="transition" extra_prefixes="moz webkit"
sub_properties="transition-property transition-duration
transition-timing-function
transition-delay"
@ -183,7 +183,7 @@ macro_rules! try_parse_one {
}
</%helpers:shorthand>
<%helpers:shorthand name="animation"
<%helpers:shorthand name="animation" extra_prefixes="moz webkit"
sub_properties="animation-name animation-duration
animation-timing-function animation-delay
animation-iteration-count animation-direction

View file

@ -5,7 +5,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="columns" sub_properties="column-count column-width" experimental="True"
spec="https://drafts.csswg.org/css-multicol/#propdef-columns">
extra_prefixes="moz" spec="https://drafts.csswg.org/css-multicol/#propdef-columns">
use properties::longhands::{column_count, column_width};
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
@ -59,7 +59,7 @@
}
</%helpers:shorthand>
<%helpers:shorthand name="column-rule" products="gecko"
<%helpers:shorthand name="column-rule" products="gecko" extra_prefixes="moz"
sub_properties="column-rule-width column-rule-style column-rule-color"
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule">
use properties::longhands::{column_rule_width, column_rule_style};

View file

@ -4,7 +4,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="mask" products="gecko"
<%helpers:shorthand name="mask" products="gecko" extra_prefixes="webkit"
sub_properties="mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position
mask-size mask-image"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask">

View file

@ -4,7 +4,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="flex-flow" sub_properties="flex-direction flex-wrap"
<%helpers:shorthand name="flex-flow" sub_properties="flex-direction flex-wrap" extra_prefixes="webkit"
spec="https://drafts.csswg.org/css-flexbox/#flex-flow-property">
use properties::longhands::{flex_direction, flex_wrap};
@ -54,7 +54,7 @@
}
</%helpers:shorthand>
<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis"
<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis" extra_prefixes="webkit"
spec="https://drafts.csswg.org/css-flexbox/#flex-property">
use parser::Parse;
use app_units::Au;