summaryrefslogtreecommitdiffstats
path: root/comm/mail/base/test/browser/files/paneSplitter.xhtml
blob: 7d25e5596e60aae72e95573562b3edfea8fea663 (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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8" />
  <title>Test for the pane-splitter custom element</title>
  <style>
    hr[is="pane-splitter"] {
      margin: 0 -3px;
      border: none;
      z-index: 1;
      cursor: ew-resize;
      opacity: .4;
      background-color: red;
    }

    #splitter3,
    #splitter4 {
      margin: -3px 0;
      cursor: ns-resize;
    }

    #horizontal-before {
      display: grid;
      grid-template-columns: minmax(auto, var(--splitter1-width)) 0 auto;
      width: 500px;
      height: 100px;
      --splitter1-width: 200px;
      margin: 1em;
    }

    #horizontal-after {
      display: grid;
      grid-template-columns: auto 0 minmax(auto, var(--splitter2-width));
      width: 500px;
      height: 100px;
      --splitter2-width: 200px;
      margin: 1em;
    }

    #vertical-before {
      display: inline-grid;
      grid-template-rows: minmax(auto, var(--splitter3-height)) 0 auto;
      width: 100px;
      height: 500px;
      --splitter3-height: 200px;
      margin: 1em;
    }

    #vertical-after {
      display: inline-grid;
      grid-template-rows: auto 0 minmax(auto, var(--splitter4-height));
      width: 100px;
      height: 500px;
      --splitter4-height: 200px;
      margin: 1em;
    }

    .resized {
      background-color: lightblue;
    }

    .fill {
      background-color: lightslategrey;
    }
  </style>
  <!-- This path is used for the automated test. -->
  <script src="chrome://messenger/content/pane-splitter.js"></script>
  <!-- This path is used when this file is loaded in a browser. -->
  <script src="../../../content/widgets/pane-splitter.js"></script>
  <script>
    function moveMarker(event) {
      let markerX = document.getElementById("markerX");
      markerX.style.left = `${event.clientX + window.scrollX}px`;
      markerX.textContent = `${event.type} event here`;

      let markerY = document.getElementById("markerY");
      markerY.style.top = `${event.clientY + window.scrollY}px`;
      markerY.textContent = `${event.type} event here`;
    }

    document.addEventListener("mousedown", moveMarker);
    document.addEventListener("mousemove", moveMarker);
    document.addEventListener("mouseup", moveMarker);

    window.addEventListener("load", () => {
      for (let splitter of document.querySelectorAll('hr[is="pane-splitter"]')) {
        splitter.resizeElement = splitter.parentNode.querySelector(".resized");
      }
    });
  </script>
</head>
<body>
  <div id="horizontal-before">
    <div id="splitter1-before" class="resized"></div>
    <hr is="pane-splitter" id="splitter1" resize-direction="horizontal" />
    <div id="splitter1-after" class="fill"></div>
  </div>

  <div id="horizontal-after">
    <div id="splitter2-before" class="fill"></div>
    <hr is="pane-splitter" id="splitter2" resize="next" resize-direction="horizontal" />
    <div id="splitter2-after" class="resized"></div>
  </div>

  <div style="display: flex;">
    <div id="vertical-before">
      <div id="splitter3-before" class="resized"></div>
      <hr is="pane-splitter" id="splitter3" />
      <div id="splitter3-after" class="fill"></div>
    </div>

    <div id="vertical-after">
      <div id="splitter4-before" class="fill"></div>
      <hr is="pane-splitter" id="splitter4" resize="next" />
      <div id="splitter4-after" class="resized"></div>
    </div>
  </div>

  <div id="markerX" style="position: absolute; top: 0px; border-left: 1px red solid;"></div>
  <div id="markerY" style="position: absolute; left: 550px; border-top: 1px red solid;"></div>
</body>
</html>