| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <textarea id="textarea" style="width: 150px; height: 100px;"></textarea> |
| <div id="resizablediv" style="resize:both; overflow:scroll; width: 100px; height: 100px;"></div> |
| <script> |
| function doScroll(x, y, deltaY, device) { |
| eventSender.gestureScrollBegin(device, x, y); |
| eventSender.gestureScrollUpdate(device, 0, deltaY); |
| eventSender.gestureScrollEnd(device, 0, 0); |
| } |
| |
| function resize(id, scrollDeltaY, expectedDeltaY, device) { |
| var target = document.getElementById(id); |
| var rect = target.getBoundingClientRect(); |
| var old_height = target.offsetHeight; |
| // Scrolling within the normal resizer area (15 x 15) |
| doScroll(rect.right - 5, rect.bottom - 5, scrollDeltaY, device); |
| assert_equals(target.offsetHeight - old_height, expectedDeltaY); |
| } |
| |
| test(function() { |
| resize("textarea", 20, 20, "touchscreen"); |
| }, 'Touchscreen drag resizes textarea'); |
| |
| test(function() { |
| resize("textarea", 20, 0, "touchpad"); |
| }, 'Touchpad scroll should not resize textarea'); |
| |
| test(function() { |
| resize("resizablediv", 20, 20, "touchscreen"); |
| }, 'Touchscreen drag resizes resizable div'); |
| |
| test(function() { |
| resize("resizablediv", 20, 0, "touchpad"); |
| }, 'Touchpad scroll should not resize resizable div'); |
| </script> |