Source/WebCore/ChangeLog

 12013-08-05 Arpita Bahuguna <a.bah@samsung.com>
 2
 3 Moving down from start of a line doesn't place the caret at the start of the next.
 4 https://bugs.webkit.org/show_bug.cgi?id=119511
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 When moving the caret from some position offset on a line to the start
 9 of that line (using the up arrow key) and then moving the caret to the
 10 following line (using the down arrow key), the caret is incorrectly
 11 positioned on the next line, displaced by an offset equivalent to that
 12 of the start caret position on the first line.
 13
 14 This is because the 'X' position for vertical arrow navigation is
 15 retained even after the selection is modified. This is done for maintaining
 16 the 'X' value when moving between lines (vertical navigation).
 17 However, if the selection modification is userTriggered, for line or
 18 paragraph granularity, once the setSelection() call resets the maintained
 19 'x' position, we should not set it back. Otherwise, the previous
 20 selection modification's 'x' value is considered and a wrong position
 21 for the next line is computed.
 22
 23 Test: editing/selection/move-caret-to-next-line.html
 24
 25 * editing/FrameSelection.cpp:
 26 (WebCore::FrameSelection::modify):
 27 Added additional check for userTriggered when trying to set back
 28 the previous 'x' position for vertical arrow navigation.
 29
1302013-07-27 Mark Rowe <mrowe@apple.com>
231
332 Logging should be configurable using human-readable channel names rather than crazy bitmasks
153739

Source/WebCore/editing/FrameSelection.cpp

@@bool FrameSelection::modify(EAlteration
10481048 break;
10491049 }
10501050
1051  if (granularity == LineGranularity || granularity == ParagraphGranularity)
 1051 if (userTriggered != UserTriggered && (granularity == LineGranularity || granularity == ParagraphGranularity))
10521052 m_xPosForVerticalArrowNavigation = x;
10531053
10541054 if (userTriggered == UserTriggered)
153739

LayoutTests/ChangeLog

 12013-08-05 Arpita Bahuguna <a.bah@samsung.com>
 2
 3 Moving down from start of a line doesn't place the caret at the start of the next.
 4 https://bugs.webkit.org/show_bug.cgi?id=119511
 5
 6 * editing/selection/move-caret-to-next-line-expected.txt: Added.
 7 * editing/selection/move-caret-to-next-line.html: Added.
 8 Added layout test case for verifying that the caret is placed
 9 at the start of the line when moving down from a previous line.
 10
1112013-08-05 Dean Jackson <dino@apple.com>
212
313 Update HTMLPreloadScanner to handle img srcset
153739

LayoutTests/editing/selection/move-caret-to-next-line-expected.txt

 1PASS caretRectAfterFirstDownArrow.left is caretRectAtStartOfLine.left
 2PASS caretRectAfterFirstDownArrow.top is caretRectAtStartOfLine.top
 3
0

LayoutTests/editing/selection/move-caret-to-next-line.html

 1<!DOCTYPE html>
 2<html>
 3<head>
 4<script src="../../fast/js/resources/js-test-pre.js"></script>
 5</head>
 6<body>
 7<div contenteditable=true id="testDiv">
 8<p>
 9Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=119511">119511</a>Caret should be placed somewhere in between this line and then moved to the start using up arrow key.
 10</p>
 11<p id="test">Down key should place caret at the start of this line.</p>
 12</div>
 13<script>
 14if (window.internals) {
 15 var testElement = document.getElementById('test');
 16 testElement.focus();
 17
 18 var selection = window.getSelection();
 19 selection.collapse(testElement, 0);
 20 caretRectAtStartOfLine = internals.absoluteCaretBounds(document);
 21
 22 selection.collapse(testElement, 1);
 23 eventSender.keyDown("upArrow");
 24 eventSender.keyDown("upArrow");
 25 eventSender.keyDown("downArrow");
 26 caretRectAfterFirstDownArrow = internals.absoluteCaretBounds(document);
 27
 28 shouldBe("caretRectAfterFirstDownArrow.left", "caretRectAtStartOfLine.left");
 29 shouldBe("caretRectAfterFirstDownArrow.top", "caretRectAtStartOfLine.top");
 30
 31 document.getElementById('testDiv').style.display = 'none';
 32}
 33</script>
 34</div>
 35</body>
 36</html>
 37
0