summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-multicol/getclientrects-000.html
blob: be11ba99493c12d75e8dd42ed55ca998bbe66001 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
<link rel="help" href="https://developer.mozilla.org/en-US/docs/Web/API/Element/getClientRects">
<link rel="help" href="https://drafts.csswg.org/css-multicol/">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
  .multicol {
      visibility: hidden;
      position: absolute;
      left: 100px;
      top: 50px;
      columns: 3;
      column-gap: 10px;
      inline-size: 290px;
      font: 20px/1 Ahem;
      orphans: 1;
      widows: 1;
  }
  #horizontalTbLtr {
      writing-mode: horizontal-tb;
  }
  #verticalLrLtr {
      writing-mode: vertical-lr;
  }
  #verticalRlLtr {
      writing-mode: vertical-rl;
  }
  #horizontalTbRtl {
      writing-mode: horizontal-tb;
      direction: rtl;
  }
  #verticalLrRtl {
      writing-mode: vertical-lr;
      direction: rtl;
  }
  #verticalRlRtl {
      writing-mode: vertical-rl;
      direction: rtl;
  }
</style>
<div class="multicol" id="horizontalTbLtr">
  <div style="block-size:20px;"></div>
  <span>XXXX XXXX XXXX XXXX</span>
</div>
<div class="multicol" id="verticalLrLtr">
  <div style="block-size:20px;"></div>
  <span>XXXX XXXX XXXX XXXX</span>
</div>
<div class="multicol" id="verticalRlLtr">
  <div style="block-size:20px;"></div>
  <span>XXXX XXXX XXXX XXXX</span>
</div>
<div class="multicol" id="horizontalTbRtl" >
  <div style="block-size:20px;"></div>
  <span>XXXX XXXX XXXX XXXX</span>
</div>
<div class="multicol" id="verticalLrRtl">
  <div style="block-size:20px;"></div>
  <span>XXXX XXXX XXXX XXXX</span>
</div>
<div class="multicol" id="verticalRlRtl">
  <div style="block-size:20px;"></div>
  <span>XXXX XXXX XXXX XXXX</span>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
  test(()=> {
      var span = document.querySelector("#horizontalTbLtr span");
      var rects = span.getClientRects();
      assert_equals(rects.length, 4);
      assert_equals(rects[0].left, 100);
      assert_equals(rects[0].top, 70);
      assert_equals(rects[1].left, 200);
      assert_equals(rects[1].top, 50);
      assert_equals(rects[2].left, 200);
      assert_equals(rects[2].top, 70);
      assert_equals(rects[3].left, 300);
      assert_equals(rects[3].top, 50);
  }, "horizontal-tb ltr");

  test(()=> {
      var span = document.querySelector("#verticalLrLtr span");
      var rects = span.getClientRects();
      assert_equals(rects.length, 4);
      assert_equals(rects[0].left, 120);
      assert_equals(rects[0].top, 50);
      assert_equals(rects[1].left, 100);
      assert_equals(rects[1].top, 150);
      assert_equals(rects[2].left, 120);
      assert_equals(rects[2].top, 150);
      assert_equals(rects[3].left, 100);
      assert_equals(rects[3].top, 250);
  }, "vertical-lr ltr");

  test(()=> {
      var span = document.querySelector("#verticalRlLtr span");
      var rects = span.getClientRects();
      assert_equals(rects.length, 4);
      assert_equals(rects[0].left, 100);
      assert_equals(rects[0].top, 50);
      assert_equals(rects[1].left, 120);
      assert_equals(rects[1].top, 150);
      assert_equals(rects[2].left, 100);
      assert_equals(rects[2].top, 150);
      assert_equals(rects[3].left, 120);
      assert_equals(rects[3].top, 250);
  }, "vertical-rl ltr");
  test(()=> {
      var span = document.querySelector("#horizontalTbRtl span");
      var rects = span.getClientRects();
      assert_equals(rects.length, 4);
      assert_equals(rects[0].left, 310);
      assert_equals(rects[0].top, 70);
      assert_equals(rects[1].left, 210);
      assert_equals(rects[1].top, 50);
      assert_equals(rects[2].left, 210);
      assert_equals(rects[2].top, 70);
      assert_equals(rects[3].left, 110);
      assert_equals(rects[3].top, 50);
  }, "horizontal-tb rtl");
  test(()=> {
      var span = document.querySelector("#verticalLrRtl span");
      var rects = span.getClientRects();
      assert_equals(rects.length, 4);
      assert_equals(rects[0].left, 120);
      assert_equals(rects[0].top, 260);
      assert_equals(rects[1].left, 100);
      assert_equals(rects[1].top, 160);
      assert_equals(rects[2].left, 120);
      assert_equals(rects[2].top, 160);
      assert_equals(rects[3].left, 100);
      assert_equals(rects[3].top, 60);
  }, "vertical-lr rtl");
  test(()=> {
      var span = document.querySelector("#verticalRlRtl span");
      var rects = span.getClientRects();
      assert_equals(rects.length, 4);
      assert_equals(rects[0].left, 100);
      assert_equals(rects[0].top, 260);
      assert_equals(rects[1].left, 120);
      assert_equals(rects[1].top, 160);
      assert_equals(rects[2].left, 100);
      assert_equals(rects[2].top, 160);
      assert_equals(rects[3].left, 120);
      assert_equals(rects[3].top, 60);
  }, "vertical-rl rtl");
</script>