Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 15ab792bb311c8bf7603e992ac922c06f3dba0e2
https://github.com/WebKit/WebKit/commit/15ab792bb311c8bf7603e992ac922c06f3dba0e2
Author: Karl Dubost <[email protected]>
Date: 2026-03-09 (Mon, 09 Mar 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/svg/coordinate-systems/outer-svg-intrinsic-size-002-expected.txt
M Source/WebCore/rendering/RenderReplaced.cpp
M Source/WebCore/svg/SVGSVGElement.cpp
Log Message:
-----------
removeAttribute for width/height on svg root element is trying to set an
empty invalid string
https://bugs.webkit.org/show_bug.cgi?id=307677
rdar://170233990
Reviewed by Nikolas Zimmermann.
When removeAttribute("width") or removeAttribute("height") was called on
an <svg> root element embedded via <object>, the parent renderer was not
notified and m_intrinsicSize in RenderReplaced became stale, causing the
old explicit value to persist instead of reverting to the CSS default
(300×150).
Three related issues are fixed:
1. SVGSVGElement::svgAttributeChanged — when widthAttr/heightAttr changes
on an SVG embedded through a frame, notify the owner renderer in the
parent document so it re-lays out with updated intrinsic dimensions.
2. SVGSVGElement::svgAttributeChanged — when a viewBox attribute changes,
similarly notify the owner renderer in the parent document, so that
aspect-ratio-derived sizes are recomputed correctly.
3. RenderReplaced::computeAspectRatioInformationForRenderBox — when
content is a RenderWidget (e.g. an <object> embedding an SVG document),
always update m_intrinsicSize rather than only when an aspect ratio
exists. Apply CSS default fallback dimensions (300×150) for zero values
so stale cached sizes are never returned. This is intentionally scoped
to RenderWidget and does not affect RenderImage (<img src="svg">),
which manages its intrinsic size independently via setIntrinsicSize()
during image load.
*
LayoutTests/imported/w3c/web-platform-tests/svg/coordinate-systems/outer-svg-intrinsic-size-002-expected.txt:
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* Source/WebCore/svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::svgAttributeChanged):
Canonical link: https://commits.webkit.org/308906@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications