Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 89dd2f9ec73985c4f68a7a8bb299e1121b2a78b5
https://github.com/WebKit/WebKit/commit/89dd2f9ec73985c4f68a7a8bb299e1121b2a78b5
Author: Taher Ali <[email protected]>
Date: 2026-04-22 (Wed, 22 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
M Source/WebCore/loader/cache/CachedImage.h
M Source/WebCore/platform/graphics/Image.h
M Source/WebCore/rendering/BackgroundPainter.cpp
M Source/WebCore/style/values/images/kinds/StyleCachedImage.cpp
M Source/WebCore/style/values/images/kinds/StyleCachedImage.h
M Source/WebCore/style/values/images/kinds/StyleGeneratedImage.h
M Source/WebCore/style/values/images/kinds/StyleImage.h
M Source/WebCore/svg/graphics/SVGImage.cpp
M Source/WebCore/svg/graphics/SVGImage.h
Log Message:
-----------
[CSS Backgrounds] SVG images without complete intrinsic dimensions should not
use ratio-based scaling for background-size
https://bugs.webkit.org/show_bug.cgi?id=313001
rdar://problem/175345107
Reviewed by Simon Fraser.
When calculating tile size in background painter it always attempts
ratio-based scaling, even for SVGs that have no usable aspect ratio.
Introduce imageHasNaturalAspectRatio() as a separate query. For SVG
images this delegates to SVGSVGElement::hasIntrinsicDimensions(), which
returns true only when the SVG has both concrete dimensions or a viewBox.
The painter now calls imageHasNaturalAspectRatio(), so for SVGs without
a real ratio the auto dimension correctly falls through to the positioning
area size. This also fixes the existing semantic mismatch where the
variable hasNaturalAspectRatio was calling imageHasNaturalDimensions().
* LayoutTests/TestExpectations:
* Source/WebCore/loader/cache/CachedImage.h:
* Source/WebCore/platform/graphics/Image.h:
(WebCore::Image::hasNaturalAspectRatio const):
* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::calculateFillTileSize):
* Source/WebCore/style/values/images/kinds/StyleCachedImage.cpp:
(WebCore::Style::CachedImage::imageHasNaturalAspectRatio const):
* Source/WebCore/style/values/images/kinds/StyleCachedImage.h:
* Source/WebCore/style/values/images/kinds/StyleGeneratedImage.h:
* Source/WebCore/style/values/images/kinds/StyleImage.h:
(WebCore::Style::Image::imageHasNaturalAspectRatio const):
* Source/WebCore/svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::hasNaturalAspectRatio const):
* Source/WebCore/svg/graphics/SVGImage.h:
* Source/WebCore/style/values/images/kinds/StyleGeneratedImage.h:
Canonical link: https://commits.webkit.org/311817@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications