haikuwebkit/LayoutTests/svg/css/svg-resource-fragment-ident...

41 lines
700 B
HTML
Raw Permalink Normal View History

Respect SVG fragment identifiers in <img> src attribute https://bugs.webkit.org/show_bug.cgi?id=129387 Reviewed by Antti Koivisto. Source/WebCore: Test: svg/css/svg-resource-fragment-identifier-img-src.html When providing an SVG image for a given renderer, check that the URL used to load that image is taken into account in case it featured a fragment identifier, ensuring that the CSS :target pseudo-class is correctly handled for SVG resources. This patch is specific to <img> elements, specific support will also need to be added for various CSS properties that support SVG images. * svg/graphics/SVGImageCache.cpp: (WebCore::SVGImageCache::imageForRenderer): Check if the provided renderer is attached to an <img> element and, if so, pass the resolved <img> source URL, taking into account srcset, to the SVGImageForContainer. * svg/graphics/SVGImageForContainer.cpp: (WebCore::SVGImageForContainer::setURL): Trigger the FrameView machinery to ensure that the :target pseudo-class is respected should the provided URL feature a fragment identifier. * svg/graphics/SVGImageForContainer.h: Declare the new setURL() method. LayoutTests: Test that we correctly handle the fragment identifier used in SVG URLs in <img> elements, checking for correct srcset handling as well. * svg/css/resources/fragment-identifiers.svg: Added. * svg/css/svg-resource-fragment-identifier-img-src-expected.html: Added. * svg/css/svg-resource-fragment-identifier-img-src.html: Added. Canonical link: https://commits.webkit.org/147492@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164804 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-27 15:52:28 +00:00
<!DOCTYPE html>
<html>
<head>
<script>
window.targetScaleFactor = 2;
</script>
<script src="../../resources/srcset-helper.js"></script>
Respect SVG fragment identifiers in <img> src attribute https://bugs.webkit.org/show_bug.cgi?id=129387 Reviewed by Antti Koivisto. Source/WebCore: Test: svg/css/svg-resource-fragment-identifier-img-src.html When providing an SVG image for a given renderer, check that the URL used to load that image is taken into account in case it featured a fragment identifier, ensuring that the CSS :target pseudo-class is correctly handled for SVG resources. This patch is specific to <img> elements, specific support will also need to be added for various CSS properties that support SVG images. * svg/graphics/SVGImageCache.cpp: (WebCore::SVGImageCache::imageForRenderer): Check if the provided renderer is attached to an <img> element and, if so, pass the resolved <img> source URL, taking into account srcset, to the SVGImageForContainer. * svg/graphics/SVGImageForContainer.cpp: (WebCore::SVGImageForContainer::setURL): Trigger the FrameView machinery to ensure that the :target pseudo-class is respected should the provided URL feature a fragment identifier. * svg/graphics/SVGImageForContainer.h: Declare the new setURL() method. LayoutTests: Test that we correctly handle the fragment identifier used in SVG URLs in <img> elements, checking for correct srcset handling as well. * svg/css/resources/fragment-identifiers.svg: Added. * svg/css/svg-resource-fragment-identifier-img-src-expected.html: Added. * svg/css/svg-resource-fragment-identifier-img-src.html: Added. Canonical link: https://commits.webkit.org/147492@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164804 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-02-27 15:52:28 +00:00
<style type="text/css" media="screen">
div {
width: 100px;
height: 100px;
margin: 10px;
display: inline-block;
}
.red {
background-color: red;
}
.green {
background-color: green;
}
.blue {
background-color: blue;
}
</style>
</head>
<body>
<div class="red"></div>
<div class="green"></div>
<div class="blue"></div>
<div class="green"></div>
</body>
</html>