| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>CSS Writing Modes Test: Shrink-to-fit with orthogonal children</title> | 2 <title>CSS Writing Modes Test: Shrink-to-fit with orthogonal children</title> |
| 3 <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#orthogonal-flow
s"> | 3 <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#orthogonal-flow
s"> |
| 4 <meta name="assert" content="Shrink-to-fit with orthogonal children"> | 4 <meta name="assert" content="Shrink-to-fit with orthogonal children"> |
| 5 <meta name="flags" content="ahem combo"> | 5 <meta name="flags" content="ahem combo"> |
| 6 <link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> | 6 <link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com"> |
| 7 <script src="../../../resources/testharness.js"></script> | 7 <script src="../../../resources/testharness.js"></script> |
| 8 <script src="../../../resources/testharnessreport.js"></script> | 8 <script src="../../../resources/testharnessreport.js"></script> |
| 9 <link rel="stylesheet" href="../../../resources/testharness.css"> | 9 <link rel="stylesheet" href="../../../resources/testharness.css"> |
| 10 <style> | 10 <style> |
| 11 .test { | 11 .test { |
| 12 border:thin solid; | 12 border:thin solid; |
| 13 font:20px/1 Ahem; | 13 font:20px/1 Ahem; |
| 14 } | 14 } |
| 15 .target { | 15 .target { |
| 16 color:blue; | 16 color:blue; |
| 17 height:3em; |
| 17 -webkit-writing-mode:vertical-rl; | 18 -webkit-writing-mode:vertical-rl; |
| 18 } | 19 } |
| 19 .border { | 20 .border { |
| 20 border-right:blue solid .5em; | 21 border-right:blue solid .5em; |
| 21 } | 22 } |
| 22 .next { | 23 .next { |
| 23 color:orange; | 24 color:orange; |
| 24 } | 25 } |
| 25 .inline-block { | 26 .inline-block { |
| 26 display:inline-block; | 27 display:inline-block; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } else { | 153 } else { |
| 153 run(); | 154 run(); |
| 154 } | 155 } |
| 155 | 156 |
| 156 function run() { | 157 function run() { |
| 157 Array.prototype.forEach.call(document.querySelectorAll(".test"), function (n
ode) { | 158 Array.prototype.forEach.call(document.querySelectorAll(".test"), function (n
ode) { |
| 158 var title = node.previousElementSibling.innerText; | 159 var title = node.previousElementSibling.innerText; |
| 159 test(function () { | 160 test(function () { |
| 160 try { | 161 try { |
| 161 var targetNode = node.querySelector(".target"); | 162 var targetNode = node.querySelector(".target"); |
| 163 var fontSize = parseFloat(getComputedStyle(targetNode).fontSize)
; |
| 162 var targetBounds = targetNode.getBoundingClientRect(); | 164 var targetBounds = targetNode.getBoundingClientRect(); |
| 163 assert_approx_equals(targetBounds.height, targetBounds.width * 2
, .01, "writing-mode is vertical") | 165 assert_less_than_equal(targetBounds.width, fontSize * 2.01, "wri
ting-mode is vertical") |
| 164 var nextNode = node.querySelector(".next"); | 166 var nextNode = node.querySelector(".next"); |
| 165 var nextBounds = nextNode.getBoundingClientRect(); | 167 var nextBounds = nextNode.getBoundingClientRect(); |
| 166 assert_equals(nextBounds.left - targetBounds.right, 0, "the left
edge of the orange box touches the right edge of the blue box"); | 168 assert_equals(nextBounds.left - targetBounds.right, 0, "the left
edge of the orange box touches the right edge of the blue box"); |
| 167 } catch (e) { | 169 } catch (e) { |
| 168 node.previousElementSibling.classList.add("fail"); | 170 node.previousElementSibling.classList.add("fail"); |
| 169 throw e; | 171 throw e; |
| 170 } | 172 } |
| 171 }, title); | 173 }, title); |
| 172 }); | 174 }); |
| 173 if (window.testRunner) | 175 if (window.testRunner) |
| 174 container.style.display = "none"; | 176 container.style.display = "none"; |
| 175 done(); | 177 done(); |
| 176 } | 178 } |
| 177 </script> | 179 </script> |
| OLD | NEW |