Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 04110306d8797967fe679e31fd1a34207975b63a
https://github.com/WebKit/WebKit/commit/04110306d8797967fe679e31fd1a34207975b63a
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-08-12 (Wed, 12 Aug 2026)
Changed paths:
M LayoutTests/platform/mac-tahoe-wk2-lbse-text/TestExpectations
M Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp
M Source/WebCore/svg/SVGSVGElement.cpp
M Source/WebCore/svg/SVGSVGElement.h
Log Message:
-----------
[LBSE] Apply the synthesized viewBox transform for SVG documents embedded
through SVGImage
https://bugs.webkit.org/show_bug.cgi?id=321333
Reviewed by Alejandro G. Castro.
An SVG document embedded through SVGImage (<img>, background-image, SVG <image>)
is resized to the container size chosen by the embedder. With no viewBox,
SVGSVGElement synthesizes one from the intrinsic size, plus a
preserveAspectRatio
of "none", so the content stretches to that size.
The legacy engine gets this for free, since buildLocalToBorderBoxTransform()
asks
the element for the viewBox transform without checking for a viewBox attribute
first, as LBSE did. Fix LBSE by calling viewBoxToViewTransform()
unconditionally.
It returns the identity transform when there is nothing to map, which makes the
surrounding conditions redundant.
* LayoutTests/platform/mac-tahoe-wk2-lbse-text/TestExpectations:
* Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp:
(WebCore::RenderSVGViewportContainer::needsHasSVGTransformFlags const):
(WebCore::RenderSVGViewportContainer::updateLayerTransform):
(WebCore::RenderSVGViewportContainer::overflowClipRect const):
* Source/WebCore/svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::hasSynthesizedViewBoxForSVGImage const):
(WebCore::SVGSVGElement::currentViewBoxRect const):
(WebCore::SVGSVGElement::viewBoxToViewTransform const):
* Source/WebCore/svg/SVGSVGElement.h:
Canonical link: https://commits.webkit.org/319025@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications