Changeset 102252 in webkit
- Timestamp:
- Dec 7, 2011 11:05:50 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102245 r102252 1 2011-12-07 Xiaomei Ji <xji@chromium.org> 2 3 Turn on move caret by word visually for windows platform. 4 https://bugs.webkit.org/show_bug.cgi?id=59652 5 6 Reviewed by Ryosuke Niwa. 7 8 * editing/selection/caret-mode-paragraph-keys-navigation.html: 9 * editing/selection/move-by-word-visually-crash-test-1.html: 10 * editing/selection/move-by-word-visually-crash-test-2.html: 11 * editing/selection/move-by-word-visually-crash-test-3.html: 12 * editing/selection/move-by-word-visually-crash-test-4.html: 13 * editing/selection/move-by-word-visually-crash-test-textarea.html: 14 * editing/selection/move-by-word-visually-inline-block-positioned-element.html: 15 * editing/selection/move-by-word-visually-multi-line.html: 16 * editing/selection/move-by-word-visually-multi-space.html: 17 * editing/selection/move-by-word-visually-null-box.html: 18 * editing/selection/move-by-word-visually-single-space-inline-element.html: 19 * editing/selection/move-by-word-visually-single-space-one-element.html: 20 * editing/selection/move-by-word-visually-textarea.html: 21 * editing/selection/move-left-right-by-word-mac-expected.txt: Added. 22 * editing/selection/move-left-right-by-word-mac.html: Added. 23 * editing/selection/resources/move-by-word-visually.js: 24 (moveByWord): 25 (moveByWordOnEveryChar): 26 1 27 2011-12-07 Balazs Kelemen <kbalazs@webkit.org> 2 28 -
trunk/LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation.html
r99258 r102252 14 14 layoutTestController.overridePreference("WebKitEnableCaretBrowsing", true); 15 15 layoutTestController.dumpAsText(); 16 layoutTestController.setEditingBehavior('mac'); 16 17 17 18 var target = document.getElementById("target"); -
trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1.html
r93935 r102252 10 10 }; 11 11 12 if (window.layoutTestController) 12 if (window.layoutTestController) { 13 13 layoutTestController.dumpAsText(); 14 layoutTestController.setEditingBehavior('win'); 15 } 14 16 </script> 15 17 <textarea></textarea> -
trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2.html
r93935 r102252 10 10 }; 11 11 12 if (window.layoutTestController) 12 if (window.layoutTestController) { 13 13 layoutTestController.dumpAsText(); 14 layoutTestController.setEditingBehavior('win'); 15 } 14 16 </script> 15 17 <vkern></vkern><marquee><div title="0|0" class="test_move_by_word">abc def -
trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3.html
r93935 r102252 10 10 }; 11 11 12 if (window.layoutTestController) 12 if (window.layoutTestController) { 13 13 layoutTestController.dumpAsText(); 14 layoutTestController.setEditingBehavior('win'); 15 } 14 16 </script> 15 17 <video></video><meter><image class="test_move_by_word" title="0|0"> -
trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4.html
r93935 r102252 10 10 }; 11 11 12 if (window.layoutTestController) 12 if (window.layoutTestController) { 13 13 layoutTestController.dumpAsText(); 14 layoutTestController.setEditingBehavior('win'); 15 } 14 16 </script> 15 17 ><div title="0|0" class="test_move_by_word" dir=ltr><keygen><base> -
trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-textarea.html
r99886 r102252 16 16 }; 17 17 18 if (window.layoutTestController) 18 if (window.layoutTestController) { 19 19 layoutTestController.dumpAsText(); 20 layoutTestController.setEditingBehavior('win'); 21 } 20 22 </script> 21 23 -
trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html
r101430 r102252 10 10 }; 11 11 12 if (window.layoutTestController) 12 if (window.layoutTestController) { 13 13 layoutTestController.dumpAsText(); 14 layoutTestController.setEditingBehavior('win'); 15 } 14 16 </script> 15 17 -
trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line.html
r101430 r102252 18 18 }; 19 19 20 if (window.layoutTestController) 20 if (window.layoutTestController) { 21 21 layoutTestController.dumpAsText(); 22 layoutTestController.setEditingBehavior('win'); 23 } 22 24 </script> 23 25 </head> -
trunk/LayoutTests/editing/selection/move-by-word-visually-multi-space.html
r92223 r102252 18 18 }; 19 19 20 if (window.layoutTestController) 20 if (window.layoutTestController) { 21 21 layoutTestController.dumpAsText(); 22 layoutTestController.setEditingBehavior('win'); 23 } 22 24 </script> 23 25 </head> -
trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html
r91788 r102252 16 16 }; 17 17 18 if (window.layoutTestController) 18 if (window.layoutTestController) { 19 19 layoutTestController.dumpAsText(); 20 layoutTestController.setEditingBehavior('win'); 21 } 20 22 </script> 21 23 <div id="console"></div> -
trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element.html
r92223 r102252 18 18 }; 19 19 20 if (window.layoutTestController) 20 if (window.layoutTestController) { 21 21 layoutTestController.dumpAsText(); 22 layoutTestController.setEditingBehavior('win'); 23 } 22 24 </script> 23 25 </head> -
trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html
r98428 r102252 18 18 }; 19 19 20 if (window.layoutTestController) 20 if (window.layoutTestController) { 21 21 layoutTestController.dumpAsText(); 22 layoutTestController.setEditingBehavior('win'); 23 } 22 24 </script> 23 25 </head> -
trunk/LayoutTests/editing/selection/move-by-word-visually-textarea.html
r101430 r102252 18 18 for (i = 0; i < 5; ++i) { 19 19 var start = test.selectionStart; 20 sel.modify("move", "right", " -webkit-visual-word");20 sel.modify("move", "right", "word"); 21 21 var wordBreak; 22 22 if (i >= wordBreaks.length) … … 34 34 } 35 35 36 if (window.layoutTestController) 36 if (window.layoutTestController) { 37 37 layoutTestController.dumpAsText(); 38 layoutTestController.setEditingBehavior('win'); 39 } 38 40 </script> 39 41 -
trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js
r93935 r102252 156 156 157 157 while (1) { 158 sel.modify("move", searchDirection, " -webkit-visual-word");158 sel.modify("move", searchDirection, "word"); 159 159 if (prevNode == sel.anchorNode && prevOffset == sel.anchorOffset) 160 160 break; … … 179 179 var positions = []; 180 180 positions.push({ node: sel.anchorNode, offset: sel.anchorOffset }); 181 sel.modify("move", searchDirection, " -webkit-visual-word");181 sel.modify("move", searchDirection, "word"); 182 182 183 183 var position = { node: sel.anchorNode, offset: sel.anchorOffset }; -
trunk/Source/WebCore/ChangeLog
r102250 r102252 1 2011-12-07 Xiaomei Ji <xji@chromium.org> 2 3 Turn on move caret by word visually for Windows platform. 4 https://bugs.webkit.org/show_bug.cgi?id=59652 5 6 Reviewed by Ryosuke Niwa. 7 8 We already support (arrow key) moving cursor by character in visual order. 9 This patch implements (ctrl/alt-arrow) moving cursor by word in visual order (in Windows). 10 It matches Firefox's default behavior. 11 12 Without this patch, ctrl(alt for mac)-arrow key or 13 selection.modify("move", "left"/"right", "word") moves cursor by word in logical order. 14 15 IE implements moving cursor by logical order for both arrow key and ctrl-arrow key. 16 Firefox implements moving cursor by visual order for both operations. 17 From Chromium bug report, native speakers would like moving cursor by visual order since it 18 is more intuitive. 19 20 The patch is only enabled for Windows (by EditingBehavior) because current implementation 21 matches Windows' native behavior. 22 For exmaple, if the logical text is "abc def hij", the cursor positions are 23 "|abc |def |hij|" no matter pressing ctrl-left-arrow or ctrl-right-arrow. 24 25 Mac and Linux's native behavior is slightly different. In which, when pressing 26 ctrl-left-arrow, the cursor positions are "|abc |def |hij|". When pressing ctrl-right-arrow, 27 the cursor positions are "|abc| def| hij|". We will implement it next. 28 29 Test: editing/selection/move-left-right-by-word-mac.html 30 31 * editing/EditingBehavior.h: 32 (WebCore::EditingBehavior::shouldMoveLeftRightByWordInVisualOrder): 33 * editing/FrameSelection.cpp: Remove experimental enum WebKitVisualWordGranularity. 34 (WebCore::FrameSelection::modifyExtendingRight): 35 (WebCore::FrameSelection::modifyExtendingForward): 36 (WebCore::FrameSelection::modifyMovingRight): 37 (WebCore::FrameSelection::modifyMovingForward): 38 (WebCore::FrameSelection::modifyExtendingLeft): 39 (WebCore::FrameSelection::modifyExtendingBackward): 40 (WebCore::FrameSelection::modifyMovingLeft): 41 (WebCore::FrameSelection::modifyMovingBackward): 42 * editing/TextGranularity.h: Remove experimental enum WebKitVisualWordGranularity. 43 * editing/VisibleSelection.cpp: Remove experimental enum WebKitVisualWordGranularity. 44 (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): 45 * page/DOMSelection.cpp: Remove experimental experimental flag -webkit-visual-word. 46 (WebCore::DOMSelection::modify): 47 1 48 2011-12-07 Jonathan Backer <backer@chromium.org> 2 49 -
trunk/Source/WebCore/editing/EditingBehavior.h
r95901 r102252 60 60 // On Mac, when processing a contextual click, the object being clicked upon should be selected. 61 61 bool shouldSelectOnContextualMenuClick() const { return m_type == EditingMacBehavior; } 62 63 // On Windows, moving caret left or right by word moves the caret by word in visual order. 64 // It moves the caret by word in logical order in other platforms. 65 bool shouldMoveLeftRightByWordInVisualOrder() const { return m_type == EditingWindowsBehavior; } 62 66 63 67 // On Mac and Windows, pressing backspace (when it isn't handled otherwise) should navigate back. -
trunk/Source/WebCore/editing/FrameSelection.cpp
r102225 r102252 573 573 pos = modifyExtendingForward(granularity); 574 574 break; 575 case WebKitVisualWordGranularity:576 break;577 575 } 578 576 return pos; … … 613 611 else 614 612 pos = endOfDocument(pos); 615 break;616 case WebKitVisualWordGranularity:617 613 break; 618 614 } … … 635 631 break; 636 632 case WordGranularity: 637 if (visualWordMovementEnabled()) { 633 if (visualWordMovementEnabled() 634 || (m_frame && m_frame->editor()->behavior().shouldMoveLeftRightByWordInVisualOrder())) { 638 635 pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity())); 639 636 break; … … 651 648 pos = rightBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock()); 652 649 break; 653 case WebKitVisualWordGranularity:654 pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()));655 break;656 650 } 657 651 return pos; … … 701 695 else 702 696 pos = endOfDocument(pos); 703 break;704 case WebKitVisualWordGranularity:705 697 break; 706 698 } … … 744 736 pos = modifyExtendingBackward(granularity); 745 737 break; 746 case WebKitVisualWordGranularity:747 break;748 738 } 749 739 return pos; … … 789 779 else 790 780 pos = startOfDocument(pos); 791 break;792 case WebKitVisualWordGranularity:793 781 break; 794 782 } … … 810 798 break; 811 799 case WordGranularity: 812 if (visualWordMovementEnabled()) { 800 if (visualWordMovementEnabled() 801 || (m_frame && m_frame->editor()->behavior().shouldMoveLeftRightByWordInVisualOrder())) { 813 802 pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity())); 814 803 break; … … 826 815 pos = leftBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock()); 827 816 break; 828 case WebKitVisualWordGranularity:829 pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()));830 break;831 817 } 832 818 return pos; … … 870 856 else 871 857 pos = startOfDocument(pos); 872 break;873 case WebKitVisualWordGranularity:874 858 break; 875 859 } -
trunk/Source/WebCore/editing/TextGranularity.h
r82588 r102252 40 40 LineBoundary, 41 41 ParagraphBoundary, 42 DocumentBoundary, 43 // FIXME: this is added temporarily for experiment with visually move 44 // caret by wordGranularity. Once all patches are landed, it should be removed. 45 WebKitVisualWordGranularity 42 DocumentBoundary 46 43 }; 47 44 -
trunk/Source/WebCore/editing/VisibleSelection.cpp
r93134 r102252 387 387 m_end = endOfSentence(VisiblePosition(m_end, m_affinity)).deepEquivalent(); 388 388 break; 389 case WebKitVisualWordGranularity:390 break;391 389 } 392 390 -
trunk/Source/WebCore/page/DOMSelection.cpp
r89440 r102252 334 334 else if (equalIgnoringCase(granularityString, "documentboundary")) 335 335 granularity = DocumentBoundary; 336 else if (equalIgnoringCase(granularityString, "-webkit-visual-word"))337 granularity = WebKitVisualWordGranularity;338 336 else 339 337 return;
Note: See TracChangeset
for help on using the changeset viewer.