Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE

Backs out https://github.com/servo/servo/pull/18809
This commit is contained in:
Gecko Backout 2017-10-19 21:26:51 +00:00 committed by moz-servo-sync
parent fe16c1d5c3
commit 11c64178d8
142 changed files with 1635 additions and 1685 deletions

View file

@ -11,13 +11,13 @@ bitflags! {
/// anonymous boxes, see StyleBuilder::for_inheritance and its callsites.
/// If we ever want to add some flags that shouldn't inherit for them,
/// we might want to add a function to handle this.
pub struct ComputedValueFlags: u16 {
pub flags ComputedValueFlags: u16 {
/// Whether the style or any of the ancestors has a text-decoration-line
/// property that should get propagated to descendants.
///
/// text-decoration-line is a reset property, but gets propagated in the
/// frame/box tree.
const HAS_TEXT_DECORATION_LINES = 1 << 0;
const HAS_TEXT_DECORATION_LINES = 1 << 0,
/// Whether line break inside should be suppressed.
///
@ -27,41 +27,41 @@ bitflags! {
///
/// This bit is propagated to all children of line participants.
/// It is currently used by ruby to make its content unbreakable.
const SHOULD_SUPPRESS_LINEBREAK = 1 << 1;
const SHOULD_SUPPRESS_LINEBREAK = 1 << 1,
/// A flag used to mark text that that has text-combine-upright.
///
/// This is used from Gecko's layout engine.
const IS_TEXT_COMBINED = 1 << 2;
const IS_TEXT_COMBINED = 1 << 2,
/// A flag used to mark styles under a relevant link that is also
/// visited.
const IS_RELEVANT_LINK_VISITED = 1 << 3;
const IS_RELEVANT_LINK_VISITED = 1 << 3,
/// A flag used to mark styles which are a pseudo-element or under one.
const IS_IN_PSEUDO_ELEMENT_SUBTREE = 1 << 4;
const IS_IN_PSEUDO_ELEMENT_SUBTREE = 1 << 4,
/// A flag used to mark styles which are in a display: none subtree, or
/// under one.
const IS_IN_DISPLAY_NONE_SUBTREE = 1 << 5;
const IS_IN_DISPLAY_NONE_SUBTREE = 1 << 5,
/// Whether this style inherits the `display` property.
///
/// This is important because it may affect our optimizations to avoid
/// computing the style of pseudo-elements, given whether the
/// pseudo-element is generated depends on the `display` value.
const INHERITS_DISPLAY = 1 << 6;
const INHERITS_DISPLAY = 1 << 6,
/// Whether this style inherits the `content` property.
///
/// Important because of the same reason.
const INHERITS_CONTENT = 1 << 7;
const INHERITS_CONTENT = 1 << 7,
/// Whether the child explicitly inherits any reset property.
const INHERITS_RESET_STYLE = 1 << 8;
const INHERITS_RESET_STYLE = 1 << 8,
/// A flag to mark a style which is a visited style.
const IS_STYLE_IF_VISITED = 1 << 9;
const IS_STYLE_IF_VISITED = 1 << 9,
}
}
@ -69,8 +69,6 @@ impl ComputedValueFlags {
/// Returns the flags that are inherited.
#[inline]
pub fn inherited(self) -> Self {
self & !(ComputedValueFlags::INHERITS_DISPLAY |
ComputedValueFlags::INHERITS_CONTENT |
ComputedValueFlags::INHERITS_RESET_STYLE)
self & !(INHERITS_DISPLAY | INHERITS_CONTENT | INHERITS_RESET_STYLE)
}
}

View file

@ -19,7 +19,7 @@ use smallvec::SmallVec;
use std::fmt;
use std::iter::{DoubleEndedIterator, Zip};
use std::slice::Iter;
use style_traits::{ToCss, ParseError, ParsingMode, StyleParseErrorKind};
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError, ParsingMode, StyleParseErrorKind};
use stylesheets::{CssRuleType, Origin, UrlExtraData};
use super::*;
use values::computed::Context;
@ -853,7 +853,7 @@ impl ToCss for PropertyDeclarationBlock {
// Substeps 7 and 8
// We need to check the shorthand whether it's an alias property or not.
// If it's an alias property, it should be serialized like its longhand.
if shorthand.flags().contains(PropertyFlags::SHORTHAND_ALIAS_PROPERTY) {
if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) {
append_serialization::<_, Cloned<slice::Iter< _>>, _>(
dest,
&property,
@ -1023,7 +1023,7 @@ pub fn parse_style_attribute<R>(input: &str,
let context = ParserContext::new(Origin::Author,
url_data,
Some(CssRuleType::Style),
ParsingMode::DEFAULT,
PARSING_MODE_DEFAULT,
quirks_mode);
let error_context = ParserErrorContext { error_reporter: error_reporter };
let mut input = ParserInput::new(input);

View file

@ -1538,7 +1538,7 @@ fn static_assert() {
}
pub fn set_computed_justify_items(&mut self, v: values::specified::JustifyItems) {
debug_assert!(v.0 != ::values::specified::align::AlignFlags::AUTO);
debug_assert!(v.0 != ::values::specified::align::ALIGN_AUTO);
self.gecko.mJustifyItems = v.into();
}
@ -3364,20 +3364,20 @@ fn static_assert() {
use properties::longhands::will_change::computed_value::T;
fn will_change_bitfield_from_prop_flags(prop: &LonghandId) -> u8 {
use properties::PropertyFlags;
use properties::{ABSPOS_CB, CREATES_STACKING_CONTEXT, FIXPOS_CB};
use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_ABSPOS_CB;
use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_FIXPOS_CB;
use gecko_bindings::structs::NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
let servo_flags = prop.flags();
let mut bitfield = 0;
if servo_flags.contains(PropertyFlags::CREATES_STACKING_CONTEXT) {
if servo_flags.contains(CREATES_STACKING_CONTEXT) {
bitfield |= NS_STYLE_WILL_CHANGE_STACKING_CONTEXT;
}
if servo_flags.contains(PropertyFlags::FIXPOS_CB) {
if servo_flags.contains(FIXPOS_CB) {
bitfield |= NS_STYLE_WILL_CHANGE_FIXPOS_CB;
}
if servo_flags.contains(PropertyFlags::ABSPOS_CB) {
if servo_flags.contains(ABSPOS_CB) {
bitfield |= NS_STYLE_WILL_CHANGE_ABSPOS_CB;
}
@ -3470,26 +3470,26 @@ fn static_assert() {
use gecko_bindings::structs::NS_STYLE_CONTAIN_STYLE;
use gecko_bindings::structs::NS_STYLE_CONTAIN_PAINT;
use gecko_bindings::structs::NS_STYLE_CONTAIN_ALL_BITS;
use properties::longhands::contain::SpecifiedValue;
use properties::longhands::contain;
if v.is_empty() {
self.gecko.mContain = NS_STYLE_CONTAIN_NONE as u8;
return;
}
if v.contains(SpecifiedValue::STRICT) {
if v.contains(contain::STRICT) {
self.gecko.mContain = (NS_STYLE_CONTAIN_STRICT | NS_STYLE_CONTAIN_ALL_BITS) as u8;
return;
}
let mut bitfield = 0;
if v.contains(SpecifiedValue::LAYOUT) {
if v.contains(contain::LAYOUT) {
bitfield |= NS_STYLE_CONTAIN_LAYOUT;
}
if v.contains(SpecifiedValue::STYLE) {
if v.contains(contain::STYLE) {
bitfield |= NS_STYLE_CONTAIN_STYLE;
}
if v.contains(SpecifiedValue::PAINT) {
if v.contains(contain::PAINT) {
bitfield |= NS_STYLE_CONTAIN_PAINT;
}
@ -3502,25 +3502,25 @@ fn static_assert() {
use gecko_bindings::structs::NS_STYLE_CONTAIN_STYLE;
use gecko_bindings::structs::NS_STYLE_CONTAIN_PAINT;
use gecko_bindings::structs::NS_STYLE_CONTAIN_ALL_BITS;
use properties::longhands::contain::{self, SpecifiedValue};
use properties::longhands::contain;
let mut servo_flags = contain::computed_value::T::empty();
let gecko_flags = self.gecko.mContain;
if gecko_flags & (NS_STYLE_CONTAIN_STRICT as u8) != 0 &&
gecko_flags & (NS_STYLE_CONTAIN_ALL_BITS as u8) != 0 {
servo_flags.insert(SpecifiedValue::STRICT | SpecifiedValue::STRICT_BITS);
servo_flags.insert(contain::STRICT | contain::STRICT_BITS);
return servo_flags;
}
if gecko_flags & (NS_STYLE_CONTAIN_LAYOUT as u8) != 0 {
servo_flags.insert(SpecifiedValue::LAYOUT);
servo_flags.insert(contain::LAYOUT);
}
if gecko_flags & (NS_STYLE_CONTAIN_STYLE as u8) != 0{
servo_flags.insert(SpecifiedValue::STYLE);
servo_flags.insert(contain::STYLE);
}
if gecko_flags & (NS_STYLE_CONTAIN_PAINT as u8) != 0 {
servo_flags.insert(SpecifiedValue::PAINT);
servo_flags.insert(contain::PAINT);
}
return servo_flags;

View file

@ -15,8 +15,7 @@ ${helpers.predefined_type(
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
allow_quirks=True,
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
)}
${helpers.predefined_type("background-image", "ImageLayer",
@ -26,8 +25,7 @@ ${helpers.predefined_type("background-image", "ImageLayer",
vector="True",
animation_value_type="discrete",
ignored_when_colors_disabled="True",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""")}
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(
@ -38,15 +36,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""">
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER">
use std::fmt;
use style_traits::ToCss;
@ -146,8 +142,7 @@ ${helpers.single_keyword("background-attachment",
gecko_constant_prefix="NS_STYLE_IMAGELAYER_ATTACHMENT",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment",
animation_value_type="discrete",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""")}
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}
${helpers.single_keyword("background-clip",
"border-box padding-box content-box",
@ -156,8 +151,7 @@ ${helpers.single_keyword("background-clip",
gecko_enum_prefix="StyleGeometryBox",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-clip",
animation_value_type="discrete",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""")}
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}
${helpers.single_keyword("background-origin",
"padding-box border-box content-box",
@ -165,8 +159,7 @@ ${helpers.single_keyword("background-origin",
gecko_enum_prefix="StyleGeometryBox",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-origin",
animation_value_type="discrete",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""")}
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}
${helpers.predefined_type("background-size", "BackgroundSize",
initial_value="computed::BackgroundSize::auto()",
@ -175,8 +168,7 @@ ${helpers.predefined_type("background-size", "BackgroundSize",
vector=True,
animation_value_type="BackgroundSizeList",
need_animatable=True,
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
extra_prefixes="webkit")}
// https://drafts.fxtf.org/compositing/#background-blend-mode
@ -187,5 +179,4 @@ ${helpers.single_keyword("background-blend-mode",
gecko_constant_prefix="NS_STYLE_BLEND",
vector=True, products="gecko", animation_value_type="discrete",
spec="https://drafts.fxtf.org/compositing/#background-blend-mode",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""")}
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}

View file

@ -28,7 +28,7 @@
animation_value_type="AnimatedColor",
logical=is_logical,
allow_quirks=not is_logical,
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
ignored_when_colors_disabled=True,
)}
@ -36,7 +36,7 @@
"specified::BorderStyle::none",
alias=maybe_moz_logical_alias(product, side, "-moz-border-%s-style"),
spec=maybe_logical_spec(side, "style"),
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
animation_value_type="discrete" if not is_logical else "none",
logical=is_logical)}
@ -48,7 +48,7 @@
spec=maybe_logical_spec(side, "width"),
animation_value_type="NonNegativeLength",
logical=is_logical,
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
allow_quirks=not is_logical)}
% endfor
@ -63,7 +63,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="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
animation_value_type="BorderCornerRadius")}
% endfor
@ -73,7 +73,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="PropertyFlags::APPLIES_TO_FIRST_LETTER"
flags="APPLIES_TO_FIRST_LETTER"
ignored_when_colors_disabled="True">
use std::fmt;
use style_traits::ToCss;
@ -207,7 +207,7 @@ ${helpers.predefined_type("border-image-source", "ImageLayer",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-image",
vector=False,
animation_value_type="discrete",
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
boxed="True")}
${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
@ -216,11 +216,11 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
initial_specified_value="specified::LengthOrNumberRect::all(specified::LengthOrNumber::zero())",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset",
animation_value_type="discrete",
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
boxed=True)}
<%helpers:longhand name="border-image-repeat" animation_value_type="discrete"
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER"
flags="APPLIES_TO_FIRST_LETTER"
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
use style_traits::ToCss;
@ -279,7 +279,7 @@ ${helpers.predefined_type("border-image-width", "BorderImageWidth",
initial_specified_value="specified::BorderImageWidth::all(specified::BorderImageSideWidth::one())",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-width",
animation_value_type="discrete",
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
boxed=True)}
${helpers.predefined_type("border-image-slice", "BorderImageSlice",
@ -287,7 +287,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="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
boxed=True)}
#[cfg(feature = "gecko")]

View file

@ -16,7 +16,7 @@
<%helpers:longhand name="display"
animation_value_type="discrete"
custom_cascade="${product == 'servo'}"
flags="PropertyFlags::APPLIES_TO_PLACEHOLDER"
flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-display/#propdef-display">
<%
values = """inline block inline-block
@ -227,7 +227,7 @@ ${helpers.single_keyword("-moz-top-layer", "none top",
${helpers.single_keyword("position", "static absolute relative fixed sticky",
animation_value_type="discrete",
flags="PropertyFlags::CREATES_STACKING_CONTEXT PropertyFlags::ABSPOS_CB",
flags="CREATES_STACKING_CONTEXT ABSPOS_CB",
spec="https://drafts.csswg.org/css-position/#position-property")}
<%helpers:single_keyword_computed name="float"
@ -240,7 +240,7 @@ ${helpers.single_keyword("position", "static absolute relative fixed sticky",
gecko_inexhaustive="True"
gecko_ffi_name="mFloat"
gecko_pref_ident="float_"
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER"
flags="APPLIES_TO_FIRST_LETTER"
spec="https://drafts.csswg.org/css-box/#propdef-float">
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
@ -362,8 +362,7 @@ ${helpers.predefined_type(
"VerticalAlign",
"computed::VerticalAlign::baseline()",
animation_value_type="ComputedValue",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align",
)}
@ -376,7 +375,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="PropertyFlags::APPLIES_TO_PLACEHOLDER",
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)")}
@ -390,12 +389,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="PropertyFlags::APPLIES_TO_PLACEHOLDER",
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" animation_value_type="discrete"
flags="PropertyFlags::APPLIES_TO_PLACEHOLDER",
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>
@ -669,7 +668,7 @@ ${helpers.predefined_type(
<%helpers:longhand name="transform" extra_prefixes="webkit"
animation_value_type="ComputedValue"
flags="PropertyFlags::CREATES_STACKING_CONTEXT PropertyFlags::FIXPOS_CB"
flags="CREATES_STACKING_CONTEXT FIXPOS_CB"
spec="https://drafts.csswg.org/css-transforms/#propdef-transform">
use values::computed::{LengthOrPercentageOrNumber as ComputedLoPoNumber, LengthOrNumber as ComputedLoN};
use values::computed::{LengthOrPercentage as ComputedLoP, Length as ComputedLength};
@ -1572,7 +1571,7 @@ ${helpers.single_keyword("isolation",
"auto isolate",
products="gecko",
spec="https://drafts.fxtf.org/compositing/#isolation",
flags="PropertyFlags::CREATES_STACKING_CONTEXT",
flags="CREATES_STACKING_CONTEXT",
animation_value_type="discrete")}
// TODO add support for logical values recto and verso
@ -1605,7 +1604,7 @@ ${helpers.single_keyword("resize",
"none both horizontal vertical",
products="gecko",
spec="https://drafts.csswg.org/css-ui/#propdef-resize",
flags="PropertyFlags::APPLIES_TO_PLACEHOLDER",
flags="APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}
@ -1616,7 +1615,7 @@ ${helpers.predefined_type("perspective",
gecko_ffi_name="mChildPerspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
extra_prefixes="moz webkit",
flags="PropertyFlags::CREATES_STACKING_CONTEXT PropertyFlags::FIXPOS_CB",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
animation_value_type="ComputedValue")}
${helpers.predefined_type("perspective-origin",
@ -1647,7 +1646,7 @@ ${helpers.single_keyword("transform-style",
"flat preserve-3d",
spec="https://drafts.csswg.org/css-transforms/#transform-style-property",
extra_prefixes="moz webkit",
flags="PropertyFlags::CREATES_STACKING_CONTEXT PropertyFlags::FIXPOS_CB",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
animation_value_type="discrete")}
${helpers.predefined_type("transform-origin",
@ -1662,7 +1661,7 @@ ${helpers.predefined_type("transform-origin",
// like `content`(layout style paint) in gecko. We should implement `size` and `content`,
// also update the glue once they are implemented in gecko.
<%helpers:longhand name="contain" animation_value_type="discrete" products="gecko"
flags="PropertyFlags::FIXPOS_CB"
flags="FIXPOS_CB"
spec="https://drafts.csswg.org/css-contain/#contain-property">
use std::fmt;
use style_traits::ToCss;
@ -1673,12 +1672,12 @@ ${helpers.predefined_type("transform-origin",
bitflags! {
#[derive(MallocSizeOf, ToComputedValue)]
pub struct SpecifiedValue: u8 {
const LAYOUT = 0x01;
const STYLE = 0x02;
const PAINT = 0x04;
const STRICT = 0x8;
const STRICT_BITS = SpecifiedValue::LAYOUT.bits | SpecifiedValue::STYLE.bits | SpecifiedValue::PAINT.bits;
pub flags SpecifiedValue: u8 {
const LAYOUT = 0x01,
const STYLE = 0x02,
const PAINT = 0x04,
const STRICT = 0x8,
const STRICT_BITS = LAYOUT.bits | STYLE.bits | PAINT.bits,
}
}
@ -1687,13 +1686,13 @@ ${helpers.predefined_type("transform-origin",
if self.is_empty() {
return dest.write_str("none")
}
if self.contains(SpecifiedValue::STRICT) {
if self.contains(STRICT) {
return dest.write_str("strict")
}
let mut has_any = false;
macro_rules! maybe_write_value {
($ident:path => $str:expr) => {
($ident:ident => $str:expr) => {
if self.contains($ident) {
if has_any {
dest.write_str(" ")?;
@ -1703,9 +1702,9 @@ ${helpers.predefined_type("transform-origin",
}
}
}
maybe_write_value!(SpecifiedValue::LAYOUT => "layout");
maybe_write_value!(SpecifiedValue::STYLE => "style");
maybe_write_value!(SpecifiedValue::PAINT => "paint");
maybe_write_value!(LAYOUT => "layout");
maybe_write_value!(STYLE => "style");
maybe_write_value!(PAINT => "paint");
debug_assert!(has_any);
Ok(())
@ -1726,15 +1725,15 @@ ${helpers.predefined_type("transform-origin",
return Ok(result)
}
if input.try(|input| input.expect_ident_matching("strict")).is_ok() {
result.insert(SpecifiedValue::STRICT | SpecifiedValue::STRICT_BITS);
result.insert(STRICT | STRICT_BITS);
return Ok(result)
}
while let Ok(name) = input.try(|i| i.expect_ident_cloned()) {
let flag = match_ignore_ascii_case! { &name,
"layout" => Some(SpecifiedValue::LAYOUT),
"style" => Some(SpecifiedValue::STYLE),
"paint" => Some(SpecifiedValue::PAINT),
"layout" => Some(LAYOUT),
"style" => Some(STYLE),
"paint" => Some(PAINT),
_ => None
};
let flag = match flag {
@ -1865,7 +1864,7 @@ ${helpers.predefined_type(
products="gecko",
boxed=True,
animation_value_type="ComputedValue",
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-shapes/#shape-outside-property",
)}
@ -1885,28 +1884,28 @@ ${helpers.predefined_type(
/// These constants match Gecko's `NS_STYLE_TOUCH_ACTION_*` constants.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[derive(ToComputedValue)]
pub struct SpecifiedValue: u8 {
const TOUCH_ACTION_NONE = structs::NS_STYLE_TOUCH_ACTION_NONE as u8;
const TOUCH_ACTION_AUTO = structs::NS_STYLE_TOUCH_ACTION_AUTO as u8;
const TOUCH_ACTION_PAN_X = structs::NS_STYLE_TOUCH_ACTION_PAN_X as u8;
const TOUCH_ACTION_PAN_Y = structs::NS_STYLE_TOUCH_ACTION_PAN_Y as u8;
const TOUCH_ACTION_MANIPULATION = structs::NS_STYLE_TOUCH_ACTION_MANIPULATION as u8;
pub flags SpecifiedValue: u8 {
const TOUCH_ACTION_NONE = structs::NS_STYLE_TOUCH_ACTION_NONE as u8,
const TOUCH_ACTION_AUTO = structs::NS_STYLE_TOUCH_ACTION_AUTO as u8,
const TOUCH_ACTION_PAN_X = structs::NS_STYLE_TOUCH_ACTION_PAN_X as u8,
const TOUCH_ACTION_PAN_Y = structs::NS_STYLE_TOUCH_ACTION_PAN_Y as u8,
const TOUCH_ACTION_MANIPULATION = structs::NS_STYLE_TOUCH_ACTION_MANIPULATION as u8,
}
}
impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
SpecifiedValue::TOUCH_ACTION_NONE => dest.write_str("none"),
SpecifiedValue::TOUCH_ACTION_AUTO => dest.write_str("auto"),
SpecifiedValue::TOUCH_ACTION_MANIPULATION => dest.write_str("manipulation"),
_ if self.contains(SpecifiedValue::TOUCH_ACTION_PAN_X | SpecifiedValue::TOUCH_ACTION_PAN_Y) => {
TOUCH_ACTION_NONE => dest.write_str("none"),
TOUCH_ACTION_AUTO => dest.write_str("auto"),
TOUCH_ACTION_MANIPULATION => dest.write_str("manipulation"),
_ if self.contains(TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y) => {
dest.write_str("pan-x pan-y")
},
_ if self.contains(SpecifiedValue::TOUCH_ACTION_PAN_X) => {
_ if self.contains(TOUCH_ACTION_PAN_X) => {
dest.write_str("pan-x")
},
_ if self.contains(SpecifiedValue::TOUCH_ACTION_PAN_Y) => {
_ if self.contains(TOUCH_ACTION_PAN_Y) => {
dest.write_str("pan-y")
},
_ => panic!("invalid touch-action value"),
@ -1916,28 +1915,28 @@ ${helpers.predefined_type(
#[inline]
pub fn get_initial_value() -> computed_value::T {
SpecifiedValue::TOUCH_ACTION_AUTO
TOUCH_ACTION_AUTO
}
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
// FIXME: remove clone() when lifetimes are non-lexical
try_match_ident_ignore_ascii_case! { input,
"auto" => Ok(SpecifiedValue::TOUCH_ACTION_AUTO),
"none" => Ok(SpecifiedValue::TOUCH_ACTION_NONE),
"manipulation" => Ok(SpecifiedValue::TOUCH_ACTION_MANIPULATION),
"auto" => Ok(TOUCH_ACTION_AUTO),
"none" => Ok(TOUCH_ACTION_NONE),
"manipulation" => Ok(TOUCH_ACTION_MANIPULATION),
"pan-x" => {
if input.try(|i| i.expect_ident_matching("pan-y")).is_ok() {
Ok(SpecifiedValue::TOUCH_ACTION_PAN_X | SpecifiedValue::TOUCH_ACTION_PAN_Y)
Ok(TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y)
} else {
Ok(SpecifiedValue::TOUCH_ACTION_PAN_X)
Ok(TOUCH_ACTION_PAN_X)
}
},
"pan-y" => {
if input.try(|i| i.expect_ident_matching("pan-x")).is_ok() {
Ok(SpecifiedValue::TOUCH_ACTION_PAN_X | SpecifiedValue::TOUCH_ACTION_PAN_Y)
Ok(TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y)
} else {
Ok(SpecifiedValue::TOUCH_ACTION_PAN_Y)
Ok(TOUCH_ACTION_PAN_Y)
}
},
}

View file

@ -13,8 +13,7 @@ ${helpers.predefined_type(
"ColorPropertyValue",
"::cssparser::RGBA::new(0, 0, 0, 255)",
animation_value_type="AnimatedRGBA",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
ignored_when_colors_disabled="True",
spec="https://drafts.csswg.org/css-color/#color"
)}

View file

@ -11,7 +11,7 @@ ${helpers.predefined_type("opacity",
"Opacity",
"1.0",
animation_value_type="ComputedValue",
flags="PropertyFlags::CREATES_STACKING_CONTEXT PropertyFlags::APPLIES_TO_PLACEHOLDER",
flags="CREATES_STACKING_CONTEXT APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-color/#opacity")}
${helpers.predefined_type(
@ -22,7 +22,7 @@ ${helpers.predefined_type(
animation_value_type="AnimatedBoxShadowList",
extra_prefixes="webkit",
ignored_when_colors_disabled=True,
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-backgrounds/#box-shadow",
)}
@ -42,7 +42,7 @@ ${helpers.predefined_type(
separator="Space",
animation_value_type="AnimatedFilterList",
extra_prefixes="webkit",
flags="PropertyFlags::CREATES_STACKING_CONTEXT PropertyFlags::FIXPOS_CB",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
spec="https://drafts.fxtf.org/filters/#propdef-filter",
)}
@ -51,5 +51,5 @@ ${helpers.single_keyword("mix-blend-mode",
color-burn hard-light soft-light difference exclusion hue
saturation color luminosity""", gecko_constant_prefix="NS_STYLE_BLEND",
animation_value_type="discrete",
flags="PropertyFlags::CREATES_STACKING_CONTEXT",
flags="CREATES_STACKING_CONTEXT",
spec="https://drafts.fxtf.org/compositing/#propdef-mix-blend-mode")}

View file

@ -69,8 +69,7 @@ macro_rules! impl_gecko_keyword_conversions {
</%def>
<%helpers:longhand name="font-family" animation_value_type="discrete"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-fonts/#propdef-font-family">
#[cfg(feature = "gecko")] use gecko_bindings::bindings;
#[cfg(feature = "gecko")] use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
@ -597,8 +596,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}
@ -615,13 +613,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}
<%helpers:longhand name="font-weight" animation_value_type="ComputedValue"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -786,8 +782,7 @@ ${helpers.single_keyword_system("font-variant-caps",
</%helpers:longhand>
<%helpers:longhand name="font-size" animation_value_type="NonNegativeLength"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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 values::specified::AllowQuirks;
@ -922,8 +917,7 @@ ${helpers.single_keyword_system("font-variant-caps",
<%helpers:longhand products="gecko" name="font-size-adjust"
animation_value_type="longhands::font_size_adjust::computed_value::T"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -1040,8 +1034,7 @@ ${helpers.single_keyword_system("font-variant-caps",
</%helpers:longhand>
<%helpers:longhand products="gecko" name="font-synthesis" animation_value_type="discrete"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -1135,8 +1128,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="ComputedValue")}
${helpers.single_keyword_system("font-kerning",
@ -1145,13 +1137,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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="discrete"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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;
@ -1263,15 +1253,15 @@ ${helpers.single_keyword_system("font-kerning",
bitflags! {
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct ParsingFlags: u8 {
const NORMAL = 0;
const HISTORICAL_FORMS = 0x01;
const STYLISTIC = 0x02;
const STYLESET = 0x04;
const CHARACTER_VARIANT = 0x08;
const SWASH = 0x10;
const ORNAMENTS = 0x20;
const ANNOTATION = 0x40;
pub flags ParsingFlags: u8 {
const NORMAL = 0,
const HISTORICAL_FORMS = 0x01,
const STYLISTIC = 0x02,
const STYLESET = 0x04,
const CHARACTER_VARIANT = 0x08,
const SWASH = 0x10,
const ORNAMENTS = 0x20,
const ANNOTATION = 0x40,
}
}
@ -1292,7 +1282,7 @@ ${helpers.single_keyword_system("font-kerning",
let mut parsed_alternates = ParsingFlags::empty();
macro_rules! check_if_parsed(
($input:expr, $flag:path) => (
($input:expr, $flag:ident) => (
if parsed_alternates.contains($flag) {
return Err($input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
}
@ -1304,7 +1294,7 @@ ${helpers.single_keyword_system("font-kerning",
match input.next()?.clone() {
Token::Ident(ref ident) => {
if *ident == "historical-forms" {
check_if_parsed!(input, ParsingFlags::HISTORICAL_FORMS);
check_if_parsed!(input, HISTORICAL_FORMS);
alternates.push(VariantAlternates::HistoricalForms);
Ok(())
} else {
@ -1316,7 +1306,7 @@ ${helpers.single_keyword_system("font-kerning",
match_ignore_ascii_case! { &name,
% for value in "swash stylistic ornaments annotation".split():
"${value}" => {
check_if_parsed!(i, ParsingFlags::${value.upper()});
check_if_parsed!(i, ${value.upper()});
let location = i.current_source_location();
let ident = CustomIdent::from_ident(location, i.expect_ident()?, &[])?;
alternates.push(VariantAlternates::${to_camel_case(value)}(ident));
@ -1325,7 +1315,7 @@ ${helpers.single_keyword_system("font-kerning",
% endfor
% for value in "styleset character-variant".split():
"${value}" => {
check_if_parsed!(i, ParsingFlags:: ${to_rust_ident(value).upper()});
check_if_parsed!(i, ${to_rust_ident(value).upper()});
let idents = i.parse_comma_separated(|i| {
let location = i.current_source_location();
CustomIdent::from_ident(location, i.expect_ident()?, &[])
@ -1351,7 +1341,7 @@ ${helpers.single_keyword_system("font-kerning",
#[cfg(feature = "gecko")]
macro_rules! exclusive_value {
(($value:ident, $set:expr) => $ident:path) => {
(($value:ident, $set:expr) => $ident:ident) => {
if $value.intersects($set) {
return Err(())
} else {
@ -1361,8 +1351,7 @@ macro_rules! exclusive_value {
}
<%helpers:longhand name="font-variant-east-asian" products="gecko" animation_value_type="discrete"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -1371,17 +1360,17 @@ macro_rules! exclusive_value {
bitflags! {
#[derive(MallocSizeOf)]
pub struct VariantEastAsian: u16 {
const NORMAL = 0;
const JIS78 = 0x01;
const JIS83 = 0x02;
const JIS90 = 0x04;
const JIS04 = 0x08;
const SIMPLIFIED = 0x10;
const TRADITIONAL = 0x20;
const FULL_WIDTH = 0x40;
const PROPORTIONAL_WIDTH = 0x80;
const RUBY = 0x100;
pub flags VariantEastAsian: u16 {
const NORMAL = 0,
const JIS78 = 0x01,
const JIS83 = 0x02,
const JIS90 = 0x04,
const JIS04 = 0x08,
const SIMPLIFIED = 0x10,
const TRADITIONAL = 0x20,
const FULL_WIDTH = 0x40,
const PROPORTIONAL_WIDTH = 0x80,
const RUBY = 0x100,
}
}
@ -1395,15 +1384,15 @@ macro_rules! exclusive_value {
<%self:simple_system_boilerplate name="font_variant_east_asian"></%self:simple_system_boilerplate>
// servo_bit: gecko_bit
<% font_variant_east_asian_map = { "VariantEastAsian::JIS78": "JIS78",
"VariantEastAsian::JIS83": "JIS83",
"VariantEastAsian::JIS90": "JIS90",
"VariantEastAsian::JIS04": "JIS04",
"VariantEastAsian::SIMPLIFIED": "SIMPLIFIED",
"VariantEastAsian::TRADITIONAL": "TRADITIONAL",
"VariantEastAsian::FULL_WIDTH": "FULL_WIDTH",
"VariantEastAsian::PROPORTIONAL_WIDTH": "PROP_WIDTH",
"VariantEastAsian::RUBY": "RUBY" } %>
<% font_variant_east_asian_map = { "JIS78": "JIS78",
"JIS83": "JIS83",
"JIS90": "JIS90",
"JIS04": "JIS04",
"SIMPLIFIED": "SIMPLIFIED",
"TRADITIONAL": "TRADITIONAL",
"FULL_WIDTH": "FULL_WIDTH",
"PROPORTIONAL_WIDTH": "PROP_WIDTH",
"RUBY": "RUBY" } %>
${helpers.gecko_bitflags_conversion(font_variant_east_asian_map, 'NS_FONT_VARIANT_EAST_ASIAN_',
'VariantEastAsian', kw_type='u16')}
@ -1418,7 +1407,7 @@ macro_rules! exclusive_value {
let mut has_any = false;
macro_rules! write_value {
($ident:path => $str:expr) => {
($ident:ident => $str:expr) => {
if self.intersects($ident) {
if has_any {
dest.write_str(" ")?;
@ -1429,15 +1418,15 @@ macro_rules! exclusive_value {
}
}
write_value!(VariantEastAsian::JIS78 => "jis78");
write_value!(VariantEastAsian::JIS83 => "jis83");
write_value!(VariantEastAsian::JIS90 => "jis90");
write_value!(VariantEastAsian::JIS04 => "jis04");
write_value!(VariantEastAsian::SIMPLIFIED => "simplified");
write_value!(VariantEastAsian::TRADITIONAL => "traditional");
write_value!(VariantEastAsian::FULL_WIDTH => "full-width");
write_value!(VariantEastAsian::PROPORTIONAL_WIDTH => "proportional-width");
write_value!(VariantEastAsian::RUBY => "ruby");
write_value!(JIS78 => "jis78");
write_value!(JIS83 => "jis83");
write_value!(JIS90 => "jis90");
write_value!(JIS04 => "jis04");
write_value!(SIMPLIFIED => "simplified");
write_value!(TRADITIONAL => "traditional");
write_value!(FULL_WIDTH => "full-width");
write_value!(PROPORTIONAL_WIDTH => "proportional-width");
write_value!(RUBY => "ruby");
debug_assert!(has_any);
Ok(())
@ -1459,10 +1448,8 @@ macro_rules! exclusive_value {
/// normal | [ <east-asian-variant-values> || <east-asian-width-values> || ruby ]
/// <east-asian-variant-values> = [ jis78 | jis83 | jis90 | jis04 | simplified | traditional ]
/// <east-asian-width-values> = [ full-width | proportional-width ]
<% east_asian_variant_values = """VariantEastAsian::JIS78 | VariantEastAsian::JIS83 |
VariantEastAsian::JIS90 | VariantEastAsian::JIS04 |
VariantEastAsian::SIMPLIFIED | VariantEastAsian::TRADITIONAL""" %>
<% east_asian_width_values = "VariantEastAsian::FULL_WIDTH | VariantEastAsian::PROPORTIONAL_WIDTH" %>
<% east_asian_variant_values = "JIS78 | JIS83 | JIS90 | JIS04 | SIMPLIFIED | TRADITIONAL" %>
<% east_asian_width_values = "FULL_WIDTH | PROPORTIONAL_WIDTH" %>
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
let mut result = VariantEastAsian::empty();
@ -1474,23 +1461,23 @@ macro_rules! exclusive_value {
while let Ok(flag) = input.try(|input| {
Ok(match_ignore_ascii_case! { &input.expect_ident().map_err(|_| ())?,
"jis78" =>
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS78),
exclusive_value!((result, ${east_asian_variant_values}) => JIS78),
"jis83" =>
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS83),
exclusive_value!((result, ${east_asian_variant_values}) => JIS83),
"jis90" =>
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS90),
exclusive_value!((result, ${east_asian_variant_values}) => JIS90),
"jis04" =>
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::JIS04),
exclusive_value!((result, ${east_asian_variant_values}) => JIS04),
"simplified" =>
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::SIMPLIFIED),
exclusive_value!((result, ${east_asian_variant_values}) => SIMPLIFIED),
"traditional" =>
exclusive_value!((result, ${east_asian_variant_values}) => VariantEastAsian::TRADITIONAL),
exclusive_value!((result, ${east_asian_variant_values}) => TRADITIONAL),
"full-width" =>
exclusive_value!((result, ${east_asian_width_values}) => VariantEastAsian::FULL_WIDTH),
exclusive_value!((result, ${east_asian_width_values}) => FULL_WIDTH),
"proportional-width" =>
exclusive_value!((result, ${east_asian_width_values}) => VariantEastAsian::PROPORTIONAL_WIDTH),
exclusive_value!((result, ${east_asian_width_values}) => PROPORTIONAL_WIDTH),
"ruby" =>
exclusive_value!((result, VariantEastAsian::RUBY) => VariantEastAsian::RUBY),
exclusive_value!((result, RUBY) => RUBY),
_ => return Err(()),
})
}) {
@ -1509,8 +1496,7 @@ macro_rules! exclusive_value {
</%helpers:longhand>
<%helpers:longhand name="font-variant-ligatures" products="gecko" animation_value_type="discrete"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -1518,18 +1504,18 @@ macro_rules! exclusive_value {
bitflags! {
#[derive(MallocSizeOf)]
pub struct VariantLigatures: u16 {
const NORMAL = 0;
const NONE = 0x01;
const COMMON_LIGATURES = 0x02;
const NO_COMMON_LIGATURES = 0x04;
const DISCRETIONARY_LIGATURES = 0x08;
const NO_DISCRETIONARY_LIGATURES = 0x10;
const HISTORICAL_LIGATURES = 0x20;
const NO_HISTORICAL_LIGATURES = 0x40;
const CONTEXTUAL = 0x80;
const NO_CONTEXTUAL = 0x100;
#[derive(MallocSizeOf)]
pub flags VariantLigatures: u16 {
const NORMAL = 0,
const NONE = 0x01,
const COMMON_LIGATURES = 0x02,
const NO_COMMON_LIGATURES = 0x04,
const DISCRETIONARY_LIGATURES = 0x08,
const NO_DISCRETIONARY_LIGATURES = 0x10,
const HISTORICAL_LIGATURES = 0x20,
const NO_HISTORICAL_LIGATURES = 0x40,
const CONTEXTUAL = 0x80,
const NO_CONTEXTUAL = 0x100,
}
}
@ -1543,15 +1529,15 @@ macro_rules! exclusive_value {
<%self:simple_system_boilerplate name="font_variant_ligatures"></%self:simple_system_boilerplate>
// servo_bit: gecko_bit
<% font_variant_ligatures_map = { "VariantLigatures::NONE": "NONE",
"VariantLigatures::COMMON_LIGATURES": "COMMON",
"VariantLigatures::NO_COMMON_LIGATURES": "NO_COMMON",
"VariantLigatures::DISCRETIONARY_LIGATURES": "DISCRETIONARY",
"VariantLigatures::NO_DISCRETIONARY_LIGATURES": "NO_DISCRETIONARY",
"VariantLigatures::HISTORICAL_LIGATURES": "HISTORICAL",
"VariantLigatures::NO_HISTORICAL_LIGATURES": "NO_HISTORICAL",
"VariantLigatures::CONTEXTUAL": "CONTEXTUAL",
"VariantLigatures::NO_CONTEXTUAL": "NO_CONTEXTUAL" } %>
<% font_variant_ligatures_map = { "NONE": "NONE",
"COMMON_LIGATURES": "COMMON",
"NO_COMMON_LIGATURES": "NO_COMMON",
"DISCRETIONARY_LIGATURES": "DISCRETIONARY",
"NO_DISCRETIONARY_LIGATURES": "NO_DISCRETIONARY",
"HISTORICAL_LIGATURES": "HISTORICAL",
"NO_HISTORICAL_LIGATURES": "NO_HISTORICAL",
"CONTEXTUAL": "CONTEXTUAL",
"NO_CONTEXTUAL": "NO_CONTEXTUAL" } %>
${helpers.gecko_bitflags_conversion(font_variant_ligatures_map, 'NS_FONT_VARIANT_LIGATURES_',
'VariantLigatures', kw_type='u16')}
@ -1561,14 +1547,14 @@ macro_rules! exclusive_value {
if self.is_empty() {
return dest.write_str("normal")
}
if self.contains(VariantLigatures::NONE) {
if self.contains(NONE) {
return dest.write_str("none")
}
let mut has_any = false;
macro_rules! write_value {
($ident:path => $str:expr) => {
($ident:ident => $str:expr) => {
if self.intersects($ident) {
if has_any {
dest.write_str(" ")?;
@ -1579,14 +1565,14 @@ macro_rules! exclusive_value {
}
}
write_value!(VariantLigatures::COMMON_LIGATURES => "common-ligatures");
write_value!(VariantLigatures::NO_COMMON_LIGATURES => "no-common-ligatures");
write_value!(VariantLigatures::DISCRETIONARY_LIGATURES => "discretionary-ligatures");
write_value!(VariantLigatures::NO_DISCRETIONARY_LIGATURES => "no-discretionary-ligatures");
write_value!(VariantLigatures::HISTORICAL_LIGATURES => "historical-ligatures");
write_value!(VariantLigatures::NO_HISTORICAL_LIGATURES => "no-historical-ligatures");
write_value!(VariantLigatures::CONTEXTUAL => "contextual");
write_value!(VariantLigatures::NO_CONTEXTUAL => "no-contextual");
write_value!(COMMON_LIGATURES => "common-ligatures");
write_value!(NO_COMMON_LIGATURES => "no-common-ligatures");
write_value!(DISCRETIONARY_LIGATURES => "discretionary-ligatures");
write_value!(NO_DISCRETIONARY_LIGATURES => "no-discretionary-ligatures");
write_value!(HISTORICAL_LIGATURES => "historical-ligatures");
write_value!(NO_HISTORICAL_LIGATURES => "no-historical-ligatures");
write_value!(CONTEXTUAL => "contextual");
write_value!(NO_CONTEXTUAL => "no-contextual");
debug_assert!(has_any);
Ok(())
@ -1606,7 +1592,7 @@ macro_rules! exclusive_value {
}
#[inline]
pub fn get_none_specified_value() -> SpecifiedValue {
SpecifiedValue::Value(VariantLigatures::NONE)
SpecifiedValue::Value(NONE)
}
/// normal | none |
@ -1618,11 +1604,10 @@ macro_rules! exclusive_value {
/// <discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]
/// <historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]
/// <contextual-alt-values> = [ contextual | no-contextual ]
<% common_lig_values = "VariantLigatures::COMMON_LIGATURES | VariantLigatures::NO_COMMON_LIGATURES" %>
<% discretionary_lig_values = """VariantLigatures::DISCRETIONARY_LIGATURES |
VariantLigatures::NO_DISCRETIONARY_LIGATURES""" %>
<% historical_lig_values = "VariantLigatures::HISTORICAL_LIGATURES | VariantLigatures::NO_HISTORICAL_LIGATURES" %>
<% contextual_alt_values = "VariantLigatures::CONTEXTUAL | VariantLigatures::NO_CONTEXTUAL" %>
<% common_lig_values = "COMMON_LIGATURES | NO_COMMON_LIGATURES" %>
<% discretionary_lig_values = "DISCRETIONARY_LIGATURES | NO_DISCRETIONARY_LIGATURES" %>
<% historical_lig_values = "HISTORICAL_LIGATURES | NO_HISTORICAL_LIGATURES" %>
<% contextual_alt_values = "CONTEXTUAL | NO_CONTEXTUAL" %>
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
let mut result = VariantLigatures::empty();
@ -1631,29 +1616,27 @@ macro_rules! exclusive_value {
return Ok(SpecifiedValue::Value(result))
}
if input.try(|input| input.expect_ident_matching("none")).is_ok() {
return Ok(SpecifiedValue::Value(VariantLigatures::NONE))
return Ok(SpecifiedValue::Value(NONE))
}
while let Ok(flag) = input.try(|input| {
Ok(match_ignore_ascii_case! { &input.expect_ident().map_err(|_| ())?,
"common-ligatures" =>
exclusive_value!((result, ${common_lig_values}) => VariantLigatures::COMMON_LIGATURES),
exclusive_value!((result, ${common_lig_values}) => COMMON_LIGATURES),
"no-common-ligatures" =>
exclusive_value!((result, ${common_lig_values}) => VariantLigatures::NO_COMMON_LIGATURES),
exclusive_value!((result, ${common_lig_values}) => NO_COMMON_LIGATURES),
"discretionary-ligatures" =>
exclusive_value!((result, ${discretionary_lig_values}) =>
VariantLigatures::DISCRETIONARY_LIGATURES),
exclusive_value!((result, ${discretionary_lig_values}) => DISCRETIONARY_LIGATURES),
"no-discretionary-ligatures" =>
exclusive_value!((result, ${discretionary_lig_values}) =>
VariantLigatures::NO_DISCRETIONARY_LIGATURES),
exclusive_value!((result, ${discretionary_lig_values}) => NO_DISCRETIONARY_LIGATURES),
"historical-ligatures" =>
exclusive_value!((result, ${historical_lig_values}) => VariantLigatures::HISTORICAL_LIGATURES),
exclusive_value!((result, ${historical_lig_values}) => HISTORICAL_LIGATURES),
"no-historical-ligatures" =>
exclusive_value!((result, ${historical_lig_values}) => VariantLigatures::NO_HISTORICAL_LIGATURES),
exclusive_value!((result, ${historical_lig_values}) => NO_HISTORICAL_LIGATURES),
"contextual" =>
exclusive_value!((result, ${contextual_alt_values}) => VariantLigatures::CONTEXTUAL),
exclusive_value!((result, ${contextual_alt_values}) => CONTEXTUAL),
"no-contextual" =>
exclusive_value!((result, ${contextual_alt_values}) => VariantLigatures::NO_CONTEXTUAL),
exclusive_value!((result, ${contextual_alt_values}) => NO_CONTEXTUAL),
_ => return Err(()),
})
}) {
@ -1672,8 +1655,7 @@ macro_rules! exclusive_value {
</%helpers:longhand>
<%helpers:longhand name="font-variant-numeric" products="gecko" animation_value_type="discrete"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -1682,16 +1664,16 @@ macro_rules! exclusive_value {
bitflags! {
#[derive(MallocSizeOf)]
pub struct VariantNumeric: u8 {
const NORMAL = 0;
const LINING_NUMS = 0x01;
const OLDSTYLE_NUMS = 0x02;
const PROPORTIONAL_NUMS = 0x04;
const TABULAR_NUMS = 0x08;
const DIAGONAL_FRACTIONS = 0x10;
const STACKED_FRACTIONS = 0x20;
const SLASHED_ZERO = 0x40;
const ORDINAL = 0x80;
pub flags VariantNumeric: u8 {
const NORMAL = 0,
const LINING_NUMS = 0x01,
const OLDSTYLE_NUMS = 0x02,
const PROPORTIONAL_NUMS = 0x04,
const TABULAR_NUMS = 0x08,
const DIAGONAL_FRACTIONS = 0x10,
const STACKED_FRACTIONS = 0x20,
const SLASHED_ZERO = 0x40,
const ORDINAL = 0x80,
}
}
@ -1706,14 +1688,14 @@ macro_rules! exclusive_value {
// servo_bit: gecko_bit
<% font_variant_numeric_map = { "VariantNumeric::LINING_NUMS": "LINING",
"VariantNumeric::OLDSTYLE_NUMS": "OLDSTYLE",
"VariantNumeric::PROPORTIONAL_NUMS": "PROPORTIONAL",
"VariantNumeric::TABULAR_NUMS": "TABULAR",
"VariantNumeric::DIAGONAL_FRACTIONS": "DIAGONAL_FRACTIONS",
"VariantNumeric::STACKED_FRACTIONS": "STACKED_FRACTIONS",
"VariantNumeric::SLASHED_ZERO": "SLASHZERO",
"VariantNumeric::ORDINAL": "ORDINAL" } %>
<% font_variant_numeric_map = { "LINING_NUMS": "LINING",
"OLDSTYLE_NUMS": "OLDSTYLE",
"PROPORTIONAL_NUMS": "PROPORTIONAL",
"TABULAR_NUMS": "TABULAR",
"DIAGONAL_FRACTIONS": "DIAGONAL_FRACTIONS",
"STACKED_FRACTIONS": "STACKED_FRACTIONS",
"SLASHED_ZERO": "SLASHZERO",
"ORDINAL": "ORDINAL" } %>
${helpers.gecko_bitflags_conversion(font_variant_numeric_map, 'NS_FONT_VARIANT_NUMERIC_',
'VariantNumeric')}
@ -1727,7 +1709,7 @@ macro_rules! exclusive_value {
let mut has_any = false;
macro_rules! write_value {
($ident:path => $str:expr) => {
($ident:ident => $str:expr) => {
if self.intersects($ident) {
if has_any {
dest.write_str(" ")?;
@ -1738,14 +1720,14 @@ macro_rules! exclusive_value {
}
}
write_value!(VariantNumeric::LINING_NUMS => "lining-nums");
write_value!(VariantNumeric::OLDSTYLE_NUMS => "oldstyle-nums");
write_value!(VariantNumeric::PROPORTIONAL_NUMS => "proportional-nums");
write_value!(VariantNumeric::TABULAR_NUMS => "tabular-nums");
write_value!(VariantNumeric::DIAGONAL_FRACTIONS => "diagonal-fractions");
write_value!(VariantNumeric::STACKED_FRACTIONS => "stacked-fractions");
write_value!(VariantNumeric::SLASHED_ZERO => "slashed-zero");
write_value!(VariantNumeric::ORDINAL => "ordinal");
write_value!(LINING_NUMS => "lining-nums");
write_value!(OLDSTYLE_NUMS => "oldstyle-nums");
write_value!(PROPORTIONAL_NUMS => "proportional-nums");
write_value!(TABULAR_NUMS => "tabular-nums");
write_value!(DIAGONAL_FRACTIONS => "diagonal-fractions");
write_value!(STACKED_FRACTIONS => "stacked-fractions");
write_value!(SLASHED_ZERO => "slashed-zero");
write_value!(ORDINAL => "ordinal");
debug_assert!(has_any);
Ok(())
@ -1773,9 +1755,9 @@ macro_rules! exclusive_value {
/// <numeric-figure-values> = [ lining-nums | oldstyle-nums ]
/// <numeric-spacing-values> = [ proportional-nums | tabular-nums ]
/// <numeric-fraction-values> = [ diagonal-fractions | stacked-fractions ]
<% numeric_figure_values = "VariantNumeric::LINING_NUMS | VariantNumeric::OLDSTYLE_NUMS" %>
<% numeric_spacing_values = "VariantNumeric::PROPORTIONAL_NUMS | VariantNumeric::TABULAR_NUMS" %>
<% numeric_fraction_values = "VariantNumeric::DIAGONAL_FRACTIONS | VariantNumeric::STACKED_FRACTIONS" %>
<% numeric_figure_values = "LINING_NUMS | OLDSTYLE_NUMS" %>
<% numeric_spacing_values = "PROPORTIONAL_NUMS | TABULAR_NUMS" %>
<% numeric_fraction_values = "DIAGONAL_FRACTIONS | STACKED_FRACTIONS" %>
pub fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
let mut result = VariantNumeric::empty();
@ -1787,21 +1769,21 @@ macro_rules! exclusive_value {
while let Ok(flag) = input.try(|input| {
Ok(match_ignore_ascii_case! { &input.expect_ident().map_err(|_| ())?,
"ordinal" =>
exclusive_value!((result, VariantNumeric::ORDINAL) => VariantNumeric::ORDINAL),
exclusive_value!((result, ORDINAL) => ORDINAL),
"slashed-zero" =>
exclusive_value!((result, VariantNumeric::SLASHED_ZERO) => VariantNumeric::SLASHED_ZERO),
exclusive_value!((result, SLASHED_ZERO) => SLASHED_ZERO),
"lining-nums" =>
exclusive_value!((result, ${numeric_figure_values}) => VariantNumeric::LINING_NUMS),
exclusive_value!((result, ${numeric_figure_values}) => LINING_NUMS),
"oldstyle-nums" =>
exclusive_value!((result, ${numeric_figure_values}) => VariantNumeric::OLDSTYLE_NUMS),
exclusive_value!((result, ${numeric_figure_values}) => OLDSTYLE_NUMS),
"proportional-nums" =>
exclusive_value!((result, ${numeric_spacing_values}) => VariantNumeric::PROPORTIONAL_NUMS),
exclusive_value!((result, ${numeric_spacing_values}) => PROPORTIONAL_NUMS),
"tabular-nums" =>
exclusive_value!((result, ${numeric_spacing_values}) => VariantNumeric::TABULAR_NUMS),
exclusive_value!((result, ${numeric_spacing_values}) => TABULAR_NUMS),
"diagonal-fractions" =>
exclusive_value!((result, ${numeric_fraction_values}) => VariantNumeric::DIAGONAL_FRACTIONS),
exclusive_value!((result, ${numeric_fraction_values}) => DIAGONAL_FRACTIONS),
"stacked-fractions" =>
exclusive_value!((result, ${numeric_fraction_values}) => VariantNumeric::STACKED_FRACTIONS),
exclusive_value!((result, ${numeric_fraction_values}) => STACKED_FRACTIONS),
_ => return Err(()),
})
}) {
@ -1825,14 +1807,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -1876,8 +1856,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="ComputedValue"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER"
spec="${variation_spec}">
use values::generics::FontSettings;
@ -1902,8 +1881,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER"""
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;
@ -2485,8 +2463,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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
animation_value_type="discrete")}
${helpers.predefined_type("-moz-min-font-size-ratio",

View file

@ -10,8 +10,7 @@ ${helpers.predefined_type("line-height",
"LineHeight",
"computed::LineHeight::normal()",
animation_value_type="LineHeight",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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
@ -21,8 +20,7 @@ ${helpers.single_keyword("text-transform",
"none capitalize uppercase lowercase",
extra_gecko_values="full-width",
animation_value_type="discrete",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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",
@ -68,7 +66,7 @@ ${helpers.single_keyword("word-break",
extra_specified="${'distribute' if product == 'gecko' else ''}"
gecko_enum_prefix="StyleTextJustify"
animation_value_type="discrete"
flags="PropertyFlags::APPLIES_TO_PLACEHOLDER",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
impl ToComputedValue for SpecifiedValue {
@ -111,7 +109,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="PropertyFlags::APPLIES_TO_PLACEHOLDER"
flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-text/#propdef-text-align">
pub mod computed_value {
use style_traits::ToCss;
@ -269,16 +267,14 @@ ${helpers.predefined_type("letter-spacing",
"LetterSpacing",
"computed::LetterSpacing::normal()",
animation_value_type="ComputedValue",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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"
@ -351,7 +347,7 @@ ${helpers.predefined_type("word-spacing",
animation_value_type="discrete"
// Only allowed for UA sheets, which set it
// !important.
flags="PropertyFlags::APPLIES_TO_PLACEHOLDER"
flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-text/#propdef-white-space">
trivial_to_computed_value!(SpecifiedValue);
% if product != "gecko":
@ -396,8 +392,7 @@ ${helpers.predefined_type(
vector=True,
animation_value_type="AnimatedTextShadowList",
ignored_when_colors_disabled=True,
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text-decor-3/#text-shadow-property",
)}
@ -699,8 +694,7 @@ ${helpers.predefined_type(
products="gecko",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://compat.spec.whatwg.org/#the-webkit-text-fill-color",
)}
@ -712,8 +706,7 @@ ${helpers.predefined_type(
products="gecko",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color",
)}
@ -723,8 +716,7 @@ ${helpers.predefined_type("-webkit-text-stroke-width",
initial_specified_value="specified::BorderSideWidth::Length(specified::Length::zero())",
computed_type="::values::computed::NonNegativeLength",
products="gecko",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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="discrete")}

View file

@ -17,6 +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="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
allowed_in_page_rule=True)}
% endfor

View file

@ -20,6 +20,6 @@
animation_value_type="NonNegativeLengthOrPercentage",
logical = side[1],
spec = spec,
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_PLACEHOLDER",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_PLACEHOLDER",
allow_quirks=not side[1])}
% endfor

View file

@ -148,7 +148,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="PropertyFlags::APPLIES_TO_PLACEHOLDER",
flags="APPLIES_TO_PLACEHOLDER",
spec="https://www.w3.org/TR/SVG11/interact.html#PointerEventsProperty")}
${helpers.single_keyword("-moz-user-input", "auto none enabled disabled",

View file

@ -45,7 +45,7 @@ macro_rules! impl_align_conversions {
${helpers.predefined_type("z-index", "IntegerOrAuto",
"Either::Second(Auto)",
spec="https://www.w3.org/TR/CSS2/visuren.html#z-index",
flags="PropertyFlags::CREATES_STACKING_CONTEXT",
flags="CREATES_STACKING_CONTEXT",
animation_value_type="ComputedValue")}

View file

@ -70,7 +70,7 @@ ${helpers.predefined_type(
products="gecko",
boxed=True,
animation_value_type="ComputedValue",
flags="PropertyFlags::CREATES_STACKING_CONTEXT",
flags="CREATES_STACKING_CONTEXT",
spec="https://drafts.fxtf.org/css-masking/#propdef-clip-path",
)}
@ -167,4 +167,4 @@ ${helpers.predefined_type("mask-image", "ImageLayer",
products="gecko",
extra_prefixes="webkit",
animation_value_type="discrete",
flags="PropertyFlags::CREATES_STACKING_CONTEXT")}
flags="CREATES_STACKING_CONTEXT")}

View file

@ -13,7 +13,7 @@
Method("has_line_through", "bool")]) %>
<%helpers:longhand name="text-overflow" animation_value_type="discrete" boxed="True"
flags="PropertyFlags::APPLIES_TO_PLACEHOLDER"
flags="APPLIES_TO_PLACEHOLDER"
spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow">
use std::fmt;
use style_traits::ToCss;
@ -141,20 +141,19 @@ ${helpers.single_keyword("unicode-bidi",
<%helpers:longhand name="text-decoration-line"
custom_cascade="${product == 'servo'}"
animation_value_type="discrete"
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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;
bitflags! {
#[derive(MallocSizeOf, ToComputedValue)]
pub struct SpecifiedValue: u8 {
const NONE = 0;
const UNDERLINE = 0x01;
const OVERLINE = 0x02;
const LINE_THROUGH = 0x04;
const BLINK = 0x08;
pub flags SpecifiedValue: u8 {
const NONE = 0,
const UNDERLINE = 0x01,
const OVERLINE = 0x02,
const LINE_THROUGH = 0x04,
const BLINK = 0x08,
% if product == "gecko":
/// Only set by presentation attributes
///
@ -163,7 +162,7 @@ ${helpers.single_keyword("unicode-bidi",
///
/// For example, this gives <a href=foo><font color="red">text</font></a>
/// a red text decoration
const COLOR_OVERRIDE = 0x10;
const COLOR_OVERRIDE = 0x10,
% endif
}
}
@ -173,7 +172,7 @@ ${helpers.single_keyword("unicode-bidi",
let mut has_any = false;
macro_rules! write_value {
($line:path => $css:expr) => {
($line:ident => $css:expr) => {
if self.contains($line) {
if has_any {
dest.write_str(" ")?;
@ -183,10 +182,10 @@ ${helpers.single_keyword("unicode-bidi",
}
}
}
write_value!(SpecifiedValue::UNDERLINE => "underline");
write_value!(SpecifiedValue::OVERLINE => "overline");
write_value!(SpecifiedValue::LINE_THROUGH => "line-through");
write_value!(SpecifiedValue::BLINK => "blink");
write_value!(UNDERLINE => "underline");
write_value!(OVERLINE => "overline");
write_value!(LINE_THROUGH => "line-through");
write_value!(BLINK => "blink");
if !has_any {
dest.write_str("none")?;
}
@ -223,17 +222,14 @@ ${helpers.single_keyword("unicode-bidi",
match input.expect_ident() {
Ok(ident) => {
(match_ignore_ascii_case! { &ident,
"underline" => if result.contains(SpecifiedValue::UNDERLINE) { Err(()) }
else { empty = false; result.insert(SpecifiedValue::UNDERLINE); Ok(()) },
"overline" => if result.contains(SpecifiedValue::OVERLINE) { Err(()) }
else { empty = false; result.insert(SpecifiedValue::OVERLINE); Ok(()) },
"line-through" => if result.contains(SpecifiedValue::LINE_THROUGH) { Err(()) }
else {
empty = false;
result.insert(SpecifiedValue::LINE_THROUGH); Ok(())
},
"blink" => if result.contains(SpecifiedValue::BLINK) { Err(()) }
else { empty = false; result.insert(SpecifiedValue::BLINK); Ok(()) },
"underline" => if result.contains(UNDERLINE) { Err(()) }
else { empty = false; result.insert(UNDERLINE); Ok(()) },
"overline" => if result.contains(OVERLINE) { Err(()) }
else { empty = false; result.insert(OVERLINE); Ok(()) },
"line-through" => if result.contains(LINE_THROUGH) { Err(()) }
else { empty = false; result.insert(LINE_THROUGH); Ok(()) },
"blink" => if result.contains(BLINK) { Err(()) }
else { empty = false; result.insert(BLINK); Ok(()) },
_ => Err(())
}).map_err(|()| {
location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))
@ -265,8 +261,7 @@ ${helpers.single_keyword("text-decoration-style",
"solid double dotted dashed wavy -moz-none",
products="gecko",
animation_value_type="discrete",
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
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(
@ -277,8 +272,7 @@ ${helpers.predefined_type(
products="gecko",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
flags="""PropertyFlags::APPLIES_TO_FIRST_LETTER PropertyFlags::APPLIES_TO_FIRST_LINE
PropertyFlags::APPLIES_TO_PLACEHOLDER""",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-color",
)}
@ -289,5 +283,5 @@ ${helpers.predefined_type(
initial_specified_value="specified::InitialLetter::normal()",
animation_value_type="discrete",
products="gecko",
flags="PropertyFlags::APPLIES_TO_FIRST_LETTER",
flags="APPLIES_TO_FIRST_LETTER",
spec="https://drafts.csswg.org/css-inline/#sizing-drop-initials")}

View file

@ -38,7 +38,7 @@ use selector_parser::PseudoElement;
use selectors::parser::SelectorParseErrorKind;
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
use shared_lock::StylesheetGuards;
use style_traits::{ParsingMode, ToCss, ParseError, StyleParseErrorKind};
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError, StyleParseErrorKind};
use stylesheets::{CssRuleType, Origin, UrlExtraData};
#[cfg(feature = "servo")] use values::Either;
use values::generics::text::LineHeight;
@ -440,23 +440,23 @@ impl CSSWideKeyword {
bitflags! {
/// A set of flags for properties.
pub struct PropertyFlags: u8 {
pub flags PropertyFlags: u8 {
/// This property requires a stacking context.
const CREATES_STACKING_CONTEXT = 1 << 0;
const CREATES_STACKING_CONTEXT = 1 << 0,
/// This property has values that can establish a containing block for
/// fixed positioned and absolutely positioned elements.
const FIXPOS_CB = 1 << 1;
const FIXPOS_CB = 1 << 1,
/// This property has values that can establish a containing block for
/// absolutely positioned elements.
const ABSPOS_CB = 1 << 2;
const ABSPOS_CB = 1 << 2,
/// This shorthand property is an alias of another property.
const SHORTHAND_ALIAS_PROPERTY = 1 << 3;
const SHORTHAND_ALIAS_PROPERTY = 1 << 3,
/// This longhand property applies to ::first-letter.
const APPLIES_TO_FIRST_LETTER = 1 << 4;
const APPLIES_TO_FIRST_LETTER = 1 << 4,
/// This longhand property applies to ::first-line.
const APPLIES_TO_FIRST_LINE = 1 << 5;
const APPLIES_TO_FIRST_LINE = 1 << 5,
/// This longhand property applies to ::placeholder.
const APPLIES_TO_PLACEHOLDER = 1 << 6;
const APPLIES_TO_PLACEHOLDER = 1 << 6,
}
}
@ -948,7 +948,7 @@ impl UnparsedValue {
Origin::Author,
&self.url_data,
None,
ParsingMode::DEFAULT,
PARSING_MODE_DEFAULT,
quirks_mode,
);
let mut input = ParserInput::new(&css);
@ -1428,7 +1428,7 @@ impl ToCss for PropertyDeclaration {
// Normally, we shouldn't be printing variables here if they came from
// shorthands. But we should allow properties that came from shorthand
// aliases. That also matches with the Gecko behavior.
Some(shorthand) if shorthand.flags().contains(PropertyFlags::SHORTHAND_ALIAS_PROPERTY) =>
Some(shorthand) if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) =>
dest.write_str(&*with_variables.css)?,
None => dest.write_str(&*with_variables.css)?,
_ => {},
@ -1487,7 +1487,7 @@ impl PropertyDeclaration {
// should return None here. But we return Some to longhands if they
// came from a shorthand alias. Because for example, we should be able to
// get -moz-transform's value from transform.
if shorthand.flags().contains(PropertyFlags::SHORTHAND_ALIAS_PROPERTY) {
if shorthand.flags().contains(SHORTHAND_ALIAS_PROPERTY) {
return Some(&*with_variables.css);
}
None
@ -1940,19 +1940,19 @@ pub mod style_structs {
/// Whether the text decoration has an underline.
#[inline]
pub fn has_underline(&self) -> bool {
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::UNDERLINE)
self.text_decoration_line.contains(longhands::text_decoration_line::UNDERLINE)
}
/// Whether the text decoration has an overline.
#[inline]
pub fn has_overline(&self) -> bool {
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::OVERLINE)
self.text_decoration_line.contains(longhands::text_decoration_line::OVERLINE)
}
/// Whether the text decoration has a line through.
#[inline]
pub fn has_line_through(&self) -> bool {
self.text_decoration_line.contains(longhands::text_decoration_line::SpecifiedValue::LINE_THROUGH)
self.text_decoration_line.contains(longhands::text_decoration_line::LINE_THROUGH)
}
% elif style_struct.name == "Box":
/// Sets the display property, but without touching
@ -2089,7 +2089,7 @@ pub struct ComputedValues {
impl ComputedValues {
/// Whether we're a visited style.
pub fn is_style_if_visited(&self) -> bool {
self.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED)
self.flags.contains(IS_STYLE_IF_VISITED)
}
/// Gets a reference to the rule node. Panic if no rule node exists.
@ -2109,9 +2109,9 @@ impl ComputedValues {
/// Returns whether we're in a display: none subtree.
pub fn is_in_display_none_subtree(&self) -> bool {
use properties::computed_value_flags::ComputedValueFlags;
use properties::computed_value_flags::IS_IN_DISPLAY_NONE_SUBTREE;
self.flags.contains(ComputedValueFlags::IS_IN_DISPLAY_NONE_SUBTREE)
self.flags.contains(IS_IN_DISPLAY_NONE_SUBTREE)
}
/// Gets a reference to the custom properties map (if one exists).
@ -2443,28 +2443,28 @@ pub fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> Wri
match inheritedbox_style.clone_direction() {
computed_values::direction::T::ltr => {},
computed_values::direction::T::rtl => {
flags.insert(logical_geometry::WritingMode::RTL);
flags.insert(logical_geometry::FLAG_RTL);
},
}
match inheritedbox_style.clone_writing_mode() {
computed_values::writing_mode::T::horizontal_tb => {},
computed_values::writing_mode::T::vertical_rl => {
flags.insert(logical_geometry::WritingMode::VERTICAL);
flags.insert(logical_geometry::FLAG_VERTICAL);
},
computed_values::writing_mode::T::vertical_lr => {
flags.insert(logical_geometry::WritingMode::VERTICAL);
flags.insert(logical_geometry::WritingMode::VERTICAL_LR);
flags.insert(logical_geometry::FLAG_VERTICAL);
flags.insert(logical_geometry::FLAG_VERTICAL_LR);
},
% if product == "gecko":
computed_values::writing_mode::T::sideways_rl => {
flags.insert(logical_geometry::WritingMode::VERTICAL);
flags.insert(logical_geometry::WritingMode::SIDEWAYS);
flags.insert(logical_geometry::FLAG_VERTICAL);
flags.insert(logical_geometry::FLAG_SIDEWAYS);
},
computed_values::writing_mode::T::sideways_lr => {
flags.insert(logical_geometry::WritingMode::VERTICAL);
flags.insert(logical_geometry::WritingMode::VERTICAL_LR);
flags.insert(logical_geometry::WritingMode::LINE_INVERTED);
flags.insert(logical_geometry::WritingMode::SIDEWAYS);
flags.insert(logical_geometry::FLAG_VERTICAL);
flags.insert(logical_geometry::FLAG_VERTICAL_LR);
flags.insert(logical_geometry::FLAG_LINE_INVERTED);
flags.insert(logical_geometry::FLAG_SIDEWAYS);
},
% endif
}
@ -2472,14 +2472,14 @@ pub fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> Wri
// If FLAG_SIDEWAYS is already set, this means writing-mode is either
// sideways-rl or sideways-lr, and for both of these values,
// text-orientation has no effect.
if !flags.intersects(logical_geometry::WritingMode::SIDEWAYS) {
if !flags.intersects(logical_geometry::FLAG_SIDEWAYS) {
match inheritedbox_style.clone_text_orientation() {
computed_values::text_orientation::T::mixed => {},
computed_values::text_orientation::T::upright => {
flags.insert(logical_geometry::WritingMode::UPRIGHT);
flags.insert(logical_geometry::FLAG_UPRIGHT);
},
computed_values::text_orientation::T::sideways => {
flags.insert(logical_geometry::WritingMode::SIDEWAYS);
flags.insert(logical_geometry::FLAG_SIDEWAYS);
},
}
}
@ -2668,14 +2668,14 @@ impl<'a> StyleBuilder<'a> {
// 99% sure it should give incorrect behavior for table anonymous box
// backgrounds, for example. This code doesn't attempt to make it play
// nice with inherited_style_ignoring_first_line.
let reset_style = if cascade_flags.contains(CascadeFlags::INHERIT_ALL) {
let reset_style = if cascade_flags.contains(INHERIT_ALL) {
inherited_style
} else {
reset_style
};
if cascade_flags.contains(CascadeFlags::VISITED_DEPENDENT_ONLY) {
flags.insert(ComputedValueFlags::IS_STYLE_IF_VISITED);
if cascade_flags.contains(VISITED_DEPENDENT_ONLY) {
flags.insert(IS_STYLE_IF_VISITED);
}
StyleBuilder {
@ -2703,7 +2703,7 @@ impl<'a> StyleBuilder<'a> {
/// Whether we're a visited style.
pub fn is_style_if_visited(&self) -> bool {
self.flags.contains(ComputedValueFlags::IS_STYLE_IF_VISITED)
self.flags.contains(IS_STYLE_IF_VISITED)
}
/// Creates a StyleBuilder holding only references to the structs of `s`, in
@ -2765,16 +2765,16 @@ impl<'a> StyleBuilder<'a> {
% endif
% if not property.style_struct.inherited:
self.flags.insert(::properties::computed_value_flags::ComputedValueFlags::INHERITS_RESET_STYLE);
self.flags.insert(::properties::computed_value_flags::INHERITS_RESET_STYLE);
self.modified_reset = true;
% endif
% if property.ident == "content":
self.flags.insert(::properties::computed_value_flags::ComputedValueFlags::INHERITS_CONTENT);
self.flags.insert(::properties::computed_value_flags::INHERITS_CONTENT);
% endif
% if property.ident == "display":
self.flags.insert(::properties::computed_value_flags::ComputedValueFlags::INHERITS_DISPLAY);
self.flags.insert(::properties::computed_value_flags::INHERITS_DISPLAY);
% endif
self.${property.style_struct.ident}.mutate()
@ -3070,17 +3070,17 @@ static CASCADE_PROPERTY: [CascadePropertyFn; ${len(data.longhands)}] = [
bitflags! {
/// A set of flags to tweak the behavior of the `cascade` function.
pub struct CascadeFlags: u8 {
pub flags CascadeFlags: u8 {
/// Whether to inherit all styles from the parent. If this flag is not
/// present, non-inherited styles are reset to their initial values.
const INHERIT_ALL = 1;
const INHERIT_ALL = 1,
/// Whether to skip any display style fixup for root element, flex/grid
/// item, and ruby descendants.
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 1 << 1;
const SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP = 1 << 1,
/// Whether to only cascade properties that are visited dependent.
const VISITED_DEPENDENT_ONLY = 1 << 2;
const VISITED_DEPENDENT_ONLY = 1 << 2,
/// Whether the given element we're styling is the document element,
/// that is, matches :root.
@ -3090,23 +3090,23 @@ bitflags! {
///
/// This affects some style adjustments, like blockification, and means
/// that it may affect global state, like the Device's root font-size.
const IS_ROOT_ELEMENT = 1 << 3;
const IS_ROOT_ELEMENT = 1 << 3,
/// Whether to convert display:contents into display:inline. This
/// is used by Gecko to prevent display:contents on generated
/// content.
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4;
const PROHIBIT_DISPLAY_CONTENTS = 1 << 4,
/// Whether we're styling the ::-moz-fieldset-content anonymous box.
const IS_FIELDSET_CONTENT = 1 << 5;
const IS_FIELDSET_CONTENT = 1 << 5,
/// Whether we're computing the style of a link, either visited or
/// unvisited.
const IS_LINK = 1 << 6;
const IS_LINK = 1 << 6,
/// Whether we're computing the style of a link element that happens to
/// be visited.
const IS_VISITED_LINK = 1 << 7;
const IS_VISITED_LINK = 1 << 7,
}
}
@ -3251,7 +3251,7 @@ where
};
let mut context = computed::Context {
is_root_element: flags.contains(CascadeFlags::IS_ROOT_ELEMENT),
is_root_element: flags.contains(IS_ROOT_ELEMENT),
// We'd really like to own the rules here to avoid refcount traffic, but
// animation's usage of `apply_declarations` make this tricky. See bug
// 1375525.
@ -3328,7 +3328,7 @@ where
// Only a few properties are allowed to depend on the visited state
// of links. When cascading visited styles, we can save time by
// only processing these properties.
if flags.contains(CascadeFlags::VISITED_DEPENDENT_ONLY) &&
if flags.contains(VISITED_DEPENDENT_ONLY) &&
!longhand_id.is_visited_dependent() {
continue
}

View file

@ -360,7 +360,7 @@ macro_rules! try_parse_one {
<%helpers:shorthand name="-moz-transform" products="gecko"
sub_properties="transform"
flags="PropertyFlags::SHORTHAND_ALIAS_PROPERTY"
flags="SHORTHAND_ALIAS_PROPERTY"
derive_serialize="True"
spec="Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/transform">
use properties::longhands::transform;