Changeset 105473 in webkit
- Timestamp:
- Jan 19, 2012 6:51:04 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r105471 r105473 1 2012-01-19 Pablo Flouret <pablof@motorola.com> 2 3 Fix inconsistent text selection behavior with option-shift-left/right/up/down. 4 https://bugs.webkit.org/show_bug.cgi?id=75652 5 6 Reviewed by Enrica Casucci. 7 8 On Mac, selecting backwards by word, line or paragraph from the middle 9 of some text, and then going forward leaves the caret back in the middle 10 with no selection, instead of directly selecting to the other end of the 11 word/line/paragraph (Unix/Windows behavior). Fix this by adding a new 12 editing behavior to control whether the selection should go across the 13 initial position of the caret directly or not in situations like the one 14 outlined above. 15 16 * editing/selection/selection-extend-should-not-move-across-caret-on-mac-expected.txt: Added. 17 * editing/selection/selection-extend-should-not-move-across-caret-on-mac.html: Added. 18 1 19 2012-01-19 Simon Fraser <simon.fraser@apple.com> 2 20 -
trunk/Source/WebCore/ChangeLog
r105471 r105473 1 2012-01-19 Pablo Flouret <pablof@motorola.com> 2 3 Fix inconsistent text selection behavior with option-shift-left/right/up/down. 4 https://bugs.webkit.org/show_bug.cgi?id=75652 5 6 Reviewed by Enrica Casucci. 7 8 On Mac, selecting backwards by word, line or paragraph from the middle 9 of some text, and then going forward leaves the caret back in the middle 10 with no selection, instead of directly selecting to the other end of the 11 word/line/paragraph (Unix/Windows behavior). Fix this by adding a new 12 editing behavior to control whether the selection should go across the 13 initial position of the caret directly or not in situations like the one 14 outlined above. 15 16 Test: editing/selection/selection-extend-should-not-move-across-caret-on-mac.html 17 18 * editing/EditingBehavior.h: 19 (WebCore::EditingBehavior::shouldExtendSelectionByWordOrLineAcrossCaret): 20 * editing/FrameSelection.cpp: 21 (WebCore::FrameSelection::modify): 22 1 23 2012-01-19 Simon Fraser <simon.fraser@apple.com> 2 24 -
trunk/Source/WebCore/editing/EditingBehavior.h
r102252 r105473 68 68 bool shouldNavigateBackOnBackspace() const { return m_type != EditingUnixBehavior; } 69 69 70 // On Mac, selecting backwards by word/line from the middle of a word/line, and then going 71 // forward leaves the caret back in the middle with no selection, instead of directly selecting 72 // to the other end of the line/word (Unix/Windows behavior). 73 bool shouldExtendSelectionByWordOrLineAcrossCaret() const { return m_type != EditingMacBehavior; } 74 70 75 private: 71 76 EditingBehaviorType m_type; -
trunk/Source/WebCore/editing/FrameSelection.cpp
r105441 r105473 937 937 break; 938 938 case AlterationExtend: 939 if (!m_selection.isCaret() 940 && (granularity == WordGranularity || granularity == ParagraphGranularity || granularity == LineGranularity) 941 && m_frame && !m_frame->editor()->behavior().shouldExtendSelectionByWordOrLineAcrossCaret()) { 942 // Don't let the selection go across the base position directly. Needed to match mac 943 // behavior when, for instance, word-selecting backwards starting with the caret in 944 // the middle of a word and then word-selecting forward, leaving the caret in the 945 // same place where it was, instead of directly selecting to the end of the word. 946 VisibleSelection newSelection = m_selection; 947 newSelection.setExtent(position); 948 if (m_selection.isBaseFirst() != newSelection.isBaseFirst()) 949 position = m_selection.base(); 950 } 951 939 952 // Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the 940 953 // base in place and moving the extent. Matches NSTextView.
Note: See TracChangeset
for help on using the changeset viewer.