summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-transforms/transform-getBoundingClientRect-001.html
blob: 15adf31f0d1ef57ec7edcb80a140c34d37cec31e (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<meta charset=UTF-8>
<title>CSS Test: transform and getBoundingClientRect</title>
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
<link rel="author" title="Google" href="http://www.google.com/">
<link rel="help" href="https://drafts.csswg.org/css-transforms-1/#transform-property">
<link rel="help" href="https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  body {
    margin: 0;
  }

  div {
    height: 100px;
    width: 100px;
  }

  #outer {
    transform: translate(100px, 100px);
  }

  #inner {
    transform: scale(0.5);
    transform-origin: center;
  }
</style>

<div id="outer">
  <div>
    <div id="inner"></div>
  </div>
</div>

<script>
  test(function() {
    let bcr = document.getElementById("inner").getBoundingClientRect();
    assert_equals(bcr.x, 125);
    assert_equals(bcr.y, 125);
  }, "correct getBoundingClientRect() result within set of transforms");
</script>