style: Move ANCHORS_RELATIVE_SELECTOR out of nsINode flags

Move the flag to ComputedValueFlags, like `CONSIDERED_RELATIVE_SELECTOR`.

Differential Revision: https://phabricator.services.mozilla.com/D180726
This commit is contained in:
David Shin 2023-06-13 13:21:42 +00:00 committed by Martin Robinson
parent 9321265b38
commit ae5e0d49d8
7 changed files with 59 additions and 43 deletions

View file

@ -60,18 +60,13 @@ bitflags! {
/// The element has an empty selector, so when a child is appended we
/// might need to restyle the parent completely.
const HAS_EMPTY_SELECTOR = 1 << 4;
/// This element has a relative selector that anchors to it, or may do so
/// if its descendants or its later siblings change.
const ANCHORS_RELATIVE_SELECTOR = 1 << 5;
}
}
impl ElementSelectorFlags {
/// Returns the subset of flags that apply to the element.
pub fn for_self(self) -> ElementSelectorFlags {
self & (ElementSelectorFlags::HAS_EMPTY_SELECTOR |
ElementSelectorFlags::ANCHORS_RELATIVE_SELECTOR)
self & ElementSelectorFlags::HAS_EMPTY_SELECTOR
}
/// Returns the subset of flags that apply to the parent.
@ -370,12 +365,10 @@ fn matches_relative_selectors<E: Element>(
element: &E,
context: &mut MatchingContext<E::Impl>,
) -> bool {
if context.needs_selector_flags() {
// If we've considered anchoring `:has()` selector while trying to match this element,
// mark it as such, as it has implications on style sharing (See style sharing
// code for further information).
element.apply_selector_flags(ElementSelectorFlags::ANCHORS_RELATIVE_SELECTOR);
}
// If we've considered anchoring `:has()` selector while trying to match this element,
// mark it as such, as it has implications on style sharing (See style sharing
// code for further information).
context.considered_relative_selector = RelativeSelectorMatchingState::ConsideredAnchor;
for RelativeSelector {
match_hint,
selector,