Add spec links for position properties

This commit is contained in:
Manish Goregaokar 2017-01-02 13:19:45 -08:00
parent 29c2db4457
commit d63af611f2
2 changed files with 31 additions and 11 deletions

View file

@ -12,16 +12,18 @@
% for side in PHYSICAL_SIDES: % for side in PHYSICAL_SIDES:
${helpers.predefined_type(side, "LengthOrPercentageOrAuto", ${helpers.predefined_type(side, "LengthOrPercentageOrAuto",
"computed::LengthOrPercentageOrAuto::Auto", "computed::LengthOrPercentageOrAuto::Auto",
spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side,
animatable=True)} animatable=True)}
% endfor % endfor
// offset-* logical properties, map to "top" / "left" / "bottom" / "right" // offset-* logical properties, map to "top" / "left" / "bottom" / "right"
% for side in LOGICAL_SIDES: % for side in LOGICAL_SIDES:
${helpers.predefined_type("offset-" + side, "LengthOrPercentageOrAuto", ${helpers.predefined_type("offset-%s" % side, "LengthOrPercentageOrAuto",
"computed::LengthOrPercentageOrAuto::Auto", "computed::LengthOrPercentageOrAuto::Auto",
spec="https://drafts.csswg.org/css-logical-props/#propdef-offset-%s" % side,
animatable=True, logical=True)} animatable=True, logical=True)}
% endfor % endfor
<%helpers:longhand name="z-index" animatable="True"> <%helpers:longhand name="z-index" spec="https://www.w3.org/TR/CSS2/visuren.html#z-index" animatable="True">
use values::NoViewportPercentage; use values::NoViewportPercentage;
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
@ -75,9 +77,11 @@
// Flex container properties // Flex container properties
${helpers.single_keyword("flex-direction", "row row-reverse column column-reverse", ${helpers.single_keyword("flex-direction", "row row-reverse column column-reverse",
spec="https://drafts.csswg.org/css-flexbox/#flex-direction-property",
animatable=False)} animatable=False)}
${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property",
animatable=False)} animatable=False)}
// FIXME(stshine): The type of 'justify-content' and 'align-content' is uint16_t in gecko // FIXME(stshine): The type of 'justify-content' and 'align-content' is uint16_t in gecko
@ -85,6 +89,7 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
${helpers.single_keyword("justify-content", "flex-start flex-end center space-between space-around", ${helpers.single_keyword("justify-content", "flex-start flex-end center space-between space-around",
gecko_constant_prefix="NS_STYLE_JUSTIFY", gecko_constant_prefix="NS_STYLE_JUSTIFY",
products="servo", products="servo",
spec="https://drafts.csswg.org/css-flexbox/#justify-content-property",
animatable=False)} animatable=False)}
// https://drafts.csswg.org/css-flexbox/#propdef-align-items // https://drafts.csswg.org/css-flexbox/#propdef-align-items
@ -93,21 +98,25 @@ ${helpers.single_keyword("align-items", "stretch flex-start flex-end center base
else "normal stretch flex-start flex-end center baseline", else "normal stretch flex-start flex-end center baseline",
need_clone=True, need_clone=True,
gecko_constant_prefix="NS_STYLE_ALIGN", gecko_constant_prefix="NS_STYLE_ALIGN",
spec="https://drafts.csswg.org/css-flexbox/#align-items-property",
animatable=False)} animatable=False)}
${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around", ${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around",
gecko_constant_prefix="NS_STYLE_ALIGN", gecko_constant_prefix="NS_STYLE_ALIGN",
products="servo", products="servo",
spec="https://drafts.csswg.org/css-flexbox/#align-content-property",
animatable=False)} animatable=False)}
// Flex item properties // Flex item properties
${helpers.predefined_type("flex-grow", "Number", ${helpers.predefined_type("flex-grow", "Number",
"0.0", "parse_non_negative", "0.0", "parse_non_negative",
spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property",
needs_context=False, needs_context=False,
animatable=True)} animatable=True)}
${helpers.predefined_type("flex-shrink", "Number", ${helpers.predefined_type("flex-shrink", "Number",
"1.0", "parse_non_negative", "1.0", "parse_non_negative",
spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property",
needs_context=False, needs_context=False,
animatable=True)} animatable=True)}
@ -117,10 +126,12 @@ ${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center
need_clone=True, need_clone=True,
extra_gecko_values="normal", extra_gecko_values="normal",
gecko_constant_prefix="NS_STYLE_ALIGN", gecko_constant_prefix="NS_STYLE_ALIGN",
spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self",
animatable=False)} animatable=False)}
// https://drafts.csswg.org/css-flexbox/#propdef-order // https://drafts.csswg.org/css-flexbox/#propdef-order
<%helpers:longhand name="order" animatable="True"> <%helpers:longhand name="order" animatable="True"
spec="https://drafts.csswg.org/css-flexbox/#order-property">
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {} impl ComputedValueAsSpecified for SpecifiedValue {}
@ -145,15 +156,22 @@ ${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center
${helpers.predefined_type("flex-basis", ${helpers.predefined_type("flex-basis",
"LengthOrPercentageOrAutoOrContent", "LengthOrPercentageOrAutoOrContent",
"computed::LengthOrPercentageOrAutoOrContent::Auto", "computed::LengthOrPercentageOrAutoOrContent::Auto",
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
animatable=False)} animatable=False)}
% for (size, logical) in ALL_SIZES: % for (size, logical) in ALL_SIZES:
<%
spec = "https://drafts.csswg.org/css-box/#propdef-%s"
if logical:
spec = "https://drafts.csswg.org/css-logical-props/#propdef-%s"
%>
// width, height, block-size, inline-size // width, height, block-size, inline-size
${helpers.predefined_type("%s" % size, ${helpers.predefined_type("%s" % size,
"LengthOrPercentageOrAuto", "LengthOrPercentageOrAuto",
"computed::LengthOrPercentageOrAuto::Auto", "computed::LengthOrPercentageOrAuto::Auto",
"parse_non_negative", "parse_non_negative",
needs_context=False, needs_context=False,
spec=spec % size,
animatable=True, logical = logical)} animatable=True, logical = logical)}
// min-width, min-height, min-block-size, min-inline-size // min-width, min-height, min-block-size, min-inline-size
@ -162,6 +180,7 @@ ${helpers.predefined_type("flex-basis",
"computed::LengthOrPercentage::Length(Au(0))", "computed::LengthOrPercentage::Length(Au(0))",
"parse_non_negative", "parse_non_negative",
needs_context=False, needs_context=False,
spec=spec % ("min-%s" % size),
animatable=True, logical = logical)} animatable=True, logical = logical)}
// max-width, max-height, max-block-size, max-inline-size // max-width, max-height, max-block-size, max-inline-size
@ -170,19 +189,19 @@ ${helpers.predefined_type("flex-basis",
"computed::LengthOrPercentageOrNone::None", "computed::LengthOrPercentageOrNone::None",
"parse_non_negative", "parse_non_negative",
needs_context=False, needs_context=False,
spec=spec % ("max-%s" % size),
animatable=True, logical = logical)} animatable=True, logical = logical)}
% endfor % endfor
${helpers.single_keyword("box-sizing", ${helpers.single_keyword("box-sizing",
"content-box border-box", "content-box border-box",
spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing",
animatable=False)} animatable=False)}
// CSS Image Values and Replaced Content Module Level 3
// https://drafts.csswg.org/css-images-3/
${helpers.single_keyword("object-fit", "fill contain cover none scale-down", ${helpers.single_keyword("object-fit", "fill contain cover none scale-down",
products="gecko", animatable=False)} products="gecko", animatable=False,
spec="https://drafts.csswg.org/css-images/#propdef-object-fit")}
// https://drafts.csswg.org/css-grid/#propdef-grid-row-start
<% grid_longhands = ["grid-row-start", "grid-row-end", "grid-column-start", "grid-column-end"] %> <% grid_longhands = ["grid-row-start", "grid-row-end", "grid-column-start", "grid-column-end"] %>
% for longhand in grid_longhands: % for longhand in grid_longhands:
@ -190,5 +209,6 @@ ${helpers.single_keyword("object-fit", "fill contain cover none scale-down",
"GridLine", "GridLine",
"Default::default()", "Default::default()",
animatable=False, animatable=False,
spec="https://drafts.csswg.org/css-grid/#propdef-%s" % longhand,
products="gecko")} products="gecko")}
% endfor % endfor

View file

@ -4,8 +4,8 @@
<%namespace name="helpers" file="/helpers.mako.rs" /> <%namespace name="helpers" file="/helpers.mako.rs" />
// https://drafts.csswg.org/css-flexbox/#flex-flow-property <%helpers:shorthand name="flex-flow" sub_properties="flex-direction flex-wrap"
<%helpers:shorthand name="flex-flow" sub_properties="flex-direction flex-wrap"> spec="https://drafts.csswg.org/css-flexbox/#flex-flow-property">
use properties::longhands::{flex_direction, flex_wrap}; use properties::longhands::{flex_direction, flex_wrap};
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> { pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
@ -54,8 +54,8 @@
} }
</%helpers:shorthand> </%helpers:shorthand>
// https://drafts.csswg.org/css-flexbox/#flex-property <%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis"
<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis"> spec="https://drafts.csswg.org/css-flexbox/#flex-property">
use parser::Parse; use parser::Parse;
use app_units::Au; use app_units::Au;
use values::specified::{Number, Length, LengthOrPercentageOrAutoOrContent}; use values::specified::{Number, Length, LengthOrPercentageOrAutoOrContent};