summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/cssom-view/client-props-zoom.html
blob: fc5b07abb5152bd94f9094308dce85a361ce96c8 (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
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<title>Client properties for elements with css zoom</title>
<link rel="author" title="Yotam Hacohen" href="mailto:yotha@chromium.org">
<link rel="author" title="Google" href="http://www.google.com/">
<link rel="help" href="https://drafts.csswg.org/css-viewport/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
      .test_content div {
        width: 64px;
        height: 64px;
        background-color: cyan;
      }
      .test_content div.x4_zoom {
        zoom: 4.0;
      }
</style>
<body>
  <div class="test_content">
    <div id="no_zoom"></div>
    <div class="x4_zoom" id="element_with_zoom"></div>

    <div class="x4_zoom">
      <div id="direct_child_of_element_with_zoom"></div>
      <div>
        <div id="indirect_child_of_element_with_zoom"></div>
      </div>
      <div class="x4_zoom" id="both_child_and_parent_has_zoom"></div>
    </div>
  </div>

  <script>
      setup(() => {
        window.noZoom = document.getElementById("no_zoom");
      });
      function compareObjectToDivWithNoZoom(object){
        assert_equals(object.clientTop, noZoom.clientTop, 'clientTop');
        assert_equals(object.clientLeft, noZoom.clientLeft, 'clientLeft');
        assert_equals(object.clientWidth, noZoom.clientWidth, 'clientWidth');
        assert_equals(object.clientHeight ,noZoom.clientHeight, 'clientHeight');
      }
      test(function() {
        assert_true(!!noZoom, "no zoom target exists");
      });
      test(function() {
        compareObjectToDivWithNoZoom(document.getElementById("element_with_zoom"));
        compareObjectToDivWithNoZoom(document.getElementById("direct_child_of_element_with_zoom"));
        compareObjectToDivWithNoZoom(document.getElementById("indirect_child_of_element_with_zoom"));
        compareObjectToDivWithNoZoom(document.getElementById("both_child_and_parent_has_zoom"));
      });
  </script>
</body>