Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a6a8ca738974cb312892566f4d9c1f824056bc03
      
https://github.com/WebKit/WebKit/commit/a6a8ca738974cb312892566f4d9c1f824056bc03
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-03-30 (Mon, 30 Mar 2026)

  Changed paths:
    A 
LayoutTests/svg/animations/no-attr-lineargradient-gradienttransform-expected.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-gradienttransform.svg
    A 
LayoutTests/svg/animations/no-attr-lineargradient-gradientunits-expected.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-gradientunits.svg
    A 
LayoutTests/svg/animations/no-attr-lineargradient-spreadmethod-expected.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-spreadmethod.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-x1-expected.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-x1.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-x2-expected.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-x2.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-y1-expected.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-y1.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-y2-expected.svg
    A LayoutTests/svg/animations/no-attr-lineargradient-y2.svg
    A LayoutTests/svg/animations/no-attr-pattern-height-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-height.svg
    A LayoutTests/svg/animations/no-attr-pattern-par-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-par.svg
    A 
LayoutTests/svg/animations/no-attr-pattern-patterncontentunits-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-patterncontentunits.svg
    A LayoutTests/svg/animations/no-attr-pattern-patterntransform-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-patterntransform.svg
    A LayoutTests/svg/animations/no-attr-pattern-patternunits-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-patternunits.svg
    A LayoutTests/svg/animations/no-attr-pattern-viewbox-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-viewbox.svg
    A LayoutTests/svg/animations/no-attr-pattern-width-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-width.svg
    A LayoutTests/svg/animations/no-attr-pattern-x-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-x.svg
    A LayoutTests/svg/animations/no-attr-pattern-y-expected.svg
    A LayoutTests/svg/animations/no-attr-pattern-y.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-cx-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-cx.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-cy-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-cy.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-fr-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-fr.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-fx-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-fx.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-fy-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-fy.svg
    A 
LayoutTests/svg/animations/no-attr-radialgradient-gradienttransform-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-gradienttransform.svg
    A 
LayoutTests/svg/animations/no-attr-radialgradient-gradientunits-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-gradientunits.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-r-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-r.svg
    A 
LayoutTests/svg/animations/no-attr-radialgradient-spreadmethod-expected.svg
    A LayoutTests/svg/animations/no-attr-radialgradient-spreadmethod.svg
    M Source/WebCore/svg/SVGElement.cpp
    M Source/WebCore/svg/SVGElement.h
    M Source/WebCore/svg/SVGFitToViewBox.h
    M Source/WebCore/svg/SVGLinearGradientElement.cpp
    M Source/WebCore/svg/SVGPatternElement.cpp
    M Source/WebCore/svg/SVGRadialGradientElement.cpp
    M Source/WebCore/svg/properties/SVGAnimatedPropertyAccessor.h
    M Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessor.h
    M Source/WebCore/svg/properties/SVGMemberAccessor.h
    M Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h
    M Source/WebCore/svg/properties/SVGPropertyRegistry.h

  Log Message:
  -----------
  Allow determining if an SVG value has been specified to enable animation
https://bugs.webkit.org/show_bug.cgi?id=269481
rdar://problem/123457088

Reviewed by Nikolas Zimmermann.

When collecting attributes for pattern/gradient rendering, hasAttribute()
was used to check whether a property value should be included. This only
checks for the presence of a DOM attribute on the element, missing the case
where a value is produced solely by SMIL animation (animVal without a
corresponding baseVal attribute). The animated value was correctly computed
and reflected in the DOM API (animVal), but the rendering codepath never
read it.

Fix this by adding SVGElement::hasAttributeOrIsAnimatingProperty() which
combines hasAttribute() with a new registry query that checks whether the
animated property for a given attribute is currently being driven by an
animator. The plumbing goes through SVGMemberAccessor::isAnimating() →
SVGAnimatedPropertyAccessor (delegates to 
SVGAnimatedPropertyBase::isAnimating())
→ SVGPropertyOwnerRegistry::isAnimatingProperty() → SVGElement convenience
method. This preserves attribute inheritance semantics for paint servers
referencing other paint servers via href, since the check is false when
neither an attribute nor an animation is present.

