summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/svg/geometry/svg-image-intrinsic-size-with-cssstyle-auto-dynamic-image-change.html
blob: 8d5e2e982e82bd73e45cf86688e637a65f5d6535 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<title>Test <svg:image>'s sizing with css size as auto, with dynamic image change</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#geometry-Sizing"/>
<link rel="help" href="https://svgwg.org/svg2-draft/single-page.html#embedded-Placement"/>
<svg height="0">
  <image width="128" height="128" xlink:href="/images/green-256x256.png" style="width:auto; height:auto"/>
</svg>
<script>
async_test(function(t) {
  var image = document.querySelector('image');
  window.onload = t.step_func(function() {
    var rectBBox = image.getBBox();
    assert_equals(rectBBox.width, 256);
    assert_equals(rectBBox.height, 256);
    image.setAttributeNS("http://www.w3.org/1999/xlink","href","data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'></svg>");
    image.onload = t.step_func_done(function() {
        var rectBBox = image.getBBox();
        assert_equals(rectBBox.width, 64);
        assert_equals(rectBBox.height, 64);
    });
  });
});
</script>