aboutsummaryrefslogtreecommitdiffstats
path: root/components/selectors/tree.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-12-10 14:23:27 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-12-14 06:28:11 +0100
commit7886e033aa7e813a9ed3becc456ee9ed059364cc (patch)
tree6ff62f4ec8593d29ef3e5fba392ee07304cb8b5c /components/selectors/tree.rs
parent0fa605d2439c4f640b7f180c18d768a7a14e7f1e (diff)
downloadservo-7886e033aa7e813a9ed3becc456ee9ed059364cc.tar.gz
servo-7886e033aa7e813a9ed3becc456ee9ed059364cc.zip
selectors: Add parsing support for ::slotted().
Without turning it on yet, of course. The reason why I didn't use the general PseudoElement mechanism is because this pseudo is a bit of its own thing, and I found easier to make ::selectors know about it (because you need to jump to the assigned slot) than the other way around. Also, we need to support ::slotted(..)::before and such, and supporting multiple pseudo-elements like that breaks some other invariants around the SelectorMap, and fixing those would require special-casing slotted a lot more in other parts of the code. Let me know if you think otherwise. I also don't like much the boolean tuple return value, but I plan to do some cleanup in the area in a bit, so it should go away soon, I'd hope.
Diffstat (limited to 'components/selectors/tree.rs')
-rw-r--r--components/selectors/tree.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/components/selectors/tree.rs b/components/selectors/tree.rs
index d050c23a470..7a83feb83d0 100644
--- a/components/selectors/tree.rs
+++ b/components/selectors/tree.rs
@@ -84,6 +84,13 @@ pub trait Element: Sized + Clone + Debug {
/// Whether this element is a `link`.
fn is_link(&self) -> bool;
+ /// Returns the assigned <slot> element this element is assigned to.
+ ///
+ /// Necessary for the `::slotted` pseudo-class.
+ fn assigned_slot(&self) -> Option<Self> {
+ None
+ }
+
fn has_id(&self,
id: &<Self::Impl as SelectorImpl>::Identifier,
case_sensitivity: CaseSensitivity)