From 26a9b450a22ad82e6aa68a3262403abc4591698d Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 2 Jan 2017 18:59:57 -0800 Subject: [PATCH] Add spec links for inherited_text properties --- .../longhand/inherited_text.mako.rs | 159 ++++++++++-------- .../shorthand/inherited_text.mako.rs | 8 +- 2 files changed, 95 insertions(+), 72 deletions(-) diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 21a769514e5..32e5c91b7d0 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -6,7 +6,8 @@ <% data.new_style_struct("InheritedText", inherited=True, gecko_name="Text") %> -<%helpers:longhand name="line-height" animatable="True"> +<%helpers:longhand name="line-height" animatable="True" + spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height"> use std::fmt; use style_traits::ToCss; use values::{CSSFloat, HasViewportPercentage}; @@ -144,7 +145,56 @@ } -<%helpers:longhand name="text-align" animatable="False"> +// CSS Text Module Level 3 + +// TODO(pcwalton): `full-width` +${helpers.single_keyword("text-transform", + "none capitalize uppercase lowercase", + extra_gecko_values="full-width", + animatable=False, + spec="https://drafts.csswg.org/css-text/#propdef-text-transform")} + +${helpers.single_keyword("hyphens", "none manual auto", + products="gecko", animatable=False, + spec="https://drafts.csswg.org/css-text/#propdef-hyphens")} + +${helpers.predefined_type("text-indent", + "LengthOrPercentage", + "computed::LengthOrPercentage::Length(Au(0))", + animatable=True, + spec="https://drafts.csswg.org/css-text/#propdef-text-indent")} + +// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred +// name per CSS-TEXT 6.2. +${helpers.single_keyword("overflow-wrap", + "normal break-word", + gecko_constant_prefix="NS_STYLE_OVERFLOWWRAP", + animatable=False, + spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap")} + +// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support. +${helpers.single_keyword("word-break", + "normal break-all keep-all", + gecko_constant_prefix="NS_STYLE_WORDBREAK", + animatable=False, + spec="https://drafts.csswg.org/css-text/#propdef-word-break")} + +// TODO(pcwalton): Support `text-justify: distribute`. +${helpers.single_keyword("text-justify", + "auto none inter-word", + products="servo", + animatable=False, + spec="https://drafts.csswg.org/css-text/#propdef-text-justify")} + +${helpers.single_keyword("text-align-last", + "auto start end left right center justify", + products="gecko", + gecko_constant_prefix="NS_STYLE_TEXT_ALIGN", + animatable=False, + spec="https://drafts.csswg.org/css-text/#propdef-text-align-last")} + +// TODO make this a shorthand and implement text-align-last/text-align-all +<%helpers:longhand name="text-align" animatable="False" spec="https://drafts.csswg.org/css-text/#propdef-text-align"> pub use self::computed_value::T as SpecifiedValue; use values::computed::ComputedValueAsSpecified; use values::NoViewportPercentage; @@ -206,7 +256,8 @@ // FIXME: This prop should be animatable. -<%helpers:longhand name="letter-spacing" animatable="False"> +<%helpers:longhand name="letter-spacing" animatable="False" + spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing"> use std::fmt; use style_traits::ToCss; use values::HasViewportPercentage; @@ -286,7 +337,8 @@ } -<%helpers:longhand name="word-spacing" animatable="False"> +<%helpers:longhand name="word-spacing" animatable="False" + spec="https://drafts.csswg.org/css-text/#propdef-word-spacing"> use std::fmt; use style_traits::ToCss; use values::HasViewportPercentage; @@ -367,40 +419,11 @@ } -${helpers.predefined_type("text-indent", - "LengthOrPercentage", - "computed::LengthOrPercentage::Length(Au(0))", - animatable=True)} - -// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred -// name per CSS-TEXT 6.2. -${helpers.single_keyword("overflow-wrap", - "normal break-word", - gecko_constant_prefix="NS_STYLE_OVERFLOWWRAP", - animatable=False)} - -// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support. -${helpers.single_keyword("word-break", - "normal break-all keep-all", - gecko_constant_prefix="NS_STYLE_WORDBREAK", - animatable=False)} - -// TODO(pcwalton): Support `text-justify: distribute`. -${helpers.single_keyword("text-justify", - "auto none inter-word", - products="servo", - animatable=False)} - -${helpers.single_keyword("text-align-last", - "auto start end left right center justify", - products="gecko", - gecko_constant_prefix="NS_STYLE_TEXT_ALIGN", - animatable=False)} - <%helpers:longhand name="-servo-text-decorations-in-effect" derived_from="display text-decoration" need_clone="True" products="servo" - animatable="False"> + animatable="False" + spec="Nonstandard (Internal property used by Servo)"> use cssparser::RGBA; use std::fmt; use style_traits::ToCss; @@ -485,7 +508,8 @@ ${helpers.single_keyword("text-align-last", <%helpers:single_keyword_computed name="white-space" values="normal pre nowrap pre-wrap pre-line" gecko_constant_prefix="NS_STYLE_WHITESPACE" - animatable="False"> + animatable="False" + spec="https://drafts.csswg.org/css-text/#propdef-white-space"> use values::computed::ComputedValueAsSpecified; use values::NoViewportPercentage; impl ComputedValueAsSpecified for SpecifiedValue {} @@ -524,7 +548,8 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="text-shadow" animatable="True"> +<%helpers:longhand name="text-shadow" animatable="True" + spec="https://drafts.csswg.org/css-text-decor/#propdef-text-shadow"> use cssparser; use std::fmt; use style_traits::ToCss; @@ -733,7 +758,8 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="text-emphasis-style" products="gecko" need_clone="True" animatable="False"> +<%helpers:longhand name="text-emphasis-style" products="gecko" need_clone="True" animatable="False" + spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-style"> use computed_values::writing_mode::T as writing_mode; use std::fmt; use style_traits::ToCss; @@ -940,7 +966,8 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="text-emphasis-position" animatable="False" products="none"> +<%helpers:longhand name="text-emphasis-position" animatable="False" products="none" + spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-position"> use std::fmt; use values::computed::ComputedValueAsSpecified; use values::NoViewportPercentage; @@ -989,31 +1016,30 @@ ${helpers.single_keyword("text-align-last", } -// https://drafts.csswg.org/css-text-decor-3/#text-emphasis-color-property ${helpers.predefined_type("text-emphasis-color", "CSSColor", "::cssparser::Color::CurrentColor", products="gecko",animatable=True, - complex_color=True, need_clone=True)} + complex_color=True, need_clone=True, + spec="https://drafts.csswg.org/css-text-decor/#propdef-text-emphasis-color")} // CSS Compatibility -// https://compat.spec.whatwg.org/#the-webkit-text-fill-color +// https://compat.spec.whatwg.org ${helpers.predefined_type( "-webkit-text-fill-color", "CSSColor", "CSSParserColor::CurrentColor", products="gecko", animatable=True, - complex_color=True, need_clone=True)} + complex_color=True, need_clone=True, + spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color")} -// CSS Compatibility -// https://compat.spec.whatwg.org/#the-webkit-text-stroke-color ${helpers.predefined_type( "-webkit-text-stroke-color", "CSSColor", "CSSParserColor::CurrentColor", products="gecko", animatable=True, - complex_color=True, need_clone=True)} + complex_color=True, need_clone=True, + spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")} -// CSS Compatibility -// https://compat.spec.whatwg.org/#the-webkit-text-stroke-width -<%helpers:longhand products="gecko" name="-webkit-text-stroke-width" animatable="False"> +<%helpers:longhand products="gecko" name="-webkit-text-stroke-width" animatable="False" + spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width"> use app_units::Au; use std::fmt; use style_traits::ToCss; @@ -1036,33 +1062,28 @@ ${helpers.predefined_type( } -// TODO(pcwalton): `full-width` -${helpers.single_keyword("text-transform", - "none capitalize uppercase lowercase", - extra_gecko_values="full-width", - animatable=False)} - -${helpers.single_keyword("text-rendering", - "auto optimizespeed optimizelegibility geometricprecision", - animatable=False)} - -// CSS Text Module Level 3 -// https://www.w3.org/TR/css-text-3/ -${helpers.single_keyword("hyphens", "none manual auto", - products="gecko", animatable=False)} - // CSS Ruby Layout Module Level 1 -// https://www.w3.org/TR/css-ruby-1/ +// https://drafts.csswg.org/css-ruby/ ${helpers.single_keyword("ruby-align", "start center space-between space-around", - products="gecko", animatable=False)} + products="gecko", animatable=False, + spec="https://drafts.csswg.org/css-ruby/#ruby-align-property")} ${helpers.single_keyword("ruby-position", "over under", - products="gecko", animatable=False)} + products="gecko", animatable=False, + spec="https://drafts.csswg.org/css-ruby/#ruby-position-property")} // CSS Writing Modes Module Level 3 -// https://drafts.csswg.org/css-writing-modes-3/#text-combine-upright +// https://drafts.csswg.org/css-writing-modes-3/ + // The spec has "digits ?" value in addition. But that value is // at-risk, and Gecko's layout code doesn't support that either. So we // can just take the easy way for now. ${helpers.single_keyword("text-combine-upright", "none all", - products="gecko", animatable=False)} + products="gecko", animatable=False, + spec="https://drafts.csswg.org/css-writing-modes-3/#text-combine-upright")} + +// SVG 1.1: Section 11 - Painting: Filling, Stroking and Marker Symbols +${helpers.single_keyword("text-rendering", + "auto optimizespeed optimizelegibility geometricprecision", + animatable=False, + spec="https://www.w3.org/TR/SVG11/painting.html#TextRenderingProperty")} diff --git a/components/style/properties/shorthand/inherited_text.mako.rs b/components/style/properties/shorthand/inherited_text.mako.rs index ba2c49423bd..180d276264e 100644 --- a/components/style/properties/shorthand/inherited_text.mako.rs +++ b/components/style/properties/shorthand/inherited_text.mako.rs @@ -6,7 +6,8 @@ // Per CSS-TEXT 6.2, "for legacy reasons, UAs must treat `word-wrap` as an alternate name for // the `overflow-wrap` property, as if it were a shorthand of `overflow-wrap`." -<%helpers:shorthand name="word-wrap" sub_properties="overflow-wrap"> +<%helpers:shorthand name="word-wrap" sub_properties="overflow-wrap" + spec="https://drafts.csswg.org/css-text/#propdef-word-wrap"> use properties::longhands::overflow_wrap; pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result { @@ -80,11 +81,12 @@ // CSS Compatibility -// https://compat.spec.whatwg.org/#the-webkit-text-stroke +// https://compat.spec.whatwg.org/ <%helpers:shorthand name="-webkit-text-stroke" sub_properties="-webkit-text-stroke-color -webkit-text-stroke-width" - products="gecko"> + products="gecko" + spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke"> use cssparser::Color as CSSParserColor; use properties::longhands::{_webkit_text_stroke_color, _webkit_text_stroke_width}; use values::specified::CSSColor;