Additionally, fix SVGFitToViewBox::hasValidViewBox() which suffered from a
similar issue: m_isViewBoxValid is only set when the viewBox DOM attribute
is parsed, so an animated viewBox without an explicit attribute was always
considered invalid. Now when the viewBox property is being animated, the
validity check bypasses the m_isViewBoxValid flag and directly validates
the animated value's dimensions.

Affects <pattern>, <linearGradient>, and <radialGradient> — all attributes
collected for rendering are now covered and fixes for both LegacySVG and
LBSE.

Inspired by (& Tests): 
https://chromium.googlesource.com/chromium/blink/+/9102ba31c8dbaf5bd47d67a4c6450fbbaf75d43d

* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::hasAttributeOrIsAnimatingProperty const):
* Source/WebCore/svg/SVGElement.h:
* Source/WebCore/svg/SVGFitToViewBox.h:
(WebCore::SVGFitToViewBox::hasValidViewBox):
* Source/WebCore/svg/SVGLinearGradientElement.cpp:
(WebCore::setGradientAttributes):
* Source/WebCore/svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::collectPatternAttributes const):
* Source/WebCore/svg/SVGRadialGradientElement.cpp:
(WebCore::setGradientAttributes):
* Source/WebCore/svg/properties/SVGAnimatedPropertyAccessor.h:
* Source/WebCore/svg/properties/SVGAnimatedPropertyPairAccessor.h:
* Source/WebCore/svg/properties/SVGMemberAccessor.h:
(WebCore::SVGMemberAccessor::isAnimating const):
* Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h:
* Source/WebCore/svg/properties/SVGPropertyRegistry.h:

> Add Test Case & Expectations:
NOTE: Due to gradient noise, all gradient tests have `fuzziness` meta tag.
* LayoutTests/svg/animations/no-attr-radialgradient-spreadmethod.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-spreadmethod-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-r.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-r-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-gradientunits.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-gradientunits-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-gradienttransform.svg:
* 
LayoutTests/svg/animations/no-attr-radialgradient-gradienttransform-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-fy.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-fy-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-fx.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-fx-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-fr.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-fr-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-cy.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-cy-expected.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-cx.svg:
* LayoutTests/svg/animations/no-attr-radialgradient-cx-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-y.svg:
* LayoutTests/svg/animations/no-attr-pattern-y-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-x.svg:
* LayoutTests/svg/animations/no-attr-pattern-x-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-width.svg:
* LayoutTests/svg/animations/no-attr-pattern-width-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-viewbox.svg:
* LayoutTests/svg/animations/no-attr-pattern-viewbox-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-patternunits.svg:
* LayoutTests/svg/animations/no-attr-pattern-patternunits-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-patterntransform.svg:
* LayoutTests/svg/animations/no-attr-pattern-patterntransform-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-patterncontentunits.svg:
* LayoutTests/svg/animations/no-attr-pattern-patterncontentunits-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-par.svg:
* LayoutTests/svg/animations/no-attr-pattern-par-expected.svg:
* LayoutTests/svg/animations/no-attr-pattern-height.svg:
* LayoutTests/svg/animations/no-attr-pattern-height-expected.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-y2.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-y2-expected.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-y1.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-y1-expected.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-x2.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-x2-expected.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-x1.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-x1-expected.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-spreadmethod.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-spreadmethod-expected.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-gradientunits.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-gradientunits-expected.svg:
* LayoutTests/svg/animations/no-attr-lineargradient-gradienttransform.svg:
* 
LayoutTests/svg/animations/no-attr-lineargradient-gradienttransform-expected.svg:

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



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

Reply via email to