aboutsummaryrefslogtreecommitdiffstats
path: root/components/selectors/tree.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2019-05-24 01:09:15 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2019-05-29 16:14:26 +0200
commit43444db8a80f8312122b6629cb7d050ac4f065c2 (patch)
treeb17b1760b64c94b3409851e3a6552a8e1a9da7ab /components/selectors/tree.rs
parent272d9758d7c4c07e2409d5e0ac7d5c152f49e7b6 (diff)
downloadservo-43444db8a80f8312122b6629cb7d050ac4f065c2.tar.gz
servo-43444db8a80f8312122b6629cb7d050ac4f065c2.zip
style: Cleanup selector-matching for nested pseudo-elements, match ::slotted correctly when there's no selector before it, and add tests.
D29542 fixed the bogus checks that was making nested pseudo-elements match author rules. This adds tests and ends up being just a cleanup, though as it turns out we it also fixes an issue with ::slotted() matched from Element.matches. Differential Revision: https://phabricator.services.mozilla.com/D27529
Diffstat (limited to 'components/selectors/tree.rs')
-rw-r--r--components/selectors/tree.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/components/selectors/tree.rs b/components/selectors/tree.rs
index 52599893d2f..611e40d6027 100644
--- a/components/selectors/tree.rs
+++ b/components/selectors/tree.rs
@@ -47,9 +47,13 @@ pub trait Element: Sized + Clone + Debug {
///
/// This is guaranteed to be called in a pseudo-element.
fn pseudo_element_originating_element(&self) -> Option<Self> {
+ debug_assert!(self.is_pseudo_element());
self.parent_element()
}
+ /// Whether we're matching on a pseudo-element.
+ fn is_pseudo_element(&self) -> bool;
+
/// Skips non-element nodes
fn prev_sibling_element(&self) -> Option<Self>;