diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2023-05-21 15:17:29 +0800 |
---|---|---|
committer | FranklinDM <mrmineshafter17@gmail.com> | 2023-05-21 19:01:41 +0800 |
commit | c58f825821ad1b7d6d695116326118d01941f279 (patch) | |
tree | eb37cba15448f3561d9dd35e018f0281996488e5 /layout | |
parent | e4eb31879fd84a3bc83f2a89e9084e140e715c9b (diff) | |
download | uxp-c58f825821ad1b7d6d695116326118d01941f279.tar.gz |
Issue #2250 - Part 1: Return early if the element being tested for is likely an ancestor and does not have an assigned slot
Diffstat (limited to 'layout')
-rw-r--r-- | layout/style/nsCSSRuleProcessor.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index da25732d37..d5d18e75a9 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -1711,7 +1711,13 @@ static bool SelectorMatches(Element* aElement, Element* targetElement = aElement; if (aTreeMatchContext.mForAssignedSlot) { - targetElement = aElement->GetAssignedSlot()->AsElement(); + HTMLSlotElement* slot = aElement->GetAssignedSlot(); + // We're likely testing the slottable's ancestors and it might + // not have an assigned slot, so return early. + if (!slot) { + return false; + } + targetElement = slot->AsElement(); } // namespace/tag match |