| <style> |
| div { |
| width: 50px; |
| height: 50px; |
| overflow: hidden; |
| -webkit-box-sizing: border-box; |
| border: solid; |
| margin: 10px; |
| } |
| |
| #both { |
| resize: both; |
| } |
| |
| #horizontal { |
| resize: horizontal; |
| } |
| |
| #vertical { |
| resize: vertical; |
| } |
| |
| #block-horizontal, |
| #block-vertical { |
| resize: block; |
| } |
| |
| #inline-horizontal, |
| #inline-vertical { |
| resize: inline; |
| } |
| </style> |
| |
| <pre id="console"></pre> |
| <div id="both"></div> |
| <div id="horizontal"></div> |
| <div id="vertical"></div> |
| <div id="block-horizontal"></div> |
| <div id="inline-horizontal"></div> |
| <section style="writing-mode: vertical-lr;"> |
| <div id="block-vertical"></div> |
| <div id="inline-vertical"></div> |
| </section> |
| |
| <script type="text/javascript"> |
| function log(message) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(message + "\n")); |
| } |
| |
| function resize(target) |
| { |
| var x = document.body.offsetLeft + target.offsetLeft + target.offsetWidth; |
| var y = document.body.offsetTop + target.offsetTop + target.offsetHeight; |
| eventSender.mouseMoveTo(x - 6, y - 6); |
| eventSender.mouseDown(); |
| eventSender.mouseMoveTo(x + 44, y + 44); |
| eventSender.mouseUp(); |
| } |
| |
| function assertSize(target, width, height) |
| { |
| var computedStyle = getComputedStyle(target); |
| var actualWidth = computedStyle.width; |
| var actualHeight = computedStyle.height; |
| |
| if (actualWidth === width && actualHeight === height) |
| log("'" + target.id + "' resized as expected to (" + width + ", " + height + ")."); |
| else |
| log("FAIL: '" + target.id + "' resized to (" + actualWidth + ", " + actualHeight + ") instead of (" + width + ", " + height + ")."); |
| } |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| |
| var both = document.getElementById("both"); |
| var horizontal = document.getElementById("horizontal"); |
| var vertical = document.getElementById("vertical"); |
| var blockHorizontal = document.getElementById("block-horizontal"); |
| var inlineHorizontal = document.getElementById("inline-horizontal"); |
| var blockVertical = document.getElementById("block-vertical"); |
| var inlineVertical = document.getElementById("inline-vertical"); |
| |
| resize(both); |
| resize(horizontal); |
| resize(vertical); |
| resize(blockHorizontal); |
| resize(inlineHorizontal); |
| resize(blockVertical); |
| resize(inlineVertical); |
| |
| assertSize(both, "100px", "100px"); |
| assertSize(horizontal, "100px", "50px"); |
| assertSize(vertical, "50px", "100px"); |
| assertSize(blockHorizontal, "50px", "100px"); |
| assertSize(inlineHorizontal, "100px", "50px"); |
| assertSize(blockVertical, "100px", "50px"); |
| assertSize(inlineVertical, "50px", "100px"); |
| } |
| </script> |