From ddb4e369ddb8d9bb20142d34e320370cd3be196f Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 25 Jul 2019 19:39:32 +0200 Subject: [PATCH] Stylo: replace product={gecko,servo} with engine={gecko,servo-2013,servo-2020} Renaming the variable helped make sure I looked at every use. --- components/layout/Cargo.toml | 2 +- components/script/build.rs | 4 +- components/style/Cargo.toml | 3 +- components/style/build.rs | 20 ++- components/style/properties/build.py | 29 ++-- components/style/properties/cascade.rs | 9 +- components/style/properties/data.py | 155 +++++++++++------- components/style/properties/helpers.mako.rs | 71 ++++---- .../helpers/animated_properties.mako.rs | 6 +- .../properties/longhands/background.mako.rs | 15 +- .../style/properties/longhands/border.mako.rs | 23 ++- .../style/properties/longhands/box.mako.rs | 112 +++++++++---- .../style/properties/longhands/column.mako.rs | 18 +- .../properties/longhands/counters.mako.rs | 6 +- .../properties/longhands/effects.mako.rs | 12 +- .../style/properties/longhands/font.mako.rs | 59 ++++--- .../longhands/inherited_box.mako.rs | 22 ++- .../longhands/inherited_svg.mako.rs | 44 ++--- .../longhands/inherited_table.mako.rs | 5 + .../longhands/inherited_text.mako.rs | 61 ++++--- .../properties/longhands/inherited_ui.mako.rs | 13 +- .../style/properties/longhands/list.mako.rs | 26 ++- .../style/properties/longhands/margin.mako.rs | 6 +- .../properties/longhands/outline.mako.rs | 9 +- .../properties/longhands/padding.mako.rs | 6 +- .../properties/longhands/position.mako.rs | 69 ++++++-- .../style/properties/longhands/svg.mako.rs | 46 +++--- .../style/properties/longhands/table.mako.rs | 3 +- .../style/properties/longhands/text.mako.rs | 12 +- .../style/properties/longhands/ui.mako.rs | 18 +- .../style/properties/longhands/xul.mako.rs | 17 +- .../style/properties/properties.mako.rs | 46 ++++-- .../properties/shorthands/background.mako.rs | 2 + .../properties/shorthands/border.mako.rs | 48 ++++-- .../style/properties/shorthands/box.mako.rs | 12 +- .../properties/shorthands/column.mako.rs | 11 +- .../style/properties/shorthands/font.mako.rs | 74 +++++---- .../shorthands/inherited_svg.mako.rs | 7 +- .../shorthands/inherited_text.mako.rs | 9 +- .../style/properties/shorthands/list.mako.rs | 9 +- .../properties/shorthands/margin.mako.rs | 9 +- .../properties/shorthands/outline.mako.rs | 14 +- .../properties/shorthands/padding.mako.rs | 9 +- .../properties/shorthands/position.mako.rs | 83 ++++++---- .../style/properties/shorthands/svg.mako.rs | 6 +- .../style/properties/shorthands/text.mako.rs | 18 +- components/style/style_adjuster.rs | 2 +- components/style/values/computed/text.rs | 11 +- components/style/values/specified/border.rs | 7 + components/style/values/specified/box.rs | 48 +++++- python/servo/post_build_commands.py | 11 +- tests/unit/style/properties/scaffolding.rs | 2 +- 52 files changed, 870 insertions(+), 469 deletions(-) diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index 1f6027eab24..9fd616bd679 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -49,7 +49,7 @@ serde_json = "1.0" servo_config = {path = "../config"} servo_url = {path = "../url"} smallvec = { version = "0.6", features = ["std", "union"] } -style = {path = "../style", features = ["servo"]} +style = {path = "../style", features = ["servo", "servo-layout-2013"]} style_traits = {path = "../style_traits"} unicode-bidi = {version = "0.3", features = ["with_serde"]} unicode-script = {version = "0.3", features = ["harfbuzz"]} diff --git a/components/script/build.rs b/components/script/build.rs index 1af9fbf7648..d044b6e4fb4 100644 --- a/components/script/build.rs +++ b/components/script/build.rs @@ -42,9 +42,7 @@ fn main() { start.elapsed().as_secs() ); - let json = out_dir - .join("build") - .join("InterfaceObjectMapData.json"); + let json = out_dir.join("build").join("InterfaceObjectMapData.json"); let json: Value = serde_json::from_reader(File::open(&json).unwrap()).unwrap(); let mut map = phf_codegen::Map::new(); for (key, value) in json.as_object().unwrap() { diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index acce17d243b..9c39a957796 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -20,7 +20,8 @@ gecko = ["style_traits/gecko", "fallible/known_system_malloc", "bindgen", "regex servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5ever", "cssparser/serde", "encoding_rs", "malloc_size_of/servo", "arrayvec/use_union", "servo_url", "string_cache", "crossbeam-channel", "to_shmem/servo", "servo_arc/servo"] -"servo-layout-2020" = [] +servo-layout-2013 = [] +servo-layout-2020 = [] gecko_debug = [] gecko_refcount_logging = [] gecko_profiler = [] diff --git a/components/style/build.rs b/components/style/build.rs index 0ff8434fa1d..20b3bf5c79f 100644 --- a/components/style/build.rs +++ b/components/style/build.rs @@ -89,14 +89,19 @@ fn generate_properties() { let script = Path::new(&env::var_os("CARGO_MANIFEST_DIR").unwrap()) .join("properties") .join("build.py"); - let product = if cfg!(feature = "gecko") { - "gecko" - } else { - "servo" - }; + + #[cfg(feature = "gecko")] + let engine = "gecko"; + + #[cfg(feature = "servo-layout-2013")] + let engine = "servo-2013"; + + #[cfg(feature = "servo-layout-2020")] + let engine = "servo-2020"; + let status = Command::new(&*PYTHON) .arg(&script) - .arg(product) + .arg(engine) .arg("style-crate") .status() .unwrap(); @@ -117,6 +122,9 @@ fn main() { feature flags at the same time." ); } + if gecko && (cfg!(feature = "servo-layout-2013") || cfg!(feature = "servo-layout-2020")) { + panic!("The 'servo-layout-*' features can only be enabled together with 'servo'."); + } println!("cargo:rerun-if-changed=build.rs"); println!("cargo:out_dir={}", env::var("OUT_DIR").unwrap()); generate_properties(); diff --git a/components/style/properties/build.py b/components/style/properties/build.py index 6ee5220857c..186018e99a4 100644 --- a/components/style/properties/build.py +++ b/components/style/properties/build.py @@ -30,35 +30,36 @@ STYLE_STRUCT_LIST = [ "effects", "font", "inherited_box", + "inherited_svg", "inherited_table", "inherited_text", "inherited_ui", - "inherited_svg", "list", "margin", "outline", "padding", "position", + "svg", "table", "text", "ui", - "svg", "xul", ] def main(): - usage = ("Usage: %s [ servo | gecko ] [ style-crate | geckolib