mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
Auto merge of #17821 - bzbarsky:pseudo-prop-restrictions, r=emilio
Implement restrictions on which properties apply to which pseudo-elements ::first-line, ::first-letter, and ::placeholder don't allow all properties to apply to them. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1382786 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because they're Gecko-only for the moment, and Gecko has tests. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/17821) <!-- Reviewable:end -->
This commit is contained in:
commit
4bf8e4413e
14 changed files with 132 additions and 8 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
use cssparser::{ToCss, serialize_identifier};
|
||||
use gecko_bindings::structs::{self, CSSPseudoElementType};
|
||||
use properties::{PropertyFlags, APPLIES_TO_FIRST_LETTER, APPLIES_TO_FIRST_LINE};
|
||||
use properties::APPLIES_TO_PLACEHOLDER;
|
||||
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
|
||||
use std::fmt;
|
||||
use string_cache::Atom;
|
||||
|
@ -119,4 +121,15 @@ impl PseudoElement {
|
|||
_ => self.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Property flag that properties must have to apply to this pseudo-element.
|
||||
#[inline]
|
||||
pub fn property_restriction(&self) -> Option<PropertyFlags> {
|
||||
match *self {
|
||||
PseudoElement::FirstLetter => Some(APPLIES_TO_FIRST_LETTER),
|
||||
PseudoElement::FirstLine => Some(APPLIES_TO_FIRST_LINE),
|
||||
PseudoElement::Placeholder => Some(APPLIES_TO_PLACEHOLDER),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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_)",
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
||||
|
@ -138,7 +142,8 @@ ${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",
|
||||
|
@ -146,14 +151,16 @@ ${helpers.single_keyword("background-clip",
|
|||
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()",
|
||||
|
@ -161,6 +168,7 @@ ${helpers.predefined_type("background-size", "BackgroundSize",
|
|||
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
|
||||
|
@ -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")}
|
||||
|
|
|
@ -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)}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
||||
|
@ -278,6 +286,7 @@ ${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",
|
||||
|
@ -285,6 +294,7 @@ ${helpers.predefined_type("border-image-slice", "BorderImageSlice",
|
|||
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")]
|
||||
|
|
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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)")}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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")}
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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(
|
||||
|
@ -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",
|
||||
)}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ macro_rules! impl_gecko_keyword_conversions {
|
|||
</%def>
|
||||
|
||||
<%helpers:longhand name="font-family" animation_value_type="discrete" need_index="True" boxed="${product == 'gecko'}"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-family">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
use self::computed_value::{FontFamily, FamilyName};
|
||||
|
@ -379,6 +380,7 @@ ${helpers.single_keyword_system("font-style",
|
|||
gecko_constant_prefix="NS_FONT_STYLE",
|
||||
gecko_ffi_name="mFont.style",
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-style",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
animation_value_type="discrete")}
|
||||
|
||||
|
||||
|
@ -395,9 +397,11 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
gecko_ffi_name="mFont.variantCaps",
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-caps",
|
||||
custom_consts=font_variant_caps_custom_consts,
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
animation_value_type="discrete")}
|
||||
|
||||
<%helpers:longhand name="font-weight" need_clone="True" animation_value_type="ComputedValue"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-weight">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
|
||||
|
@ -559,6 +563,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand name="font-size" need_clone="True" animation_value_type="ComputedValue"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
allow_quirks="True" spec="https://drafts.csswg.org/css-fonts/#propdef-font-size">
|
||||
use app_units::Au;
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
|
@ -1020,6 +1025,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand products="gecko" name="font-size-adjust" animation_value_type="ComputedValue"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-size-adjust">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
|
||||
|
@ -1141,6 +1147,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand products="gecko" name="font-synthesis" animation_value_type="discrete"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-synthesis">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
@ -1238,6 +1245,7 @@ ${helpers.single_keyword_system("font-stretch",
|
|||
gecko_constant_prefix="NS_FONT_STRETCH",
|
||||
cast_type='i16',
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-stretch",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
animation_value_type="ComputedValue")}
|
||||
|
||||
${helpers.single_keyword_system("font-kerning",
|
||||
|
@ -1246,9 +1254,11 @@ ${helpers.single_keyword_system("font-kerning",
|
|||
gecko_ffi_name="mFont.kerning",
|
||||
gecko_constant_prefix="NS_FONT_KERNING",
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-kerning",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
animation_value_type="discrete")}
|
||||
|
||||
<%helpers:longhand name="font-variant-alternates" products="gecko" animation_value_type="none"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-alternates">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
use std::fmt;
|
||||
|
@ -1458,6 +1468,7 @@ macro_rules! exclusive_value {
|
|||
}
|
||||
|
||||
<%helpers:longhand name="font-variant-east-asian" products="gecko" animation_value_type="discrete"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-east-asian">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
use std::fmt;
|
||||
|
@ -1603,6 +1614,7 @@ macro_rules! exclusive_value {
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand name="font-variant-ligatures" products="gecko" animation_value_type="discrete"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-ligatures">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
use std::fmt;
|
||||
|
@ -1762,6 +1774,7 @@ macro_rules! exclusive_value {
|
|||
</%helpers:longhand>
|
||||
|
||||
<%helpers:longhand name="font-variant-numeric" products="gecko" animation_value_type="discrete"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-numeric">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
use std::fmt;
|
||||
|
@ -1915,10 +1928,12 @@ ${helpers.single_keyword_system("font-variant-position",
|
|||
gecko_ffi_name="mFont.variantPosition",
|
||||
gecko_constant_prefix="NS_FONT_VARIANT_POSITION",
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-variant-position",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
animation_value_type="discrete")}
|
||||
|
||||
<%helpers:longhand name="font-feature-settings" products="gecko" animation_value_type="discrete"
|
||||
extra_prefixes="moz" boxed="True"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts/#propdef-font-feature-settings">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
use values::generics::FontSettings;
|
||||
|
@ -1961,6 +1976,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
|
|||
"""
|
||||
%>
|
||||
<%helpers:longhand name="font-variation-settings" products="gecko" animation_value_type="none"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="${variation_spec}">
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
use values::generics::FontSettings;
|
||||
|
@ -1991,6 +2007,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
|
|||
|
||||
<%helpers:longhand name="font-language-override" products="gecko" animation_value_type="discrete"
|
||||
extra_prefixes="moz" boxed="True"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-fonts-3/#propdef-font-language-override">
|
||||
use properties::longhands::system_font::SystemFont;
|
||||
use std::fmt;
|
||||
|
@ -2550,6 +2567,7 @@ ${helpers.single_keyword("-moz-osx-font-smoothing",
|
|||
gecko_ffi_name="mFont.smoothing",
|
||||
products="gecko",
|
||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth)",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
animation_value_type="discrete")}
|
||||
|
||||
${helpers.predefined_type("-moz-min-font-size-ratio",
|
||||
|
|
|
@ -10,6 +10,7 @@ ${helpers.predefined_type("line-height",
|
|||
"LineHeight",
|
||||
"computed::LineHeight::normal()",
|
||||
animation_value_type="ComputedValue",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height")}
|
||||
|
||||
// CSS Text Module Level 3
|
||||
|
@ -19,6 +20,7 @@ ${helpers.single_keyword("text-transform",
|
|||
"none capitalize uppercase lowercase",
|
||||
extra_gecko_values="full-width",
|
||||
animation_value_type="discrete",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-text-transform")}
|
||||
|
||||
${helpers.single_keyword("hyphens", "manual none auto",
|
||||
|
@ -66,6 +68,7 @@ ${helpers.single_keyword("word-break",
|
|||
gecko_enum_prefix="StyleTextJustify"
|
||||
gecko_inexhaustive="True"
|
||||
animation_value_type="discrete"
|
||||
flags="APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
|
||||
no_viewport_percentage!(SpecifiedValue);
|
||||
|
||||
|
@ -109,6 +112,7 @@ ${helpers.single_keyword("text-align-last",
|
|||
|
||||
// TODO make this a shorthand and implement text-align-last/text-align-all
|
||||
<%helpers:longhand name="text-align" animation_value_type="discrete"
|
||||
flags="APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-text-align">
|
||||
no_viewport_percentage!(SpecifiedValue);
|
||||
pub mod computed_value {
|
||||
|
@ -267,12 +271,14 @@ ${helpers.predefined_type("letter-spacing",
|
|||
"LetterSpacing",
|
||||
"computed::LetterSpacing::normal()",
|
||||
animation_value_type="ComputedValue",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing")}
|
||||
|
||||
${helpers.predefined_type("word-spacing",
|
||||
"WordSpacing",
|
||||
"computed::WordSpacing::normal()",
|
||||
animation_value_type="ComputedValue",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-word-spacing")}
|
||||
|
||||
<%helpers:longhand name="-servo-text-decorations-in-effect"
|
||||
|
@ -367,6 +373,9 @@ ${helpers.predefined_type("word-spacing",
|
|||
needs_conversion="True"
|
||||
gecko_inexhaustive="True"
|
||||
animation_value_type="discrete"
|
||||
// Only allowed for UA sheets, which set it
|
||||
// !important.
|
||||
flags="APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-text/#propdef-white-space">
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
impl ComputedValueAsSpecified for SpecifiedValue {}
|
||||
|
@ -414,6 +423,7 @@ ${helpers.predefined_type(
|
|||
vector=True,
|
||||
animation_value_type="AnimatedTextShadowList",
|
||||
ignored_when_colors_disabled=True,
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text-decor-3/#text-shadow-property",
|
||||
)}
|
||||
|
||||
|
@ -718,6 +728,7 @@ ${helpers.predefined_type(
|
|||
"computed_value::T::currentcolor()",
|
||||
products="gecko", animation_value_type="IntermediateColor",
|
||||
need_clone=True, ignored_when_colors_disabled=True,
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color")}
|
||||
|
||||
${helpers.predefined_type(
|
||||
|
@ -726,6 +737,7 @@ ${helpers.predefined_type(
|
|||
initial_specified_value="specified::Color::currentcolor()",
|
||||
products="gecko", animation_value_type="IntermediateColor",
|
||||
need_clone=True, ignored_when_colors_disabled=True,
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")}
|
||||
|
||||
${helpers.predefined_type("-webkit-text-stroke-width",
|
||||
|
@ -734,6 +746,7 @@ ${helpers.predefined_type("-webkit-text-stroke-width",
|
|||
initial_specified_value="specified::BorderSideWidth::Length(specified::Length::zero())",
|
||||
computed_type="::app_units::Au",
|
||||
products="gecko",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width",
|
||||
animation_value_type="none")}
|
||||
|
||||
|
|
|
@ -17,5 +17,6 @@
|
|||
alias=maybe_moz_logical_alias(product, side, "-moz-margin-%s"),
|
||||
allow_quirks=not side[1],
|
||||
animation_value_type="ComputedValue", logical = side[1], spec = spec,
|
||||
flags="APPLIES_TO_FIRST_LETTER",
|
||||
allowed_in_page_rule=True)}
|
||||
% endfor
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<% from data import ALL_SIDES, maybe_moz_logical_alias %>
|
||||
<% data.new_style_struct("Padding", inherited=False) %>
|
||||
|
||||
// APPLIES_TO_PLACEHOLDER so we can set it in UA stylesheets. But we use a
|
||||
// !important value there, so pages can't set it.
|
||||
% for side in ALL_SIDES:
|
||||
<%
|
||||
spec = "https://drafts.csswg.org/css-box/#propdef-padding-%s" % side[0]
|
||||
|
@ -19,5 +21,6 @@
|
|||
animation_value_type="ComputedValue",
|
||||
logical = side[1],
|
||||
spec = spec,
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_PLACEHOLDER",
|
||||
allow_quirks=not side[1])}
|
||||
% endfor
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
// TODO(pcwalton): SVG-only values.
|
||||
${helpers.single_keyword("pointer-events", "auto none", animation_value_type="discrete",
|
||||
extra_gecko_values="visiblepainted visiblefill visiblestroke visible painted fill stroke all",
|
||||
flags="APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty")}
|
||||
|
||||
${helpers.single_keyword("-moz-user-input", "auto none enabled disabled",
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
Method("has_line_through", "bool")]) %>
|
||||
|
||||
<%helpers:longhand name="text-overflow" animation_value_type="discrete" boxed="True"
|
||||
flags="APPLIES_TO_PLACEHOLDER"
|
||||
spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
@ -142,6 +143,7 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
custom_cascade="${product == 'servo'}"
|
||||
need_clone=True
|
||||
animation_value_type="discrete"
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line">
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
|
@ -262,6 +264,7 @@ ${helpers.single_keyword("text-decoration-style",
|
|||
"solid double dotted dashed wavy -moz-none",
|
||||
products="gecko",
|
||||
animation_value_type="discrete",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style")}
|
||||
|
||||
${helpers.predefined_type(
|
||||
|
@ -271,6 +274,7 @@ ${helpers.predefined_type(
|
|||
products="gecko",
|
||||
animation_value_type="IntermediateColor",
|
||||
ignored_when_colors_disabled=True,
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
|
||||
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-color")}
|
||||
|
||||
${helpers.predefined_type(
|
||||
|
@ -280,4 +284,5 @@ ${helpers.predefined_type(
|
|||
initial_specified_value="specified::InitialLetter::normal()",
|
||||
animation_value_type="discrete",
|
||||
products="gecko",
|
||||
flags="APPLIES_TO_FIRST_LETTER",
|
||||
spec="https://drafts.csswg.org/css-inline/#sizing-drop-initials")}
|
||||
|
|
|
@ -442,6 +442,12 @@ bitflags! {
|
|||
const ABSPOS_CB = 1 << 2,
|
||||
/// This shorthand property is an alias of another property.
|
||||
const SHORTHAND_ALIAS_PROPERTY = 1 << 3,
|
||||
/// This longhand property applies to ::first-letter.
|
||||
const APPLIES_TO_FIRST_LETTER = 1 << 4,
|
||||
/// This longhand property applies to ::first-line.
|
||||
const APPLIES_TO_FIRST_LINE = 1 << 5,
|
||||
/// This longhand property applies to ::placeholder.
|
||||
const APPLIES_TO_PLACEHOLDER = 1 << 6,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2866,11 +2872,26 @@ pub fn cascade(
|
|||
&[]
|
||||
};
|
||||
let node_importance = node.importance();
|
||||
|
||||
let property_restriction = pseudo.and_then(|p| p.property_restriction());
|
||||
|
||||
declarations
|
||||
.iter()
|
||||
// Yield declarations later in source order (with more precedence) first.
|
||||
.rev()
|
||||
.filter_map(move |&(ref declaration, declaration_importance)| {
|
||||
if let Some(property_restriction) = property_restriction {
|
||||
// declaration.id() is either a longhand or a custom
|
||||
// property. Custom properties are always allowed, but
|
||||
// longhands are only allowed if they have our
|
||||
// property_restriction flag set.
|
||||
if let PropertyDeclarationId::Longhand(id) = declaration.id() {
|
||||
if !id.flags().contains(property_restriction) {
|
||||
return None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if declaration_importance == node_importance {
|
||||
Some((declaration, cascade_level))
|
||||
} else {
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::{OpaqueNode, TElement, TNode};
|
|||
use element_state::ElementState;
|
||||
use fnv::FnvHashMap;
|
||||
use invalidation::element::element_wrapper::ElementSnapshot;
|
||||
use properties::PropertyFlags;
|
||||
use selector_parser::{AttrValue as SelectorAttrValue, ElementExt, PseudoElementCascadeType, SelectorParser};
|
||||
use selectors::Element;
|
||||
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
|
||||
|
@ -39,6 +40,12 @@ pub enum PseudoElement {
|
|||
Before,
|
||||
Selection,
|
||||
// If/when :first-letter is added, update is_first_letter accordingly.
|
||||
|
||||
// If/when ::first-letter, ::first-line, or ::placeholder are added, adjust
|
||||
// our property_restriction implementation to do property filtering for
|
||||
// them. Also, make sure the UA sheet has the !important rules some of the
|
||||
// APPLIES_TO_PLACEHOLDER properties expect!
|
||||
|
||||
// Non-eager pseudos.
|
||||
DetailsSummary,
|
||||
DetailsContent,
|
||||
|
@ -169,6 +176,12 @@ impl PseudoElement {
|
|||
|
||||
/// Stub, only Gecko needs this
|
||||
pub fn pseudo_info(&self) { () }
|
||||
|
||||
/// Property flag that properties must have to apply to this pseudo-element.
|
||||
#[inline]
|
||||
pub fn property_restriction(&self) -> Option<PropertyFlags> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// The type used for storing pseudo-class string arguments.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue