mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-28 18:28:38 +09:00
Issue #1592 - Part 7: Slottables cannot be matched from the outer tree.
This commit is contained in:
parent
91d2b6f4cf
commit
19226fd560
1 changed files with 13 additions and 5 deletions
|
|
@ -1380,8 +1380,9 @@ enum class SelectorMatchesFlags : uint8_t {
|
|||
// pseudo-element.
|
||||
IS_PSEUDO_CLASS_ARGUMENT = 1 << 2,
|
||||
|
||||
// The selector should be blocked from matching the :host pseudo-class.
|
||||
IS_HOST_INACCESSIBLE = 1 << 3
|
||||
// The selector should be blocked from matching because it is called
|
||||
// from outside the shadow tree.
|
||||
IS_OUTSIDE_SHADOW_TREE = 1 << 3
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(SelectorMatchesFlags)
|
||||
|
||||
|
|
@ -1400,7 +1401,7 @@ static inline bool ActiveHoverQuirkMatches(nsCSSSelector* aSelector,
|
|||
aSelectorFlags & (SelectorMatchesFlags::UNKNOWN |
|
||||
SelectorMatchesFlags::HAS_PSEUDO_ELEMENT |
|
||||
SelectorMatchesFlags::IS_PSEUDO_CLASS_ARGUMENT |
|
||||
SelectorMatchesFlags::IS_HOST_INACCESSIBLE)) {
|
||||
SelectorMatchesFlags::IS_OUTSIDE_SHADOW_TREE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1798,6 +1799,8 @@ static bool SelectorMatches(Element* aElement,
|
|||
}
|
||||
}
|
||||
|
||||
const bool isOutsideShadowTree =
|
||||
!!(aSelectorFlags & SelectorMatchesFlags::IS_OUTSIDE_SHADOW_TREE);
|
||||
const bool isNegated = (aDependence != nullptr);
|
||||
// The selectors for which we set node bits are, unfortunately, early
|
||||
// in this function (because they're pseudo-classes, which are
|
||||
|
|
@ -1966,6 +1969,11 @@ static bool SelectorMatches(Element* aElement,
|
|||
|
||||
case CSSPseudoClassType::slotted:
|
||||
{
|
||||
// Slottables cannot be matched from the outer tree.
|
||||
if (isOutsideShadowTree) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Slot elements cannot be matched.
|
||||
if (aElement->IsHTMLElement(nsGkAtoms::slot)) {
|
||||
return false;
|
||||
|
|
@ -1997,7 +2005,7 @@ static bool SelectorMatches(Element* aElement,
|
|||
// style).
|
||||
if (!shadow ||
|
||||
aSelector->HasFeatureSelectors() ||
|
||||
aSelectorFlags & SelectorMatchesFlags::IS_HOST_INACCESSIBLE) {
|
||||
isOutsideShadowTree) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -4232,7 +4240,7 @@ nsCSSRuleProcessor::RestrictedSelectorListMatches(Element* aElement,
|
|||
NodeMatchContext nodeContext(EventStates(), false);
|
||||
SelectorMatchesFlags flags = aElement->IsInShadowTree() ?
|
||||
SelectorMatchesFlags::NONE :
|
||||
SelectorMatchesFlags::IS_HOST_INACCESSIBLE;
|
||||
SelectorMatchesFlags::IS_OUTSIDE_SHADOW_TREE;
|
||||
return SelectorListMatches(aElement,
|
||||
aSelectorList,
|
||||
nodeContext,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue