haikuwebkit/LayoutTests/svg/custom/image-width-height-auto-ini...

43 lines
1.3 KiB
XML
Raw Permalink Normal View History

[SVG2]: Add 'auto' behavior to the 'width' and 'height' properties of the SVG <image> element https://bugs.webkit.org/show_bug.cgi?id=202013 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-10-21 Reviewed by Simon Fraser. LayoutTests/imported/w3c: * web-platform-tests/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change-expected.txt: * web-platform-tests/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-expected.txt: Source/WebCore: The spec page is: https://www.w3.org/TR/SVG/geometry.html#Sizing Handle the case if the 'width' or the 'height' of an SVG <image> or both are missing. Tests: svg/custom/image-width-height-auto-dynamic.svg svg/custom/image-width-height-auto-initial.svg svg/custom/image-width-height-length-initial.svg * rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::calculateObjectBoundingBox const): (WebCore::RenderSVGImage::updateImageViewport): * rendering/svg/RenderSVGImage.h: LayoutTests: * svg/custom/image-width-height-auto-dynamic-expected.svg: Added. * svg/custom/image-width-height-auto-dynamic.svg: Added. * svg/custom/image-width-height-auto-initial-expected.svg: Added. * svg/custom/image-width-height-auto-initial.svg: Added. * svg/custom/image-width-height-length-initial-expected.svg: Added. * svg/custom/image-width-height-length-initial.svg: Added. * svg/custom/resources/100x200-green.png: Added. Canonical link: https://commits.webkit.org/216616@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-21 20:25:49 +00:00
<svg xmlns="http://www.w3.org/2000/svg">
<style>
#image-1 { height: auto; }
#image-2 { width: auto; }
#image-3 { height: auto; }
#image-4 { width: auto; }
</style>
<g id="g-1" transform="translate(10, 10)">
<image href="resources/100x200-green.png" width="50"/>
</g>
<g id="g-2" transform="translate(110, 10)">
<image href="resources/100x200-green.png" height="100"/>
</g>
<g id="g-3" transform="translate(210, 10)">
<image href="resources/100x200-green.png">
<animate attributeType="XML" attributeName="width" from="0" to="50" dur="1s" fill="freeze"/>
</image>
</g>
<g id="g-4" transform="translate(310, 10)">
<image href="resources/100x200-green.png">
<animate attributeType="XML" attributeName="height" from="0" to="100" dur="1s" fill="freeze"/>
</image>
</g>
<use y="110" href="#g-1"/>
<use y="110" href="#g-2"/>
<use y="110" href="#g-3"/>
<use y="110" href="#g-4"/>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
window.addEventListener('load', (event) => {
document.documentElement.setCurrentTime(5);
if (window.testRunner)
testRunner.notifyDone();
});
</script>
</svg>