Skip to content

Commit

Permalink
Flag properties that apply to ::first-letter/::first-line/::placehold…
Browse files Browse the repository at this point in the history
…er. r=emilio

Part 2 of the fix for Gecko bug 1382786 <https://bugzilla.mozilla.org/show_bug.cgi?id=1382786>.
  • Loading branch information
bzbarsky committed Jul 21, 2017
1 parent e05058d commit 592a96f
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 8 deletions.
23 changes: 16 additions & 7 deletions components/style/properties/longhand/background.mako.rs
Expand Up @@ -12,7 +12,8 @@ ${helpers.predefined_type("background-color", "Color",
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
animation_value_type="IntermediateColor",
ignored_when_colors_disabled=True,
allow_quirks=True)}
allow_quirks=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}

${helpers.predefined_type("background-image", "ImageLayer",
initial_value="Either::First(None_)",
Expand All @@ -21,7 +22,8 @@ ${helpers.predefined_type("background-image", "ImageLayer",
vector="True",
animation_value_type="discrete",
has_uncacheable_values="True" if product == "gecko" else "False",
ignored_when_colors_disabled="True")}
ignored_when_colors_disabled="True",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}

% for (axis, direction, initial) in [("x", "Horizontal", "left"), ("y", "Vertical", "top")]:
${helpers.predefined_type(
Expand All @@ -32,11 +34,13 @@ ${helpers.predefined_type("background-image", "ImageLayer",
spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-" + axis,
animation_value_type="ComputedValue",
vector=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
)}
% endfor

<%helpers:vector_longhand name="background-repeat" animation_value_type="discrete"
spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat">
spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat"
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER">
use std::fmt;
use style_traits::ToCss;

Expand Down Expand Up @@ -138,29 +142,33 @@ ${helpers.single_keyword("background-attachment",
vector=True,
gecko_constant_prefix="NS_STYLE_IMAGELAYER_ATTACHMENT",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment",
animation_value_type="discrete")}
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}

${helpers.single_keyword("background-clip",
"border-box padding-box content-box",
extra_gecko_values="text",
vector=True, extra_prefixes="webkit",
gecko_enum_prefix="StyleGeometryBox",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip",
animation_value_type="discrete")}
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}

${helpers.single_keyword("background-origin",
"padding-box border-box content-box",
vector=True, extra_prefixes="webkit",
gecko_enum_prefix="StyleGeometryBox",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin",
animation_value_type="discrete")}
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}

${helpers.predefined_type("background-size", "BackgroundSize",
initial_value="computed::LengthOrPercentageOrAuto::Auto.into()",
initial_specified_value="specified::LengthOrPercentageOrAuto::Auto.into()",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-size",
vector=True,
animation_value_type="ComputedValue",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
extra_prefixes="webkit")}

