OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="resources/scrollbars.js"></script> |
| 3 <style> |
| 4 .horizontal-header { |
| 5 width: 120px; |
| 6 } |
| 7 .vertical-header { |
| 8 width: 60px; |
| 9 } |
| 10 .container-row { |
| 11 display: flex; |
| 12 flex-direction: row; |
| 13 align-items: flex-start; |
| 14 justify-content: flex-start; |
| 15 } |
| 16 .container { |
| 17 flex: none; |
| 18 margin: 5px; |
| 19 } |
| 20 .ltr { |
| 21 direction: ltr; |
| 22 } |
| 23 .rtl { |
| 24 direction: rtl; |
| 25 } |
| 26 .horizontal { |
| 27 writing-mode: horizontal-tb; |
| 28 } |
| 29 .flipped-blocks { |
| 30 writing-mode: vertical-rl; |
| 31 } |
| 32 .flipped-lines { |
| 33 writing-mode: vertical-lr; |
| 34 } |
| 35 .flex { |
| 36 border: 2px solid red; |
| 37 overflow: scroll; |
| 38 max-width: 100px; |
| 39 max-height: 100px; |
| 40 white-space: nowrap; |
| 41 font-size: 0; |
| 42 } |
| 43 .row > div, .row-reverse > div { |
| 44 display: inline-flex; |
| 45 margin: 3px; |
| 46 } |
| 47 .column > div, .column-reverse > div { |
| 48 display: flex; |
| 49 } |
| 50 |
| 51 /* Adjust margins to account for collapsing. */ |
| 52 .ltr.horizontal > .row > .leaf3 { |
| 53 margin-right: 0; |
| 54 } |
| 55 .ltr.flipped-blocks > .row > .leaf3, .ltr.flipped-lines > .row > .leaf3 { |
| 56 margin-bottom: 0; |
| 57 } |
| 58 .rtl.horizontal > .row > .leaf3 { |
| 59 margin-left: 0; |
| 60 } |
| 61 .rtl.flipped-blocks > .row > .leaf3, .rtl.flipped-lines > .row > .leaf3 { |
| 62 margin-top: 0; |
| 63 } |
| 64 |
| 65 .ltr.horizontal > .row-reverse > .leaf3 { |
| 66 margin-left: 0; |
| 67 } |
| 68 .ltr.flipped-blocks > .row-reverse > .leaf3, .ltr.flipped-lines > .row-reverse >
.leaf3 { |
| 69 margin-top: 0; |
| 70 } |
| 71 .rtl.horizontal > .row-reverse > .leaf3 { |
| 72 margin-right: 0; |
| 73 } |
| 74 .rtl.flipped-blocks > .row-reverse > .leaf3, .rtl.flipped-lines > .row-reverse >
.leaf3 { |
| 75 margin-bottom: 0; |
| 76 } |
| 77 |
| 78 .horizontal > .column > .leaf1, .horizontal > .column > .leaf2 { |
| 79 margin: 3px 3px 6px 3px; |
| 80 } |
| 81 .horizontal > .column > .leaf3 { |
| 82 margin: 3px; |
| 83 } |
| 84 .flipped-blocks > .column > .leaf1, .flipped-blocks > .column > .leaf2 { |
| 85 margin: 3px 3px 3px 6px; |
| 86 } |
| 87 .flipped-blocks > .column > .leaf3 { |
| 88 margin: 3px; |
| 89 } |
| 90 .flipped-lines > .column > .leaf1, .flipped-lines > .column > .leaf2 { |
| 91 margin: 3px 6px 3px 3px; |
| 92 } |
| 93 .flipped-lines > .column > .leaf3 { |
| 94 margin: 3px; |
| 95 } |
| 96 |
| 97 .horizontal > .column-reverse > .leaf1, .horizontal > .column-reverse > .leaf2 { |
| 98 margin: 6px 3px 3px 3px; |
| 99 } |
| 100 .horizontal > .column-reverse > .leaf3 { |
| 101 margin: 0 3px 3px 3px; |
| 102 } |
| 103 .flipped-blocks > .column-reverse > .leaf1, .flipped-blocks > .column-reverse >
.leaf2 { |
| 104 margin: 3px 6px 3px 3px; |
| 105 } |
| 106 .flipped-blocks > .column-reverse > .leaf3 { |
| 107 margin: 3px 0 3px 3px; |
| 108 } |
| 109 .flipped-lines > .column-reverse > .leaf1, .flipped-lines > .column-reverse > .l
eaf2 { |
| 110 margin: 3px 3px 3px 6px; |
| 111 } |
| 112 .flipped-lines > .column-reverse > .leaf3 { |
| 113 margin: 3px 3px 3px 0; |
| 114 } |
| 115 |
| 116 .flex > div { |
| 117 width: 30px; |
| 118 height: 30px; |
| 119 border: 2px solid blue; |
| 120 flex-direction: column; |
| 121 justify-content: center; |
| 122 } |
| 123 .flex > div > div { |
| 124 font-size: 20px; |
| 125 text-align: center; |
| 126 flex: none; |
| 127 } |
| 128 </style> |
| 129 |
| 130 <div class="container-row"> |
| 131 <div class="vertical-header ltr horizontal"></div> |
| 132 <div class="horizontal-header ltr horizontal">ltr<br>horizontal-tb</div> |
| 133 <div class="vertical-header ltr flipped-blocks">ltr<br>vertical-rl</div> |
| 134 <div class="vertical-header ltr flipped-blocks">ltr<br>vertical-lr</div> |
| 135 <div class="horizontal-header rtl horizontal">rtl<br>horizontal-tb</div> |
| 136 <div class="vertical-header rtl flipped-blocks">rtl<br>vertical-rl</div> |
| 137 <div class="vertical-header rtl flipped-blocks">rtl<br>vertical-lr</div> |
| 138 </div> |
| 139 |
| 140 <script> |
| 141 // Override createContentNode to emulate reverse flow direction. |
| 142 createContentNode = (flexDirection, textDirection, writingMode) => { |
| 143 var flexNode = document.createElement("div"); |
| 144 flexNode.className = "flex " + flexDirection; |
| 145 flexNode.title = "flex-direction: " + flexDirection + "; direction: " + textDi
rection + "; writing-mode: " + writingMode; |
| 146 for (var i = 1; i < 4; i++) |
| 147 flexNode.appendChild(createLeafNode(flexDirection.endsWith("reverse") ? 4 -
i : i)); |
| 148 return flexNode; |
| 149 } |
| 150 |
| 151 flexDirections.forEach((flexDirection) => { |
| 152 var containerRow = createContainerRow(flexDirection); |
| 153 document.body.appendChild(containerRow); |
| 154 }); |
| 155 |
| 156 // Scroll all flex containers to the emulated beginning of flow. |
| 157 var nodes = document.querySelectorAll(".ltr > .row-reverse"); |
| 158 for (var i = 0; i < nodes.length; i++) { |
| 159 nodes[i].scrollLeft = 10000; |
| 160 nodes[i].scrollTop = 10000; |
| 161 } |
| 162 nodes = document.querySelectorAll(".rtl > .row-reverse"); |
| 163 for (var i = 0; i < nodes.length; i++) { |
| 164 nodes[i].scrollLeft = 0; |
| 165 nodes[i].scrollTop = 0; |
| 166 } |
| 167 nodes = document.querySelectorAll(".column-reverse"); |
| 168 for (var i = 0; i < nodes.length; i++) { |
| 169 nodes[i].scrollLeft = 10000; |
| 170 nodes[i].scrollTop = 10000; |
| 171 } |
| 172 nodes = document.querySelectorAll(".flipped-blocks > .column-reverse"); |
| 173 for (var i = 0; i < nodes.length; i++) { |
| 174 nodes[i].scrollLeft = 0; |
| 175 nodes[i].scrollTop = 0; |
| 176 } |
| 177 </script> |
OLD | NEW |