| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| jsTestIsAsync = true; |
| |
| description('Verify selecting text does not cause any scrolling.'); |
| |
| var originalPageYOffset; |
| var originalBodyScrollTop; |
| function test() |
| { |
| setTimeout(autoscrollTestPart1, 0); |
| } |
| function autoscrollTestPart1() |
| { |
| var ta = document.getElementById('ta'); |
| ta.scrollIntoView(); |
| |
| originalPageYOffset = pageYOffset; |
| originalBodyScrollTop = document.body.scrollTop; |
| |
| if (window.eventSender) { |
| var taClientRect = ta.getBoundingClientRect(); |
| var verticalOffset = taClientRect.top + (taClientRect.height / 2); |
| var h = ta.offsetTop - document.body.scrollTop + 10; |
| eventSender.dragMode = false; |
| eventSender.mouseMoveTo(20, verticalOffset); |
| eventSender.mouseDown(); |
| eventSender.mouseMoveTo(20, verticalOffset); |
| eventSender.mouseMoveTo(100, verticalOffset); |
| } |
| setTimeout(autoscrollTestPart2, 100); |
| } |
| function autoscrollTestPart2() |
| { |
| if (window.eventSender) |
| eventSender.mouseUp(); |
| |
| shouldBeTrue('document.getSelection().toString().length > 1'); |
| shouldBe('pageXOffset', '0'); |
| shouldBe('pageYOffset', 'originalPageYOffset'); |
| shouldBe('document.body.scrollLeft', '0'); |
| shouldBe('document.body.scrollTop', 'originalBodyScrollTop'); |
| shouldBe('pageYOffset', 'document.body.scrollTop'); |
| shouldBeTrue('pageYOffset > 2000'); |
| |
| finishJSTest(); |
| } |
| </script> |
| </head> |
| <body onload="test()"> |
| <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12331">bug 12331</a>.</p> |
| <p>To test manually, scroll down until you find the input element. Select some text. If the bug occurs, the page will scroll back up to the top.</p> |
| <div style="height:3000px"></div> |
| <input id="ta" value="select some of this text"></input> |
| <p>If the bug does not occur, you'll be left down here at the bottom.</p> |
| </body> |
| <script src="../../resources/js-test-post.js"></script> |
| </html> |