// https://drafts.fxtf.org/compositing/#background-blend-mode
Expand All @@ -170,4 +178,5 @@ ${helpers.single_keyword("background-blend-mode",
saturation color luminosity""",
gecko_constant_prefix="NS_STYLE_BLEND",
vector=True, products="gecko", animation_value_type="discrete",
spec="https://drafts.fxtf.org/compositing/#background-blend-mode")}
spec="https://drafts.fxtf.org/compositing/#background-blend-mode",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}
10 changes: 10 additions & 0 deletions components/style/properties/longhand/border.mako.rs
Expand Up @@ -27,12 +27,14 @@
animation_value_type="IntermediateColor",
logical=is_logical,
allow_quirks=not is_logical,
flags="APPLIES_TO_FIRST_LETTER",
ignored_when_colors_disabled=True)}

${helpers.predefined_type("border-%s-style" % side_name, "BorderStyle",
"specified::BorderStyle::none",
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-style"),
spec=maybe_logical_spec(side, "style"),
flags="APPLIES_TO_FIRST_LETTER",
animation_value_type="discrete" if not is_logical else "none",
logical=is_logical)}

Expand All @@ -44,6 +46,7 @@
spec=maybe_logical_spec(side, "width"),
animation_value_type="ComputedValue",
logical=is_logical,
flags="APPLIES_TO_FIRST_LETTER",
allow_quirks=not is_logical)}
% endfor

Expand All @@ -58,6 +61,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
"parse", extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-backgrounds/#border-%s-radius" % corner,
boxed=True,
flags="APPLIES_TO_FIRST_LETTER",
animation_value_type="ComputedValue")}
% endfor

Expand All @@ -67,6 +71,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
<%helpers:longhand name="-moz-border-${side}-colors" animation_value_type="discrete"
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-border-*-colors)"
products="gecko"
flags="APPLIES_TO_FIRST_LETTER"
ignored_when_colors_disabled="True">
use std::fmt;
use style_traits::ToCss;
Expand Down Expand Up @@ -206,6 +211,7 @@ ${helpers.predefined_type("border-image-source", "ImageLayer",
vector=False,
animation_value_type="discrete",
has_uncacheable_values=False,
flags="APPLIES_TO_FIRST_LETTER",
boxed="True")}

${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
Expand All @@ -214,9 +220,11 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
initial_specified_value="specified::LengthOrNumber::zero().into()",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset",
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER",
boxed=True)}

<%helpers:longhand name="border-image-repeat" animation_value_type="discrete"
flags="APPLIES_TO_FIRST_LETTER"
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
use style_traits::ToCss;

Expand Down Expand Up @@ -278,13 +286,15 @@ ${helpers.predefined_type("border-image-width", "BorderImageWidth",
initial_specified_value="specified::BorderImageSideWidth::one().into()",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-width",
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER",
boxed=True)}

${helpers.predefined_type("border-image-slice", "BorderImageSlice",
initial_value="computed::NumberOrPercentage::Percentage(computed::Percentage(1.)).into()",
initial_specified_value="specified::NumberOrPercentage::Percentage(specified::Percentage::new(1.)).into()",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-slice",
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER",
boxed=True)}

#[cfg(feature = "gecko")]
Expand Down
15 changes: 15 additions & 0 deletions components/style/properties/longhand/box.mako.rs
Expand Up @@ -10,10 +10,14 @@
gecko_name="Display") %>

// TODO(SimonSapin): don't parse `inline-table`, since we don't support it
//
// We allow "display" to apply to placeholders because we need to make the
// placeholder pseudo-element an inline-block in the UA stylesheet in Gecko.
<%helpers:longhand name="display"
need_clone="True"
animation_value_type="discrete"
custom_cascade="${product == 'servo'}"
flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-display/#propdef-display">
<%
values = """inline block inline-block
Expand Down Expand Up @@ -216,6 +220,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
gecko_inexhaustive="True"
gecko_ffi_name="mFloat"
gecko_pref_ident="float_"
flags="APPLIES_TO_FIRST_LETTER"
spec="https://drafts.csswg.org/css-box/#propdef-float">
no_viewport_percentage!(SpecifiedValue);
impl ToComputedValue for SpecifiedValue {
Expand Down Expand Up @@ -306,6 +311,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
</%helpers:longhand>

<%helpers:longhand name="vertical-align" animation_value_type="ComputedValue"
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align">
use std::fmt;
use style_traits::ToCss;
Expand Down Expand Up @@ -432,6 +438,7 @@ ${helpers.single_keyword("-servo-overflow-clip-box", "padding-box content-box",

${helpers.single_keyword("overflow-clip-box", "padding-box content-box",
products="gecko", animation_value_type="discrete", internal=True,
flags="APPLIES_TO_PLACEHOLDER",
spec="Internal, not web-exposed, \
may be standardized in the future (https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-clip-box)")}

Expand All @@ -445,10 +452,12 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
extra_gecko_values="-moz-hidden-unscrollable",
custom_consts=overflow_custom_consts,
gecko_constant_prefix="NS_STYLE_OVERFLOW",
flags="APPLIES_TO_PLACEHOLDER",
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" animation_value_type="discrete"
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow-y">
pub use super::overflow_x::{SpecifiedValue, parse, get_initial_value, computed_value};
</%helpers:longhand>
Expand Down Expand Up @@ -1618,10 +1627,15 @@ ${helpers.single_keyword("page-break-inside",
// CSS Basic User Interface Module Level 3
// http://dev.w3.org/csswg/css-ui
// FIXME support logical values `block` and `inline` (https://drafts.csswg.org/css-logical-props/#resize)
//
// This is APPLIES_TO_PLACEHOLDER so we can override, in the UA sheet, the
// 'resize' property we'd inherit from textarea otherwise. Basically, just
// makes the UA rules easier to write.
${helpers.single_keyword("resize",
"none both horizontal vertical",
products="gecko",
spec="https://drafts.csswg.org/css-ui/#propdef-resize",
flags="APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}


Expand Down Expand Up @@ -1888,6 +1902,7 @@ ${helpers.predefined_type("shape-outside", "basic_shape::FloatAreaShape",
"generics::basic_shape::ShapeSource::None",
products="gecko", boxed="True",
animation_value_type="none",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-shapes/#shape-outside-property")}

<%helpers:longhand name="touch-action"
Expand Down
1 change: 1 addition & 0 deletions components/style/properties/longhand/color.mako.rs
Expand Up @@ -11,6 +11,7 @@
<%helpers:longhand name="color" need_clone="True"
animation_value_type="IntermediateRGBA"
ignored_when_colors_disabled="True"
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-color/#color">
use cssparser::RGBA;
use values::specified::{AllowQuirks, Color};
Expand Down
3 changes: 2 additions & 1 deletion components/style/properties/longhand/effects.mako.rs
Expand Up @@ -11,7 +11,7 @@ ${helpers.predefined_type("opacity",
"Opacity",
"1.0",
animation_value_type="ComputedValue",
flags="CREATES_STACKING_CONTEXT",
flags="CREATES_STACKING_CONTEXT APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-color/#opacity")}

${helpers.predefined_type(
Expand All @@ -22,6 +22,7 @@ ${helpers.predefined_type(
animation_value_type="AnimatedBoxShadowList",
extra_prefixes="webkit",
ignored_when_colors_disabled=True,
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-backgrounds/#box-shadow",
)}

Expand Down

0 comments on commit 592a96f

Please sign in to comment.