Issue #2250 - Part 2: Ignore the ancestor filter assertion if rule matching is restricted or if the current element is under a shadow host

This only affects debug builds.
This commit is contained in:
FranklinDM 2023-05-21 15:24:31 +08:00 committed by roytam1
commit 3d917c9965

View file

@ -680,7 +680,11 @@ void RuleHash::EnumerateAllRules(Element* aElement, ElementDependentRuleProcesso
aData->mTreeMatchContext.mAncestorFilter.HasFilter() ?
&aData->mTreeMatchContext.mAncestorFilter : nullptr;
#ifdef DEBUG
if (filter) {
bool isRestricted = (aData->mTreeMatchContext.mShadowHosts.Length() > 0 ||
aData->mTreeMatchContext.mRestrictToSlottedPseudo ||
aData->mTreeMatchContext.mOnlyMatchHostPseudo ||
aData->mTreeMatchContext.mForAssignedSlot);
if (filter && !isRestricted) {
filter->AssertHasAllAncestors(aElement);
}
#endif