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