Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: LayoutTests/editing/input/resources/reveal-utilities.js

Issue 9965112: Revert 103073 - Scroll non-visible edit controls and caret into the center of the view when startin… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/input/resources/reveal-utilities.js
===================================================================
--- LayoutTests/editing/input/resources/reveal-utilities.js (revision 113050)
+++ LayoutTests/editing/input/resources/reveal-utilities.js (working copy)
@@ -1,66 +0,0 @@
-function offsetFromViewportTop(element)
-{
- return element.getClientRects()[0].top;
-}
-
-function offsetOfMiddleFromViewportTop(element)
-{
- return element.getClientRects()[0].top + Math.round(element.getClientRects()[0].height / 2);
-}
-
-function copyText()
-{
- var copy = document.getElementById("copy");
- copy.focus();
- document.execCommand("selectall");
- document.execCommand("copy");
-}
-
-function generateNumbers(from, to, zeroPaddedWidth, delimiter)
-{
- var result = "";
- for (var i = from; i <= to; ++i) {
- var number = i.toString();
- while (number.length < zeroPaddedWidth)
- number = "0" + number;
- result += number + delimiter;
- }
- return result;
-}
-
-function assertInputIsInTheMiddleOfViewport()
-{
- var viewportMiddle = Math.round(window.innerHeight / 2);
- var offsetOfInput = offsetOfMiddleFromViewportTop(document.getElementById("input"));
- document.getElementById("results").innerHTML += "ScrollVertically: " +
- (Math.abs(offsetOfInput - viewportMiddle) <= 3 ?
- "PASS" :
- "FAIL<br>viewportMiddle: " + viewportMiddle + ", offsetOfInput: " + offsetOfInput);
-}
-
-function performVerticalScrollingTest()
-{
- var initialOffset = offsetFromViewportTop(document.body.children[0]);
- document.getElementById("input").focus();
- if (window.eventSender) {
- while (offsetFromViewportTop(document.body.children[0]) < initialOffset)
- eventSender.keyDown("pageUp");
- return true;
- }
- return false;
-}
-
-function performVerticalScrollingInputTest()
-{
- if (performVerticalScrollingTest())
- eventSender.keyDown("a");
-}
-
-function performVerticalScrollingPasteTest()
-{
- copyText();
- if (performVerticalScrollingTest()) {
- document.execCommand("selectall");
- document.execCommand("paste");
- }
-}

Powered by Google App Engine
This is Rietveld 408576698