Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a61f5be9e63a0e2a62a436809340e1950f1b9b04
https://github.com/WebKit/WebKit/commit/a61f5be9e63a0e2a62a436809340e1950f1b9b04
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-07-13 (Mon, 13 Jul 2026)
Changed paths:
A
LayoutTests/svg/transforms/change-transform-origin-with-transform-attribute-expected.html
A
LayoutTests/svg/transforms/change-transform-origin-with-transform-attribute.html
M Source/WebCore/rendering/RenderLayerModelObject.cpp
M Source/WebCore/rendering/RenderLayerModelObject.h
M Source/WebCore/rendering/svg/RenderSVGModelObject.cpp
M Source/WebCore/rendering/svg/RenderSVGModelObject.h
Log Message:
-----------
[LBSE] Cache the SVG transform origin on RenderSVGModelObject
https://bugs.webkit.org/show_bug.cgi?id=319228
Reviewed by Rob Buis.
applySVGTransform() calls computeTransformOrigin() for every non-layered SVG
shape on every
transform flush. The origin only depends on the transform-origin style and the
transform
reference box, so it stays the same as long as those do not change. Sampling
MotionMark/Suits
at high, fixed complexity showed computeTransformOrigin costs ~1% of the
WebProcess main thread.
Cache the origin on RenderSVGModelObject keyed on the reference box. A
different box forces a
recompute, and styleDidChange() drops the cache for transform-origin or
transform-box changes,
where the box is the same but the origin differs. The cache is only used on the
plain SVG
transform path (no CSS transform and no pre, post or supplemental matrix).
Viewport containers
and CSS-transformed renderers keep computing it directly. The optimization
scope could be expanded
in future.
Added a new test to cover an edge case caused by a missing cache invalidation
during development,
that lacked test coverage so far. The rest of the change is covered by existing
tests.
Test: svg/transforms/change-transform-origin-with-transform-attribute.html
*
LayoutTests/svg/transforms/change-transform-origin-with-transform-attribute-expected.html:
Added.
*
LayoutTests/svg/transforms/change-transform-origin-with-transform-attribute.html:
Added.
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::applySVGTransform const):
* Source/WebCore/rendering/RenderLayerModelObject.h:
(WebCore::RenderLayerModelObject::cachedTransformOriginForReferenceBox const):
* Source/WebCore/rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::styleDidChange):
(WebCore::RenderSVGModelObject::cachedTransformOriginForReferenceBox const):
* Source/WebCore/rendering/svg/RenderSVGModelObject.h:
(WebCore::RenderSVGModelObject::invalidateCachedTransformOrigin const):
Canonical link: https://commits.webkit.org/317077@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications