Diff
Deleted: branches/chromium/1084/LayoutTests/editing/input/caret-at-the-edge-of-contenteditable.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/caret-at-the-edge-of-contenteditable.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/caret-at-the-edge-of-contenteditable.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<head>
-</head>
-<body>
-<div>When the caret reaches the edge of the input box or content editable div, on the next input if must jump to the center of the control.</div>
-<span style="position:absolute; visibility:hidden" id="single-digit">0</span>
-<div style="border:thin solid black; white-space:nowrap; overflow:hidden" contenteditable="true" id="input-contenteditable">012345678901234567890123456789</div>
-<script>
-
-var contentEditable = document.getElementById("input-contenteditable");
-var singleDigitWidth = document.getElementById("single-digit").clientWidth;
-var contentEditableSize = 10;
-contentEditable.style.width = (singleDigitWidth * contentEditableSize) + "px";
-contentEditable.focus();
-// Move the caret to the beginning of the input.
-getSelection().collapse(contentEditable.firstChild, 0);
-var editableContent = contentEditable.textContent;
-if (window.eventSender) {
- for (var i = 0; i < contentEditableSize * 1.2; ++i)
- eventSender.keyDown(editableContent[i]);
-}
-
-</script>
-</body>
Deleted: branches/chromium/1084/LayoutTests/editing/input/caret-at-the-edge-of-input.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/caret-at-the-edge-of-input.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/caret-at-the-edge-of-input.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<head>
-</head>
-<body>
-<div>When the caret reaches the edge of the input box, on the next input if must jump to the center of the control.</div>
-<input type="text" name="input-edit" id="input-edit" size="10" value="012345678901234567890123456789" />
-<script>
-
-var inputEdit = document.getElementById("input-edit");
-inputEdit.focus();
-var inputEditContent = inputEdit.value;
-inputEdit.setSelectionRange(0, 0);
-if (window.eventSender) {
- for (var i = 0; i < inputEdit.size * 1.2; ++i)
- eventSender.keyDown(inputEditContent[i]);
-}
-
-</script>
-</body>
Deleted: branches/chromium/1084/LayoutTests/editing/input/resources/reveal-utilities.js (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/resources/reveal-utilities.js 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/resources/reveal-utilities.js 2012-04-03 17:00:19 UTC (rev 113050)
@@ -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");
- }
-}
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-caret-of-multiline-contenteditable.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-caret-of-multiline-contenteditable.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-caret-of-multiline-contenteditable.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<head>
-<script type="text/_javascript_" src=""
-</head>
-<body>
-<div>When the caret is scrolled out, on starting typing it must be brought to the center of the control.</div>
-<span style="position:absolute; visibility:hidden" id="single-digit">0</span>
-<div style="border:thin solid black; overflow:scroll" contenteditable="true" id="input-contenteditable"></div>
-<script>
-
-var contentEditable = document.getElementById("input-contenteditable");
-contentEditable.innerHTML = generateNumbers(0, 30, 2, "<br>");
-var singleDigitHeight = document.getElementById("single-digit").clientHeight;
-var contentEditableSize = 10;
-contentEditable.style.height = (singleDigitHeight * contentEditableSize) + "px";
-contentEditable.focus();
-var child = contentEditable.firstChild;
-for (var i = 0; i < 36; ++i)
- child = child.nextSibling;
-getSelection().collapse(child, 0);
-if (window.eventSender)
- eventSender.keyDown(">");
-
-</script>
-</body>
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-caret-of-multiline-input.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-caret-of-multiline-input.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-caret-of-multiline-input.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<head>
-<script type="text/_javascript_" src=""
-</head>
-<body>
-<div>When the caret is scrolled out, on starting typing it must be brought to the center of the control.</div>
-<textarea name="textarea" id="textarea" rows="10" cols="10"></textarea>
-<script>
-
-var textArea = document.getElementById("textarea");
-textArea.textContent = generateNumbers(0, 30, 2, "\n");
-textArea.focus();
-textArea.selectionStart = 36;
-if (window.eventSender)
- eventSender.keyDown(">");
-
-</script>
-</body>
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-input-vertically-expected.txt (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-input-vertically-expected.txt 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-input-vertically-expected.txt 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,4 +0,0 @@
-After starting typing in a scrolled out of view editor control, the control is to be brought in the center of the view
-To test manually, scroll the page up to the top, then start typing. Input box should be scrolled into the middle of the view.
-a
-ScrollVertically: PASS
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-input-vertically.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-input-vertically.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-input-vertically.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<head>
-<script type="text/_javascript_" src=""
-<style type="text/css">
-/* This is needed for divs percent heights to work. */
-html { height:100%; }
-body { margin:0; padding:0; height:100%; }
-</style>
-</head>
-<body>
-<div>After starting typing in a scrolled out of view editor control, the control is to be brought in the center of the view</div>
-<div style="height:200%"></div>
-<div>To test manually, scroll the page up to the top, then start typing. Input box should be scrolled into the middle of the view.</div>
-<div style="width:150px; border:thin solid black" contenteditable="true" id="input"></div>
-<div style="height:200%"></div>
-<div id="results"></div>
-<script>
-
-if (window.layoutTestController)
- layoutTestController.dumpAsText();
-performVerticalScrollingInputTest();
-assertInputIsInTheMiddleOfViewport();
-
-</script>
-</body>
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-paste-vertically-expected.txt (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-paste-vertically-expected.txt 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-paste-vertically-expected.txt 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,5 +0,0 @@
-After pasting text in a scrolled out of view editor control, the control is to be brought in the center of the view
-To test manually, have some text in the clipboard, scroll the page up to the top, then paste. The control should be scrolled into the middle of the view.
-WebKit
-WebKit
-ScrollVertically: PASS
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-paste-vertically.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-paste-vertically.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-contenteditable-on-paste-vertically.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<head>
-<script type="text/_javascript_" src=""
-<style type="text/css">
-/* This is needed for divs percent heights to work. */
-html { height:100%; }
-body { margin:0; padding:0; height:100%; }
-</style>
-</head>
-<body>
-<div>After pasting text in a scrolled out of view editor control, the control is to be brought in the center of the view</div>
-<div style="height:200%"></div>
-<div>To test manually, have some text in the clipboard, scroll the page up to the top, then paste. The control should be scrolled into the middle of the view.</div>
-<div style="width:150px; border:thin solid black" contenteditable="true" id="input"></div>
-<div style="height:200%"></div>
-<div contenteditable="true" id="copy">WebKit</div>
-<div id="results"></div>
-<script>
-
-if (window.layoutTestController)
- layoutTestController.dumpAsText();
-performVerticalScrollingPasteTest();
-assertInputIsInTheMiddleOfViewport();
-
-</script>
-</body>
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-input-vertically-expected.txt (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-input-vertically-expected.txt 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-input-vertically-expected.txt 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,4 +0,0 @@
-After starting typing in a scrolled out of view editor control, the control is to be brought in the center of the view
-To test manually, scroll the page up to the top, then start typing. Input box should be scrolled into the middle of the view.
-
-ScrollVertically: PASS
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-input-vertically.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-input-vertically.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-input-vertically.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<head>
-<script type="text/_javascript_" src=""
-<style type="text/css">
-/* This is needed for divs percent heights to work. */
-html { height:100%; }
-body { margin:0; padding:0; height:100%; }
-</style>
-</head>
-<body>
-<div>After starting typing in a scrolled out of view editor control, the control is to be brought in the center of the view</div>
-<div style="height:200%"></div>
-<div>To test manually, scroll the page up to the top, then start typing. Input box should be scrolled into the middle of the view.</div>
-<input type="text" name="input" id="input" />
-<div style="height:200%"></div>
-<div id="results"></div>
-<script>
-
-if (window.layoutTestController)
- layoutTestController.dumpAsText();
-performVerticalScrollingInputTest();
-assertInputIsInTheMiddleOfViewport();
-
-</script>
-</body>
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-paste-vertically-expected.txt (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-paste-vertically-expected.txt 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-paste-vertically-expected.txt 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,5 +0,0 @@
-After pasting text in a scrolled out of view editor control, the control is to be brought in the center of the view
-To test manually, have some text in the clipboard, then scroll the page up to the top, then paste. Input box should be scrolled into the middle of the view.
-
-WebKit
-ScrollVertically: PASS
Deleted: branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-paste-vertically.html (113049 => 113050)
--- branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-paste-vertically.html 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/LayoutTests/editing/input/reveal-edit-on-paste-vertically.html 2012-04-03 17:00:19 UTC (rev 113050)
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<head>
-<script type="text/_javascript_" src=""
-<style type="text/css">
-/* This is needed for divs percent heights to work. */
-html { height:100%; }
-body { margin:0; padding:0; height:100%; }
-</style>
-</head>
-<body>
-<div>After pasting text in a scrolled out of view editor control, the control is to be brought in the center of the view</div>
-<div style="height:200%"></div>
-<div>To test manually, have some text in the clipboard, then scroll the page up to the top, then paste. Input box should be scrolled into the middle of the view.</div>
-<input type="text" name="input" id="input" />
-<div style="height:200%"></div>
-<div contenteditable="true" id="copy">WebKit</div>
-<div id="results"></div>
-<script>
-
-if (window.layoutTestController)
- layoutTestController.dumpAsText();
-performVerticalScrollingPasteTest();
-assertInputIsInTheMiddleOfViewport();
-
-</script>
-</body>
Modified: branches/chromium/1084/Source/WebCore/editing/Editor.cpp (113049 => 113050)
--- branches/chromium/1084/Source/WebCore/editing/Editor.cpp 2012-04-03 16:52:28 UTC (rev 113049)
+++ branches/chromium/1084/Source/WebCore/editing/Editor.cpp 2012-04-03 17:00:19 UTC (rev 113050)
@@ -916,7 +916,7 @@
// Reveal the current selection
if (Frame* editedFrame = document->frame())
if (Page* page = editedFrame->page())
- page->focusController()->focusedOrMainFrame()->selection()->revealSelection(ScrollAlignment::alignCenterIfNeeded);
+ page->focusController()->focusedOrMainFrame()->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded);
}
}
@@ -2255,7 +2255,7 @@
if (m_ignoreCompositionSelectionChange)
return;
- m_frame->selection()->revealSelection(ScrollAlignment::alignCenterIfNeeded);
+ m_frame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded);
}
void Editor::setIgnoreCompositionSelectionChange(bool ignore)