Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 71fd20edca0a0515591a3d158dde65d8b56b22b6
      
https://github.com/WebKit/WebKit/commit/71fd20edca0a0515591a3d158dde65d8b56b22b6
  Author: Sam Weinig <[email protected]>
  Date:   2026-10-13 (Tue, 13 Oct 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-fit-fill-svg-with-natural-size-and-viewbox-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-fit-fill-svg-with-natural-size-and-viewbox-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-fit-fill-svg-with-natural-size-and-viewbox.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-does-not-affect-img-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-does-not-affect-img-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-does-not-affect-img.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-ignores-svg-root-viewbox-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-ignores-svg-root-viewbox-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-ignores-svg-root-viewbox.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-viewbox-only-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-viewbox-only-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-viewbox-only.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-with-size-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-with-size-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-with-size.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-animated-viewbox-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-animated-viewbox-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-animated-viewbox.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-shared-document-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-shared-document-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-shared-document.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-svg-viewbox-only-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-svg-viewbox-only-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-svg-viewbox-only.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-overrides-svg-root-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-overrides-svg-root-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-overrides-svg-root.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-slice-svg-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-slice-svg-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-slice-svg.html
    M Source/WebCore/platform/graphics/ImagePaintingOptions.h
    M Source/WebCore/platform/graphics/ImageTypes.h
    M Source/WebCore/rendering/svg/RenderSVGImage.cpp
    M Source/WebCore/rendering/svg/RenderSVGImage.h
    M Source/WebCore/rendering/svg/SVGImageIntrinsicSizing.cpp
    M Source/WebCore/rendering/svg/SVGImageIntrinsicSizing.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.h
    M Source/WebCore/svg/SVGSVGElement.cpp
    M Source/WebCore/svg/SVGSVGElement.h
    M Source/WebCore/svg/graphics/SVGImage.cpp
    M Source/WebCore/svg/graphics/SVGImage.h

  Log Message:
  -----------
  <svg:image> should cause referenced SVG images to treat their own root 
preserveAspectRatio as none
https://bugs.webkit.org/show_bug.cgi?id=326836

Reviewed by Nikolas Zimmermann.

SVG2 says:

  "For ‘image’ elements embedding an SVG image, the ‘preserveAspectRatio’ 
attribute on the root element in the
   referenced SVG image must be ignored, and instead treated as if it had a 
value of none."

    - https://w3c.github.io/svgwg/svg2-draft/embedded.html#ImageElement

To implement this, we now pass a new flag IgnoreRootPreserveAspectRatio when 
painting <svg:image> elements
(both RenderSVGImage and LegacyRenderSVGImage) and implement the rest of the 
placement sizing via new helpers.

In the follow on changes we can add support for `object-fit` and 
`object-position` in this shared placement code.

Tests: 
imported/w3c/web-platform-tests/css/css-images/object-fit-fill-svg-with-natural-size-and-viewbox.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-does-not-affect-img.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-ignores-svg-root-viewbox.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-viewbox-only.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-with-size.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-animated-viewbox.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-shared-document.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-svg-viewbox-only.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-overrides-svg-root.html
       
imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-slice-svg.html

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-fit-fill-svg-with-natural-size-and-viewbox-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-fit-fill-svg-with-natural-size-and-viewbox-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-images/object-fit-fill-svg-with-natural-size-and-viewbox.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-does-not-affect-img-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-does-not-affect-img-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-does-not-affect-img.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-ignores-svg-root-viewbox-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-ignores-svg-root-viewbox-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-ignores-svg-root-viewbox.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-viewbox-only-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-viewbox-only-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-viewbox-only.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-with-size-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-with-size-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-meet-svg-with-size.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-animated-viewbox-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-animated-viewbox-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-animated-viewbox.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-shared-document-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-shared-document-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-shared-document.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-svg-viewbox-only-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-svg-viewbox-only-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-none-svg-viewbox-only.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-overrides-svg-root-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-overrides-svg-root-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-overrides-svg-root.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-slice-svg-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-slice-svg-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/svg/embedded/image-preserveaspectratio-slice-svg.html:
 Added.
* Source/WebCore/platform/graphics/ImagePaintingOptions.h:
* Source/WebCore/platform/graphics/ImageTypes.h:
* Source/WebCore/rendering/svg/RenderSVGImage.cpp:
* Source/WebCore/rendering/svg/RenderSVGImage.h:
* Source/WebCore/rendering/svg/SVGImageIntrinsicSizing.cpp:
* Source/WebCore/rendering/svg/SVGImageIntrinsicSizing.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.cpp:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGImage.h:
* Source/WebCore/svg/SVGSVGElement.cpp:
* Source/WebCore/svg/SVGSVGElement.h:
* Source/WebCore/svg/graphics/SVGImage.cpp:
* Source/WebCore/svg/graphics/SVGImage.h:

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



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

Reply via email to