summaryrefslogtreecommitdiffstats
path: root/servo/components/style/properties
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /servo/components/style/properties
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/properties')
-rw-r--r--servo/components/style/properties/build.py72
-rw-r--r--servo/components/style/properties/cascade.rs22
-rw-r--r--servo/components/style/properties/data.py108
-rw-r--r--servo/components/style/properties/declaration_block.rs4
-rw-r--r--servo/components/style/properties/helpers.mako.rs6
-rw-r--r--servo/components/style/properties/helpers/animated_properties.mako.rs14
-rw-r--r--servo/components/style/properties/longhands/background.mako.rs20
-rw-r--r--servo/components/style/properties/longhands/border.mako.rs25
-rw-r--r--servo/components/style/properties/longhands/box.mako.rs53
-rw-r--r--servo/components/style/properties/longhands/column.mako.rs15
-rw-r--r--servo/components/style/properties/longhands/counters.mako.rs10
-rw-r--r--servo/components/style/properties/longhands/effects.mako.rs15
-rw-r--r--servo/components/style/properties/longhands/font.mako.rs18
-rw-r--r--servo/components/style/properties/longhands/inherited_box.mako.rs15
-rw-r--r--servo/components/style/properties/longhands/inherited_svg.mako.rs4
-rw-r--r--servo/components/style/properties/longhands/inherited_table.mako.rs14
-rw-r--r--servo/components/style/properties/longhands/inherited_text.mako.rs34
-rw-r--r--servo/components/style/properties/longhands/inherited_ui.mako.rs6
-rw-r--r--servo/components/style/properties/longhands/list.mako.rs19
-rw-r--r--servo/components/style/properties/longhands/margin.mako.rs3
-rw-r--r--servo/components/style/properties/longhands/outline.mako.rs16
-rw-r--r--servo/components/style/properties/longhands/padding.mako.rs3
-rw-r--r--servo/components/style/properties/longhands/page.mako.rs2
-rw-r--r--servo/components/style/properties/longhands/position.mako.rs68
-rw-r--r--servo/components/style/properties/longhands/svg.mako.rs2
-rw-r--r--servo/components/style/properties/longhands/table.mako.rs5
-rw-r--r--servo/components/style/properties/longhands/text.mako.rs15
-rw-r--r--servo/components/style/properties/longhands/ui.mako.rs36
-rw-r--r--servo/components/style/properties/longhands/xul.mako.rs4
-rw-r--r--servo/components/style/properties/mod.rs8
-rw-r--r--servo/components/style/properties/properties.mako.rs30
-rw-r--r--servo/components/style/properties/shorthands/background.mako.rs4
-rw-r--r--servo/components/style/properties/shorthands/border.mako.rs19
-rw-r--r--servo/components/style/properties/shorthands/box.mako.rs37
-rw-r--r--servo/components/style/properties/shorthands/column.mako.rs4
-rw-r--r--servo/components/style/properties/shorthands/counters.mako.rs3
-rw-r--r--servo/components/style/properties/shorthands/effects.mako.rs3
-rw-r--r--servo/components/style/properties/shorthands/font.mako.rs5
-rw-r--r--servo/components/style/properties/shorthands/inherited_box.mako.rs3
-rw-r--r--servo/components/style/properties/shorthands/inherited_table.mako.rs3
-rw-r--r--servo/components/style/properties/shorthands/inherited_ui.mako.rs3
-rw-r--r--servo/components/style/properties/shorthands/list.mako.rs21
-rw-r--r--servo/components/style/properties/shorthands/margin.mako.rs6
-rw-r--r--servo/components/style/properties/shorthands/outline.mako.rs2
-rw-r--r--servo/components/style/properties/shorthands/padding.mako.rs6
-rw-r--r--servo/components/style/properties/shorthands/page.mako.rs3
-rw-r--r--servo/components/style/properties/shorthands/position.mako.rs14
-rw-r--r--servo/components/style/properties/shorthands/table.mako.rs3
-rw-r--r--servo/components/style/properties/shorthands/text.mako.rs2
-rw-r--r--servo/components/style/properties/shorthands/ui.mako.rs104
-rw-r--r--servo/components/style/properties/shorthands/xul.mako.rs3
51 files changed, 460 insertions, 454 deletions
diff --git a/servo/components/style/properties/build.py b/servo/components/style/properties/build.py
index 42121a4eae..d1f76d4a25 100644
--- a/servo/components/style/properties/build.py
+++ b/servo/components/style/properties/build.py
@@ -20,36 +20,10 @@ RE_PYTHON_ADDR = re.compile(r"<.+? object at 0x[0-9a-fA-F]+>")
OUT_DIR = os.environ.get("OUT_DIR", "")
-STYLE_STRUCT_LIST = [
- "background",
- "border",
- "box",
- "column",
- "counters",
- "effects",
- "font",
- "inherited_box",
- "inherited_svg",
- "inherited_table",
- "inherited_text",
- "inherited_ui",
- "list",
- "margin",
- "outline",
- "page",
- "padding",
- "position",
- "svg",
- "table",
- "text",
- "ui",
- "xul",
-]
-
def main():
usage = (
- "Usage: %s [ servo-2013 | servo-2020 | gecko ] [ style-crate | geckolib <template> | html ]"
+ "Usage: %s [ servo | gecko ] [ style-crate | geckolib <template> ]"
% sys.argv[0]
)
if len(sys.argv) < 3:
@@ -57,29 +31,15 @@ def main():
engine = sys.argv[1]
output = sys.argv[2]
- if engine not in ["servo-2013", "servo-2020", "gecko"] or output not in [
+ if engine not in ["servo", "gecko"] or output not in [
"style-crate",
"geckolib",
- "html",
]:
abort(usage)
properties = data.PropertiesData(engine=engine)
- files = {}
- for kind in ["longhands", "shorthands"]:
- files[kind] = {}
- for struct in STYLE_STRUCT_LIST:
- file_name = os.path.join(BASE, kind, "{}.mako.rs".format(struct))
- if kind == "shorthands" and not os.path.exists(file_name):
- files[kind][struct] = ""
- continue
- files[kind][struct] = render(
- file_name,
- engine=engine,
- data=properties,
- )
properties_template = os.path.join(BASE, "properties.mako.rs")
- files["properties"] = render(
+ properties_file = render(
properties_template,
engine=engine,
data=properties,
@@ -87,31 +47,15 @@ def main():
OUT_DIR=OUT_DIR,
)
if output == "style-crate":
- write(OUT_DIR, "properties.rs", files["properties"])
- for kind in ["longhands", "shorthands"]:
- for struct in files[kind]:
- write(
- os.path.join(OUT_DIR, kind),
- "{}.rs".format(struct),
- files[kind][struct],
- )
-
- if engine == "gecko":
- template = os.path.join(BASE, "gecko.mako.rs")
- rust = render(template, data=properties)
- write(OUT_DIR, "gecko_properties.rs", rust)
-
- if engine in ["servo-2013", "servo-2020"]:
- if engine == "servo-2013":
- pref_attr = "servo_2013_pref"
- if engine == "servo-2020":
- pref_attr = "servo_2020_pref"
+ write(OUT_DIR, "properties.rs", properties_file)
+
+ if engine == "servo":
properties_dict = {
kind: {
- p.name: {"pref": getattr(p, pref_attr)}
+ p.name: {"pref": getattr(p, "servo_pref")}
for prop in properties_list
if prop.enabled_in_content()
- for p in [prop] + prop.alias
+ for p in [prop] + prop.aliases
}
for kind, properties_list in [
("longhands", properties.longhands),
diff --git a/servo/components/style/properties/cascade.rs b/servo/components/style/properties/cascade.rs
index d4d48eaeb8..0f264a9249 100644
--- a/servo/components/style/properties/cascade.rs
+++ b/servo/components/style/properties/cascade.rs
@@ -297,7 +297,7 @@ where
context.style().add_flags(cascade_input_flags);
let using_cached_reset_properties;
- let ignore_colors = !context.builder.device.use_document_colors();
+ let ignore_colors = context.builder.device.forced_colors().is_active();
let mut cascade = Cascade::new(first_line_reparenting, ignore_colors);
let mut declarations = Default::default();
let mut shorthand_cache = ShorthandsWithPropertyReferencesCache::default();
@@ -763,6 +763,11 @@ impl<'b> Cascade<'b> {
if apply!(Zoom) {
self.compute_zoom(context);
+ // NOTE(emilio): This is a bit of a hack, but matches the shipped WebKit and Blink
+ // behavior for now. Ideally, in the future, we have a pass over all
+ // implicitly-or-explicitly-inherited properties that can contain lengths and
+ // re-compute them properly, see https://github.com/w3c/csswg-drafts/issues/9397.
+ self.recompute_font_size_for_zoom_change(&mut context.builder);
}
// Compute font-family.
@@ -1226,8 +1231,6 @@ impl<'b> Cascade<'b> {
/// <svg:text> is not affected by text zoom, and it uses a preshint to disable it. We fix up
/// the struct when this happens by unzooming its contained font values, which will have been
/// zoomed in the parent.
- ///
- /// FIXME(emilio): Why doing this _before_ handling font-size? That sounds wrong.
#[cfg(feature = "gecko")]
fn unzoom_fonts_if_needed(&self, builder: &mut StyleBuilder) {
debug_assert!(self.seen.contains(LonghandId::XTextScale));
@@ -1250,6 +1253,19 @@ impl<'b> Cascade<'b> {
builder.mutate_font().unzoom_fonts(device);
}
+ fn recompute_font_size_for_zoom_change(&self, builder: &mut StyleBuilder) {
+ debug_assert!(self.seen.contains(LonghandId::Zoom));
+ // NOTE(emilio): Intentionally not using the effective zoom here, since all the inherited
+ // zooms are already applied.
+ let zoom = builder.get_box().clone_zoom();
+ let old_size = builder.get_font().clone_font_size();
+ let new_size = old_size.zoom(zoom);
+ if old_size == new_size {
+ return;
+ }
+ builder.mutate_font().set_font_size(new_size);
+ }
+
/// Special handling of font-size: math (used for MathML).
/// https://w3c.github.io/mathml-core/#the-math-script-level-property
/// TODO: Bug: 1548471: MathML Core also does not specify a script min size
diff --git a/servo/components/style/properties/data.py b/servo/components/style/properties/data.py
index 093f1cb75f..2a29a7ed58 100644
--- a/servo/components/style/properties/data.py
+++ b/servo/components/style/properties/data.py
@@ -176,11 +176,9 @@ class Keyword(object):
gecko_enum_prefix=None,
custom_consts=None,
extra_gecko_values=None,
- extra_servo_2013_values=None,
- extra_servo_2020_values=None,
+ extra_servo_values=None,
gecko_aliases=None,
- servo_2013_aliases=None,
- servo_2020_aliases=None,
+ servo_aliases=None,
gecko_strip_moz_prefix=None,
gecko_inexhaustive=None,
):
@@ -196,11 +194,9 @@ class Keyword(object):
)
self.gecko_enum_prefix = gecko_enum_prefix
self.extra_gecko_values = (extra_gecko_values or "").split()
- self.extra_servo_2013_values = (extra_servo_2013_values or "").split()
- self.extra_servo_2020_values = (extra_servo_2020_values or "").split()
+ self.extra_servo_values = (extra_servo_values or "").split()
self.gecko_aliases = parse_aliases(gecko_aliases or "")
- self.servo_2013_aliases = parse_aliases(servo_2013_aliases or "")
- self.servo_2020_aliases = parse_aliases(servo_2020_aliases or "")
+ self.servo_aliases = parse_aliases(servo_aliases or "")
self.consts_map = {} if custom_consts is None else custom_consts
self.gecko_strip_moz_prefix = (
True if gecko_strip_moz_prefix is None else gecko_strip_moz_prefix
@@ -210,20 +206,16 @@ class Keyword(object):
def values_for(self, engine):
if engine == "gecko":
return self.values + self.extra_gecko_values
- elif engine == "servo-2013":
- return self.values + self.extra_servo_2013_values
- elif engine == "servo-2020":
- return self.values + self.extra_servo_2020_values
+ elif engine == "servo":
+ return self.values + self.extra_servo_values
else:
raise Exception("Bad engine: " + engine)
def aliases_for(self, engine):
if engine == "gecko":
return self.gecko_aliases
- elif engine == "servo-2013":
- return self.servo_2013_aliases
- elif engine == "servo-2020":
- return self.servo_2020_aliases
+ elif engine == "servo":
+ return self.servo_aliases
else:
raise Exception("Bad engine: " + engine)
@@ -289,8 +281,7 @@ class Property(object):
self,
name,
spec,
- servo_2013_pref,
- servo_2020_pref,
+ servo_pref,
gecko_pref,
enabled_in,
rule_types_allowed,
@@ -304,8 +295,7 @@ class Property(object):
self.spec = spec
self.ident = to_rust_ident(name)
self.camel_case = to_camel_case(self.ident)
- self.servo_2013_pref = servo_2013_pref
- self.servo_2020_pref = servo_2020_pref
+ self.servo_pref = servo_pref
self.gecko_pref = gecko_pref
self.rule_types_allowed = rule_values_from_arg(rule_types_allowed)
# For enabled_in, the setup is as follows:
@@ -329,10 +319,8 @@ class Property(object):
def experimental(self, engine):
if engine == "gecko":
return bool(self.gecko_pref)
- elif engine == "servo-2013":
- return bool(self.servo_2013_pref)
- elif engine == "servo-2020":
- return bool(self.servo_2020_pref)
+ elif engine == "servo":
+ return bool(self.servo_pref)
else:
raise Exception("Bad engine: " + engine)
@@ -364,8 +352,7 @@ class Longhand(Property):
animation_value_type=None,
keyword=None,
predefined_type=None,
- servo_2013_pref=None,
- servo_2020_pref=None,
+ servo_pref=None,
gecko_pref=None,
enabled_in="content",
need_index=False,
@@ -390,8 +377,7 @@ class Longhand(Property):
self,
name=name,
spec=spec,
- servo_2013_pref=servo_2013_pref,
- servo_2020_pref=servo_2020_pref,
+ servo_pref=servo_pref,
gecko_pref=gecko_pref,
enabled_in=enabled_in,
rule_types_allowed=rule_types_allowed,
@@ -518,16 +504,8 @@ class Longhand(Property):
def may_be_disabled_in(self, shorthand, engine):
if engine == "gecko":
return self.gecko_pref and self.gecko_pref != shorthand.gecko_pref
- elif engine == "servo-2013":
- return (
- self.servo_2013_pref
- and self.servo_2013_pref != shorthand.servo_2013_pref
- )
- elif engine == "servo-2020":
- return (
- self.servo_2020_pref
- and self.servo_2020_pref != shorthand.servo_2020_pref
- )
+ elif engine == "servo":
+ return self.servo_pref and self.servo_pref != shorthand.servo_pref
else:
raise Exception("Bad engine: " + engine)
@@ -659,8 +637,7 @@ class Shorthand(Property):
name,
sub_properties,
spec=None,
- servo_2013_pref=None,
- servo_2020_pref=None,
+ servo_pref=None,
gecko_pref=None,
enabled_in="content",
rule_types_allowed=DEFAULT_RULES,
@@ -672,8 +649,7 @@ class Shorthand(Property):
self,
name=name,
spec=spec,
- servo_2013_pref=servo_2013_pref,
- servo_2020_pref=servo_2020_pref,
+ servo_pref=servo_pref,
gecko_pref=gecko_pref,
enabled_in=enabled_in,
rule_types_allowed=rule_types_allowed,
@@ -704,8 +680,7 @@ class Alias(object):
self.original = original
self.enabled_in = original.enabled_in
self.animatable = original.animatable
- self.servo_2013_pref = original.servo_2013_pref
- self.servo_2020_pref = original.servo_2020_pref
+ self.servo_pref = original.servo_pref
self.gecko_pref = gecko_pref
self.rule_types_allowed = original.rule_types_allowed
self.flags = original.flags
@@ -722,10 +697,8 @@ class Alias(object):
def experimental(self, engine):
if engine == "gecko":
return bool(self.gecko_pref)
- elif engine == "servo-2013":
- return bool(self.servo_2013_pref)
- elif engine == "servo-2020":
- return bool(self.servo_2020_pref)
+ elif engine == "servo":
+ return bool(self.servo_pref)
else:
raise Exception("Bad engine: " + engine)
@@ -768,7 +741,7 @@ class Method(object):
class StyleStruct(object):
- def __init__(self, name, inherited, gecko_name=None, additional_methods=None):
+ def __init__(self, name, inherited, gecko_name=None):
self.gecko_struct_name = "Gecko" + name
self.name = name
self.name_lower = to_snake_case(name)
@@ -777,15 +750,12 @@ class StyleStruct(object):
self.inherited = inherited
self.gecko_name = gecko_name or name
self.gecko_ffi_name = "nsStyle" + self.gecko_name
- self.additional_methods = additional_methods or []
self.document_dependent = self.gecko_name in ["Font", "Visibility", "Text"]
class PropertiesData(object):
def __init__(self, engine):
self.engine = engine
- self.style_structs = []
- self.current_style_struct = None
self.longhands = []
self.longhands_by_name = {}
self.longhands_by_logical_group = {}
@@ -797,13 +767,35 @@ class PropertiesData(object):
CountedUnknownProperty(p) for p in COUNTED_UNKNOWN_PROPERTIES
]
- def new_style_struct(self, *args, **kwargs):
- style_struct = StyleStruct(*args, **kwargs)
- self.style_structs.append(style_struct)
- self.current_style_struct = style_struct
+ self.style_structs = [
+ StyleStruct("Background", inherited=False),
+ StyleStruct("Border", inherited=False),
+ StyleStruct("Box", inherited=False, gecko_name="Display"),
+ StyleStruct("Column", inherited=False),
+ StyleStruct("Counters", inherited=False, gecko_name="Content"),
+ StyleStruct("Effects", inherited=False),
+ StyleStruct("Font", inherited=True),
+ StyleStruct("InheritedBox", inherited=True, gecko_name="Visibility"),
+ StyleStruct("InheritedSVG", inherited=True, gecko_name="SVG"),
+ StyleStruct("InheritedTable", inherited=True, gecko_name="TableBorder"),
+ StyleStruct("InheritedText", inherited=True, gecko_name="Text"),
+ StyleStruct("InheritedUI", inherited=True, gecko_name="UI"),
+ StyleStruct("List", inherited=True),
+ StyleStruct("Margin", inherited=False),
+ StyleStruct("Outline", inherited=False),
+ StyleStruct("Padding", inherited=False),
+ StyleStruct("Page", inherited=False),
+ StyleStruct("Position", inherited=False),
+ StyleStruct("SVG", inherited=False, gecko_name="SVGReset"),
+ StyleStruct("Table", inherited=False),
+ StyleStruct("Text", inherited=False, gecko_name="TextReset"),
+ StyleStruct("UI", inherited=False, gecko_name="UIReset"),
+ StyleStruct("XUL", inherited=False),
+ ]
+ self.current_style_struct = None
def active_style_structs(self):
- return [s for s in self.style_structs if s.additional_methods or s.longhands]
+ return [s for s in self.style_structs if s.longhands]
def add_prefixed_aliases(self, property):
# FIXME Servo's DOM architecture doesn't support vendor-prefixed properties.
@@ -856,7 +848,7 @@ def _add_logical_props(data, props):
groups = set()
for prop in props:
if prop not in data.longhands_by_name:
- assert data.engine in ["servo-2013", "servo-2020"]
+ assert data.engine == "servo"
continue
prop = data.longhands_by_name[prop]
if prop.logical_group:
diff --git a/servo/components/style/properties/declaration_block.rs b/servo/components/style/properties/declaration_block.rs
index 81d7148e62..94945ab8c0 100644
--- a/servo/components/style/properties/declaration_block.rs
+++ b/servo/components/style/properties/declaration_block.rs
@@ -36,10 +36,10 @@ use cssparser::{
use itertools::Itertools;
use selectors::SelectorList;
use servo_arc::Arc;
-use smallbitvec::{self, SmallBitVec};
+use smallbitvec::SmallBitVec;
use smallvec::SmallVec;
use std::fmt::{self, Write};
-use std::iter::{DoubleEndedIterator, Zip};
+use std::iter::Zip;
use std::slice::Iter;
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
use thin_vec::ThinVec;
diff --git a/servo/components/style/properties/helpers.mako.rs b/servo/components/style/properties/helpers.mako.rs
index 968a97aa00..82998632ca 100644
--- a/servo/components/style/properties/helpers.mako.rs
+++ b/servo/components/style/properties/helpers.mako.rs
@@ -594,11 +594,9 @@
'gecko_constant_prefix',
'gecko_enum_prefix',
'extra_gecko_values',
- 'extra_servo_2013_values',
- 'extra_servo_2020_values',
+ 'extra_servo_values',
'gecko_aliases',
- 'servo_2013_aliases',
- 'servo_2020_aliases',
+ 'servo_aliases',
'custom_consts',
'gecko_inexhaustive',
'gecko_strip_moz_prefix',
diff --git a/servo/components/style/properties/helpers/animated_properties.mako.rs b/servo/components/style/properties/helpers/animated_properties.mako.rs
index 290684cdab..171413b243 100644
--- a/servo/components/style/properties/helpers/animated_properties.mako.rs
+++ b/servo/components/style/properties/helpers/animated_properties.mako.rs
@@ -737,7 +737,7 @@ impl<'a> TransitionPropertyIterator<'a> {
/// A single iteration of the TransitionPropertyIterator.
pub struct TransitionPropertyIteration {
/// The id of the longhand for this property.
- pub longhand_id: LonghandId,
+ pub property: OwnedPropertyDeclarationId,
/// The index of this property in the list of transition properties for this
/// iterator's style.
@@ -753,7 +753,7 @@ impl<'a> Iterator for TransitionPropertyIterator<'a> {
if let Some(ref mut longhand_iterator) = self.longhand_iterator {
if let Some(longhand_id) = longhand_iterator.next() {
return Some(TransitionPropertyIteration {
- longhand_id,
+ property: OwnedPropertyDeclarationId::Longhand(longhand_id),
index: self.index_range.start - 1,
});
}
@@ -766,7 +766,7 @@ impl<'a> Iterator for TransitionPropertyIterator<'a> {
match id.longhand_or_shorthand() {
Ok(longhand_id) => {
return Some(TransitionPropertyIteration {
- longhand_id,
+ property: OwnedPropertyDeclarationId::Longhand(longhand_id),
index,
});
},
@@ -778,7 +778,13 @@ impl<'a> Iterator for TransitionPropertyIterator<'a> {
},
}
}
- TransitionProperty::Custom(..) | TransitionProperty::Unsupported(..) => {}
+ TransitionProperty::Custom(name) => {
+ return Some(TransitionPropertyIteration {
+ property: OwnedPropertyDeclarationId::Custom(name),
+ index,
+ })
+ },
+ TransitionProperty::Unsupported(..) => {},
}
}
}
diff --git a/servo/components/style/properties/longhands/background.mako.rs b/servo/components/style/properties/longhands/background.mako.rs
index 48270f748e..535dd64e20 100644
--- a/servo/components/style/properties/longhands/background.mako.rs
+++ b/servo/components/style/properties/longhands/background.mako.rs
@@ -4,13 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("Background", inherited=False) %>
-
${helpers.predefined_type(
"background-color",
"Color",
"computed::Color::TRANSPARENT_BLACK",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="SpecifiedValue::transparent()",
spec="https://drafts.csswg.org/css-backgrounds/#background-color",
animation_value_type="AnimatedColor",
@@ -23,7 +21,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"background-image",
"Image",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::Image::None",
initial_specified_value="specified::Image::None",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-image",
@@ -38,7 +36,7 @@ ${helpers.predefined_type(
"background-position-" + axis,
"position::" + direction + "Position",
"computed::LengthPercentage::zero_percent()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="SpecifiedValue::initial_specified_value()",
spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-" + axis,
animation_value_type="ComputedValue",
@@ -52,7 +50,7 @@ ${helpers.predefined_type(
"background-repeat",
"BackgroundRepeat",
"computed::BackgroundRepeat::repeat()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::BackgroundRepeat::repeat()",
animation_value_type="discrete",
vector=True,
@@ -62,8 +60,8 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"background-attachment",
- "scroll" + (" fixed" if engine in ["gecko", "servo-2013"] else "") + (" local" if engine == "gecko" else ""),
- engines="gecko servo-2013 servo-2020",
+ "scroll fixed" + (" local" if engine == "gecko" else ""),
+ engines="gecko servo",
vector=True,
gecko_enum_prefix="StyleImageLayerAttachment",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment",
@@ -74,7 +72,7 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"background-clip",
"border-box padding-box content-box",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
extra_gecko_values="text",
vector=True, extra_prefixes="webkit",
gecko_enum_prefix="StyleGeometryBox",
@@ -87,7 +85,7 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"background-origin",
"padding-box border-box content-box",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
vector=True, extra_prefixes="webkit",
gecko_enum_prefix="StyleGeometryBox",
gecko_inexhaustive=True,
@@ -99,7 +97,7 @@ ${helpers.single_keyword(
${helpers.predefined_type(
"background-size",
"BackgroundSize",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::BackgroundSize::auto()",
initial_specified_value="specified::BackgroundSize::auto()",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-size",
diff --git a/servo/components/style/properties/longhands/border.mako.rs b/servo/components/style/properties/longhands/border.mako.rs
index 4d0676f678..59a0fee94a 100644
--- a/servo/components/style/properties/longhands/border.mako.rs
+++ b/servo/components/style/properties/longhands/border.mako.rs
@@ -3,11 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import Keyword, Method, ALL_CORNERS, PHYSICAL_SIDES, ALL_SIDES, maybe_moz_logical_alias %>
+<% from data import ALL_CORNERS, ALL_SIDES, maybe_moz_logical_alias %>
-<% data.new_style_struct("Border", inherited=False,
- additional_methods=[Method("border_" + side + "_has_nonzero_width",
- "bool") for side in ["top", "right", "bottom", "left"]]) %>
<%
def maybe_logical_spec(side, kind):
if side[1]: # if it is logical
@@ -23,7 +20,7 @@
${helpers.predefined_type(
"border-%s-color" % side_name, "Color",
"computed_value::T::currentcolor()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
aliases=maybe_moz_logical_alias(engine, side, "-moz-border-%s-color"),
spec=maybe_logical_spec(side, "color"),
animation_value_type="AnimatedColor",
@@ -37,7 +34,7 @@
${helpers.predefined_type(
"border-%s-style" % side_name, "BorderStyle",
"specified::BorderStyle::None",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
aliases=maybe_moz_logical_alias(engine, side, "-moz-border-%s-style"),
spec=maybe_logical_spec(side, "style"),
animation_value_type="discrete" if not is_logical else "none",
@@ -50,7 +47,7 @@
"border-%s-width" % side_name,
"BorderSideWidth",
"app_units::Au::from_px(3)",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
aliases=maybe_moz_logical_alias(engine, side, "-moz-border-%s-width"),
spec=maybe_logical_spec(side, "width"),
animation_value_type="NonNegativeLength",
@@ -76,7 +73,7 @@
"BorderCornerRadius",
"computed::BorderCornerRadius::zero()",
"parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
extra_prefixes=prefixes,
spec=maybe_logical_spec(corner, "radius"),
boxed=True,
@@ -111,13 +108,13 @@ ${helpers.single_keyword(
${helpers.predefined_type(
"border-image-source",
"Image",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::Image::None",
initial_specified_value="specified::Image::None",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-image",
vector=False,
animation_value_type="discrete",
- boxed=engine == "servo-2013",
+ boxed=engine == "servo",
ignored_when_colors_disabled=True,
affects="paint",
)}
@@ -125,7 +122,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"border-image-outset",
"NonNegativeLengthOrNumberRect",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="generics::rect::Rect::all(computed::NonNegativeLengthOrNumber::zero())",
initial_specified_value="generics::rect::Rect::all(specified::NonNegativeLengthOrNumber::zero())",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset",
@@ -138,7 +135,7 @@ ${helpers.predefined_type(
"border-image-repeat",
"BorderImageRepeat",
"computed::BorderImageRepeat::stretch()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::BorderImageRepeat::stretch()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-backgrounds/#the-border-image-repeat",
@@ -148,7 +145,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"border-image-width",
"BorderImageWidth",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::BorderImageWidth::all(computed::BorderImageSideWidth::one())",
initial_specified_value="specified::BorderImageWidth::all(specified::BorderImageSideWidth::one())",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-width",
@@ -160,7 +157,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"border-image-slice",
"BorderImageSlice",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::BorderImageSlice::hundred_percent()",
initial_specified_value="specified::BorderImageSlice::hundred_percent()",
spec="https://drafts.csswg.org/css-backgrounds/#border-image-slice",
diff --git a/servo/components/style/properties/longhands/box.mako.rs b/servo/components/style/properties/longhands/box.mako.rs
index 017bef38ea..187e8f8169 100644
--- a/servo/components/style/properties/longhands/box.mako.rs
+++ b/servo/components/style/properties/longhands/box.mako.rs
@@ -3,17 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import ALL_AXES, Keyword, Method, to_rust_ident, to_camel_case%>
-
-<% data.new_style_struct("Box",
- inherited=False,
- gecko_name="Display") %>
+<% from data import ALL_AXES %>
${helpers.predefined_type(
"display",
"Display",
"computed::Display::inline()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Display::inline()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-display/#propdef-display",
@@ -38,7 +34,7 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"-servo-top-layer",
"none top",
- engines="servo-2013 servo-2020",
+ engines="servo",
animation_value_type="none",
enabled_in="ua",
spec="Internal (not web-exposed)",
@@ -47,8 +43,8 @@ ${helpers.single_keyword(
<%helpers:single_keyword
name="position"
- values="static absolute relative fixed ${'sticky' if engine in ['gecko', 'servo-2013'] else ''}"
- engines="gecko servo-2013 servo-2020"
+ values="static absolute relative fixed sticky"
+ engines="gecko servo"
animation_value_type="discrete"
gecko_enum_prefix="StylePositionProperty"
spec="https://drafts.csswg.org/css-position/#position-property"
@@ -69,8 +65,7 @@ ${helpers.predefined_type(
"float",
"Float",
"computed::Float::None",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
initial_specified_value="specified::Float::None",
spec="https://drafts.csswg.org/css-box/#propdef-float",
animation_value_type="discrete",
@@ -83,7 +78,7 @@ ${helpers.predefined_type(
"clear",
"Clear",
"computed::Clear::None",
- engines="gecko servo-2013",
+ engines="gecko servo",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css2/#propdef-clear",
servo_restyle_damage="rebuild_and_reflow",
@@ -94,7 +89,7 @@ ${helpers.predefined_type(
"vertical-align",
"VerticalAlign",
"computed::VerticalAlign::baseline()",
- engines="gecko servo-2013",
+ engines="gecko servo",
animation_value_type="ComputedValue",
spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align",
servo_restyle_damage = "reflow",
@@ -105,7 +100,7 @@ ${helpers.predefined_type(
"baseline-source",
"BaselineSource",
"computed::BaselineSource::Auto",
- engines="gecko servo-2013",
+ engines="gecko servo",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-inline-3/#baseline-source",
servo_restyle_damage = "reflow",
@@ -117,7 +112,8 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"-servo-overflow-clip-box",
"padding-box content-box",
- engines="servo-2013",
+ engines="servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="none",
enabled_in="ua",
spec="Internal, not web-exposed, \
@@ -146,7 +142,7 @@ ${helpers.single_keyword(
full_name,
"Overflow",
"computed::Overflow::Visible",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
logical_group="overflow",
logical=logical,
animation_value_type="discrete",
@@ -174,7 +170,7 @@ ${helpers.predefined_type(
"transform",
"Transform",
"generics::transform::Transform::none()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
extra_prefixes=transform_extra_prefixes,
animation_value_type="ComputedValue",
flags="CAN_ANIMATE_ON_COMPOSITOR",
@@ -187,7 +183,7 @@ ${helpers.predefined_type(
"rotate",
"Rotate",
"generics::transform::Rotate::None",
- engines="gecko servo-2013",
+ engines="gecko servo",
animation_value_type="ComputedValue",
boxed=True,
flags="CAN_ANIMATE_ON_COMPOSITOR",
@@ -201,7 +197,7 @@ ${helpers.predefined_type(
"scale",
"Scale",
"generics::transform::Scale::None",
- engines="gecko servo-2013",
+ engines="gecko servo",
animation_value_type="ComputedValue",
boxed=True,
flags="CAN_ANIMATE_ON_COMPOSITOR",
@@ -215,7 +211,7 @@ ${helpers.predefined_type(
"translate",
"Translate",
"generics::transform::Translate::None",
- engines="gecko servo-2013",
+ engines="gecko servo",
animation_value_type="ComputedValue",
boxed=True,
flags="CAN_ANIMATE_ON_COMPOSITOR",
@@ -285,7 +281,6 @@ ${helpers.predefined_type(
"computed::OffsetPosition::normal()",
engines="gecko",
animation_value_type="ComputedValue",
- gecko_pref="layout.css.motion-path-offset-position.enabled",
flags="CAN_ANIMATE_ON_COMPOSITOR",
spec="https://drafts.fxtf.org/motion-1/#offset-position-property",
servo_restyle_damage="reflow_out_of_flow",
@@ -409,7 +404,7 @@ ${helpers.predefined_type(
"perspective",
"Perspective",
"computed::Perspective::none()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
gecko_ffi_name="mChildPerspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
extra_prefixes=transform_extra_prefixes,
@@ -422,7 +417,7 @@ ${helpers.predefined_type(
"perspective-origin",
"Position",
"computed::position::Position::center()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
boxed=True,
extra_prefixes=transform_extra_prefixes,
spec="https://drafts.csswg.org/css-transforms-2/#perspective-origin-property",
@@ -434,7 +429,7 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"backface-visibility",
"visible hidden",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
gecko_enum_prefix="StyleBackfaceVisibility",
spec="https://drafts.csswg.org/css-transforms/#backface-visibility-property",
extra_prefixes=transform_extra_prefixes,
@@ -456,7 +451,7 @@ ${helpers.predefined_type(
"transform-style",
"TransformStyle",
"computed::TransformStyle::Flat",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-transforms-2/#transform-style-property",
extra_prefixes=transform_extra_prefixes,
animation_value_type="discrete",
@@ -468,7 +463,7 @@ ${helpers.predefined_type(
"transform-origin",
"TransformOrigin",
"computed::TransformOrigin::initial_value()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="ComputedValue",
extra_prefixes=transform_extra_prefixes,
gecko_ffi_name="mTransformOrigin",
@@ -503,10 +498,11 @@ ${helpers.predefined_type(
"container-type",
"ContainerType",
"computed::ContainerType::Normal",
- engines="gecko",
+ engines="gecko servo",
animation_value_type="none",
enabled_in="ua",
gecko_pref="layout.css.container-queries.enabled",
+ servo_pref="layout.container-queries.enabled",
spec="https://drafts.csswg.org/css-contain-3/#container-type",
affects="layout",
)}
@@ -515,10 +511,11 @@ ${helpers.predefined_type(
"container-name",
"ContainerName",
"computed::ContainerName::none()",
- engines="gecko",
+ engines="gecko servo",
animation_value_type="none",
enabled_in="ua",
gecko_pref="layout.css.container-queries.enabled",
+ servo_pref="layout.container-queries.enabled",
spec="https://drafts.csswg.org/css-contain-3/#container-name",
affects="",
)}
diff --git a/servo/components/style/properties/longhands/column.mako.rs b/servo/components/style/properties/longhands/column.mako.rs
index 38c32938c6..ca97f36dba 100644
--- a/servo/components/style/properties/longhands/column.mako.rs
+++ b/servo/components/style/properties/longhands/column.mako.rs
@@ -4,17 +4,14 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("Column", inherited=False) %>
-
${helpers.predefined_type(
"column-width",
"length::NonNegativeLengthOrAuto",
"computed::length::NonNegativeLengthOrAuto::auto()",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
initial_specified_value="specified::length::NonNegativeLengthOrAuto::auto()",
animation_value_type="NonNegativeLengthOrAuto",
- servo_2013_pref="layout.columns.enabled",
+ servo_pref="layout.columns.enabled",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-width",
servo_restyle_damage="rebuild_and_reflow",
affects="layout",
@@ -24,10 +21,9 @@ ${helpers.predefined_type(
"column-count",
"ColumnCount",
"computed::ColumnCount::auto()",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
initial_specified_value="specified::ColumnCount::auto()",
- servo_2013_pref="layout.columns.enabled",
+ servo_pref="layout.columns.enabled",
animation_value_type="AnimatedColumnCount",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-count",
servo_restyle_damage="rebuild_and_reflow",
@@ -71,7 +67,8 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"column-span",
"none all",
- engines="gecko",
+ engines="gecko servo",
+ servo_pref="layout.columns.enabled",
animation_value_type="discrete",
gecko_enum_prefix="StyleColumnSpan",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-span",
diff --git a/servo/components/style/properties/longhands/counters.mako.rs b/servo/components/style/properties/longhands/counters.mako.rs
index 6c844c3567..5991bd416c 100644
--- a/servo/components/style/properties/longhands/counters.mako.rs
+++ b/servo/components/style/properties/longhands/counters.mako.rs
@@ -4,13 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("Counters", inherited=False, gecko_name="Content") %>
-
${helpers.predefined_type(
"content",
"Content",
"computed::Content::normal()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Content::normal()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-content/#propdef-content",
@@ -21,7 +19,8 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"counter-increment",
"CounterIncrement",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
initial_value="Default::default()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists/#propdef-counter-increment",
@@ -32,7 +31,8 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"counter-reset",
"CounterReset",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
initial_value="Default::default()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists-3/#propdef-counter-reset",
diff --git a/servo/components/style/properties/longhands/effects.mako.rs b/servo/components/style/properties/longhands/effects.mako.rs
index b301aab5dd..742844a670 100644
--- a/servo/components/style/properties/longhands/effects.mako.rs
+++ b/servo/components/style/properties/longhands/effects.mako.rs
@@ -4,14 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-// Box-shadow, etc.
-<% data.new_style_struct("Effects", inherited=False) %>
-
${helpers.predefined_type(
"opacity",
"Opacity",
"1.0",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="ComputedValue",
flags="CAN_ANIMATE_ON_COMPOSITOR",
spec="https://drafts.csswg.org/css-color/#transparency",
@@ -23,8 +20,8 @@ ${helpers.predefined_type(
"box-shadow",
"BoxShadow",
None,
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
vector=True,
simple_vector_bindings=True,
animation_value_type="AnimatedBoxShadowList",
@@ -39,7 +36,7 @@ ${helpers.predefined_type(
"clip",
"ClipRectOrAuto",
"computed::ClipRectOrAuto::auto()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="ComputedValue",
boxed=True,
allow_quirks="Yes",
@@ -51,7 +48,7 @@ ${helpers.predefined_type(
"filter",
"Filter",
None,
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
vector=True,
simple_vector_bindings=True,
gecko_ffi_name="mFilters",
@@ -84,7 +81,7 @@ ${helpers.single_keyword(
"""normal multiply screen overlay darken lighten color-dodge
color-burn hard-light soft-light difference exclusion hue
saturation color luminosity plus-lighter""",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
gecko_enum_prefix="StyleBlend",
animation_value_type="discrete",
spec="https://drafts.fxtf.org/compositing/#propdef-mix-blend-mode",
diff --git a/servo/components/style/properties/longhands/font.mako.rs b/servo/components/style/properties/longhands/font.mako.rs
index 4583de0bd7..3f7a2f0657 100644
--- a/servo/components/style/properties/longhands/font.mako.rs
+++ b/servo/components/style/properties/longhands/font.mako.rs
@@ -3,14 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import Method, to_camel_case, to_rust_ident, to_camel_case_lower, SYSTEM_FONT_LONGHANDS %>
-
-<% data.new_style_struct("Font", inherited=True) %>
+<% from data import SYSTEM_FONT_LONGHANDS %>
${helpers.predefined_type(
"font-family",
"FontFamily",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::FontFamily::serif()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-fonts/#propdef-font-family",
@@ -21,7 +19,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"font-style",
"FontStyle",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::FontStyle::normal()",
initial_specified_value="specified::FontStyle::normal()",
animation_value_type="FontStyle",
@@ -39,7 +37,7 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"font-variant-caps",
"normal small-caps",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
extra_gecko_values="all-small-caps petite-caps all-petite-caps unicase titling-caps",
gecko_constant_prefix="NS_FONT_VARIANT_CAPS",
gecko_ffi_name="mFont.variantCaps",
@@ -53,7 +51,7 @@ ${helpers.single_keyword(
${helpers.predefined_type(
"font-weight",
"FontWeight",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::FontWeight::normal()",
initial_specified_value="specified::FontWeight::normal()",
animation_value_type="Number",
@@ -65,7 +63,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"font-size",
"FontSize",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::FontSize::medium()",
initial_specified_value="specified::FontSize::medium()",
animation_value_type="NonNegativeLength",
@@ -137,7 +135,7 @@ ${helpers.predefined_type(
${helpers.predefined_type(
"font-stretch",
"FontStretch",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::FontStretch::hundred()",
initial_specified_value="specified::FontStretch::normal()",
animation_value_type="Percentage",
@@ -354,7 +352,7 @@ ${helpers.predefined_type(
"line-height",
"LineHeight",
"computed::LineHeight::normal()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="LineHeight",
spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height",
servo_restyle_damage="reflow",
diff --git a/servo/components/style/properties/longhands/inherited_box.mako.rs b/servo/components/style/properties/longhands/inherited_box.mako.rs
index 7fd94d1a1f..add367798b 100644
--- a/servo/components/style/properties/longhands/inherited_box.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_box.mako.rs
@@ -4,13 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("InheritedBox", inherited=True, gecko_name="Visibility") %>
-
// TODO: collapse. Well, do tables first.
${helpers.single_keyword(
"visibility",
"visible hidden collapse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
gecko_ffi_name="mVisible",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-box/#propdef-visibility",
@@ -23,13 +21,12 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"writing-mode",
"horizontal-tb vertical-rl vertical-lr",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
extra_gecko_values="sideways-rl sideways-lr",
gecko_aliases="lr=horizontal-tb lr-tb=horizontal-tb \
rl=horizontal-tb rl-tb=horizontal-tb \
tb=vertical-rl tb-rl=vertical-rl",
- servo_2013_pref="layout.writing-mode.enabled",
- servo_2020_pref="layout.writing-mode.enabled",
+ servo_pref="layout.writing-mode.enabled",
animation_value_type="none",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-writing-mode",
gecko_enum_prefix="StyleWritingModeProperty",
@@ -40,8 +37,8 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"direction",
"ltr rtl",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="none",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-direction",
gecko_enum_prefix="StyleDirection",
@@ -88,7 +85,7 @@ ${helpers.predefined_type(
"image-rendering",
"ImageRendering",
"computed::ImageRendering::Auto",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-images/#propdef-image-rendering",
animation_value_type="discrete",
affects="paint",
diff --git a/servo/components/style/properties/longhands/inherited_svg.mako.rs b/servo/components/style/properties/longhands/inherited_svg.mako.rs
index 90443f962a..d01d5a4a80 100644
--- a/servo/components/style/properties/longhands/inherited_svg.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_svg.mako.rs
@@ -4,10 +4,6 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-// SVG 2
-// https://svgwg.org/svg2-draft/
-<% data.new_style_struct("InheritedSVG", inherited=True, gecko_name="SVG") %>
-
// Section 10 - Text
${helpers.single_keyword(
diff --git a/servo/components/style/properties/longhands/inherited_table.mako.rs b/servo/components/style/properties/longhands/inherited_table.mako.rs
index 7eb42a6eb2..c7ada525b8 100644
--- a/servo/components/style/properties/longhands/inherited_table.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_table.mako.rs
@@ -4,12 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("InheritedTable", inherited=True, gecko_name="TableBorder") %>
-
${helpers.single_keyword(
"border-collapse",
"separate collapse",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
gecko_enum_prefix="StyleBorderCollapse",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-border-collapse",
@@ -20,7 +19,8 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"empty-cells",
"show hide",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
gecko_enum_prefix="StyleEmptyCells",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-empty-cells",
@@ -32,7 +32,8 @@ ${helpers.predefined_type(
"caption-side",
"table::CaptionSide",
"computed::table::CaptionSide::Top",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-tables/#propdef-caption-side",
servo_restyle_damage="rebuild_and_reflow",
@@ -43,8 +44,7 @@ ${helpers.predefined_type(
"border-spacing",
"BorderSpacing",
"computed::BorderSpacing::zero()",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
animation_value_type="BorderSpacing",
boxed=True,
spec="https://drafts.csswg.org/css-tables/#propdef-border-spacing",
diff --git a/servo/components/style/properties/longhands/inherited_text.mako.rs b/servo/components/style/properties/longhands/inherited_text.mako.rs
index 544ba99bf7..c6ad907b23 100644
--- a/servo/components/style/properties/longhands/inherited_text.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_text.mako.rs
@@ -3,14 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import Keyword %>
-<% data.new_style_struct("InheritedText", inherited=True, gecko_name="Text") %>
${helpers.predefined_type(
"color",
"ColorPropertyValue",
"crate::color::AbsoluteColor::BLACK",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="AbsoluteColor",
ignored_when_colors_disabled="True",
spec="https://drafts.csswg.org/css-color/#color",
@@ -23,7 +21,8 @@ ${helpers.predefined_type(
"text-transform",
"TextTransform",
"computed::TextTransform::none()",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-text-transform",
servo_restyle_damage="rebuild_and_reflow",
@@ -58,8 +57,7 @@ ${helpers.predefined_type(
"text-indent",
"TextIndent",
"computed::TextIndent::zero()",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-text/#propdef-text-indent",
servo_restyle_damage = "reflow",
@@ -72,8 +70,8 @@ ${helpers.predefined_type(
"overflow-wrap",
"OverflowWrap",
"computed::OverflowWrap::Normal",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
aliases="word-wrap",
@@ -85,8 +83,8 @@ ${helpers.predefined_type(
"word-break",
"WordBreak",
"computed::WordBreak::Normal",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-word-break",
servo_restyle_damage="rebuild_and_reflow",
@@ -97,8 +95,7 @@ ${helpers.predefined_type(
"text-justify",
"TextJustify",
"computed::TextJustify::Auto",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-text-justify",
servo_restyle_damage="rebuild_and_reflow",
@@ -109,7 +106,7 @@ ${helpers.predefined_type(
"text-align-last",
"TextAlignLast",
"computed::text::TextAlignLast::Auto",
- engines="gecko",
+ engines="gecko servo",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-text-align-last",
affects="layout",
@@ -120,7 +117,7 @@ ${helpers.predefined_type(
"text-align",
"TextAlign",
"computed::TextAlign::Start",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-text-align",
servo_restyle_damage = "reflow",
@@ -131,7 +128,7 @@ ${helpers.predefined_type(
"letter-spacing",
"LetterSpacing",
"computed::LetterSpacing::normal()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing",
servo_restyle_damage="rebuild_and_reflow",
@@ -142,7 +139,7 @@ ${helpers.predefined_type(
"word-spacing",
"WordSpacing",
"computed::WordSpacing::zero()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-text/#propdef-word-spacing",
servo_restyle_damage="rebuild_and_reflow",
@@ -164,7 +161,8 @@ ${helpers.predefined_type(
"text-shadow",
"SimpleShadow",
None,
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
vector=True,
vector_animation_type="with_zero",
animation_value_type="AnimatedTextShadowList",
@@ -304,7 +302,7 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"text-rendering",
"auto optimizespeed optimizelegibility geometricprecision",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
gecko_enum_prefix="StyleTextRendering",
animation_value_type="discrete",
spec="https://svgwg.org/svg2-draft/painting.html#TextRenderingProperty",
diff --git a/servo/components/style/properties/longhands/inherited_ui.mako.rs b/servo/components/style/properties/longhands/inherited_ui.mako.rs
index 6cdf721336..7ee1adc602 100644
--- a/servo/components/style/properties/longhands/inherited_ui.mako.rs
+++ b/servo/components/style/properties/longhands/inherited_ui.mako.rs
@@ -4,13 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("InheritedUI", inherited=True, gecko_name="UI") %>
-
${helpers.predefined_type(
"cursor",
"Cursor",
"computed::Cursor::auto()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Cursor::auto()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-ui/#cursor",
@@ -23,7 +21,7 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"pointer-events",
"auto none",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
animation_value_type="discrete",
extra_gecko_values="visiblepainted visiblefill visiblestroke visible painted fill stroke all",
spec="https://svgwg.org/svg2-draft/interact.html#PointerEventsProperty",
diff --git a/servo/components/style/properties/longhands/list.mako.rs b/servo/components/style/properties/longhands/list.mako.rs
index 619724bd32..0a3f8e36ec 100644
--- a/servo/components/style/properties/longhands/list.mako.rs
+++ b/servo/components/style/properties/longhands/list.mako.rs
@@ -4,13 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("List", inherited=True) %>
-
${helpers.single_keyword(
"list-style-position",
"outside inside",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
gecko_enum_prefix="StyleListStylePosition",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-position",
@@ -24,17 +22,16 @@ ${helpers.single_keyword(
// upper-roman
//
// [1]: http://dev.w3.org/csswg/css-counter-styles/
-% if engine in ["servo-2013", "servo-2020"]:
+% if engine == "servo":
${helpers.single_keyword(
"list-style-type",
- "disc none circle square disclosure-open disclosure-closed",
- extra_servo_2013_values="""
+ """disc none circle square disclosure-open disclosure-closed
decimal lower-alpha upper-alpha arabic-indic bengali cambodian cjk-decimal devanagari
gujarati gurmukhi kannada khmer lao malayalam mongolian myanmar oriya persian telugu
thai tibetan cjk-earthly-branch cjk-heavenly-stem lower-greek hiragana hiragana-iroha
katakana katakana-iroha
""",
- engines="servo-2013 servo-2020",
+ engines="servo",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-type",
servo_restyle_damage="rebuild_and_reflow",
@@ -59,11 +56,12 @@ ${helpers.single_keyword(
${helpers.predefined_type(
"list-style-image",
"Image",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_value="computed::Image::None",
initial_specified_value="specified::Image::None",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-lists/#propdef-list-style-image",
+ boxed=engine == "servo",
servo_restyle_damage="rebuild_and_reflow",
affects="layout",
)}
@@ -72,7 +70,8 @@ ${helpers.predefined_type(
"quotes",
"Quotes",
"computed::Quotes::get_initial_value()",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-content/#propdef-quotes",
servo_restyle_damage="rebuild_and_reflow",
diff --git a/servo/components/style/properties/longhands/margin.mako.rs b/servo/components/style/properties/longhands/margin.mako.rs
index b5a87f9683..1000704140 100644
--- a/servo/components/style/properties/longhands/margin.mako.rs
+++ b/servo/components/style/properties/longhands/margin.mako.rs
@@ -4,7 +4,6 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import ALL_SIDES, DEFAULT_RULES_AND_PAGE, maybe_moz_logical_alias %>
-<% data.new_style_struct("Margin", inherited=False) %>
% for side in ALL_SIDES:
<%
@@ -16,7 +15,7 @@
"margin-%s" % side[0],
"LengthPercentageOrAuto",
"computed::LengthPercentageOrAuto::zero()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
aliases=maybe_moz_logical_alias(engine, side, "-moz-margin-%s"),
allow_quirks="No" if side[1] else "Yes",
animation_value_type="ComputedValue",
diff --git a/servo/components/style/properties/longhands/outline.mako.rs b/servo/components/style/properties/longhands/outline.mako.rs
index 8e7f956bf5..d366cbc996 100644
--- a/servo/components/style/properties/longhands/outline.mako.rs
+++ b/servo/components/style/properties/longhands/outline.mako.rs
@@ -3,18 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import Method %>
-<% data.new_style_struct("Outline",
- inherited=False,
- additional_methods=[Method("outline_has_nonzero_width", "bool")]) %>
-
-// TODO(pcwalton): `invert`
${helpers.predefined_type(
"outline-color",
"Color",
"computed_value::T::currentcolor()",
- engines="gecko servo-2013",
+ engines="gecko servo",
initial_specified_value="specified::Color::currentcolor()",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
@@ -26,8 +20,7 @@ ${helpers.predefined_type(
"outline-style",
"OutlineStyle",
"computed::OutlineStyle::none()",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
initial_specified_value="specified::OutlineStyle::none()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-ui/#propdef-outline-style",
@@ -38,8 +31,7 @@ ${helpers.predefined_type(
"outline-width",
"BorderSideWidth",
"app_units::Au::from_px(3)",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.2020.unimplemented",
+ engines="gecko servo",
initial_specified_value="specified::BorderSideWidth::medium()",
animation_value_type="NonNegativeLength",
spec="https://drafts.csswg.org/css-ui/#propdef-outline-width",
@@ -50,7 +42,7 @@ ${helpers.predefined_type(
"outline-offset",
"Length",
"crate::values::computed::Length::new(0.)",
- engines="gecko servo-2013",
+ engines="gecko servo",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-ui/#propdef-outline-offset",
affects="overflow",
diff --git a/servo/components/style/properties/longhands/padding.mako.rs b/servo/components/style/properties/longhands/padding.mako.rs
index a165e2cd34..d3984b71d2 100644
--- a/servo/components/style/properties/longhands/padding.mako.rs
+++ b/servo/components/style/properties/longhands/padding.mako.rs
@@ -4,7 +4,6 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import ALL_SIDES, maybe_moz_logical_alias %>
-<% data.new_style_struct("Padding", inherited=False) %>
% for side in ALL_SIDES:
<%
@@ -16,7 +15,7 @@
"padding-%s" % side[0],
"NonNegativeLengthPercentage",
"computed::NonNegativeLengthPercentage::zero()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
aliases=maybe_moz_logical_alias(engine, side, "-moz-padding-%s"),
animation_value_type="NonNegativeLengthPercentage",
logical=side[1],
diff --git a/servo/components/style/properties/longhands/page.mako.rs b/servo/components/style/properties/longhands/page.mako.rs
index 86cd284e18..bb7729c722 100644
--- a/servo/components/style/properties/longhands/page.mako.rs
+++ b/servo/components/style/properties/longhands/page.mako.rs
@@ -5,8 +5,6 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import PAGE_RULE %>
-<% data.new_style_struct("Page", inherited=False) %>
-
${helpers.predefined_type(
"size",
"PageSize",
diff --git a/servo/components/style/properties/longhands/position.mako.rs b/servo/components/style/properties/longhands/position.mako.rs
index fb68baa6b4..e71803e026 100644
--- a/servo/components/style/properties/longhands/position.mako.rs
+++ b/servo/components/style/properties/longhands/position.mako.rs
@@ -2,19 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-<%! from data import to_rust_ident %>
<%namespace name="helpers" file="/helpers.mako.rs" />
<% from data import ALL_SIZES, PHYSICAL_SIDES, LOGICAL_SIDES %>
-<% data.new_style_struct("Position", inherited=False) %>
-
// "top" / "left" / "bottom" / "right"
% for side in PHYSICAL_SIDES:
${helpers.predefined_type(
side,
"LengthPercentageOrAuto",
"computed::LengthPercentageOrAuto::auto()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://www.w3.org/TR/CSS2/visuren.html#propdef-%s" % side,
animation_value_type="ComputedValue",
allow_quirks="Yes",
@@ -29,7 +26,7 @@
"inset-%s" % side,
"LengthPercentageOrAuto",
"computed::LengthPercentageOrAuto::auto()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical-props/#propdef-inset-%s" % side,
animation_value_type="ComputedValue",
logical=True,
@@ -42,7 +39,7 @@ ${helpers.predefined_type(
"z-index",
"ZIndex",
"computed::ZIndex::auto()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://www.w3.org/TR/CSS2/visuren.html#z-index",
animation_value_type="ComputedValue",
affects="paint",
@@ -55,8 +52,8 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"flex-direction",
"row row-reverse column column-reverse",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
spec="https://drafts.csswg.org/css-flexbox/#flex-direction-property",
extra_prefixes="webkit",
animation_value_type="discrete",
@@ -68,8 +65,8 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"flex-wrap",
"nowrap wrap wrap-reverse",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
spec="https://drafts.csswg.org/css-flexbox/#flex-wrap-property",
extra_prefixes="webkit",
animation_value_type="discrete",
@@ -78,12 +75,13 @@ ${helpers.single_keyword(
affects="layout",
)}
-% if engine == "servo-2013":
+% if engine in "servo":
// FIXME: Update Servo to support the same Syntax as Gecko.
${helpers.single_keyword(
"justify-content",
"flex-start stretch flex-end center space-between space-around",
- engines="servo-2013",
+ engines="servo",
+ servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
animation_value_type="discrete",
@@ -117,12 +115,13 @@ ${helpers.single_keyword(
)}
% endif
-% if engine in ["servo-2013", "servo-2020"]:
+% if engine == "servo":
// FIXME: Update Servo to support the same Syntax as Gecko.
${helpers.single_keyword(
"align-content",
"stretch flex-start flex-end center space-between space-around",
- engines="servo-2013",
+ engines="servo",
+ servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
animation_value_type="discrete",
@@ -133,8 +132,8 @@ ${helpers.single_keyword(
${helpers.single_keyword(
"align-items",
"stretch flex-start flex-end center baseline",
- engines="servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="servo",
+ servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#align-items-property",
animation_value_type="discrete",
@@ -195,8 +194,8 @@ ${helpers.predefined_type(
"flex-grow",
"NonNegativeNumber",
"From::from(0.0)",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property",
extra_prefixes="webkit",
animation_value_type="NonNegativeNumber",
@@ -208,8 +207,8 @@ ${helpers.predefined_type(
"flex-shrink",
"NonNegativeNumber",
"From::from(1.0)",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
spec="https://drafts.csswg.org/css-flexbox/#flex-shrink-property",
extra_prefixes="webkit",
animation_value_type="NonNegativeNumber",
@@ -218,13 +217,13 @@ ${helpers.predefined_type(
)}
// https://drafts.csswg.org/css-align/#align-self-property
-% if engine in ["servo-2013", "servo-2020"]:
+% if engine == "servo":
// FIXME: Update Servo to support the same syntax as Gecko.
${helpers.single_keyword(
"align-self",
"auto stretch flex-start flex-end center baseline",
- engines="servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="servo",
+ servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self",
animation_value_type="discrete",
@@ -260,8 +259,8 @@ ${helpers.predefined_type(
"order",
"Integer",
"0",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-flexbox/#order-property",
@@ -273,8 +272,8 @@ ${helpers.predefined_type(
"flex-basis",
"FlexBasis",
"computed::FlexBasis::auto()",
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
extra_prefixes="webkit",
animation_value_type="FlexBasis",
@@ -294,7 +293,7 @@ ${helpers.predefined_type(
size,
"Size",
"computed::Size::auto()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
logical=logical,
logical_group="size",
allow_quirks="No" if logical else "Yes",
@@ -308,7 +307,7 @@ ${helpers.predefined_type(
"min-%s" % size,
"Size",
"computed::Size::auto()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
logical=logical,
logical_group="min-size",
allow_quirks="No" if logical else "Yes",
@@ -321,7 +320,7 @@ ${helpers.predefined_type(
"max-%s" % size,
"MaxSize",
"computed::MaxSize::none()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
logical=logical,
logical_group="max-size",
allow_quirks="No" if logical else "Yes",
@@ -335,7 +334,7 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"box-sizing",
"content-box border-box",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
extra_prefixes="moz:layout.css.prefixes.box-sizing webkit",
spec="https://drafts.csswg.org/css-ui/#propdef-box-sizing",
gecko_enum_prefix="StyleBoxSizing",
@@ -436,9 +435,9 @@ ${helpers.predefined_type(
"column-gap",
"length::NonNegativeLengthPercentageOrNormal",
"computed::length::NonNegativeLengthPercentageOrNormal::normal()",
- engines="gecko servo-2013",
+ engines="gecko servo",
aliases="grid-column-gap" if engine == "gecko" else "",
- servo_2013_pref="layout.columns.enabled",
+ servo_pref="layout.columns.enabled",
spec="https://drafts.csswg.org/css-align-3/#propdef-column-gap",
animation_value_type="NonNegativeLengthPercentageOrNormal",
servo_restyle_damage="reflow",
@@ -462,7 +461,8 @@ ${helpers.predefined_type(
"aspect-ratio",
"AspectRatio",
"computed::AspectRatio::auto()",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-sizing-4/#aspect-ratio",
servo_restyle_damage="reflow",
diff --git a/servo/components/style/properties/longhands/svg.mako.rs b/servo/components/style/properties/longhands/svg.mako.rs
index 10788d4802..12998d553b 100644
--- a/servo/components/style/properties/longhands/svg.mako.rs
+++ b/servo/components/style/properties/longhands/svg.mako.rs
@@ -4,8 +4,6 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("SVG", inherited=False, gecko_name="SVGReset") %>
-
${helpers.single_keyword(
"vector-effect",
"none non-scaling-stroke",
diff --git a/servo/components/style/properties/longhands/table.mako.rs b/servo/components/style/properties/longhands/table.mako.rs
index 3a756636ad..059838bac1 100644
--- a/servo/components/style/properties/longhands/table.mako.rs
+++ b/servo/components/style/properties/longhands/table.mako.rs
@@ -4,12 +4,11 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% data.new_style_struct("Table", inherited=False) %>
-
${helpers.single_keyword(
"table-layout",
"auto fixed",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
gecko_ffi_name="mLayoutStrategy",
animation_value_type="discrete",
gecko_enum_prefix="StyleTableLayout",
diff --git a/servo/components/style/properties/longhands/text.mako.rs b/servo/components/style/properties/longhands/text.mako.rs
index 0ee8ba3168..68b8ff3ceb 100644
--- a/servo/components/style/properties/longhands/text.mako.rs
+++ b/servo/components/style/properties/longhands/text.mako.rs
@@ -3,15 +3,13 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import Method %>
-
-<% data.new_style_struct("Text", inherited=False, gecko_name="TextReset") %>
${helpers.predefined_type(
"text-overflow",
"TextOverflow",
"computed::TextOverflow::get_initial_value()",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
animation_value_type="discrete",
boxed=True,
spec="https://drafts.csswg.org/css-ui/#propdef-text-overflow",
@@ -22,7 +20,8 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"unicode-bidi",
"normal embed isolate bidi-override isolate-override plaintext",
- engines="gecko servo-2013",
+ engines="gecko servo",
+ servo_pref="layout.legacy_layout",
gecko_enum_prefix="StyleUnicodeBidi",
animation_value_type="none",
spec="https://drafts.csswg.org/css-writing-modes/#propdef-unicode-bidi",
@@ -34,7 +33,7 @@ ${helpers.predefined_type(
"text-decoration-line",
"TextDecorationLine",
"specified::TextDecorationLine::none()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::TextDecorationLine::none()",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-line",
@@ -45,7 +44,7 @@ ${helpers.predefined_type(
${helpers.single_keyword(
"text-decoration-style",
"solid double dotted dashed wavy -moz-none",
- engines="gecko servo-2020",
+ engines="gecko servo",
gecko_enum_prefix="StyleTextDecorationStyle",
animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style",
@@ -56,7 +55,7 @@ ${helpers.predefined_type(
"text-decoration-color",
"Color",
"computed_value::T::currentcolor()",
- engines="gecko servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Color::currentcolor()",
animation_value_type="AnimatedColor",
ignored_when_colors_disabled=True,
diff --git a/servo/components/style/properties/longhands/ui.mako.rs b/servo/components/style/properties/longhands/ui.mako.rs
index 58006e0d65..762cb64e9a 100644
--- a/servo/components/style/properties/longhands/ui.mako.rs
+++ b/servo/components/style/properties/longhands/ui.mako.rs
@@ -3,11 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import DEFAULT_RULES_EXCEPT_KEYFRAME, Method %>
-
-// CSS Basic User Interface Module Level 1
-// https://drafts.csswg.org/css-ui-3/
-<% data.new_style_struct("UI", inherited=False, gecko_name="UIReset") %>
+<% from data import DEFAULT_RULES_EXCEPT_KEYFRAME %>
// TODO spec says that UAs should not support this
// we should probably remove from gecko (https://bugzilla.mozilla.org/show_bug.cgi?id=1328331)
@@ -145,7 +141,7 @@ ${helpers.predefined_type(
"transition-duration",
"Time",
"computed::Time::zero()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Time::zero()",
parse_method="parse_non_negative",
vector=True,
@@ -160,7 +156,7 @@ ${helpers.predefined_type(
"transition-timing-function",
"TimingFunction",
"computed::TimingFunction::ease()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::TimingFunction::ease()",
vector=True,
need_index=True,
@@ -174,7 +170,7 @@ ${helpers.predefined_type(
"transition-property",
"TransitionProperty",
"computed::TransitionProperty::all()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::TransitionProperty::all()",
vector=True,
none_value="computed::TransitionProperty::none()",
@@ -189,7 +185,7 @@ ${helpers.predefined_type(
"transition-delay",
"Time",
"computed::Time::zero()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Time::zero()",
vector=True,
need_index=True,
@@ -219,7 +215,7 @@ ${helpers.predefined_type(
"animation-name",
"AnimationName",
"computed::AnimationName::none()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::AnimationName::none()",
vector=True,
need_index=True,
@@ -234,7 +230,7 @@ ${helpers.predefined_type(
"animation-duration",
"Time",
"computed::Time::zero()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Time::zero()",
parse_method="parse_non_negative",
vector=True,
@@ -251,7 +247,7 @@ ${helpers.predefined_type(
"animation-timing-function",
"TimingFunction",
"computed::TimingFunction::ease()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::TimingFunction::ease()",
vector=True,
need_index=True,
@@ -265,7 +261,7 @@ ${helpers.predefined_type(
"animation-iteration-count",
"AnimationIterationCount",
"computed::AnimationIterationCount::one()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::AnimationIterationCount::one()",
vector=True,
need_index=True,
@@ -280,7 +276,7 @@ ${helpers.predefined_type(
"animation-direction",
"AnimationDirection",
"computed::AnimationDirection::Normal",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::AnimationDirection::Normal",
vector=True,
need_index=True,
@@ -295,7 +291,7 @@ ${helpers.predefined_type(
"animation-play-state",
"AnimationPlayState",
"computed::AnimationPlayState::Running",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="computed::AnimationPlayState::Running",
vector=True,
need_index=True,
@@ -310,7 +306,7 @@ ${helpers.predefined_type(
"animation-fill-mode",
"AnimationFillMode",
"computed::AnimationFillMode::None",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="computed::AnimationFillMode::None",
vector=True,
need_index=True,
@@ -325,12 +321,13 @@ ${helpers.predefined_type(
"animation-composition",
"AnimationComposition",
"computed::AnimationComposition::Replace",
- engines="gecko",
+ engines="gecko servo",
initial_specified_value="computed::AnimationComposition::Replace",
vector=True,
need_index=True,
animation_value_type="none",
gecko_pref="layout.css.animation-composition.enabled",
+ servo_pref="layout.unimplemented",
spec="https://drafts.csswg.org/css-animations-2/#animation-composition",
affects="",
)}
@@ -339,7 +336,7 @@ ${helpers.predefined_type(
"animation-delay",
"Time",
"computed::Time::zero()",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
initial_specified_value="specified::Time::zero()",
vector=True,
need_index=True,
@@ -354,7 +351,8 @@ ${helpers.predefined_type(
"animation-timeline",
"AnimationTimeline",
"computed::AnimationTimeline::auto()",
- engines="gecko",
+ engines="gecko servo",
+ servo_pref="layout.unimplemented",
initial_specified_value="specified::AnimationTimeline::auto()",
vector=True,
need_index=True,
diff --git a/servo/components/style/properties/longhands/xul.mako.rs b/servo/components/style/properties/longhands/xul.mako.rs
index 8974ac30dc..f9de8eb239 100644
--- a/servo/components/style/properties/longhands/xul.mako.rs
+++ b/servo/components/style/properties/longhands/xul.mako.rs
@@ -3,10 +3,6 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
-<% from data import Method %>
-
-// Non-standard properties that Gecko uses for XUL elements.
-<% data.new_style_struct("XUL", inherited=False) %>
${helpers.single_keyword(
"-moz-box-align",
diff --git a/servo/components/style/properties/mod.rs b/servo/components/style/properties/mod.rs
index 7adb6d4ae6..4a08d67f77 100644
--- a/servo/components/style/properties/mod.rs
+++ b/servo/components/style/properties/mod.rs
@@ -17,12 +17,6 @@ pub use self::generated::*;
#[deny(missing_docs)]
pub mod generated {
include!(concat!(env!("OUT_DIR"), "/properties.rs"));
-
- #[cfg(feature = "gecko")]
- #[allow(unsafe_code, missing_docs)]
- pub mod gecko {
- include!(concat!(env!("OUT_DIR"), "/gecko_properties.rs"));
- }
}
use crate::custom_properties::{self, ComputedCustomProperties};
@@ -1040,7 +1034,7 @@ impl<'a> PropertyDeclarationId<'a> {
pub fn is_discrete_animatable(&self) -> bool {
match self {
Self::Longhand(longhand) => longhand.is_discrete_animatable(),
- // TODO(bug 1846516): Refine this?
+ // TODO(bug 1885995): Refine this.
Self::Custom(_) => true,
}
}
diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs
index b08314d7d5..e438967c35 100644
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -87,10 +87,19 @@ macro_rules! expanded {
#[allow(missing_docs)]
pub mod longhands {
% for style_struct in data.style_structs:
- include!("${repr(os.path.join(OUT_DIR, 'longhands/{}.rs'.format(style_struct.name_lower)))[1:-1]}");
+ <% data.current_style_struct = style_struct %>
+ <%include file="/longhands/${style_struct.name_lower}.mako.rs" />
% endfor
}
+
+#[cfg(feature = "gecko")]
+#[allow(unsafe_code, missing_docs)]
+pub mod gecko {
+ <%include file="/gecko.mako.rs" />
+}
+
+
macro_rules! unwrap_or_initial {
($prop: ident) => (unwrap_or_initial!($prop, $prop));
($prop: ident, $expr: expr) =>
@@ -107,7 +116,7 @@ pub mod shorthands {
use crate::values::specified;
% for style_struct in data.style_structs:
- include!("${repr(os.path.join(OUT_DIR, 'shorthands/{}.rs'.format(style_struct.name_lower)))[1:-1]}");
+ <%include file="/shorthands/${style_struct.name_lower}.mako.rs" />
% endfor
// We didn't define the 'all' shorthand using the regular helpers:shorthand
@@ -142,7 +151,7 @@ pub mod shorthands {
data.declare_shorthand(
"all",
logical_longhands + other_longhands,
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-cascade-3/#all-shorthand"
)
ALL_SHORTHAND_LEN = len(logical_longhands) + len(other_longhands);
@@ -505,8 +514,7 @@ impl NonCustomPropertyId {
}] = [
% for property in data.longhands + data.shorthands + data.all_aliases():
<%
- attrs = {"servo-2013": "servo_2013_pref", "servo-2020": "servo_2020_pref"}
- pref = getattr(property, attrs[engine])
+ pref = getattr(property, "servo_pref")
%>
% if pref:
Some("${pref}"),
@@ -2482,7 +2490,7 @@ impl<'a> StyleBuilder<'a> {
}
% endif
- % if not property.is_vector or property.simple_vector_bindings or engine in ["servo-2013", "servo-2020"]:
+ % if not property.is_vector or property.simple_vector_bindings or engine == "servo":
/// Set the `${property.ident}` to the computed value `value`.
#[allow(non_snake_case)]
pub fn set_${property.ident}(
@@ -2736,7 +2744,13 @@ impl<'a> StyleBuilder<'a> {
if matches!(line_height, computed::LineHeight::Normal) {
self.add_flags(flag);
}
- device.calc_line_height(&font, writing_mode, None)
+ let lh = device.calc_line_height(&font, writing_mode, None);
+ if line_height_base == LineHeightBase::InheritedStyle {
+ // Apply our own zoom if our style source is the parent style.
+ computed::NonNegativeLength::new(self.get_box().clone_zoom().zoom(lh.px()))
+ } else {
+ lh
+ }
}
/// And access to inherited style structs.
@@ -2932,7 +2946,7 @@ const_assert!(std::mem::size_of::<longhands::${longhand.ident}::SpecifiedValue>(
% endif
% endfor
-% if engine in ["servo-2013", "servo-2020"]:
+% if engine == "servo":
% for effect_name in ["repaint", "reflow_out_of_flow", "reflow", "rebuild_and_reflow_inline", "rebuild_and_reflow"]:
macro_rules! restyle_damage_${effect_name} {
($old: ident, $new: ident, $damage: ident, [ $($effect:expr),* ]) => ({
diff --git a/servo/components/style/properties/shorthands/background.mako.rs b/servo/components/style/properties/shorthands/background.mako.rs
index 08838233f6..5fee5cb2b0 100644
--- a/servo/components/style/properties/shorthands/background.mako.rs
+++ b/servo/components/style/properties/shorthands/background.mako.rs
@@ -6,7 +6,7 @@
// TODO: other background-* properties
<%helpers:shorthand name="background"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="background-color background-position-x background-position-y background-repeat
background-attachment background-image background-size background-origin
background-clip"
@@ -230,7 +230,7 @@
</%helpers:shorthand>
<%helpers:shorthand name="background-position"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
flags="SHORTHAND_IN_GETCS"
sub_properties="background-position-x background-position-y"
spec="https://drafts.csswg.org/css-backgrounds-4/#the-background-position">
diff --git a/servo/components/style/properties/shorthands/border.mako.rs b/servo/components/style/properties/shorthands/border.mako.rs
index c6a87f3197..2eeb691e24 100644
--- a/servo/components/style/properties/shorthands/border.mako.rs
+++ b/servo/components/style/properties/shorthands/border.mako.rs
@@ -9,7 +9,7 @@ ${helpers.four_sides_shorthand(
"border-color",
"border-%s-color",
"specified::Color::parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-backgrounds/#border-color",
allow_quirks="Yes",
)}
@@ -17,13 +17,13 @@ ${helpers.four_sides_shorthand(
${helpers.four_sides_shorthand(
"border-style",
"border-%s-style",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-backgrounds/#border-style",
)}
<%helpers:shorthand
name="border-width"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="${
' '.join('border-%s-width' % side
for side in PHYSICAL_SIDES)}"
@@ -104,7 +104,7 @@ pub fn parse_border<'i, 't>(
%>
<%helpers:shorthand
name="border-${side}"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="${' '.join(
'border-%s-%s' % (side, prop)
for prop in ['width', 'style', 'color']
@@ -139,7 +139,7 @@ pub fn parse_border<'i, 't>(
% endfor
<%helpers:shorthand name="border"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="${' '.join('border-%s-%s' % (side, prop)
for side in PHYSICAL_SIDES for prop in ['width', 'style', 'color']
)}
@@ -232,7 +232,7 @@ pub fn parse_border<'i, 't>(
<%helpers:shorthand
name="border-radius"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="${' '.join(
'border-%s-radius' % (corner)
for corner in ['top-left', 'top-right', 'bottom-right', 'bottom-left']
@@ -278,7 +278,8 @@ pub fn parse_border<'i, 't>(
<%helpers:shorthand
name="border-image"
- engines="gecko servo-2013"
+ engines="gecko servo"
+ servo_pref="layout.legacy_layout",
sub_properties="border-image-outset
border-image-repeat border-image-slice border-image-source border-image-width"
extra_prefixes="moz:layout.css.prefixes.border-image webkit"
@@ -402,7 +403,7 @@ pub fn parse_border<'i, 't>(
spec = "https://drafts.csswg.org/css-logical/#propdef-border-%s-%s" % (axis, prop)
%>
<%helpers:shorthand
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
name="border-${axis}-${prop}"
sub_properties="${' '.join(
'border-%s-%s-%s' % (axis, side, prop)
@@ -448,7 +449,7 @@ pub fn parse_border<'i, 't>(
%>
<%helpers:shorthand
name="border-${axis}"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="${' '.join(
'border-%s-%s-width' % (axis, side)
for side in ['start', 'end']
diff --git a/servo/components/style/properties/shorthands/box.mako.rs b/servo/components/style/properties/shorthands/box.mako.rs
index f644687dc0..078a511ae9 100644
--- a/servo/components/style/properties/shorthands/box.mako.rs
+++ b/servo/components/style/properties/shorthands/box.mako.rs
@@ -8,7 +8,7 @@ ${helpers.two_properties_shorthand(
"overflow",
"overflow-x",
"overflow-y",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
flags="SHORTHAND_IN_GETCS",
spec="https://drafts.csswg.org/css-overflow/#propdef-overflow",
)}
@@ -159,13 +159,7 @@ ${helpers.two_properties_shorthand(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
- let offset_position =
- if static_prefs::pref!("layout.css.motion-path-offset-position.enabled") {
- input.try_parse(|i| OffsetPosition::parse(context, i)).ok()
- } else {
- None
- };
-
+ let offset_position = input.try_parse(|i| OffsetPosition::parse(context, i)).ok();
let offset_path = input.try_parse(|i| OffsetPath::parse(context, i)).ok();
// Must have one of [offset-position, offset-path].
@@ -212,24 +206,19 @@ ${helpers.two_properties_shorthand(
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
- if let Some(offset_position) = self.offset_position {
- // The basic concept is: we must serialize offset-position or offset-path group.
- // offset-path group means "offset-path offset-distance offset-rotate".
- let must_serialize_path = *self.offset_path != OffsetPath::None
- || (!self.offset_distance.is_zero() || !self.offset_rotate.is_auto());
- let position_is_default = matches!(offset_position, OffsetPosition::Normal);
- if !position_is_default || !must_serialize_path {
- offset_position.to_css(dest)?;
- }
+ // The basic concept is: we must serialize offset-position or offset-path group.
+ // offset-path group means "offset-path offset-distance offset-rotate".
+ let must_serialize_path = *self.offset_path != OffsetPath::None
+ || (!self.offset_distance.is_zero() || !self.offset_rotate.is_auto());
+ let position_is_default = matches!(self.offset_position, OffsetPosition::Normal);
+ if !position_is_default || !must_serialize_path {
+ self.offset_position.to_css(dest)?;
+ }
- if must_serialize_path {
- if !position_is_default {
- dest.write_char(' ')?;
- }
- self.offset_path.to_css(dest)?;
+ if must_serialize_path {
+ if !position_is_default {
+ dest.write_char(' ')?;
}
- } else {
- // If the pref is off, we always show offset-path.
self.offset_path.to_css(dest)?;
}
diff --git a/servo/components/style/properties/shorthands/column.mako.rs b/servo/components/style/properties/shorthands/column.mako.rs
index 3740775a7e..4cf9a8d786 100644
--- a/servo/components/style/properties/shorthands/column.mako.rs
+++ b/servo/components/style/properties/shorthands/column.mako.rs
@@ -5,9 +5,9 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="columns"
- engines="gecko servo-2013"
+ engines="gecko servo"
sub_properties="column-width column-count"
- servo_2013_pref="layout.columns.enabled",
+ servo_pref="layout.columns.enabled"
spec="https://drafts.csswg.org/css-multicol/#propdef-columns">
use crate::properties::longhands::{column_count, column_width};
diff --git a/servo/components/style/properties/shorthands/counters.mako.rs b/servo/components/style/properties/shorthands/counters.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/counters.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
diff --git a/servo/components/style/properties/shorthands/effects.mako.rs b/servo/components/style/properties/shorthands/effects.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/effects.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
diff --git a/servo/components/style/properties/shorthands/font.mako.rs b/servo/components/style/properties/shorthands/font.mako.rs
index 17dcf9d926..aaf0895aa5 100644
--- a/servo/components/style/properties/shorthands/font.mako.rs
+++ b/servo/components/style/properties/shorthands/font.mako.rs
@@ -7,7 +7,7 @@
<%helpers:shorthand
name="font"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="
font-style
font-variant-caps
@@ -321,7 +321,8 @@
</%helpers:shorthand>
<%helpers:shorthand name="font-variant"
- engines="gecko servo-2013"
+ engines="gecko servo"
+ servo_pref="layout.legacy_layout",
flags="SHORTHAND_IN_GETCS"
sub_properties="font-variant-caps
${'font-variant-alternates' if engine == 'gecko' else ''}
diff --git a/servo/components/style/properties/shorthands/inherited_box.mako.rs b/servo/components/style/properties/shorthands/inherited_box.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/inherited_box.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
diff --git a/servo/components/style/properties/shorthands/inherited_table.mako.rs b/servo/components/style/properties/shorthands/inherited_table.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/inherited_table.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
diff --git a/servo/components/style/properties/shorthands/inherited_ui.mako.rs b/servo/components/style/properties/shorthands/inherited_ui.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/inherited_ui.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
diff --git a/servo/components/style/properties/shorthands/list.mako.rs b/servo/components/style/properties/shorthands/list.mako.rs
index 2e234e3d8f..183c5ab5da 100644
--- a/servo/components/style/properties/shorthands/list.mako.rs
+++ b/servo/components/style/properties/shorthands/list.mako.rs
@@ -5,7 +5,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="list-style"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
sub_properties="list-style-position list-style-image list-style-type"
spec="https://drafts.csswg.org/css-lists/#propdef-list-style">
use crate::properties::longhands::{list_style_image, list_style_position, list_style_type};
@@ -110,7 +110,11 @@
use longhands::list_style_type::SpecifiedValue as ListStyleType;
use longhands::list_style_image::SpecifiedValue as ListStyleImage;
let mut have_one_non_initial_value = false;
- if self.list_style_position != &ListStylePosition::Outside {
+ #[cfg(feature = "gecko")]
+ let position_is_initial = self.list_style_position == &ListStylePosition::Outside;
+ #[cfg(feature = "servo")]
+ let position_is_initial = matches!(self.list_style_position, None | Some(&ListStylePosition::Outside));
+ if !position_is_initial {
self.list_style_position.to_css(dest)?;
have_one_non_initial_value = true;
}
@@ -121,7 +125,11 @@
self.list_style_image.to_css(dest)?;
have_one_non_initial_value = true;
}
- if self.list_style_type != &ListStyleType::disc() {
+ #[cfg(feature = "gecko")]
+ let type_is_initial = self.list_style_type == &ListStyleType::disc();
+ #[cfg(feature = "servo")]
+ let type_is_initial = self.list_style_type == &ListStyleType::Disc;
+ if !type_is_initial {
if have_one_non_initial_value {
dest.write_char(' ')?;
}
@@ -129,7 +137,14 @@
have_one_non_initial_value = true;
}
if !have_one_non_initial_value {
+ #[cfg(feature = "gecko")]
self.list_style_position.to_css(dest)?;
+ #[cfg(feature = "servo")]
+ if let Some(position) = self.list_style_position {
+ position.to_css(dest)?;
+ } else {
+ self.list_style_type.to_css(dest)?;
+ }
}
Ok(())
}
diff --git a/servo/components/style/properties/shorthands/margin.mako.rs b/servo/components/style/properties/shorthands/margin.mako.rs
index 6b5bf7e467..ba994316a2 100644
--- a/servo/components/style/properties/shorthands/margin.mako.rs
+++ b/servo/components/style/properties/shorthands/margin.mako.rs
@@ -9,7 +9,7 @@ ${helpers.four_sides_shorthand(
"margin",
"margin-%s",
"specified::LengthPercentageOrAuto::parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-box/#propdef-margin",
rule_types_allowed=DEFAULT_RULES_AND_PAGE,
allow_quirks="Yes",
@@ -20,7 +20,7 @@ ${helpers.two_properties_shorthand(
"margin-block-start",
"margin-block-end",
"specified::LengthPercentageOrAuto::parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical/#propdef-margin-block"
)}
@@ -29,7 +29,7 @@ ${helpers.two_properties_shorthand(
"margin-inline-start",
"margin-inline-end",
"specified::LengthPercentageOrAuto::parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical/#propdef-margin-inline"
)}
diff --git a/servo/components/style/properties/shorthands/outline.mako.rs b/servo/components/style/properties/shorthands/outline.mako.rs
index 6ee8ed22c9..ff77e1175e 100644
--- a/servo/components/style/properties/shorthands/outline.mako.rs
+++ b/servo/components/style/properties/shorthands/outline.mako.rs
@@ -5,7 +5,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="outline"
- engines="gecko servo-2013"
+ engines="gecko servo"
sub_properties="outline-color outline-style outline-width"
spec="https://drafts.csswg.org/css-ui/#propdef-outline">
use crate::properties::longhands::{outline_color, outline_width, outline_style};
diff --git a/servo/components/style/properties/shorthands/padding.mako.rs b/servo/components/style/properties/shorthands/padding.mako.rs
index 11ddfed3b1..dad0193708 100644
--- a/servo/components/style/properties/shorthands/padding.mako.rs
+++ b/servo/components/style/properties/shorthands/padding.mako.rs
@@ -8,7 +8,7 @@ ${helpers.four_sides_shorthand(
"padding",
"padding-%s",
"specified::NonNegativeLengthPercentage::parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-box-3/#propdef-padding",
allow_quirks="Yes",
)}
@@ -18,7 +18,7 @@ ${helpers.two_properties_shorthand(
"padding-block-start",
"padding-block-end",
"specified::NonNegativeLengthPercentage::parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical/#propdef-padding-block"
)}
@@ -27,7 +27,7 @@ ${helpers.two_properties_shorthand(
"padding-inline-start",
"padding-inline-end",
"specified::NonNegativeLengthPercentage::parse",
- engines="gecko servo-2013 servo-2020",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical/#propdef-padding-inline"
)}
diff --git a/servo/components/style/properties/shorthands/page.mako.rs b/servo/components/style/properties/shorthands/page.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/page.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
diff --git a/servo/components/style/properties/shorthands/position.mako.rs b/servo/components/style/properties/shorthands/position.mako.rs
index ed7df5e27a..ac09bb27d6 100644
--- a/servo/components/style/properties/shorthands/position.mako.rs
+++ b/servo/components/style/properties/shorthands/position.mako.rs
@@ -5,8 +5,8 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="flex-flow"
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
sub_properties="flex-direction flex-wrap"
extra_prefixes="webkit"
spec="https://drafts.csswg.org/css-flexbox/#flex-flow-property">
@@ -60,8 +60,8 @@
</%helpers:shorthand>
<%helpers:shorthand name="flex"
- engines="gecko servo-2013 servo-2020",
- servo_2020_pref="layout.flexbox.enabled",
+ engines="gecko servo",
+ servo_pref="layout.flexbox.enabled",
sub_properties="flex-grow flex-shrink flex-basis"
extra_prefixes="webkit"
derive_serialize="True"
@@ -858,7 +858,7 @@ ${helpers.four_sides_shorthand(
"inset",
"%s",
"specified::LengthPercentageOrAuto::parse",
- engines="gecko servo-2013",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical/#propdef-inset",
allow_quirks="No",
)}
@@ -868,7 +868,7 @@ ${helpers.two_properties_shorthand(
"inset-block-start",
"inset-block-end",
"specified::LengthPercentageOrAuto::parse",
- engines="gecko servo-2013",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical/#propdef-inset-block"
)}
@@ -877,7 +877,7 @@ ${helpers.two_properties_shorthand(
"inset-inline-start",
"inset-inline-end",
"specified::LengthPercentageOrAuto::parse",
- engines="gecko servo-2013",
+ engines="gecko servo",
spec="https://drafts.csswg.org/css-logical/#propdef-inset-inline"
)}
diff --git a/servo/components/style/properties/shorthands/table.mako.rs b/servo/components/style/properties/shorthands/table.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/table.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
diff --git a/servo/components/style/properties/shorthands/text.mako.rs b/servo/components/style/properties/shorthands/text.mako.rs
index 5b071be2c4..a913f81875 100644
--- a/servo/components/style/properties/shorthands/text.mako.rs
+++ b/servo/components/style/properties/shorthands/text.mako.rs
@@ -5,7 +5,7 @@
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="text-decoration"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
flags="SHORTHAND_IN_GETCS"
sub_properties="text-decoration-line
${' text-decoration-style text-decoration-color text-decoration-thickness' if engine == 'gecko' else ''}"
diff --git a/servo/components/style/properties/shorthands/ui.mako.rs b/servo/components/style/properties/shorthands/ui.mako.rs
index 4a27d5e003..1915c65a63 100644
--- a/servo/components/style/properties/shorthands/ui.mako.rs
+++ b/servo/components/style/properties/shorthands/ui.mako.rs
@@ -18,7 +18,7 @@ macro_rules! try_parse_one {
}
<%helpers:shorthand name="transition"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
extra_prefixes="moz:layout.css.prefixes.transitions webkit"
sub_properties="transition-property transition-duration
transition-timing-function
@@ -204,7 +204,7 @@ macro_rules! try_parse_one {
</%helpers:shorthand>
<%helpers:shorthand name="animation"
- engines="gecko servo-2013 servo-2020"
+ engines="gecko servo"
extra_prefixes="moz:layout.css.prefixes.animations webkit"
sub_properties="animation-name animation-duration
animation-timing-function animation-delay
@@ -295,6 +295,13 @@ macro_rules! try_parse_one {
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
+ use crate::values::specified::easing::TimingFunction;
+ use crate::values::specified::{
+ AnimationDirection, AnimationFillMode, AnimationPlayState,
+ };
+ use crate::Zero;
+ use style_traits::values::SequenceWriter;
+
let len = self.animation_name.0.len();
// There should be at least one declared value
if len == 0 {
@@ -320,28 +327,83 @@ macro_rules! try_parse_one {
dest.write_str(", ")?;
}
- % for name in props[2:]:
- self.animation_${name}.0[i].to_css(dest)?;
- dest.write_char(' ')?;
+ // We follow the order of this syntax:
+ // <single-animation> =
+ // <animation-duration> ||
+ // <easing-function> ||
+ // <animation-delay> ||
+ // <single-animation-iteration-count> ||
+ // <single-animation-direction> ||
+ // <single-animation-fill-mode> ||
+ // <single-animation-play-state> ||
+ // [ none | <keyframes-name> ] ||
+ // <single-animation-timeline>
+ //
+ // https://drafts.csswg.org/css-animations-2/#animation-shorthand
+ //
+ // FIXME: Bug 1804574. The initial value of duration should be auto, per
+ // css-animations-2.
+ let has_duration = !self.animation_duration.0[i].is_zero();
+ let has_timing_function = !self.animation_timing_function.0[i].is_ease();
+ let has_delay = !self.animation_delay.0[i].is_zero();
+ let has_iteration_count = !self.animation_iteration_count.0[i].is_one();
+ let has_direction =
+ !matches!(self.animation_direction.0[i], AnimationDirection::Normal);
+ let has_fill_mode =
+ !matches!(self.animation_fill_mode.0[i], AnimationFillMode::None);
+ let has_play_state =
+ !matches!(self.animation_play_state.0[i], AnimationPlayState::Running);
+ let animation_name = &self.animation_name.0[i];
+ let has_name = !animation_name.is_none();
+ let has_timeline = match self.animation_timeline {
+ Some(timeline) => !timeline.0[i].is_auto(),
+ _ => false,
+ };
+
+ let mut writer = SequenceWriter::new(dest, " ");
+
+ // To avoid ambiguity, we have to serialize duration if both duration is initial
+ // but delay is not. (In other words, it's ambiguous if we serialize delay only.)
+ if has_duration || has_delay {
+ writer.item(&self.animation_duration.0[i])?;
+ }
+
+ if has_timing_function || TimingFunction::match_keywords(animation_name) {
+ writer.item(&self.animation_timing_function.0[i])?;
+ }
+
+ // For animation-delay and animation-iteration-count.
+ % for name in props[4:6]:
+ if has_${name} {
+ writer.item(&self.animation_${name}.0[i])?;
+ }
% endfor
- self.animation_name.0[i].to_css(dest)?;
+ if has_direction || AnimationDirection::match_keywords(animation_name) {
+ writer.item(&self.animation_direction.0[i])?;
+ }
+
+ if has_fill_mode || AnimationFillMode::match_keywords(animation_name) {
+ writer.item(&self.animation_fill_mode.0[i])?;
+ }
- // Based on the spec, the default values of other properties must be output in at
- // least the cases necessary to distinguish an animation-name. The serialization
- // order of animation-timeline is always later than animation-name, so it's fine
- // to not serialize it if it is the default value. It's still possible to
- // distinguish them (because we always serialize animation-name).
- // https://drafts.csswg.org/css-animations-1/#animation
- // https://drafts.csswg.org/css-animations-2/#typedef-single-animation
- //
- // Note: it's also fine to always serialize this. However, it seems Blink
- // doesn't serialize default animation-timeline now, so we follow the same rule.
- if let Some(ref timeline) = self.animation_timeline {
- if !timeline.0[i].is_auto() {
- dest.write_char(' ')?;
- timeline.0[i].to_css(dest)?;
- }
+ if has_play_state || AnimationPlayState::match_keywords(animation_name) {
+ writer.item(&self.animation_play_state.0[i])?;
+ }
+
+ // If all values are initial, we must serialize animation-name.
+ let has_any = {
+ has_timeline
+ % for name in props[2:]:
+ || has_${name}
+ % endfor
+ };
+ if has_name || !has_any {
+ writer.item(animation_name)?;
+ }
+
+ if has_timeline {
+ writer.item(&self.animation_timeline.unwrap().0[i])?;
}
}
Ok(())
diff --git a/servo/components/style/properties/shorthands/xul.mako.rs b/servo/components/style/properties/shorthands/xul.mako.rs
new file mode 100644
index 0000000000..daa3e8897c
--- /dev/null
+++ b/servo/components/style/properties/shorthands/xul.mako.rs
@@ -0,0 +1,3 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */