mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Add infrastructure to match :host.
This commit is contained in:
parent
1654f297ca
commit
9fa2618197
9 changed files with 159 additions and 41 deletions
|
@ -1822,12 +1822,21 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
|
||||
#[inline]
|
||||
fn parent_element(&self) -> Option<Self> {
|
||||
// FIXME(emilio): This will need to jump across if the parent node is a
|
||||
// shadow root to get the shadow host.
|
||||
let parent_node = self.as_node().parent_node();
|
||||
parent_node.and_then(|n| n.as_element())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn parent_node_is_shadow_root(&self) -> bool {
|
||||
self.as_node().parent_node().map_or(false, |p| p.is_shadow_root())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn containing_shadow_host(&self) -> Option<Self> {
|
||||
let shadow = self.containing_shadow()?;
|
||||
Some(shadow.host())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn pseudo_element_originating_element(&self) -> Option<Self> {
|
||||
debug_assert!(self.implemented_pseudo_element().is_some());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue