Skip to content

Truly independent web browser

LibWeb: Answer whether a selector is relational without a scan

Andreas Klingf87ebc022a17
diff --git a/Libraries/LibWeb/Rust/src/css/style/selector.rs b/Libraries/LibWeb/Rust/src/css/style/selector.rs
index 776c2e7b34c..54ddd8d3dfd 100644
--- a/Libraries/LibWeb/Rust/src/css/style/selector.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/selector.rs
@@ -854,9 +854,8 @@ impl<A: AtomSpace> SelectorProgram<A> {
#[must_use]
pub fn contains_relational_selector(&self) -> bool {
- self.nodes
- .iter()
- .any(|node| matches!(node, SelectorOp::RelativeExists(_)))
+ // Every relative query is pushed together with the one RelativeExists node evaluating it.
+ !self.relative_queries.is_empty()
}
/// Whether any node in this subtree tests sibling position. A retained witness for a