Skip to content

Commit

Permalink
REGRESSION(273934@main): [ Debug ] Multiple layout tests crashing.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268650
rdar://122199019

Reviewed by Matthieu Dubet.

This restores the behavior pre-273934@main when getting the computed style of pseudo-elements like "::placeholder" / "::file-selector-button".

getComputedStyle() support for these pseudo-elements is currently broken (and has always been), since we return the element style instead, but this change
makes it so we stop asserting.

* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::getComputedStyle const):

Canonical link: https://commits.webkit.org/274010@main
  • Loading branch information
nt1m committed Feb 2, 2024
1 parent eeda728 commit ea774f9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/WebCore/page/LocalDOMWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,8 @@ Ref<CSSStyleDeclaration> LocalDOMWindow::getComputedStyle(Element& element, cons
auto pseudoId = CSSSelector::parsePseudoElement(pseudoElt, CSSSelectorParserContext { element.document() });
if (!pseudoId)
return CSSComputedStyleDeclaration::createEmpty(element);
return CSSComputedStyleDeclaration::create(element, Style::PseudoElementIdentifier { *pseudoId });
// FIXME: CSSSelector::parsePseudoElement should never return PseudoId::None.
return CSSComputedStyleDeclaration::create(element, pseudoId == PseudoId::None ? std::nullopt : std::optional(Style::PseudoElementIdentifier { *pseudoId }));
}

RefPtr<CSSRuleList> LocalDOMWindow::getMatchedCSSRules(Element* element, const String& pseudoElement, bool authorOnly) const
Expand Down

0 comments on commit ea774f9

Please sign in to comment.