diff --git a/Cargo.lock b/Cargo.lock index c23511fbdf5..1e328da1c3d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6687,7 +6687,7 @@ dependencies = [ [[package]] name = "selectors" version = "0.28.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "bitflags 2.9.1", "cssparser", @@ -6982,7 +6982,7 @@ dependencies = [ [[package]] name = "servo_arc" version = "0.4.1" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "serde", "stable_deref_trait", @@ -7446,7 +7446,7 @@ dependencies = [ [[package]] name = "stylo" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "app_units", "arrayvec", @@ -7503,7 +7503,7 @@ dependencies = [ [[package]] name = "stylo_atoms" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "string_cache", "string_cache_codegen", @@ -7512,12 +7512,12 @@ dependencies = [ [[package]] name = "stylo_config" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" [[package]] name = "stylo_derive" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "darling", "proc-macro2", @@ -7529,7 +7529,7 @@ dependencies = [ [[package]] name = "stylo_dom" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "bitflags 2.9.1", "stylo_malloc_size_of", @@ -7538,7 +7538,7 @@ dependencies = [ [[package]] name = "stylo_malloc_size_of" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "app_units", "cssparser", @@ -7555,12 +7555,12 @@ dependencies = [ [[package]] name = "stylo_static_prefs" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" [[package]] name = "stylo_traits" version = "0.3.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "app_units", "bitflags 2.9.1", @@ -7969,7 +7969,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "to_shmem" version = "0.2.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "cssparser", "servo_arc", @@ -7982,7 +7982,7 @@ dependencies = [ [[package]] name = "to_shmem_derive" version = "0.1.0" -source = "git+https://github.com/servo/stylo?branch=2025-05-01#15596275d9bdfcbfc584bdb6618fa2006ac38f29" +source = "git+https://github.com/servo/stylo?branch=2025-05-01#3a3663a3199282cb06889e48a427db76f320ddc3" dependencies = [ "darling", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index d5655dff3ef..5bd2c0d2188 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -225,14 +225,14 @@ codegen-units = 1 # Or for Stylo: # # [patch."https://github.com/servo/stylo"] -# selectors = { path = "../stylo/selectors" } -# servo_arc = { path = "../stylo/servo_arc" } -# stylo = { path = "../stylo/style" } -# stylo_atoms = { path = "../stylo/stylo_atoms" } -# stylo_config = { path = "../stylo/stylo_config" } -# stylo_dom = { path = "../stylo/stylo_dom" } -# stylo_malloc_size_of = { path = "../stylo/malloc_size_of" } -# stylo_traits = { path = "../stylo/style_traits" } +# selectors = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } +# servo_arc = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } +# stylo = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } +# stylo_atoms = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } +# stylo_config = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } +# stylo_dom = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } +# stylo_malloc_size_of = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } +# stylo_traits = { git = "https://github.com/simonwuelker/stylo", branch = "shadow-parts-exportparts" } # # Or for WebRender: # diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 4bb356826c3..a3477028a85 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -4226,6 +4226,7 @@ impl VirtualMethods for Element { local_name!("class") | local_name!("part") => { AttrValue::from_serialized_tokenlist(value.into()) }, + local_name!("exportparts") => AttrValue::from_shadow_parts(value.into()), _ => self .super_type() .unwrap() diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs index fd34d591f0c..62cfb5b9313 100644 --- a/components/script/layout_dom/element.rs +++ b/components/script/layout_dom/element.rs @@ -307,6 +307,21 @@ impl<'dom> style::dom::TElement for ServoLayoutElement<'dom> { } } + fn each_exported_part(&self, name: &AtomIdent, callback: F) + where + F: FnMut(&AtomIdent), + { + let Some(exported_parts) = self + .element + .get_attr_for_layout(&ns!(), &local_name!("exportparts")) + else { + return; + }; + exported_parts + .as_shadow_parts() + .for_each_exported_part(AtomIdent::cast(name), callback); + } + fn has_dirty_descendants(&self) -> bool { unsafe { self.as_node() @@ -751,8 +766,12 @@ impl<'dom> ::selectors::Element for ServoLayoutElement<'dom> { ) } - fn imported_part(&self, _: &AtomIdent) -> Option { - None + fn imported_part(&self, name: &AtomIdent) -> Option { + self.element + .get_attr_for_layout(&ns!(), &local_name!("exportparts"))? + .as_shadow_parts() + .imported_part(name) + .map(|import| AtomIdent::new(import.clone())) } #[inline] diff --git a/tests/wpt/meta/css/css-shadow-parts/both-part-and-exportparts.html.ini b/tests/wpt/meta/css/css-shadow-parts/both-part-and-exportparts.html.ini deleted file mode 100644 index 44fae3819a5..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/both-part-and-exportparts.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[both-part-and-exportparts.html] - [::part() rules match elements having both @part and @exportparts] - expected: FAIL diff --git a/tests/wpt/meta/css/css-shadow-parts/double-forward.html.ini b/tests/wpt/meta/css/css-shadow-parts/double-forward.html.ini deleted file mode 100644 index 2ca3e6ea37d..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/double-forward.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[double-forward.html] - [Part in inner host is forwarded through the middle host for styling by document style sheet] - expected: FAIL diff --git a/tests/wpt/meta/css/css-shadow-parts/exportparts-different-scope.html.ini b/tests/wpt/meta/css/css-shadow-parts/exportparts-different-scope.html.ini deleted file mode 100644 index b6e6d38d30c..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/exportparts-different-scope.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[exportparts-different-scope.html] - expected: FAIL diff --git a/tests/wpt/meta/css/css-shadow-parts/exportparts-multiple.html.ini b/tests/wpt/meta/css/css-shadow-parts/exportparts-multiple.html.ini deleted file mode 100644 index cb8e5c6ac20..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/exportparts-multiple.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[exportparts-multiple.html] - [Forwarding part under multiple names should work] - expected: FAIL diff --git a/tests/wpt/meta/css/css-shadow-parts/invalidation-complex-selector-forward.html.ini b/tests/wpt/meta/css/css-shadow-parts/invalidation-complex-selector-forward.html.ini deleted file mode 100644 index b016daa81eb..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/invalidation-complex-selector-forward.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[invalidation-complex-selector-forward.html] - [Part in selected host changed color] - expected: FAIL diff --git a/tests/wpt/meta/css/css-shadow-parts/precedence-part-vs-part.html.ini b/tests/wpt/meta/css/css-shadow-parts/precedence-part-vs-part.html.ini deleted file mode 100644 index 48b47fd2c73..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/precedence-part-vs-part.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[precedence-part-vs-part.html] - [Style from document overrides style from outer CE] - expected: FAIL diff --git a/tests/wpt/meta/css/css-shadow-parts/simple-forward-shorthand.html.ini b/tests/wpt/meta/css/css-shadow-parts/simple-forward-shorthand.html.ini deleted file mode 100644 index ea340dff75c..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/simple-forward-shorthand.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[simple-forward-shorthand.html] - [Part in inner host is forwarded, under the same name, for styling by document style sheet] - expected: FAIL diff --git a/tests/wpt/meta/css/css-shadow-parts/simple-forward.html.ini b/tests/wpt/meta/css/css-shadow-parts/simple-forward.html.ini deleted file mode 100644 index 757dfe7d435..00000000000 --- a/tests/wpt/meta/css/css-shadow-parts/simple-forward.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[simple-forward.html] - [Part in inner host is forwarded for styling by document style sheet] - expected: FAIL