#[repr(C)]pub struct CssPath {
pub selectors: CssPathSelectorVec,
}Expand description
Represents a full CSS path (i.e. the “div#id.class” selector belonging to a CSS “content group” (the following key-value block)).
"#div > .my_class:focus" ==
[
CssPathSelector::Type(NodeTypeTag::Div),
CssPathSelector::PseudoSelector(CssPathPseudoSelector::LimitChildren),
CssPathSelector::Class("my_class"),
CssPathSelector::PseudoSelector(CssPathPseudoSelector::Focus),
]Fields§
§selectors: CssPathSelectorVecImplementations§
Source§impl CssPath
impl CssPath
pub fn new(selectors: Vec<CssPathSelector>) -> Self
Sourcepub fn push_front_scope(&mut self, start: usize, end: usize)
pub fn push_front_scope(&mut self, start: usize, end: usize)
Prepend a Root scope selector (push_front) confining this rule to the owner
node start (whose subtree spans the inclusive flat ids [start, end]).
Two cases (#47 leak fix + descendant-selector support):
- A bare
*rule (theparse_inlinewrapper for awith_css/set_cssbare-declaration string) is scoped node-only ([start, start]): inline-style semantics — it applies to the OWNER only and must not leak to descendants or siblings.[Root([s,s]), Global]matchessonly. - A rule with a real selector (
.menu-item,div, a descendant chain — fromadd_component_css/ a component stylesheet) is scoped to the whole subtree ([start, end]), so its selectors match within the owner’s subtree (e.g. a menu container’s.menu-itemchildren).[Root([s,e]), Class(x)]matches any node in[s,e]that also matches.x.
Sourcepub fn push_front_scope_for(
&mut self,
start: usize,
end: usize,
node_only_bare_global: bool,
)
pub fn push_front_scope_for( &mut self, start: usize, end: usize, node_only_bare_global: bool, )
Like Self::push_front_scope, but the CALLER decides whether a bare
[Global] path is a bare-declaration wrapper (scope it NODE-ONLY,
[start, start]) or a real stylesheet * { ... } rule (scope it to
the whole subtree).
The two are indistinguishable by path shape - parse_inline wraps
selector-less declarations in *, and an author stylesheet’s
universal rule IS * - but they differ by RULE PRIORITY
(rule_priority::INLINE vs AUTHOR), which only the caller holding
the CssRuleBlock can see. Treating every bare global as a wrapper
scoped the classic * { margin: 0 } reset of a mounted document to
the mount root alone: the UA body margin survived on every child and
each reftest page rendered shifted by 8px against the browser.