Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 19a32ddd271368e7c6c774883950f1ac119b64f0
      
https://github.com/WebKit/WebKit/commit/19a32ddd271368e7c6c774883950f1ac119b64f0
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-08-26 (Wed, 26 Aug 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/fast/shadow-dom/svg-multiple-references-in-multiple-shadows-pattern-expected.html
    A 
LayoutTests/fast/shadow-dom/svg-multiple-references-in-multiple-shadows-pattern.html
    A 
LayoutTests/fast/shadow-dom/svg-pattern-dynamic-update-href-in-shadow-tree-expected.html
    A 
LayoutTests/fast/shadow-dom/svg-pattern-dynamic-update-href-in-shadow-tree.html
    A LayoutTests/fast/shadow-dom/svg-pattern-href-in-shadow-tree-expected.html
    A LayoutTests/fast/shadow-dom/svg-pattern-href-in-shadow-tree.html
    M LayoutTests/platform/mac-tahoe-wk2-lbse-text/TestExpectations
    A LayoutTests/svg/custom/pattern-href-cycle-detection-expected.svg
    A LayoutTests/svg/custom/pattern-href-cycle-detection.svg
    M Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourcePattern.cpp
    M Source/WebCore/svg/SVGLinearGradientElement.cpp
    M Source/WebCore/svg/SVGPatternElement.cpp
    M Source/WebCore/svg/SVGPatternElement.h
    M Source/WebCore/svg/SVGRadialGradientElement.cpp

  Log Message:
  -----------
  [LBSE] Collecting pattern attributes walks an xlink:href cycle forever
https://bugs.webkit.org/show_bug.cgi?id=321882

Reviewed by Rob Buis.

RenderSVGResourcePattern::collectPatternAttributesIfNeeded() followed the
xlink:href chain without remembering where it had been, so two patterns pointing
at each other, or one pointing at itself, hang the WebContent process on the
first paint.

Gradients never had that problem, their walk and its cycle detection live in
SVGLinearGradientElement::collectGradientAttributes(). Switch patterns to the
same kind of logic: move the walk into 
SVGPatternElement::collectPatternAttributes(),
which now returns whether the pattern can be rendered. The legacy renderer 
keeps its
SVGResourcesCache walk and only follows the rename.

Two further differences turned out to be accidental and now follow the gradient
rule: patterns kept the attributes collected so far when the chain reached an
element without a renderer aand they resolved each href in the tree scope of the
element holding it, not the one the walk started from which is incorrect.

Finally, unify both code paths as much as possible, so gradient/pattern 
attribute
collection has the very same shape - less confusing this way.

Update expectations, and add new fast/shadow-dom tests to cover the tree scope
change.

* LayoutTests/TestExpectations:
* 
LayoutTests/fast/shadow-dom/svg-multiple-references-in-multiple-shadows-pattern-expected.html:
 Added.
* 
LayoutTests/fast/shadow-dom/svg-multiple-references-in-multiple-shadows-pattern.html:
 Added.
* 
LayoutTests/fast/shadow-dom/svg-pattern-dynamic-update-href-in-shadow-tree-expected.html:
 Added.
* 
LayoutTests/fast/shadow-dom/svg-pattern-dynamic-update-href-in-shadow-tree.html:
 Added.
* LayoutTests/fast/shadow-dom/svg-pattern-href-in-shadow-tree-expected.html: 
Added.
* LayoutTests/fast/shadow-dom/svg-pattern-href-in-shadow-tree.html: Added.
* LayoutTests/platform/mac-tahoe-wk2-lbse-text/TestExpectations:
* LayoutTests/svg/custom/pattern-href-cycle-detection-expected.svg: Added.
* LayoutTests/svg/custom/pattern-href-cycle-detection.svg: Added.
* Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::collectPatternAttributesIfNeeded):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourcePattern.cpp:
(WebCore::LegacyRenderSVGResourcePattern::collectPatternAttributes const):
* Source/WebCore/svg/SVGLinearGradientElement.cpp:
(WebCore::setGradientAttributes):
(WebCore::SVGLinearGradientElement::collectGradientAttributes):
* Source/WebCore/svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::collectPatternAttributes):
(WebCore::SVGPatternElement::collectOwnPatternAttributes const):
(WebCore::SVGPatternElement::collectPatternAttributes const): Deleted.
* Source/WebCore/svg/SVGPatternElement.h:
* Source/WebCore/svg/SVGRadialGradientElement.cpp:
(WebCore::setGradientAttributes):
(WebCore::SVGRadialGradientElement::collectGradientAttributes):

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



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

Reply via email to