Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 291f67b116a80125379aebecec1861ecd5eb0206
      
https://github.com/WebKit/WebKit/commit/291f67b116a80125379aebecec1861ecd5eb0206
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-08-09 (Sun, 09 Aug 2026)

  Changed paths:
    M Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp
    M Source/WebCore/rendering/svg/RenderSVGResourceGradient.h
    M Source/WebCore/rendering/svg/SVGContainerLayout.cpp

  Log Message:
  -----------
  [LBSE] Don't rebuild objectBoundingBox gradients on layout size change
https://bugs.webkit.org/show_bug.cgi?id=321375

Reviewed by Simon Fraser.

On a layout size change, SVGContainerLayout invalidated any gradient using
relative lengths via invalidateGradient(), which nulls both m_gradient and
m_attributes. The next paint then re-runs collectGradientAttributesIfNeeded()
(SVGElement::synchronizeAllAttributes, serializing _every_ animated property\
to a string including the gradientTransform) and createGradient().

For an objectBoundingBox gradient this is wasted: its coordinates resolve
against the object bounding box, and buildGradientIfNeeded already recomputes
that userspace transform on every paint regardless of m_gradient. Only the
object bounding box changed, not the gradient's own resolved data, so the cached
gradient and attributes stay valid. userSpaceOnUse gradients resolve against
the viewport and genuinely change with the layout size.

Introduce invalidateGradientOnLayoutSizeChange(), which only repaints the
gradient clients when objectBoundingBox units are used, keeping the cached
gradient.

* Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::RenderSVGResourceGradient::invalidateGradientOnLayoutSizeChange):
* Source/WebCore/rendering/svg/RenderSVGResourceGradient.h:
* Source/WebCore/rendering/svg/SVGContainerLayout.cpp:
(WebCore::SVGContainerLayout::layoutChildren):

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



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

Reply via email to