Index: LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-text-field.html |
diff --git a/LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-text-field.html b/LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-text-field.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..beb956fa9e7bc746b2465cae6e9300bda2852dbd |
--- /dev/null |
+++ b/LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-text-field.html |
@@ -0,0 +1,101 @@ |
+<!DOCTYPE html> |
+<html> |
+ <head> |
+ <link rel="stylesheet" href="../../../js/resources/js-test-style.css"> |
+ <script src="../../../js/resources/js-test-pre.js"></script> |
+ <script src="resources/gesture-helpers.js"></script> |
+ </head> |
+ |
+ <body id="body" style="margin:0" onload="runTest()"> |
+ <form> |
+ <input id="textfield" style="height: 200px; font-size:xx-large" type="text" value="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"> |
+ </form> |
+ <div style="background: green; height:100px; width: 3000px"></div> |
+ |
+ <p id="description"></p> |
+ <div id="console"></div> |
+ <script type="text/javascript"> |
+ |
+ var box; |
+ var body; |
+ |
+ function testScroll() |
+ { |
+ debug("Testing gesture scroll on text field"); |
+ eventSender.gestureScrollBegin(100, 30); |
+ eventSender.gestureScrollUpdate(-10, 0); |
+ eventSender.gestureScrollUpdate(-10, 0); |
+ eventSender.gestureScrollUpdate(-10, 0); |
+ eventSender.gestureScrollUpdate(-10, 0); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ shouldBe('box.scrollLeft', '40'); |
+ } |
+ |
+ function testFling() |
+ { |
+ debug("Testing fling gesture scroll on text field"); |
+ |
+ eventSender.gestureScrollBegin(100, 30); |
+ eventSender.gestureScrollUpdate(-10, 0); |
+ eventSender.gestureScrollUpdateWithoutPropagation(-500, 0); |
+ eventSender.gestureScrollUpdateWithoutPropagation(-300, 0); |
+ eventSender.gestureScrollUpdateWithoutPropagation(-200, 0); |
+ eventSender.gestureScrollUpdateWithoutPropagation(-200, 0); |
+ eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); |
+ eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ // The text box should be fully scrolled now |
+ shouldBe('box.scrollWidth - box.scrollLeft', 'box.clientWidth'); |
+ |
+ // Make sure the fling doesn't propagate to the body element |
+ shouldBe('body.scrollLeft', '0'); |
+ } |
+ |
+ function testFullyScrolledFling() |
+ { |
+ debug("Testing fling gesture scroll on fully scrolled text field scrolls parent"); |
+ |
+ // The text box should still be fully scrolled |
+ shouldBe('textfield.scrollWidth - textfield.scrollLeft', 'textfield.clientWidth'); |
+ |
+ eventSender.gestureScrollBegin(100, 30); |
+ eventSender.gestureScrollUpdate(-10, 0); |
+ eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ // Make sure the scroll occured on the body element |
+ shouldBe('body.scrollLeft', '110'); |
+ } |
+ |
+ if (window.testRunner) |
+ testRunner.waitUntilDone(); |
+ |
+ function runTest() |
+ { |
+ box = document.getElementById("textfield"); |
+ body = document.getElementById("body"); |
+ |
+ if (window.eventSender) { |
+ description('This tests that input text fields can be touch scrolled'); |
+ if (checkTestDependencies() && window.eventSender.gestureScrollUpdateWithoutPropagation) { |
+ testScroll(); |
+ testFling(); |
+ testFullyScrolledFling(); |
+ |
+ successfullyParsed = true; |
+ isSuccessfullyParsed(); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ |
+ } else { |
+ exitIfNecessary(); |
+ } |
+ } else { |
+ debug("This test requires DumpRenderTree. Gesture-scroll the page to validate the implementation."); |
+ } |
+ } |
+ </script> |
+ </body> |
+</html> |