Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: efc9437044b6b399b798750f85b916b47a6589ef
      
https://github.com/WebKit/WebKit/commit/efc9437044b6b399b798750f85b916b47a6589ef
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-05-28 (Thu, 28 May 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-display/display-contents-svg-anchor-child-expected.txt
    M LayoutTests/svg/css/display-computed-expected.txt
    M Source/WebCore/accessibility/AccessibilitySVGObject.cpp
    M Source/WebCore/style/StyleAdjuster.cpp
    M Source/WebCore/svg/SVGGElement.cpp
    M Source/WebCore/svg/SVGUseElement.cpp

  Log Message:
  -----------
  SVG elements with display: contents is visually hidden
https://bugs.webkit.org/show_bug.cgi?id=284634
rdar://141825746

Reviewed by Simon Fraser and Tyler Wilcock.

This patch aligns WebKit with Blink / Chromium and Web Specification [1]:

Merge: https://chromium-review.googlesource.com/c/chromium/src/+/829633

According to the CSS Display Specification [1], nested `svg` elements, `g`,
`use`, and `tspan` elements are not rendered and their children are
"hoisted". For other elements display:contents behaves as display:none.

[1] https://drafts.csswg.org/css-display-3/#unbox-svg

* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::hasEffectiveDisplayNoneForDisplayContents):
* Source/WebCore/svg/SVGGElement.cpp:
(WebCore::SVGGElement::createElementRenderer):
* Source/WebCore/svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::createElementRenderer):

> Accessibility Specific Fix:
* Source/WebCore/accessibility/AccessibilitySVGObject.cpp:
(WebCore::AccessibilitySVGObject::determineAccessibilityRole):

AccessibilitySVGObject::determineAccessibilityRole() bailed out with
AccessibilityRole::Unknown whenever m_renderer was null, which masked
the role of display:contents SVG elements that no longer create
renderers under the unbox-svg rules. The <g> branch only reads from
the DOM element (aria-label/title/desc/focusability), so move it
above the renderer-null check so a display:contents <g> still
resolves to Group (when it carries a name) or Generic. This fixes
the 'g element with display: contents, as child of svg, is labelled
via title element' subtest in display-contents-role-and-label.html.

* LayoutTests/TestExpectations: Progression
* LayoutTests/svg/css/display-computed-expected.txt: Ditto
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-display/display-contents-svg-anchor-child-expected.txt:
 Rebased

Canonical link: https://commits.webkit.org/314079@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to