Auto merge of #14827 - Manishearth:spec-doc, r=emilio

Add spec links to all CSS properties

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14827)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-03 14:28:29 -08:00 committed by GitHub
commit 61f6454b9c
39 changed files with 565 additions and 276 deletions

View file

@ -84,12 +84,15 @@ def arg_to_bool(arg):
class Longhand(object):
def __init__(self, style_struct, name, animatable=None, derived_from=None, keyword=None,
def __init__(self, style_struct, name, spec=None, animatable=None, derived_from=None, keyword=None,
predefined_type=None, custom_cascade=False, experimental=False, internal=False,
need_clone=False, need_index=False, gecko_ffi_name=None, depend_on_viewport_size=False,
allowed_in_keyframe_block=True, complex_color=False, cast_type='u8',
has_uncacheable_values=False, logical=False):
self.name = name
if not spec:
raise TypeError("Spec should be specified for %s" % name)
self.spec = spec
self.keyword = keyword
self.predefined_type = predefined_type
self.ident = to_rust_ident(name)
@ -130,9 +133,12 @@ class Longhand(object):
class Shorthand(object):
def __init__(self, name, sub_properties, experimental=False, internal=False,
def __init__(self, name, sub_properties, spec=None, experimental=False, internal=False,
allowed_in_keyframe_block=True):
self.name = name
if not spec:
raise TypeError("Spec should be specified for %s" % name)
self.spec = spec
self.ident = to_rust_ident(name)
self.camel_case = to_camel_case(self.ident)
self.derived_from = None

View file

@ -185,6 +185,7 @@
if property is None:
return ""
%>
/// ${property.spec}
pub mod ${property.ident} {
#![allow(unused_imports)]
% if not property.derived_from:
@ -337,7 +338,7 @@
</%call>
</%def>
<%def name="single_keyword_computed(name, values, vector=False, **kwargs)">
<%def name="single_keyword_computed(name, values, vector=False, extra_specified=None, **kwargs)">
<%
keyword_kwargs = {a: kwargs.pop(a, None) for a in [
'gecko_constant_prefix', 'gecko_enum_prefix',
@ -347,7 +348,16 @@
%>
<%def name="inner_body()">
pub use self::computed_value::T as SpecifiedValue;
% if extra_specified:
use style_traits::ToCss;
define_css_keyword_enum! { SpecifiedValue:
% for value in data.longhands_by_name[name].keyword.values_for(product) + extra_specified.split():
"${value}" => ${to_rust_ident(value)},
% endfor
}
% else:
pub use self::computed_value::T as SpecifiedValue;
% endif
pub mod computed_value {
use style_traits::ToCss;
define_css_keyword_enum! { T:
@ -362,12 +372,12 @@
}
#[inline]
pub fn get_initial_specified_value() -> SpecifiedValue {
get_initial_value()
SpecifiedValue::${to_rust_ident(values.split()[0])}
}
#[inline]
pub fn parse(_context: &ParserContext, input: &mut Parser)
-> Result<SpecifiedValue, ()> {
computed_value::T::parse(input)
SpecifiedValue::parse(input)
}
</%def>
% if vector:
@ -389,6 +399,7 @@
**kwargs)
%>
% if shorthand:
/// ${shorthand.spec}
pub mod ${shorthand.ident} {
#[allow(unused_imports)]
use cssparser::Parser;
@ -540,10 +551,9 @@
% endif
</%def>
<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, needs_context=True)">
<%self:shorthand name="${name}" sub_properties="${
' '.join(sub_property_pattern % side
for side in ['top', 'right', 'bottom', 'left'])}">
<%def name="four_sides_shorthand(name, sub_property_pattern, parser_function, needs_context=True, **kwargs)">
<% sub_properties=' '.join(sub_property_pattern % side for side in ['top', 'right', 'bottom', 'left']) %>
<%call expr="self.shorthand(name, sub_properties=sub_properties, **kwargs)">
#[allow(unused_imports)]
use parser::Parse;
use super::parse_four_sides;
@ -575,7 +585,7 @@
)
}
}
</%self:shorthand>
</%call>
</%def>
<%def name="logical_setter_helper(name)">

View file

@ -8,9 +8,11 @@
${helpers.predefined_type("background-color", "CSSColor",
"::cssparser::Color::RGBA(::cssparser::RGBA { red: 0., green: 0., blue: 0., alpha: 0. }) /* transparent */",
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
animatable=True, complex_color=True)}
<%helpers:vector_longhand name="background-image" animatable="False"
spec="https://drafts.csswg.org/css-backgrounds/#the-background-image"
has_uncacheable_values="${product == 'gecko'}">
use std::fmt;
use style_traits::ToCss;
@ -86,7 +88,8 @@ ${helpers.predefined_type("background-color", "CSSColor",
}
</%helpers:vector_longhand>
<%helpers:vector_longhand name="background-position-x" animatable="True">
<%helpers:vector_longhand name="background-position-x" animatable="True"
spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-x">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -135,7 +138,8 @@ ${helpers.predefined_type("background-color", "CSSColor",
}
</%helpers:vector_longhand>
<%helpers:vector_longhand name="background-position-y" animatable="True">
<%helpers:vector_longhand name="background-position-y" animatable="True"
spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-y">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -188,24 +192,29 @@ ${helpers.predefined_type("background-color", "CSSColor",
${helpers.single_keyword("background-repeat",
"repeat repeat-x repeat-y space round no-repeat",
vector=True,
spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat",
animatable=False)}
${helpers.single_keyword("background-attachment",
"scroll fixed" + (" local" if product == "gecko" else ""),
vector=True,
spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment",
animatable=False)}
${helpers.single_keyword("background-clip",
"border-box padding-box content-box",
vector=True,
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,
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"
spec="https://drafts.csswg.org/css-backgrounds/#the-background-size">
use cssparser::Token;
use std::ascii::AsciiExt;
use std::fmt;
@ -406,4 +415,5 @@ ${helpers.single_keyword("background-blend-mode",
"""normal multiply screen overlay darken lighten color-dodge
color-burn hard-light soft-light difference exclusion hue
saturation color luminosity""",
vector="true", products="gecko", animatable=False)}
vector="true", products="gecko", animatable=False,
spec="https://drafts.fxtf.org/compositing/#background-blend-mode")}

View file

@ -8,10 +8,17 @@
<% data.new_style_struct("Border", inherited=False,
additional_methods=[Method("border_" + side + "_has_nonzero_width",
"bool") for side in ["top", "right", "bottom", "left"]]) %>
<%
def maybe_logical_spec(side, kind):
if side[1]: # if it is logical
return "https://drafts.csswg.org/css-logical-props/#propdef-border-%s-%s" % (side[0], kind)
else:
return "https://drafts.csswg.org/css-backgrounds/#border-%s-%s" % (side[0], kind)
%>
% for side in ALL_SIDES:
${helpers.predefined_type("border-%s-color" % side[0], "CSSColor",
"::cssparser::Color::CurrentColor",
spec=maybe_logical_spec(side, "color"),
animatable=True, logical = side[1])}
% endfor
@ -19,11 +26,13 @@
${helpers.predefined_type("border-%s-style" % side[0], "BorderStyle",
"specified::BorderStyle::none",
needs_context=False, need_clone=True,
spec=maybe_logical_spec(side, "style"),
animatable=False, logical = side[1])}
% endfor
% for side in ALL_SIDES:
<%helpers:longhand name="border-${side[0]}-width" animatable="True" logical="${side[1]}">
<%helpers:longhand name="border-${side[0]}-width" animatable="True" logical="${side[1]}"
spec="${maybe_logical_spec(side, 'width')}">
use app_units::Au;
use std::fmt;
use style_traits::ToCss;
@ -53,12 +62,14 @@
${helpers.predefined_type("border-" + corner + "-radius", "BorderRadiusSize",
"computed::BorderRadiusSize::zero()",
"parse",
spec="https://drafts.csswg.org/css-backgrounds/#border-%s-radius" % corner,
animatable=True)}
% endfor
${helpers.single_keyword("box-decoration-break", "slice clone",
gecko_enum_prefix="StyleBoxDecorationBreak",
gecko_inexhaustive=True,
spec="https://drafts.csswg.org/css-break/#propdef-box-decoration-break",
products="gecko", animatable=False)}
${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
@ -66,10 +77,11 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
gecko_enum_prefix="StyleFloatEdge",
gecko_inexhaustive=True,
products="gecko",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-float-edge)",
animatable=False)}
// https://drafts.csswg.org/css-backgrounds-3/#border-image-source
<%helpers:longhand name="border-image-source" products="gecko" animatable="False">
<%helpers:longhand name="border-image-source" products="gecko" animatable="False"
spec="https://drafts.csswg.org/css-backgrounds/#border-image-source">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -144,8 +156,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
}
</%helpers:longhand>
// https://drafts.csswg.org/css-backgrounds-3/#border-image-outset
<%helpers:longhand name="border-image-outset" products="gecko" animatable="False">
<%helpers:longhand name="border-image-outset" products="gecko" animatable="False"
spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -260,8 +272,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
}
</%helpers:longhand>
// https://drafts.csswg.org/css-backgrounds-3/#border-image-repeat
<%helpers:longhand name="border-image-repeat" products="gecko" animatable="False">
<%helpers:longhand name="border-image-repeat" products="gecko" animatable="False"
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -338,8 +350,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
}
</%helpers:longhand>
// https://drafts.csswg.org/css-backgrounds-3/#border-image-width
<%helpers:longhand name="border-image-width" products="gecko" animatable="False">
<%helpers:longhand name="border-image-width" products="gecko" animatable="False"
spec="https://drafts.csswg.org/css-backgrounds/#border-image-width">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -538,8 +550,8 @@ ${helpers.single_keyword("-moz-float-edge", "content-box margin-box",
}
</%helpers:longhand>
// https://drafts.csswg.org/css-backgrounds-3/#border-image-slice
<%helpers:longhand name="border-image-slice" products="gecko" animatable="False">
<%helpers:longhand name="border-image-slice" products="gecko" animatable="False"
spec="https://drafts.csswg.org/css-backgrounds/#border-image-slice">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;

View file

@ -13,7 +13,8 @@
<%helpers:longhand name="display"
need_clone="True"
animatable="False"
custom_cascade="${product == 'servo'}">
custom_cascade="${product == 'servo'}"
spec="https://drafts.csswg.org/css-display/#propdef-display">
<%
values = """inline block inline-block
table inline-table table-row-group table-header-group table-footer-group
@ -94,15 +95,19 @@
</%helpers:longhand>
${helpers.single_keyword("position", "static absolute relative fixed",
need_clone=True, extra_gecko_values="sticky", animatable=False)}
need_clone=True, extra_gecko_values="sticky", animatable=False,
spec="https://drafts.csswg.org/css-position/#position-property")}
<%helpers:single_keyword_computed name="float"
values="none left right"
// https://drafts.csswg.org/css-logical-props/#float-clear
extra_specified="inline-start inline-end"
animatable="False"
need_clone="True"
gecko_enum_prefix="StyleFloat"
gecko_inexhaustive="True"
gecko_ffi_name="mFloat">
gecko_ffi_name="mFloat"
spec="https://drafts.csswg.org/css-box/#propdef-float">
use values::NoViewportPercentage;
impl NoViewportPercentage for SpecifiedValue {}
impl ToComputedValue for SpecifiedValue {
@ -114,27 +119,75 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
longhands::position::SpecifiedValue::absolute |
longhands::position::SpecifiedValue::fixed);
if positioned {
SpecifiedValue::none
computed_value::T::none
} else {
*self
let ltr = context.style().writing_mode.is_bidi_ltr();
// https://drafts.csswg.org/css-logical-props/#float-clear
match *self {
SpecifiedValue::inline_start if ltr => computed_value::T::left,
SpecifiedValue::inline_start => computed_value::T::right,
SpecifiedValue::inline_end if ltr => computed_value::T::right,
SpecifiedValue::inline_end => computed_value::T::left,
% for value in "none left right".split():
SpecifiedValue::${value} => computed_value::T::${value},
% endfor
}
}
}
#[inline]
fn from_computed_value(computed: &computed_value::T) -> SpecifiedValue {
*computed
match *computed {
% for value in "none left right".split():
computed_value::T::${value} => SpecifiedValue::${value},
% endfor
}
}
}
</%helpers:single_keyword_computed>
${helpers.single_keyword("clear", "none left right both",
animatable=False, gecko_ffi_name="mBreakType",
gecko_enum_prefix="StyleClear")}
<%helpers:single_keyword_computed name="clear"
values="none left right both"
// https://drafts.csswg.org/css-logical-props/#float-clear
extra_specified="inline-start inline-end"
animatable="False"
gecko_enum_prefix="StyleClear"
gecko_ffi_name="mBreakType"
spec="https://www.w3.org/TR/CSS2/visuren.html#flow-control">
use values::NoViewportPercentage;
impl NoViewportPercentage for SpecifiedValue {}
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
#[inline]
fn to_computed_value(&self, context: &Context) -> computed_value::T {
let ltr = context.style().writing_mode.is_bidi_ltr();
// https://drafts.csswg.org/css-logical-props/#float-clear
match *self {
SpecifiedValue::inline_start if ltr => computed_value::T::left,
SpecifiedValue::inline_start => computed_value::T::right,
SpecifiedValue::inline_end if ltr => computed_value::T::right,
SpecifiedValue::inline_end => computed_value::T::left,
% for value in "none left right both".split():
SpecifiedValue::${value} => computed_value::T::${value},
% endfor
}
}
#[inline]
fn from_computed_value(computed: &computed_value::T) -> SpecifiedValue {
match *computed {
% for value in "none left right both".split():
computed_value::T::${value} => SpecifiedValue::${value},
% endfor
}
}
}
</%helpers:single_keyword_computed>
<%helpers:longhand name="-servo-display-for-hypothetical-box"
animatable="False"
derived_from="display"
products="servo">
products="servo"
spec="Internal (not web-exposed)">
pub use super::display::{SpecifiedValue, get_initial_value};
pub use super::display::{parse};
@ -150,7 +203,8 @@ ${helpers.single_keyword("clear", "none left right both",
</%helpers:longhand>
<%helpers:longhand name="vertical-align" animatable="True">
<%helpers:longhand name="vertical-align" animatable="True"
spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -277,20 +331,25 @@ ${helpers.single_keyword("clear", "none left right both",
// CSS 2.1, Section 11 - Visual effects
// Non-standard, see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box#Specifications
${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",
products="servo", animatable=False, internal=True)}
products="servo", animatable=False, internal=True,
spec="Internal, not web-exposed, \
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}
${helpers.single_keyword("overflow-clip-box", "padding-box content-box",
products="gecko", animatable=False, internal=True)}
products="gecko", animatable=False, internal=True,
spec="Internal, not web-exposed, \
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
need_clone=True, animatable=False,
gecko_constant_prefix="NS_STYLE_OVERFLOW")}
gecko_constant_prefix="NS_STYLE_OVERFLOW",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-x")}
// FIXME(pcwalton, #2742): Implement scrolling for `scroll` and `auto`.
<%helpers:longhand name="overflow-y" need_clone="True" animatable="False">
<%helpers:longhand name="overflow-y" need_clone="True" animatable="False"
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y">
use super::overflow_x;
use std::fmt;
@ -337,7 +396,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:longhand name="transition-duration"
need_index="True"
animatable="False">
animatable="False"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-duration">
use values::computed::ComputedValueAsSpecified;
use values::specified::Time;
@ -393,7 +453,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
// TODO(pcwalton): Lots more timing functions.
<%helpers:longhand name="transition-timing-function"
need_index="True"
animatable="False">
animatable="False"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function">
use self::computed_value::{StartEnd, TransitionTimingFunction};
use euclid::point::{Point2D, TypedPoint2D};
@ -593,7 +654,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:longhand name="transition-property"
need_index="True"
animatable="False">
animatable="False"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property">
use values::computed::ComputedValueAsSpecified;
@ -645,7 +707,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:longhand name="transition-delay"
need_index="True"
animatable="False">
animatable="False"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-delay">
pub use properties::longhands::transition_duration::{SingleSpecifiedValue, SpecifiedValue};
pub use properties::longhands::transition_duration::computed_value;
pub use properties::longhands::transition_duration::{get_initial_value, get_initial_single_value, parse};
@ -654,7 +717,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:longhand name="animation-name"
need_index="True"
animatable="False",
allowed_in_keyframe_block="False">
allowed_in_keyframe_block="False"
spec="https://drafts.csswg.org/css-animations/#propdef-animation-name">
use values::computed::ComputedValueAsSpecified;
use values::NoViewportPercentage;
@ -730,6 +794,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:longhand name="animation-duration"
need_index="True"
animatable="False",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-duration",
allowed_in_keyframe_block="False">
pub use super::transition_duration::computed_value;
pub use super::transition_duration::{get_initial_value, get_initial_single_value, parse};
@ -740,6 +805,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:longhand name="animation-timing-function"
need_index="True"
animatable="False",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-timing-function",
allowed_in_keyframe_block="False">
pub use super::transition_timing_function::computed_value;
pub use super::transition_timing_function::{get_initial_value, get_initial_single_value, parse};
@ -750,6 +816,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
<%helpers:longhand name="animation-iteration-count"
need_index="True"
animatable="False",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-iteration-count",
allowed_in_keyframe_block="False">
use values::computed::ComputedValueAsSpecified;
use values::NoViewportPercentage;
@ -842,6 +909,7 @@ ${helpers.single_keyword("animation-direction",
need_index=True,
animatable=False,
vector=True,
spec="https://drafts.csswg.org/css-animations/#propdef-animation-direction",
allowed_in_keyframe_block=False)}
// animation-play-state is the exception to the rule for allowed_in_keyframe_block:
@ -852,6 +920,7 @@ ${helpers.single_keyword("animation-play-state",
need_index=True,
animatable=False,
vector=True,
spec="https://drafts.csswg.org/css-animations/#propdef-animation-play-state",
allowed_in_keyframe_block=True)}
${helpers.single_keyword("animation-fill-mode",
@ -859,11 +928,13 @@ ${helpers.single_keyword("animation-fill-mode",
need_index=True,
animatable=False,
vector=True,
spec="https://drafts.csswg.org/css-animations/#propdef-animation-fill-mode",
allowed_in_keyframe_block=False)}
<%helpers:longhand name="animation-delay"
need_index="True"
animatable="False",
spec="https://drafts.csswg.org/css-animations/#propdef-animation-delay",
allowed_in_keyframe_block="False">
pub use super::transition_duration::computed_value;
pub use super::transition_duration::{get_initial_value, get_initial_single_value, parse};
@ -871,7 +942,8 @@ ${helpers.single_keyword("animation-fill-mode",
pub use super::transition_duration::SingleSpecifiedValue;
</%helpers:longhand>
<%helpers:longhand products="gecko" name="scroll-snap-points-y" animatable="False">
<%helpers:longhand products="gecko" name="scroll-snap-points-y" animatable="False"
spec="Nonstandard (https://www.w3.org/TR/2015/WD-css-snappoints-1-20150326/#scroll-snap-points)">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -965,7 +1037,8 @@ ${helpers.single_keyword("animation-fill-mode",
}
</%helpers:longhand>
<%helpers:longhand products="gecko" name="scroll-snap-points-x" animatable="False">
<%helpers:longhand products="gecko" name="scroll-snap-points-x" animatable="False"
spec="Nonstandard (https://www.w3.org/TR/2015/WD-css-snappoints-1-20150326/#scroll-snap-points)">
pub use super::scroll_snap_points_y::SpecifiedValue;
pub use super::scroll_snap_points_y::computed_value;
pub use super::scroll_snap_points_y::get_initial_value;
@ -974,7 +1047,8 @@ ${helpers.single_keyword("animation-fill-mode",
<%helpers:longhand name="transform" products="gecko servo" animatable="${product == 'servo'}">
<%helpers:longhand name="transform" products="gecko servo" animatable="${product == 'servo'}"
spec="https://drafts.csswg.org/css-transforms/#propdef-transform">
use app_units::Au;
use style_traits::ToCss;
use values::CSSFloat;
@ -1501,17 +1575,18 @@ ${helpers.single_keyword("animation-fill-mode",
${helpers.single_keyword("scroll-behavior",
"auto smooth",
products="gecko",
spec="https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior",
animatable=False)}
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x
${helpers.single_keyword("scroll-snap-type-x",
"none mandatory proximity",
products="gecko",
gecko_constant_prefix="NS_STYLE_SCROLL_SNAP_TYPE",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x)",
animatable=False)}
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-y
<%helpers:longhand products="gecko" name="scroll-snap-type-y" animatable="False">
<%helpers:longhand products="gecko" name="scroll-snap-type-y" animatable="False"
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x)">
pub use super::scroll_snap_type_x::SpecifiedValue;
pub use super::scroll_snap_type_x::computed_value;
pub use super::scroll_snap_type_x::get_initial_value;
@ -1523,41 +1598,48 @@ ${helpers.single_keyword("scroll-snap-type-x",
${helpers.single_keyword("isolation",
"auto isolate",
products="gecko",
spec="https://drafts.fxtf.org/compositing/#isolation",
animatable=False)}
// TODO add support for logical values recto and verso
${helpers.single_keyword("page-break-after",
"auto always avoid left right",
products="gecko",
spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-after",
animatable=False)}
${helpers.single_keyword("page-break-before",
"auto always avoid left right",
products="gecko",
spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-before",
animatable=False)}
${helpers.single_keyword("page-break-inside",
"auto avoid",
products="gecko",
gecko_ffi_name="mBreakInside",
gecko_constant_prefix="NS_STYLE_PAGE_BREAK",
spec="https://drafts.csswg.org/css2/page.html#propdef-page-break-inside",
animatable=False)}
// CSS Basic User Interface Module Level 3
// http://dev.w3.org/csswg/css-ui/
// http://dev.w3.org/csswg/css-ui
// FIXME support logical values `block` and `inline` (https://drafts.csswg.org/css-logical-props/#resize)
${helpers.single_keyword("resize",
"none both horizontal vertical",
products="gecko",
spec="https://drafts.csswg.org/css-ui/#propdef-resize",
animatable=False)}
// https://drafts.csswg.org/css-transforms/#perspective
${helpers.predefined_type("perspective",
"LengthOrNone",
"Either::Second(None_)",
gecko_ffi_name="mChildPerspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
animatable=True)}
// FIXME: This prop should be animatable
// https://drafts.csswg.org/css-transforms/#perspective-origin-property
<%helpers:longhand name="perspective-origin" animatable="False">
<%helpers:longhand name="perspective-origin" animatable="False"
spec="https://drafts.csswg.org/css-transforms/#perspective-origin-property">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -1643,26 +1725,26 @@ ${helpers.predefined_type("perspective",
}
</%helpers:longhand>
// https://drafts.csswg.org/css-transforms/#backface-visibility-property
${helpers.single_keyword("backface-visibility",
"visible hidden",
spec="https://drafts.csswg.org/css-transforms/#backface-visibility-property",
animatable=False)}
// https://drafts.csswg.org/css-transforms/#transform-box
${helpers.single_keyword("transform-box",
"border-box fill-box view-box",
products="gecko",
spec="https://drafts.csswg.org/css-transforms/#transform-box",
animatable=False)}
// `auto` keyword is not supported in gecko yet.
// https://drafts.csswg.org/css-transforms/#transform-style-property
${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",
animatable=False)}
// https://drafts.csswg.org/css-transforms/#transform-origin-property
<%helpers:longhand name="transform-origin" animatable="True">
<%helpers:longhand name="transform-origin" animatable="True"
spec="https://drafts.csswg.org/css-transforms/#transform-origin-property">
use app_units::Au;
use std::fmt;
use style_traits::ToCss;
@ -1795,18 +1877,19 @@ ${helpers.single_keyword("-moz-appearance",
gecko_ffi_name="mAppearance",
gecko_constant_prefix="NS_THEME",
products="gecko",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance)",
animatable=False)}
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding
${helpers.predefined_type("-moz-binding", "UrlOrNone", "Either::Second(None_)",
products="gecko",
animatable="False",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-binding)",
disable_when_testing="True")}
// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-orient
${helpers.single_keyword("-moz-orient",
"inline block horizontal vertical",
products="gecko",
gecko_ffi_name="mOrient",
gecko_enum_prefix="StyleOrient",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-orient)",
animatable=False)}

View file

@ -6,7 +6,8 @@
<% data.new_style_struct("Color", inherited=True) %>
<%helpers:raw_longhand name="color" need_clone="True" animatable="True">
<%helpers:raw_longhand name="color" need_clone="True" animatable="True"
spec="https://drafts.csswg.org/css-color/#color">
use cssparser::Color as CSSParserColor;
use cssparser::RGBA;
use values::specified::{CSSColor, CSSRGBA};

View file

@ -12,11 +12,13 @@ ${helpers.predefined_type("column-width",
"Either::Second(Auto)",
parse_method="parse_non_negative_length",
animatable=False,
experimental=True)}
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"
spec="https://drafts.csswg.org/css-multicol/#propdef-column-count">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -101,13 +103,16 @@ ${helpers.predefined_type("column-gap",
"Either::Second(Normal)",
parse_method='parse_non_negative_length',
experimental=True,
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")}
${helpers.single_keyword("column-fill", "auto balance",
products="gecko", animatable=False)}
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"
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width">
use app_units::Au;
use std::fmt;
use style_traits::ToCss;
@ -140,15 +145,17 @@ ${helpers.single_keyword("column-fill", "auto balance",
${helpers.predefined_type("column-rule-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-multicol/#propdef-column-rule-color")}
// It's not implemented in servo or gecko yet.
// https://drafts.csswg.org/css-multicol-1/#column-span
${helpers.single_keyword("column-span", "none all",
products="none", animatable=False)}
products="none", animatable=False,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-span")}
${helpers.single_keyword("column-rule-style",
"none hidden dotted dashed solid double groove ridge inset outset",
products="gecko",
gecko_constant_prefix="NS_STYLE_BORDER_STYLE",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-style")}

View file

@ -6,7 +6,7 @@
<% data.new_style_struct("Counters", inherited=False, gecko_name="Content") %>
<%helpers:longhand name="content" animatable="False">
<%helpers:longhand name="content" animatable="False" spec="https://drafts.csswg.org/css-content/#propdef-content">
use cssparser::Token;
use std::ascii::AsciiExt;
use values::computed::ComputedValueAsSpecified;
@ -174,7 +174,8 @@
}
</%helpers:longhand>
<%helpers:longhand name="counter-increment" products="servo" animatable="False">
<%helpers:longhand name="counter-increment" products="servo" animatable="False"
spec="https://drafts.csswg.org/css-lists/#propdef-counter-increment">
use std::fmt;
use style_traits::ToCss;
use super::content;
@ -247,7 +248,8 @@
}
</%helpers:longhand>
<%helpers:longhand name="counter-reset" products="servo" animatable="False">
<%helpers:longhand name="counter-reset" products="servo" animatable="False"
spec="https://drafts.csswg.org/css-lists-3/#propdef-counter-reset">
pub use super::counter_increment::{SpecifiedValue, computed_value, get_initial_value};
use super::counter_increment::{parse_common};

View file

@ -10,9 +10,11 @@
${helpers.predefined_type("opacity",
"Opacity",
"1.0",
animatable=True)}
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"
spec="https://drafts.csswg.org/css-backgrounds/#box-shadow">
use cssparser;
use std::fmt;
use style_traits::ToCss;
@ -74,7 +76,8 @@ ${helpers.predefined_type("opacity",
</%helpers:vector_longhand>
// FIXME: This prop should be animatable
<%helpers:longhand name="clip" products="servo" animatable="False">
<%helpers:longhand name="clip" products="servo" animatable="False"
spec="https://drafts.fxtf.org/css-masking/#clip-property">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -287,7 +290,8 @@ ${helpers.predefined_type("opacity",
</%helpers:longhand>
// FIXME: This prop should be animatable
<%helpers:longhand name="filter" animatable="False">
<%helpers:longhand name="filter" animatable="False"
spec="https://drafts.fxtf.org/filters/#propdef-filter">
//pub use self::computed_value::T as SpecifiedValue;
use cssparser;
use std::fmt;
@ -694,4 +698,5 @@ ${helpers.single_keyword("mix-blend-mode",
"""normal multiply screen overlay darken lighten color-dodge
color-burn hard-light soft-light difference exclusion hue
saturation color luminosity""", gecko_constant_prefix="NS_STYLE_BLEND",
animatable=False)}
animatable=False,
spec="https://drafts.fxtf.org/compositing/#propdef-mix-blend-mode")}

View file

@ -8,7 +8,8 @@
<% data.new_style_struct("Font",
inherited=True,
additional_methods=[Method("compute_font_hash", is_mut=True)]) %>
<%helpers:longhand name="font-family" animatable="False" need_index="True">
<%helpers:longhand name="font-family" animatable="False" need_index="True"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-family">
use self::computed_value::FontFamily;
use values::NoViewportPercentage;
use values::computed::ComputedValueAsSpecified;
@ -134,10 +135,12 @@ ${helpers.single_keyword("font-style",
"normal italic oblique",
gecko_constant_prefix="NS_FONT_STYLE",
gecko_ffi_name="mFont.style",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-style",
animatable=False)}
${helpers.single_keyword("font-variant",
"normal small-caps",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant",
animatable=False)}
@ -152,10 +155,12 @@ ${helpers.single_keyword("font-variant-caps",
gecko_constant_prefix="NS_FONT_VARIANT_CAPS",
gecko_ffi_name="mFont.variantCaps",
products="gecko",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-caps",
custom_consts=font_variant_caps_custom_consts,
animatable=False)}
<%helpers:longhand name="font-weight" need_clone="True" animatable="True">
<%helpers:longhand name="font-weight" need_clone="True" animatable="True"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -288,7 +293,8 @@ ${helpers.single_keyword("font-variant-caps",
}
</%helpers:longhand>
<%helpers:longhand name="font-size" need_clone="True" animatable="True">
<%helpers:longhand name="font-size" need_clone="True" animatable="True"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size">
use app_units::Au;
use std::fmt;
use style_traits::ToCss;
@ -370,8 +376,8 @@ ${helpers.single_keyword("font-variant-caps",
}
</%helpers:longhand>
// https://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop
<%helpers:longhand products="gecko" name="font-size-adjust" animatable="True">
<%helpers:longhand products="gecko" name="font-size-adjust" animatable="True"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size-adjust">
use values::NoViewportPercentage;
use values::computed::ComputedValueAsSpecified;
use values::specified::Number;
@ -430,7 +436,8 @@ ${helpers.single_keyword("font-variant-caps",
}
</%helpers:longhand>
<%helpers:longhand products="gecko" name="font-synthesis" animatable="False">
<%helpers:longhand products="gecko" name="font-synthesis" animatable="False"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-synthesis">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -500,6 +507,7 @@ ${helpers.single_keyword("font-stretch",
gecko_ffi_name="mFont.stretch",
gecko_constant_prefix="NS_FONT_STRETCH",
cast_type='i16',
spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch",
animatable=False)}
${helpers.single_keyword("font-kerning",
@ -507,6 +515,7 @@ ${helpers.single_keyword("font-kerning",
products="gecko",
gecko_ffi_name="mFont.kerning",
gecko_constant_prefix="NS_FONT_KERNING",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch",
animatable=False)}
${helpers.single_keyword("font-variant-position",
@ -514,9 +523,11 @@ ${helpers.single_keyword("font-variant-position",
products="gecko",
gecko_ffi_name="mFont.variantPosition",
gecko_constant_prefix="NS_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"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-feature-settings">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -626,7 +637,8 @@ ${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"
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font-language-override">
use values::NoViewportPercentage;
use values::computed::ComputedValueAsSpecified;
pub use self::computed_value::T as SpecifiedValue;

View file

@ -6,22 +6,25 @@
<% data.new_style_struct("InheritedBox", inherited=True, gecko_name="Visibility") %>
${helpers.single_keyword("direction", "ltr rtl", need_clone=True, animatable=False)}
// TODO: collapse. Well, do tables first.
${helpers.single_keyword("visibility",
"visible hidden",
extra_gecko_values="collapse",
gecko_ffi_name="mVisible",
animatable=True)}
animatable=True,
spec="https://drafts.csswg.org/css-box/#propdef-visibility")}
// CSS Writing Modes Level 3
// http://dev.w3.org/csswg/css-writing-modes/
// https://drafts.csswg.org/css-writing-modes-3
${helpers.single_keyword("writing-mode",
"horizontal-tb vertical-rl vertical-lr",
experimental=True,
need_clone=True,
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode")}
${helpers.single_keyword("direction", "ltr rtl", need_clone=True, animatable=False,
spec="https://drafts.csswg.org/css-writing-modes/#propdef-direction")}
// FIXME(SimonSapin): Add 'mixed' and 'upright' (needs vertical text support)
// FIXME(SimonSapin): initial (first) value should be 'mixed', when that's implemented
@ -32,13 +35,15 @@ ${helpers.single_keyword("text-orientation",
need_clone=True,
extra_gecko_values="mixed upright",
extra_servo_values="sideways-right sideways-left",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-writing-modes/#propdef-text-orientation")}
// CSS Color Module Level 4
// https://drafts.csswg.org/css-color/
${helpers.single_keyword("color-adjust",
"economy exact", products="gecko",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-color/#propdef-color-adjust")}
<% image_rendering_custom_consts = { "crisp-edges": "CRISPEDGES" } %>
// According to to CSS-IMAGES-3, `optimizespeed` and `optimizequality` are synonyms for `auto`
@ -48,13 +53,15 @@ ${helpers.single_keyword("image-rendering",
extra_gecko_values="optimizespeed optimizequality",
extra_servo_values="pixelated",
custom_consts=image_rendering_custom_consts,
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-images/#propdef-image-rendering")}
// Image Orientation
// https://drafts.csswg.org/css-images/#the-image-orientation
<%helpers:longhand name="image-orientation"
products="None"
animatable="False">
animatable="False"
spec="https://drafts.csswg.org/css-images/#propdef-image-orientation, \
/// additional values in https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation">
use std::fmt;
use style_traits::ToCss;
use values::specified::Angle;
@ -188,7 +195,8 @@ ${helpers.single_keyword("image-rendering",
<%helpers:longhand name="-servo-under-display-none"
derived_from="display"
products="servo"
animatable="False">
animatable="False"
spec="Nonstandard (internal layout use only)">
use std::fmt;
use style_traits::ToCss;
use values::computed::ComputedValueAsSpecified;

View file

@ -17,49 +17,60 @@
${helpers.single_keyword("text-anchor",
"start middle end",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG/text.html#TextAnchorProperty")}
// Section 11 - Painting: Filling, Stroking and Marker Symbols
${helpers.single_keyword("color-interpolation",
"auto sRGB linearRGB",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperty")}
${helpers.single_keyword("color-interpolation-filters", "auto sRGB linearRGB",
products="gecko",
gecko_constant_prefix="NS_STYLE_COLOR_INTERPOLATION",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationFiltersProperty")}
${helpers.predefined_type("fill-opacity", "Opacity", "1.0",
products="gecko", animatable=False)}
products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#FillOpacityProperty")}
${helpers.single_keyword("fill-rule", "nonzero evenodd",
gecko_enum_prefix="StyleFillRule",
gecko_inexhaustive=True,
products="gecko", animatable=False)}
products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#FillRuleProperty")}
${helpers.single_keyword("shape-rendering",
"auto optimizeSpeed crispEdges geometricPrecision",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#ShapeRenderingProperty")}
${helpers.single_keyword("stroke-linecap", "butt round square",
products="gecko", animatable=False)}
products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeLinecapProperty")}
${helpers.single_keyword("stroke-linejoin", "miter round bevel",
products="gecko", animatable=False)}
products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeLinejoinProperty")}
${helpers.predefined_type("stroke-miterlimit", "Number", "4.0",
"parse_at_least_one", products="gecko",
needs_context=False,
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeMiterlimitProperty")}
${helpers.predefined_type("stroke-opacity", "Opacity", "1.0",
products="gecko", animatable=False)}
products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeOpacityProperty")}
// Section 14 - Clipping, Masking and Compositing
${helpers.single_keyword("clip-rule", "nonzero evenodd",
products="gecko",
gecko_enum_prefix="StyleFillRule",
gecko_inexhaustive=True,
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG11/masking.html#ClipRuleProperty")}

View file

@ -8,15 +8,19 @@
${helpers.single_keyword("border-collapse", "separate collapse",
gecko_constant_prefix="NS_STYLE_BORDER",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-tables/#propdef-border-collapse")}
${helpers.single_keyword("empty-cells", "show hide",
gecko_constant_prefix="NS_STYLE_TABLE_EMPTY_CELLS",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-tables/#propdef-empty-cells")}
${helpers.single_keyword("caption-side", "top bottom",
extra_gecko_values="right left top-outside bottom-outside",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-tables/#propdef-caption-side")}
<%helpers:longhand name="border-spacing" animatable="False">
<%helpers:longhand name="border-spacing" animatable="False"
spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing">
use app_units::Au;
use std::fmt;
use style_traits::ToCss;

View file

@ -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>
<%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 @@
</%helpers:longhand>
// 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>
<%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:longhand>
${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:single_keyword_computed>
<%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>
<%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>
<%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",
}
</%helpers:longhand>
// 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(
}
</%helpers:longhand>
// 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 <integer>?" 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")}

View file

@ -6,7 +6,8 @@
<% data.new_style_struct("List", inherited=True) %>
${helpers.single_keyword("list-style-position", "outside inside", animatable=False)}
${helpers.single_keyword("list-style-position", "outside inside", animatable=False,
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-position")}
// TODO(pcwalton): Implement the full set of counter styles per CSS-COUNTER-STYLES [1] 6.1:
//
@ -24,12 +25,15 @@ ${helpers.single_keyword("list-style-type", """
cjk-heavenly-stem lower-greek hiragana hiragana-iroha katakana
katakana-iroha lower-alpha upper-alpha""",
gecko_constant_prefix="NS_STYLE_LIST_STYLE",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type")}
${helpers.predefined_type("list-style-image", "UrlOrNone", "Either::Second(None_)",
animatable="False")}
animatable="False",
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image")}
<%helpers:longhand name="quotes" animatable="False">
<%helpers:longhand name="quotes" animatable="False"
spec="https://drafts.csswg.org/css-content/#propdef-quotes">
use cssparser::Token;
use std::borrow::Cow;
use std::fmt;

View file

@ -7,7 +7,12 @@
<% data.new_style_struct("Margin", inherited=False) %>
% for side in ALL_SIDES:
<%
spec = "https://drafts.csswg.org/css-box/#propdef-margin-%s" % side[0]
if side[1]:
spec = "https://drafts.csswg.org/css-logical-props/#propdef-margin-%s" % side[1]
%>
${helpers.predefined_type("margin-%s" % side[0], "LengthOrPercentageOrAuto",
"computed::LengthOrPercentageOrAuto::Length(Au(0))",
animatable=True, logical = side[1])}
animatable=True, logical = side[1], spec = spec)}
% endfor

View file

@ -11,9 +11,11 @@
// TODO(pcwalton): `invert`
${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::CurrentColor",
animatable=True, complex_color=True, need_clone=True)}
animatable=True, complex_color=True, need_clone=True,
spec="https://drafts.csswg.org/css-ui/#propdef-outline-color")}
<%helpers:longhand name="outline-style" need_clone="True" animatable="False">
<%helpers:longhand name="outline-style" need_clone="True" animatable="False"
spec="https://drafts.csswg.org/css-ui/#propdef-outline-style">
pub use values::specified::BorderStyle as SpecifiedValue;
pub fn get_initial_value() -> SpecifiedValue { SpecifiedValue::none }
pub mod computed_value {
@ -27,7 +29,8 @@ ${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::Curr
}
</%helpers:longhand>
<%helpers:longhand name="outline-width" animatable="True">
<%helpers:longhand name="outline-width" animatable="True"
spec="https://drafts.csswg.org/css-ui/#propdef-outline-width">
use app_units::Au;
use std::fmt;
use style_traits::ToCss;
@ -77,9 +80,11 @@ ${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::Curr
// TODO: Should they animate?
% for corner in ["topleft", "topright", "bottomright", "bottomleft"]:
${helpers.predefined_type("-moz-outline-radius-" + corner, "BorderRadiusSize",
"computed::BorderRadiusSize::zero()",
"parse", products="gecko",
animatable=False)}
"computed::BorderRadiusSize::zero()",
"parse", products="gecko",
animatable=False,
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)")}
% endfor
${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo", animatable=True)}
${helpers.predefined_type("outline-offset", "Length", "Au(0)", products="servo", animatable=True,
spec="https://drafts.csswg.org/css-ui/#propdef-outline-offset")}

View file

@ -7,10 +7,16 @@
<% data.new_style_struct("Padding", inherited=False) %>
% for side in ALL_SIDES:
<%
spec = "https://drafts.csswg.org/css-box/#propdef-padding-%s" % side[0]
if side[1]:
spec = "https://drafts.csswg.org/css-logical-props/#propdef-padding-%s" % side[1]
%>
${helpers.predefined_type("padding-%s" % side[0], "LengthOrPercentage",
"computed::LengthOrPercentage::Length(Au(0))",
"parse_non_negative",
needs_context=False,
animatable=True,
logical = side[1])}
logical = side[1],
spec = spec)}
% endfor

View file

@ -6,7 +6,7 @@
<% data.new_style_struct("Pointing", inherited=True, gecko_name="UserInterface") %>
<%helpers:longhand name="cursor" animatable="False">
<%helpers:longhand name="cursor" animatable="False" spec="https://drafts.csswg.org/css-ui/#cursor">
pub use self::computed_value::T as SpecifiedValue;
use values::NoViewportPercentage;
use values::computed::ComputedValueAsSpecified;
@ -146,23 +146,27 @@
// NB: `pointer-events: auto` (and use of `pointer-events` in anything that isn't SVG, in fact)
// is nonstandard, slated for CSS4-UI.
// TODO(pcwalton): SVG-only values.
${helpers.single_keyword("pointer-events", "auto none", animatable=False)}
${helpers.single_keyword("pointer-events", "auto none", animatable=False,
spec="https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty")}
${helpers.single_keyword("-moz-user-input", "none enabled disabled",
products="gecko", gecko_ffi_name="mUserInput",
gecko_enum_prefix="StyleUserInput",
gecko_inexhaustive=True,
animatable=False)}
animatable=False,
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-input)")}
${helpers.single_keyword("-moz-user-modify", "read-only read-write write-only",
products="gecko", gecko_ffi_name="mUserModify",
gecko_enum_prefix="StyleUserModify",
gecko_inexhaustive=True,
animatable=False)}
animatable=False,
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-modify)")}
${helpers.single_keyword("-moz-user-focus",
"ignore normal select-after select-before select-menu select-same select-all none",
products="gecko", gecko_ffi_name="mUserFocus",
gecko_enum_prefix="StyleUserFocus",
gecko_inexhaustive=True,
animatable=False)}
animatable=False,
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-focus)")}

View file

@ -12,16 +12,18 @@
% for side in PHYSICAL_SIDES:
${helpers.predefined_type(side, "LengthOrPercentageOrAuto",
"computed::LengthOrPercentageOrAuto::Auto",
spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side,
animatable=True)}
% endfor
// offset-* logical properties, map to "top" / "left" / "bottom" / "right"
% for side in LOGICAL_SIDES:
${helpers.predefined_type("offset-" + side, "LengthOrPercentageOrAuto",
${helpers.predefined_type("offset-%s" % side, "LengthOrPercentageOrAuto",
"computed::LengthOrPercentageOrAuto::Auto",
spec="https://drafts.csswg.org/css-logical-props/#propdef-offset-%s" % side,
animatable=True, logical=True)}
% 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::computed::ComputedValueAsSpecified;
@ -75,9 +77,11 @@
// 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)}
${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property",
animatable=False)}
// 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",
gecko_constant_prefix="NS_STYLE_JUSTIFY",
products="servo",
spec="https://drafts.csswg.org/css-flexbox/#justify-content-property",
animatable=False)}
// 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",
need_clone=True,
gecko_constant_prefix="NS_STYLE_ALIGN",
spec="https://drafts.csswg.org/css-flexbox/#align-items-property",
animatable=False)}
${helpers.single_keyword("align-content", "stretch flex-start flex-end center space-between space-around",
gecko_constant_prefix="NS_STYLE_ALIGN",
products="servo",
spec="https://drafts.csswg.org/css-flexbox/#align-content-property",
animatable=False)}
// Flex item properties
${helpers.predefined_type("flex-grow", "Number",
"0.0", "parse_non_negative",
spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property",
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",
needs_context=False,
animatable=True)}
@ -117,10 +126,12 @@ ${helpers.single_keyword("align-self", "auto stretch flex-start flex-end center
need_clone=True,
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"
spec="https://drafts.csswg.org/css-flexbox/#order-property">
use values::computed::ComputedValueAsSpecified;
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",
"LengthOrPercentageOrAutoOrContent",
"computed::LengthOrPercentageOrAutoOrContent::Auto",
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
animatable=False)}
% 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
${helpers.predefined_type("%s" % size,
"LengthOrPercentageOrAuto",
"computed::LengthOrPercentageOrAuto::Auto",
"parse_non_negative",
needs_context=False,
spec=spec % size,
animatable=True, logical = logical)}
// min-width, min-height, min-block-size, min-inline-size
@ -162,6 +180,7 @@ ${helpers.predefined_type("flex-basis",
"computed::LengthOrPercentage::Length(Au(0))",
"parse_non_negative",
needs_context=False,
spec=spec % ("min-%s" % size),
animatable=True, logical = logical)}
// max-width, max-height, max-block-size, max-inline-size
@ -170,19 +189,19 @@ ${helpers.predefined_type("flex-basis",
"computed::LengthOrPercentageOrNone::None",
"parse_non_negative",
needs_context=False,
spec=spec % ("max-%s" % size),
animatable=True, logical = logical)}
% endfor
${helpers.single_keyword("box-sizing",
"content-box border-box",
spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing",
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",
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"] %>
% for longhand in grid_longhands:
@ -190,5 +209,6 @@ ${helpers.single_keyword("object-fit", "fill contain cover none scale-down",
"GridLine",
"Default::default()",
animatable=False,
spec="https://drafts.csswg.org/css-grid/#propdef-%s" % longhand,
products="gecko")}
% endfor

View file

@ -11,10 +11,12 @@ ${helpers.single_keyword("dominant-baseline",
"""auto use-script no-change reset-size ideographic alphabetic hanging
mathematical central middle text-after-edge text-before-edge""",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG11/text.html#DominantBaselineProperty")}
${helpers.single_keyword("vector-effect", "none non-scaling-stroke",
products="gecko", animatable=False)}
products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVGTiny12/painting.html#VectorEffectProperty")}
// Section 13 - Gradients and Patterns
@ -22,11 +24,13 @@ ${helpers.predefined_type(
"stop-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0 })",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVGTiny12/painting.html#StopColorProperty")}
${helpers.predefined_type("stop-opacity", "Opacity", "1.0",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVGTiny12/painting.html#propdef-stop-opacity")}
// Section 15 - Filter Effects
@ -34,23 +38,28 @@ ${helpers.predefined_type(
"flood-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0 })",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG/filters.html#FloodColorProperty")}
${helpers.predefined_type("flood-opacity", "Opacity",
"1.0", products="gecko", animatable=False)}
"1.0", products="gecko", animatable=False,
spec="https://www.w3.org/TR/SVG/filters.html#FloodOpacityProperty")}
${helpers.predefined_type(
"lighting-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0 })",
products="gecko",
animatable=False)}
animatable=False,
spec="https://www.w3.org/TR/SVG/filters.html#LightingColorProperty")}
// CSS Masking Module Level 1
// https://www.w3.org/TR/css-masking-1/
// https://drafts.fxtf.org/css-masking
${helpers.single_keyword("mask-type", "luminance alpha",
products="gecko", animatable=False)}
products="gecko", animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-type")}
<%helpers:longhand name="clip-path" animatable="False" products="gecko">
<%helpers:longhand name="clip-path" animatable="False" products="gecko"
spec="https://drafts.fxtf.org/css-masking/#propdef-clip-path">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -81,7 +90,8 @@ ${helpers.single_keyword("mask-mode",
"alpha luminance match-source",
vector=True,
products="gecko",
animatable=False)}
animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-mode")}
// TODO implement all of repeat-style for background and mask
// https://drafts.csswg.org/css-backgrounds-3/#repeat-style
@ -89,9 +99,11 @@ ${helpers.single_keyword("mask-repeat",
"repeat repeat-x repeat-y space round no-repeat",
vector=True,
products="gecko",
animatable=False)}
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"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position">
use std::fmt;
use style_traits::ToCss;
use values::HasViewportPercentage;
@ -151,7 +163,8 @@ ${helpers.single_keyword("mask-clip",
"content-box padding-box border-box",
vector=True,
products="gecko",
animatable=False)}
animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-clip")}
// missing: margin-box fill-box stroke-box view-box
// (gecko doesn't implement these)
@ -159,9 +172,11 @@ ${helpers.single_keyword("mask-origin",
"content-box padding-box border-box",
vector=True,
products="gecko",
animatable=False)}
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"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size">
use properties::longhands::background_size;
pub use ::properties::longhands::background_size::SpecifiedValue;
pub use ::properties::longhands::background_size::single_value as single_value;
@ -181,10 +196,12 @@ ${helpers.single_keyword("mask-composite",
"add subtract intersect exclude",
vector=True,
products="gecko",
animatable=False)}
animatable=False,
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-composite")}
<%helpers:vector_longhand name="mask-image" products="gecko" animatable="False"
has_uncacheable_values="${product == 'gecko'}">
has_uncacheable_values="${product == 'gecko'}",
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-image">
use std::fmt;
use style_traits::ToCss;
use std::sync::Arc;

View file

@ -7,4 +7,5 @@
<% data.new_style_struct("Table", inherited=False) %>
${helpers.single_keyword("table-layout", "auto fixed",
gecko_ffi_name="mLayoutStrategy", animatable=False)}
gecko_ffi_name="mLayoutStrategy", animatable=False,
spec="https://drafts.csswg.org/css-tables/#propdef-table-layout")}

View file

@ -12,7 +12,8 @@
Method("has_overline", "bool"),
Method("has_line_through", "bool")]) %>
<%helpers:longhand name="text-overflow" animatable="False">
<%helpers:longhand name="text-overflow" animatable="False"
spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -93,13 +94,15 @@
${helpers.single_keyword("unicode-bidi",
"normal embed isolate bidi-override isolate-override plaintext",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-writing-modes/#propdef-unicode-bidi")}
// FIXME: This prop should be animatable.
<%helpers:longhand name="${'text-decoration' if product == 'servo' else 'text-decoration-line'}"
custom_cascade="${product == 'servo'}"
animatable="False"
disable_when_testing="True">
disable_when_testing="True",
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line">
use std::fmt;
use style_traits::ToCss;
use values::NoViewportPercentage;
@ -200,11 +203,13 @@ ${helpers.single_keyword("unicode-bidi",
${helpers.single_keyword("text-decoration-style",
"solid double dotted dashed wavy -moz-none",
products="gecko",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style")}
${helpers.predefined_type(
"text-decoration-color", "CSSColor",
"CSSParserColor::RGBA(RGBA { red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0 })",
complex_color=True,
products="gecko",
animatable=True)}
animatable=True,
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-color")}

View file

@ -9,12 +9,16 @@
// https://drafts.csswg.org/css-ui-3/
<% data.new_style_struct("UI", inherited=False, gecko_name="UIReset") %>
// TODO spec says that UAs should not support this
// we should probably remove from gecko (https://bugzilla.mozilla.org/show_bug.cgi?id=1328331)
${helpers.single_keyword("ime-mode", "normal auto active disabled inactive",
products="gecko", gecko_ffi_name="mIMEMode",
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-ui/#input-method-editor")}
${helpers.single_keyword("-moz-user-select", "auto text none all", products="gecko",
gecko_ffi_name="mUserSelect",
gecko_enum_prefix="StyleUserSelect",
gecko_inexhaustive=True,
animatable=False)}
animatable=False,
spec="https://drafts.csswg.org/css-ui-4/#propdef-user-select")}

View file

@ -12,9 +12,11 @@ ${helpers.single_keyword("-moz-box-align", "stretch start center baseline end",
products="gecko", gecko_ffi_name="mBoxAlign",
gecko_enum_prefix="StyleBoxAlign",
gecko_inexhaustive=True,
animatable=False)}
animatable=False,
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)}
animatable=False,
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/box-flex)")}

View file

@ -1891,7 +1891,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
let positioned = matches!(style.get_box().clone_position(),
longhands::position::SpecifiedValue::absolute |
longhands::position::SpecifiedValue::fixed);
let floated = style.get_box().clone_float() != longhands::float::SpecifiedValue::none;
let floated = style.get_box().clone_float() != longhands::float::computed_value::T::none;
// FIXME(heycam): We should look past any display:contents ancestors to
// determine if we are a flex or grid item, but we don't have access to
// grandparent or higher style here.

View file

@ -8,7 +8,8 @@
<%helpers:shorthand name="background"
sub_properties="background-color background-position-x background-position-y background-repeat
background-attachment background-image background-size background-origin
background-clip">
background-clip"
spec="https://drafts.csswg.org/css-backgrounds/#the-background">
use properties::longhands::{background_color, background_position_x, background_position_y, background_repeat};
use properties::longhands::{background_attachment, background_image, background_size, background_origin};
use properties::longhands::background_clip;
@ -252,7 +253,8 @@
</%helpers:shorthand>
<%helpers:shorthand name="background-position"
sub_properties="background-position-x background-position-y">
sub_properties="background-position-x background-position-y"
spec="https://drafts.csswg.org/css-backgrounds-4/#the-background-position">
use properties::longhands::{background_position_x,background_position_y};
use values::specified::position::Position;
use parser::Parse;

View file

@ -5,15 +5,18 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import to_rust_ident, ALL_SIDES %>
${helpers.four_sides_shorthand("border-color", "border-%s-color", "specified::CSSColor::parse")}
${helpers.four_sides_shorthand("border-color", "border-%s-color", "specified::CSSColor::parse",
spec="https://drafts.csswg.org/css-backgrounds/#border-color")}
${helpers.four_sides_shorthand("border-style", "border-%s-style",
"specified::BorderStyle::parse",
needs_context=False)}
needs_context=False,
spec="https://drafts.csswg.org/css-backgrounds/#border-style")}
<%helpers:shorthand name="border-width" sub_properties="${
' '.join('border-%s-width' % side
for side in ['top', 'right', 'bottom', 'left'])}">
for side in ['top', 'right', 'bottom', 'left'])}"
spec="https://drafts.csswg.org/css-backgrounds/#border-width">
use super::parse_four_sides;
use parser::Parse;
use values::specified;
@ -87,11 +90,16 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
if any { Ok((color, style, width)) } else { Err(()) }
}
% for side in map(lambda x: x[0], ALL_SIDES):
% for side, logical in ALL_SIDES:
<%
spec = "https://drafts.csswg.org/css-backgrounds/#border-%s" % side
if logical:
spec = "https://drafts.csswg.org/css-logical-props/#propdef-border-%s" % side
%>
<%helpers:shorthand name="border-${side}" sub_properties="${' '.join(
'border-%s-%s' % (side, prop)
for prop in ['color', 'style', 'width']
)}">
)}" spec="${spec}">
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
let (color, style, width) = try!(super::parse_border(context, input));
@ -120,7 +128,7 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
'border-%s-%s' % (side, prop)
for side in ['top', 'right', 'bottom', 'left']
for prop in ['color', 'style', 'width']
)}">
)}" spec="https://drafts.csswg.org/css-backgrounds/#border">
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
let (color, style, width) = try!(super::parse_border(context, input));
@ -151,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">
use values::specified::basic_shape::BorderRadius;
use parser::Parse;
@ -184,9 +192,9 @@ pub fn parse_border(context: &ParserContext, input: &mut Parser)
}
</%helpers:shorthand>
// https://drafts.csswg.org/css-backgrounds-3/#border-image
<%helpers:shorthand name="border-image" products="gecko" sub_properties="border-image-outset
border-image-repeat border-image-slice border-image-source border-image-width">
border-image-repeat border-image-slice border-image-source border-image-width"
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

@ -4,7 +4,8 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="overflow" sub_properties="overflow-x overflow-y">
<%helpers:shorthand name="overflow" sub_properties="overflow-x overflow-y"
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow">
use properties::longhands::{overflow_x, overflow_y};
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
@ -96,7 +97,8 @@ macro_rules! try_parse_one {
<%helpers:shorthand name="transition"
sub_properties="transition-property transition-duration
transition-timing-function
transition-delay">
transition-delay"
spec="https://drafts.csswg.org/css-transitions/#propdef-transition">
use parser::Parse;
use properties::longhands::{transition_delay, transition_duration, transition_property};
use properties::longhands::{transition_timing_function};
@ -185,7 +187,8 @@ macro_rules! try_parse_one {
animation-timing-function animation-delay
animation-iteration-count animation-direction
animation-fill-mode animation-play-state"
allowed_in_keyframe_block="False">
allowed_in_keyframe_block="False"
spec="https://drafts.csswg.org/css-animations/#propdef-animation">
use parser::Parse;
use properties::longhands::{animation_name, animation_duration, animation_timing_function};
use properties::longhands::{animation_delay, animation_iteration_count, animation_direction};
@ -332,7 +335,8 @@ macro_rules! try_parse_one {
</%helpers:shorthand>
<%helpers:shorthand name="scroll-snap-type" products="gecko"
sub_properties="scroll-snap-type-x scroll-snap-type-y">
sub_properties="scroll-snap-type-x scroll-snap-type-y"
spec="https://drafts.csswg.org/css-scroll-snap/#propdef-scroll-snap-type">
use properties::longhands::scroll_snap_type_x;
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {

View file

@ -4,7 +4,8 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="columns" sub_properties="column-count column-width" experimental="True">
<%helpers:shorthand name="columns" sub_properties="column-count column-width" experimental="True"
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, ()> {
@ -58,9 +59,9 @@
}
</%helpers:shorthand>
// https://drafts.csswg.org/css-multicol/#column-rule
<%helpers:shorthand name="column-rule" products="gecko"
sub_properties="column-rule-width column-rule-style column-rule-color">
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};
use properties::longhands::column_rule_color;

View file

@ -5,7 +5,8 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="font" sub_properties="font-style font-variant font-weight
font-size line-height font-family">
font-size line-height font-family"
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font">
use properties::longhands::{font_style, font_variant, font_weight, font_size,
line_height, font_family};

View file

@ -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<Longhands, ()> {
@ -22,9 +23,9 @@
}
</%helpers:shorthand>
// https://drafts.csswg.org/css-text-decor-3/#text-emphasis-property
<%helpers:shorthand name="text-emphasis" products="gecko" sub_properties="text-emphasis-color
text-emphasis-style">
text-emphasis-style"
spec="https://drafts.csswg.org/css-text-decor-3/#text-emphasis-property">
use properties::longhands::{text_emphasis_color, text_emphasis_style};
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
@ -80,11 +81,12 @@
</%helpers:shorthand>
// 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;

View file

@ -5,7 +5,8 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="list-style"
sub_properties="list-style-image list-style-position list-style-type">
sub_properties="list-style-image list-style-position list-style-type"
spec="https://drafts.csswg.org/css-lists/#propdef-list-style">
use properties::longhands::{list_style_image, list_style_position, list_style_type};
use values::{Either, None_};

View file

@ -4,4 +4,5 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
${helpers.four_sides_shorthand("margin", "margin-%s", "specified::LengthOrPercentageOrAuto::parse")}
${helpers.four_sides_shorthand("margin", "margin-%s", "specified::LengthOrPercentageOrAuto::parse",
spec="https://drafts.csswg.org/css-box/#propdef-margin")}

View file

@ -6,7 +6,8 @@
<%helpers:shorthand name="mask" products="gecko"
sub_properties="mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position
mask-size mask-image">
mask-size mask-image"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask">
use properties::longhands::{mask_mode, mask_repeat, mask_clip, mask_origin, mask_composite, mask_position};
use properties::longhands::{mask_size, mask_image};

View file

@ -4,7 +4,8 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="outline" sub_properties="outline-color outline-style outline-width">
<%helpers:shorthand name="outline" sub_properties="outline-color outline-style outline-width"
spec="https://drafts.csswg.org/css-ui/#propdef-outline">
use properties::longhands::outline_width;
use values::specified;
use parser::Parse;
@ -75,7 +76,7 @@
<%helpers:shorthand name="-moz-outline-radius" sub_properties="${' '.join(
'-moz-outline-radius-%s' % corner
for corner in ['topleft', 'topright', 'bottomright', 'bottomleft']
)}" products="gecko">
)}" products="gecko" spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius)">
use properties::shorthands;
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {

View file

@ -4,4 +4,5 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
${helpers.four_sides_shorthand("padding", "padding-%s", "specified::LengthOrPercentage::parse")}
${helpers.four_sides_shorthand("padding", "padding-%s", "specified::LengthOrPercentage::parse",
spec="https://drafts.csswg.org/css-box-3/#propdef-padding")}

View file

@ -4,8 +4,8 @@
<%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};
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
@ -54,8 +54,8 @@
}
</%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 app_units::Au;
use values::specified::{Number, Length, LengthOrPercentageOrAutoOrContent};

View file

@ -9,7 +9,8 @@
text-decoration-line
text-decoration-style"
products="gecko"
disable_when_testing="True">
disable_when_testing="True"
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration">
use cssparser::Color as CSSParserColor;
use properties::longhands::{text_decoration_color, text_decoration_line, text_decoration_style};
use values::specified::CSSColor;