mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
script: Support custom element states (#38564)
Also adds support for `:state`. Testing: Covered by existing tests --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
dcd25072d3
commit
04dd74dddb
20 changed files with 209 additions and 152 deletions
|
@ -560,10 +560,11 @@ impl<'dom> style::dom::TElement for ServoLayoutElement<'dom> {
|
|||
.intersection(ElementSelectorFlags::RELATIVE_SELECTOR_SEARCH_DIRECTION_ANCESTOR_SIBLING)
|
||||
}
|
||||
|
||||
fn each_custom_state<F>(&self, _callback: F)
|
||||
fn each_custom_state<F>(&self, callback: F)
|
||||
where
|
||||
F: FnMut(&AtomIdent),
|
||||
{
|
||||
self.element.each_custom_state(callback);
|
||||
}
|
||||
|
||||
/// Returns the implicit scope root for given sheet index and host.
|
||||
|
@ -960,8 +961,12 @@ impl<'dom> ::selectors::Element for ServoLayoutElement<'dom> {
|
|||
true
|
||||
}
|
||||
|
||||
fn has_custom_state(&self, _name: &AtomIdent) -> bool {
|
||||
false
|
||||
fn has_custom_state(&self, name: &AtomIdent) -> bool {
|
||||
let mut has_state = false;
|
||||
self.element
|
||||
.each_custom_state(|state| has_state |= state == name);
|
||||
|
||||
has_state
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue