Changeset 56175 in webkit
- Timestamp:
- Mar 18, 2010 11:23:45 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r56174 r56175 1 2010-03-12 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by David Levin. 4 5 smartdelete should only occur after double-click 6 https://bugs.webkit.org/show_bug.cgi?id=35314 7 8 * editing/deleting/non-smart-delete.html: 9 * editing/pasteboard/drag-drop-modifies-page.html: 10 * editing/pasteboard/page-zoom-expected.txt: 11 Space is removed because we used to incorrectly smartpaste here. 12 New behavior matches NSTextView. 13 * editing/style/apply-through-end-of-document-expected.txt: 14 The change here is that selectall + smartpaste doesn't put a BR, 15 but selectall + normal-paste does. Not sure if that's a bug or not, 16 but it's not a side effect of this change. 17 * editing/style/style-boundary-005.html: 18 * platform/mac/editing/deleting/non-smart-delete-expected.checksum: 19 * platform/mac/editing/deleting/non-smart-delete-expected.png: 20 * platform/mac/editing/deleting/non-smart-delete-expected.txt: 21 * platform/mac/editing/execCommand/paste-1-expected.txt: 22 * platform/mac/editing/execCommand/paste-2-expected.txt: 23 * platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.checksum: 24 * platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.png: 25 * platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.txt: 26 27 * platform/mac/editing/selection/expanding-selections-expected.txt: 28 * platform/mac/editing/selection/expanding-selections2-expected.txt: 29 * platform/mac/editing/selection/triple-click-in-pre-expected.txt: 30 The above three results change because granularity is no longer part of the seleciton, 31 so changes in granularity don't fire selection change notifications. 32 33 * platform/mac/editing/style/style-boundary-005-expected.checksum: 34 * platform/mac/editing/style/style-boundary-005-expected.png: 35 * platform/mac/editing/style/style-boundary-005-expected.txt: 36 1 37 2010-03-18 Alexey Proskuryakov <ap@apple.com> 2 38 -
trunk/LayoutTests/editing/deleting/non-smart-delete.html
r55913 r56175 41 41 Expected Results: 42 42 <br> 43 The first word should be deleted. The space following it should remain. It should look like this (currently this is broken and the space is deleted https://bugs.webkit.org/show_bug.cgi?id=35314):43 The first word should be deleted. The space following it should remain. It should look like this: 44 44 <BR> 45 45 " bar baz" -
trunk/LayoutTests/editing/pasteboard/drag-drop-modifies-page.html
r55913 r56175 30 30 <body> 31 31 <p>This tests non-smartmove drag/drop. The space should be deleted on move, 32 but not reinserted on drop, resulting in "worldhello". Currently there's a bug 33 (https://bugs.webkit.org/show_bug.cgi?id=35314) where the space is reinserted on drop.</p> 32 but not reinserted on drop, resulting in "worldhello".</p> 34 33 <div contenteditable="true" id="test"><span id="dragme">hello</span> world</div> 35 34 <script>runEditingTest();</script> -
trunk/LayoutTests/editing/pasteboard/page-zoom-expected.txt
r54932 r56175 1 1 Copy this 16px text. 2 Paste 2 PasteCopy this 16px text it here. 3 3 The pasted text should have a font size of 16px. 4 4 5 5 6 6 Copy this x-small text. 7 Paste 7 PasteCopy this x-small it here. 8 8 The pasted text should have a font size of x-small. 9 9 -
trunk/LayoutTests/editing/style/apply-through-end-of-document-expected.txt
r43420 r56175 25 25 RenderText {#text} at (0,0) size 24x15 26 26 text run at (0,0) width 24: "the" 27 RenderBR {BR} at (24,12) size 0x0 27 28 caret: position 3 of child 0 {#text} of child 7 {PRE} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/style/style-boundary-005.html
r55913 r56175 52 52 Expected Results: 53 53 <br> 54 Should see this content in the red box below (currently there's a bug where 55 there is an extra space after the bold element https://bugs.webkit.org/show_bug.cgi?id=35314): 54 Should see this content in the red box below: 56 55 <br><div>one two three <b>four</b>one</div> 57 56 </div> -
trunk/LayoutTests/platform/mac/editing/deleting/non-smart-delete-expected.checksum
r55913 r56175 1 25614efd3493758eb76da8f4748cdd48 1 d3f2f03e7a6b3460b751bb500f812b0d -
trunk/LayoutTests/platform/mac/editing/deleting/non-smart-delete-expected.txt
r55913 r56175 12 12 RenderBlock {HTML} at (0,0) size 800x600 13 13 RenderBody {BODY} at (8,8) size 784x584 14 RenderBlock {DIV} at (0,0) size 784x2 40[border: (2px solid #0000FF)]14 RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)] 15 15 RenderBlock {DIV} at (14,14) size 756x56 16 16 RenderText {#text} at (0,0) size 67x28 … … 19 19 RenderText {#text} at (0,28) size 642x28 20 20 text run at (0,28) width 642: "Non-smart delete when deleting a word selected via the keyboard." 21 RenderBlock {DIV} at (14,86) size 756x1 4021 RenderBlock {DIV} at (14,86) size 756x112 22 22 RenderText {#text} at (0,0) size 189x28 23 23 text run at (0,0) width 189: "Expected Results: " 24 24 RenderBR {BR} at (189,22) size 0x0 25 RenderText {#text} at (0,28) size 715x 8425 RenderText {#text} at (0,28) size 715x56 26 26 text run at (0,28) width 715: "The first word should be deleted. The space following it should remain. It" 27 text run at (0,56) width 671: "should look like this (currently this is broken and the space is deleted" 28 text run at (0,84) width 489: "https://bugs.webkit.org/show_bug.cgi?id=35314): " 29 RenderBR {BR} at (489,106) size 0x0 30 RenderText {#text} at (0,112) size 97x28 31 text run at (0,112) width 97: "\" bar baz\"" 32 RenderBlock {DIV} at (0,264) size 784x32 27 text run at (0,56) width 210: "should look like this: " 28 RenderBR {BR} at (210,78) size 0x0 29 RenderText {#text} at (0,84) size 97x28 30 text run at (0,84) width 97: "\" bar baz\"" 31 RenderBlock {DIV} at (0,236) size 784x32 33 32 RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)] 34 RenderText {#text} at (2,2) size 7 1x2835 text run at (2,2) width 7 1: "bar baz"33 RenderText {#text} at (2,2) size 77x28 34 text run at (2,2) width 77: " bar baz" 36 35 caret: position 0 of child 0 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/platform/mac/editing/execCommand/paste-1-expected.txt
r30635 r56175 5 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 6 6 EDITING DELEGATE: shouldDeleteDOMRange:range from 8 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document 7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document toDOMRange:range from 7 of #text > BODY > HTML > #document to 7of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 9 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 10 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 7 of #text > BODY > HTML > #document to 7of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document toDOMRange:range from 4 of #text > BODY > HTML > #document to 4of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE10 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted 11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 12 12 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 13 13 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 28 28 RenderBlock {HTML} at (0,0) size 300x150 29 29 RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0] 30 RenderText {#text} at (0,0) size 4 5x1831 text run at (0,0) width 4 5: "foo bar"32 RenderText {#text} at (4 5,0) size 26x1833 text run at (4 5,0) width 26: "baz"30 RenderText {#text} at (0,0) size 49x18 31 text run at (0,0) width 49: "foo bar " 32 RenderText {#text} at (49,0) size 22x18 33 text run at (49,0) width 22: "baz" 34 34 RenderText {#text} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/editing/execCommand/paste-2-expected.txt
r30635 r56175 5 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 6 6 EDITING DELEGATE: shouldDeleteDOMRange:range from 8 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document 7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document toDOMRange:range from 7 of #text > BODY > HTML > #document to 7of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 9 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 10 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 7 of #text > BODY > HTML > #document to 7of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document toDOMRange:range from 4 of #text > BODY > HTML > #document to 4of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE10 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted 11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document toDOMRange:range from 3 of #text > BODY > HTML > #document to 3 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 12 12 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 13 13 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 28 28 RenderBlock {HTML} at (0,0) size 300x150 29 29 RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0] 30 RenderText {#text} at (0,0) size 4 5x1831 text run at (0,0) width 4 5: "foo bar"32 RenderText {#text} at (4 5,0) size 26x1833 text run at (4 5,0) width 26: "baz"30 RenderText {#text} at (0,0) size 49x18 31 text run at (0,0) width 49: "foo bar " 32 RenderText {#text} at (49,0) size 22x18 33 text run at (49,0) width 22: "baz" 34 34 RenderText {#text} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.checksum
r55913 r56175 1 3d3191296d52f9a79e4d6cc041582b91 1 935cba8b736643ed7cbb0133e973c810 -
trunk/LayoutTests/platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.txt
r55913 r56175 5 5 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionDropped 6 6 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 7 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE7 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 8 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 9 9 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 13 13 RenderBlock {HTML} at (0,0) size 800x600 14 14 RenderBody {BODY} at (8,8) size 784x584 15 RenderBlock {P} at (0,0) size 784x 5416 RenderText {#text} at (0,0) size 7 56x5415 RenderBlock {P} at (0,0) size 784x36 16 RenderText {#text} at (0,0) size 719x36 17 17 text run at (0,0) width 719: "This tests non-smartmove drag/drop. The space should be deleted on move, but not reinserted on drop, resulting in" 18 text run at (0,18) width 756: "\"worldhello\". Currently there's a bug (https://bugs.webkit.org/show_bug.cgi?id=35314) where the space is reinserted on" 19 text run at (0,36) width 33: "drop." 20 RenderBlock {DIV} at (0,70) size 784x18 18 text run at (0,18) width 86: "\"worldhello\"." 19 RenderBlock {DIV} at (0,52) size 784x18 21 20 RenderText {#text} at (0,0) size 37x18 22 21 text run at (0,0) width 37: "world" 23 RenderText {#text} at (37,0) size 3 5x1824 text run at (37,0) width 3 5: "hello"22 RenderText {#text} at (37,0) size 31x18 23 text run at (37,0) width 31: "hello" 25 24 selection start: position 0 of child 1 {#text} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document 26 selection end: position 6of child 1 {#text} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document25 selection end: position 5 of child 1 {#text} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/platform/mac/editing/selection/expanding-selections-expected.txt
r25970 r56175 4 4 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 5 5 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 6 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification7 6 layer at (0,0) size 800x600 8 7 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/editing/selection/expanding-selections2-expected.txt
r25970 r56175 4 4 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 5 5 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 6 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification7 6 layer at (0,0) size 800x600 8 7 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/editing/selection/triple-click-in-pre-expected.txt
r25970 r56175 6 6 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 7 7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 16 of #text > PRE > DIV > DIV > BODY > HTML > #document to 30 of #text > PRE > DIV > DIV > BODY > HTML > #document toDOMRange:range from 16 of #text > PRE > DIV > DIV > BODY > HTML > #document to 30 of #text > PRE > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 8 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification9 8 layer at (0,0) size 800x600 10 9 RenderView at (0,0) size 800x600 -
trunk/LayoutTests/platform/mac/editing/style/style-boundary-005-expected.checksum
r55913 r56175 1 28d32961a9388737065e99d4c3cb04a2 1 1c5a6f9e02365f6d0d5c5c13c592c2a3 -
trunk/LayoutTests/platform/mac/editing/style/style-boundary-005-expected.txt
r55913 r56175 25 25 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 26 26 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 5 of #text > B > DIV > DIV > BODY > HTML > #document to 5 of #text > B > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted 27 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > B > DIV > DIV > BODY > HTML > #document to 5 of #text > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > DIV > BODY > HTML > #document to 4of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE27 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > B > DIV > DIV > BODY > HTML > #document to 5 of #text > B > DIV > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 28 28 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 29 29 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification … … 33 33 RenderBlock {HTML} at (0,0) size 800x600 34 34 RenderBody {BODY} at (8,8) size 784x584 35 RenderBlock {DIV} at (0,0) size 784x 240[border: (2px solid #0000FF)]35 RenderBlock {DIV} at (0,0) size 784x184 [border: (2px solid #0000FF)] 36 36 RenderBlock {DIV} at (14,14) size 756x56 37 37 RenderText {#text} at (0,0) size 67x28 … … 40 40 RenderText {#text} at (0,28) size 698x28 41 41 text run at (0,28) width 698: "Pasting at style boundary does not crash or produce empty style span(s)." 42 RenderBlock {DIV} at (14,86) size 756x 14043 RenderBlock (anonymous) at (0,0) size 756x 11242 RenderBlock {DIV} at (14,86) size 756x84 43 RenderBlock (anonymous) at (0,0) size 756x56 44 44 RenderText {#text} at (0,0) size 189x28 45 45 text run at (0,0) width 189: "Expected Results: " 46 46 RenderBR {BR} at (189,22) size 0x0 47 RenderText {#text} at (0,28) size 723x84 48 text run at (0,28) width 723: "Should see this content in the red box below (currently there's a bug where" 49 text run at (0,56) width 435: "there is an extra space after the bold element" 50 text run at (0,84) width 489: "https://bugs.webkit.org/show_bug.cgi?id=35314): " 51 RenderBR {BR} at (489,106) size 0x0 52 RenderBlock {DIV} at (0,112) size 756x28 47 RenderText {#text} at (0,28) size 442x28 48 text run at (0,28) width 442: "Should see this content in the red box below: " 49 RenderBR {BR} at (442,50) size 0x0 50 RenderBlock {DIV} at (0,56) size 756x28 53 51 RenderText {#text} at (0,0) size 138x28 54 52 text run at (0,0) width 138: "one two three " … … 58 56 RenderText {#text} at (182,0) size 35x28 59 57 text run at (182,0) width 35: "one" 60 RenderBlock {DIV} at (0,2 64) size 784x2258 RenderBlock {DIV} at (0,208) size 784x22 61 59 RenderBlock {DIV} at (0,0) size 784x22 [border: (2px solid #FF0000)] 62 60 RenderText {#text} at (2,2) size 86x18 … … 65 63 RenderText {#text} at (88,2) size 33x18 66 64 text run at (88,2) width 33: " four" 67 RenderText {#text} at (121,2) size 2 7x1868 text run at (121,2) width 2 7: "one"65 RenderText {#text} at (121,2) size 23x18 66 text run at (121,2) width 23: "one" 69 67 RenderBlock (anonymous) at (0,22) size 784x0 70 68 RenderText {#text} at (0,0) size 0x0 71 caret: position 4of child 2 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document69 caret: position 3 of child 2 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document -
trunk/WebCore/ChangeLog
r56174 r56175 1 2010-03-12 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by David Levin. 4 5 smartdelete should only occur after double-click 6 https://bugs.webkit.org/show_bug.cgi?id=35314 7 8 1. Consolidate all notions of selection-granularity into SelectionController. 9 2. Now only mouse-based selections store a selection-granularity. This matches NSTextView. 10 11 New tests were added in http://trac.webkit.org/changeset/55913. 12 13 * WebCore.base.exp: 14 * editing/MoveSelectionCommand.cpp: 15 (WebCore::MoveSelectionCommand::MoveSelectionCommand): 16 (WebCore::MoveSelectionCommand::doApply): 17 * editing/MoveSelectionCommand.h: 18 (WebCore::MoveSelectionCommand::create): 19 * editing/SelectionController.cpp: 20 (WebCore::SelectionController::SelectionController): 21 (WebCore::SelectionController::setSelection): 22 (WebCore::SelectionController::modify): 23 (WebCore::SelectionController::clear): 24 * editing/SelectionController.h: 25 (WebCore::SelectionController::setSelection): 26 (WebCore::SelectionController::granularity): 27 * editing/VisibleSelection.cpp: 28 (WebCore::VisibleSelection::VisibleSelection): 29 (WebCore::VisibleSelection::expandUsingGranularity): 30 (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): 31 (WebCore::VisibleSelection::validate): 32 * editing/VisibleSelection.h: 33 (WebCore::operator==): 34 * loader/FrameLoader.cpp: 35 (WebCore::FrameLoader::clear): 36 * page/DOMSelection.cpp: 37 (WebCore::DOMSelection::extend): 38 * page/DragController.cpp: 39 (WebCore::DragController::concludeEditDrag): 40 * page/EventHandler.cpp: 41 (WebCore::EventHandler::selectClosestWordFromMouseEvent): 42 (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent): 43 (WebCore::EventHandler::handleMousePressEventTripleClick): 44 (WebCore::EventHandler::handleMousePressEventSingleClick): 45 (WebCore::EventHandler::updateSelectionForMouseDrag): 46 * page/Frame.cpp: 47 (WebCore::Frame::Frame): 48 (WebCore::Frame::selectionGranularity): 49 * page/Frame.h: 50 * rendering/RenderTextControl.cpp: 51 (WebCore::RenderTextControl::setSelectionRange): 52 1 53 2010-03-18 Dimitri Glazkov <dglazkov@chromium.org> 2 54 -
trunk/WebCore/WebCore.base.exp
r56051 r56175 408 408 __ZN7WebCore19InspectorController34inspectorStartsAttachedSettingNameEv 409 409 __ZN7WebCore19SelectionController10setFocusedEb 410 __ZN7WebCore19SelectionController12setSelectionERKNS_16VisibleSelectionEbbb 410 __ZN7WebCore19SelectionController12setSelectionERKNS_16VisibleSelectionEbbbNS_15TextGranularityE 411 411 __ZN7WebCore19SelectionController16setSelectedRangeEPNS_5RangeENS_9EAffinityEb 412 412 __ZN7WebCore19SelectionController5clearEv -
trunk/WebCore/editing/MoveSelectionCommand.cpp
r43035 r56175 32 32 namespace WebCore { 33 33 34 MoveSelectionCommand::MoveSelectionCommand(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smart Move)35 : CompositeEditCommand(position.node()->document()), m_fragment(fragment), m_position(position), m_smart Move(smartMove)34 MoveSelectionCommand::MoveSelectionCommand(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartInsert, bool smartDelete) 35 : CompositeEditCommand(position.node()->document()), m_fragment(fragment), m_position(position), m_smartInsert(smartInsert), m_smartDelete(smartDelete) 36 36 { 37 37 ASSERT(m_fragment); … … 61 61 } 62 62 63 deleteSelection(m_smart Move);63 deleteSelection(m_smartDelete); 64 64 65 65 // If the node for the destination has been removed as a result of the deletion, … … 75 75 return; 76 76 } 77 applyCommandToComposite(ReplaceSelectionCommand::create(positionNode->document(), m_fragment, true, m_smart Move));77 applyCommandToComposite(ReplaceSelectionCommand::create(positionNode->document(), m_fragment, true, m_smartInsert)); 78 78 } 79 79 -
trunk/WebCore/editing/MoveSelectionCommand.h
r34536 r56175 35 35 class MoveSelectionCommand : public CompositeEditCommand { 36 36 public: 37 static PassRefPtr<MoveSelectionCommand> create(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smart Move = false)37 static PassRefPtr<MoveSelectionCommand> create(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartInsert = false, bool smartDelete = false) 38 38 { 39 return adoptRef(new MoveSelectionCommand(fragment, position, smart Move));39 return adoptRef(new MoveSelectionCommand(fragment, position, smartInsert, smartDelete)); 40 40 } 41 41 42 42 private: 43 MoveSelectionCommand(PassRefPtr<DocumentFragment>, const Position&, bool smart Move);43 MoveSelectionCommand(PassRefPtr<DocumentFragment>, const Position&, bool smartInsert, bool smartDelete); 44 44 45 45 virtual void doApply(); … … 48 48 RefPtr<DocumentFragment> m_fragment; 49 49 Position m_position; 50 bool m_smartMove; 50 bool m_smartInsert; 51 bool m_smartDelete; 51 52 }; 52 53 -
trunk/WebCore/editing/SelectionController.cpp
r55990 r56175 67 67 : m_frame(frame) 68 68 , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation) 69 , m_granularity(CharacterGranularity) 69 70 , m_caretBlinkTimer(this, &SelectionController::caretBlinkTimerFired) 70 71 , m_needsLayout(true) … … 105 106 } 106 107 107 void SelectionController::setSelection(const VisibleSelection& s, bool closeTyping, bool clearTypingStyle, bool userTriggered) 108 { 108 void SelectionController::setSelection(const VisibleSelection& s, bool closeTyping, bool clearTypingStyle, bool userTriggered, TextGranularity granularity) 109 { 110 m_granularity = granularity; 111 109 112 m_lastChangeWasHorizontalExtension = false; 110 113 … … 603 606 } 604 607 605 if (m_frame)606 m_frame->setSelectionGranularity(granularity);607 608 608 willBeModified(alter, dir); 609 609 … … 638 638 if (pos.isNull()) 639 639 return false; 640 640 641 641 // Some of the above operations set an xPosForVerticalArrowNavigation. 642 642 // Setting a selection will clear it, so save it to possibly restore later. … … 657 657 m_xPosForVerticalArrowNavigation = x; 658 658 659 if (userTriggered) { 660 // User modified selection change also sets the granularity back to character. 661 // NOTE: The one exception is that we need to keep word granularity to 662 // preserve smart delete behavior when extending by word (e.g. double-click), 663 // then shift-option-right arrow, then delete needs to smart delete, per TextEdit. 664 if (!(alter == EXTEND && granularity == WordGranularity && m_frame->selectionGranularity() == WordGranularity)) 665 m_frame->setSelectionGranularity(CharacterGranularity); 666 } 659 if (userTriggered) 660 m_granularity = CharacterGranularity; 661 667 662 668 663 setNeedsLayout(); … … 759 754 760 755 if (userTriggered) 761 m_ frame->setSelectionGranularity(CharacterGranularity);756 m_granularity = CharacterGranularity; 762 757 763 758 m_lastChangeWasHorizontalExtension = alter == EXTEND; 764 759 765 return true;766 }767 768 bool SelectionController::expandUsingGranularity(TextGranularity granularity)769 {770 if (isNone())771 return false;772 773 m_selection.expandUsingGranularity(granularity);774 m_needsLayout = true;775 760 return true; 776 761 } … … 818 803 void SelectionController::clear() 819 804 { 805 m_granularity = CharacterGranularity; 820 806 setSelection(VisibleSelection()); 821 807 } -
trunk/WebCore/editing/SelectionController.h
r55673 r56175 60 60 61 61 const VisibleSelection& selection() const { return m_selection; } 62 void setSelection(const VisibleSelection&, bool closeTyping = true, bool clearTypingStyle = true, bool userTriggered = false); 62 void setSelection(const VisibleSelection&, bool closeTyping = true, bool clearTypingStyle = true, bool userTriggered = false, TextGranularity = CharacterGranularity); 63 void setSelection(const VisibleSelection& selection, TextGranularity granularity) { setSelection(selection, true, true, false, granularity); } 63 64 bool setSelectedRange(Range*, EAffinity, bool closeTyping); 64 65 void selectAll(); … … 76 77 bool modify(EAlteration, EDirection, TextGranularity, bool userTriggered = false); 77 78 bool modify(EAlteration, int verticalDistance, bool userTriggered = false); 78 bool expandUsingGranularity(TextGranularity);79 TextGranularity granularity() const { return m_granularity; } 79 80 80 81 void setBase(const VisiblePosition&, bool userTriggered = false); … … 179 180 180 181 VisibleSelection m_selection; 182 TextGranularity m_granularity; 181 183 182 184 Timer<SelectionController> m_caretBlinkTimer; -
trunk/WebCore/editing/VisibleSelection.cpp
r55752 r56175 44 44 VisibleSelection::VisibleSelection() 45 45 : m_affinity(DOWNSTREAM) 46 , m_granularity(CharacterGranularity)47 46 , m_selectionType(NoSelection) 48 47 , m_baseIsFirst(true) … … 54 53 , m_extent(pos) 55 54 , m_affinity(affinity) 56 , m_granularity(CharacterGranularity)57 55 { 58 56 validate(); … … 63 61 , m_extent(extent) 64 62 , m_affinity(affinity) 65 , m_granularity(CharacterGranularity)66 63 { 67 64 validate(); … … 72 69 , m_extent(pos.deepEquivalent()) 73 70 , m_affinity(pos.affinity()) 74 , m_granularity(CharacterGranularity)75 71 { 76 72 validate(); … … 81 77 , m_extent(extent.deepEquivalent()) 82 78 , m_affinity(base.affinity()) 83 , m_granularity(CharacterGranularity)84 79 { 85 80 validate(); … … 90 85 , m_extent(range->endPosition()) 91 86 , m_affinity(affinity) 92 , m_granularity(CharacterGranularity)93 87 { 94 88 validate(); … … 191 185 return false; 192 186 193 m_granularity = granularity; 194 validate(); 187 validate(granularity); 195 188 return true; 196 189 } … … 269 262 } 270 263 271 void VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity( )264 void VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity(TextGranularity granularity) 272 265 { 273 266 if (m_baseIsFirst) { … … 279 272 } 280 273 281 switch ( m_granularity) {274 switch (granularity) { 282 275 case CharacterGranularity: 283 276 // Don't do any expansion. … … 409 402 } 410 403 411 void VisibleSelection::validate( )404 void VisibleSelection::validate(TextGranularity granularity) 412 405 { 413 406 setBaseAndExtentToDeepEquivalents(); 414 setStartAndEndFromBaseAndExtentRespectingGranularity( );407 setStartAndEndFromBaseAndExtentRespectingGranularity(granularity); 415 408 adjustSelectionToAvoidCrossingEditingBoundaries(); 416 409 updateSelectionType(); -
trunk/WebCore/editing/VisibleSelection.h
r53085 r56175 82 82 83 83 bool expandUsingGranularity(TextGranularity granularity); 84 TextGranularity granularity() const { return m_granularity; } 85 84 86 85 // We don't yet support multi-range selections, so we only ever have one range to return. 87 86 PassRefPtr<Range> firstRange() const; … … 107 106 108 107 private: 109 void validate( );108 void validate(TextGranularity = CharacterGranularity); 110 109 111 110 // Support methods for validate() 112 111 void setBaseAndExtentToDeepEquivalents(); 113 void setStartAndEndFromBaseAndExtentRespectingGranularity( );112 void setStartAndEndFromBaseAndExtentRespectingGranularity(TextGranularity); 114 113 void adjustSelectionToAvoidCrossingEditingBoundaries(); 115 114 void updateSelectionType(); … … 126 125 127 126 EAffinity m_affinity; // the upstream/downstream affinity of the caret 128 TextGranularity m_granularity; // granularity of start/end selection129 127 130 128 // these are cached, can be recalculated by validate() … … 135 133 inline bool operator==(const VisibleSelection& a, const VisibleSelection& b) 136 134 { 137 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity() && a. granularity() == b.granularity() && a.isBaseFirst() == b.isBaseFirst();135 return a.start() == b.start() && a.end() == b.end() && a.affinity() == b.affinity() && a.isBaseFirst() == b.isBaseFirst(); 138 136 } 139 137 -
trunk/WebCore/loader/FrameLoader.cpp
r56070 r56175 731 731 m_frame->view()->clear(); 732 732 733 m_frame->setSelectionGranularity(CharacterGranularity);734 735 733 // Do not drop the document before the ScriptController and view are cleared 736 734 // as some destructors might still try to access the document. -
trunk/WebCore/page/DOMSelection.cpp
r46982 r56175 327 327 328 328 SelectionController* selection = m_frame->selection(); 329 selection->expandUsingGranularity(CharacterGranularity);330 329 selection->setExtent(VisiblePosition(node, offset, DOWNSTREAM)); 331 330 } -
trunk/WebCore/page/DragController.cpp
r55977 r56175 433 433 m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData); 434 434 if (dragIsMove(innerFrame->selection())) { 435 bool smartMove = innerFrame->selectionGranularity() == WordGranularity 436 && innerFrame->editor()->smartInsertDeleteEnabled() 437 && dragData->canSmartReplace(); 438 applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base(), smartMove)); 435 // NSTextView behavior is to always smart delete on moving a selection, 436 // but only to smart insert if the selection granularity is word granularity. 437 bool smartDelete = innerFrame->editor()->smartInsertDeleteEnabled(); 438 bool smartInsert = smartDelete && innerFrame->selectionGranularity() == WordGranularity && dragData->canSmartReplace(); 439 applyCommand(MoveSelectionCommand::create(fragment, dragCaret.base(), smartInsert, smartDelete)); 439 440 } else { 440 441 if (setSelectionToDragCaret(innerFrame, dragCaret, range, point)) -
trunk/WebCore/page/EventHandler.cpp
r56096 r56175 240 240 if (innerNode && innerNode->renderer() && m_mouseDownMayStartSelect) { 241 241 VisiblePosition pos(innerNode->renderer()->positionForPoint(result.localPoint())); 242 TextGranularity granularity = CharacterGranularity; 242 243 if (pos.isNotNull()) { 243 244 newSelection = VisibleSelection(pos); … … 246 247 247 248 if (newSelection.isRange()) { 248 m_frame->setSelectionGranularity(WordGranularity);249 granularity = WordGranularity; 249 250 m_beganSelectingText = true; 250 251 if (result.event().clickCount() == 2 && m_frame->editor()->isSelectTrailingWhitespaceEnabled()) … … 253 254 254 255 if (m_frame->shouldChangeSelection(newSelection)) 255 m_frame->selection()->setSelection(newSelection );256 m_frame->selection()->setSelection(newSelection, granularity); 256 257 } 257 258 } … … 271 272 newSelection = VisibleSelection::selectionFromContentsOfNode(URLElement); 272 273 274 TextGranularity granularity = CharacterGranularity; 273 275 if (newSelection.isRange()) { 274 m_frame->setSelectionGranularity(WordGranularity);276 granularity = WordGranularity; 275 277 m_beganSelectingText = true; 276 278 } 277 279 278 280 if (m_frame->shouldChangeSelection(newSelection)) 279 m_frame->selection()->setSelection(newSelection );281 m_frame->selection()->setSelection(newSelection, granularity); 280 282 } 281 283 } … … 314 316 newSelection.expandUsingGranularity(ParagraphGranularity); 315 317 } 318 319 TextGranularity granularity = CharacterGranularity; 316 320 if (newSelection.isRange()) { 317 m_frame->setSelectionGranularity(ParagraphGranularity);321 granularity = ParagraphGranularity; 318 322 m_beganSelectingText = true; 319 323 } 320 324 321 325 if (m_frame->shouldChangeSelection(newSelection)) 322 m_frame->selection()->setSelection(newSelection );326 m_frame->selection()->setSelection(newSelection, granularity); 323 327 324 328 return true; … … 350 354 351 355 VisibleSelection newSelection = m_frame->selection()->selection(); 356 TextGranularity granularity = CharacterGranularity; 357 352 358 if (extendSelection && newSelection.isCaretOrRange()) { 353 359 m_frame->selection()->setLastChangeWasHorizontalExtension(false); … … 362 368 newSelection = VisibleSelection(start, pos); 363 369 364 if (m_frame->selectionGranularity() != CharacterGranularity) 370 if (m_frame->selectionGranularity() != CharacterGranularity) { 371 granularity = m_frame->selectionGranularity(); 365 372 newSelection.expandUsingGranularity(m_frame->selectionGranularity()); 373 } 374 366 375 m_beganSelectingText = true; 367 } else {376 } else 368 377 newSelection = VisibleSelection(visiblePos); 369 m_frame->setSelectionGranularity(CharacterGranularity);370 }371 378 372 379 if (m_frame->shouldChangeSelection(newSelection)) 373 m_frame->selection()->setSelection(newSelection );380 m_frame->selection()->setSelection(newSelection, granularity); 374 381 375 382 return true; … … 586 593 if (m_frame->shouldChangeSelection(newSelection)) { 587 594 m_frame->selection()->setLastChangeWasHorizontalExtension(false); 588 m_frame->selection()->setSelection(newSelection );595 m_frame->selection()->setSelection(newSelection, m_frame->selectionGranularity()); 589 596 } 590 597 } -
trunk/WebCore/page/Frame.cpp
r56068 r56175 133 133 , m_ownerElement(ownerElement) 134 134 , m_script(this) 135 , m_selectionGranularity(CharacterGranularity)136 135 , m_selectionController(this) 137 136 , m_editor(this) … … 366 365 TextGranularity Frame::selectionGranularity() const 367 366 { 368 return m_selectionGranularity; 369 } 370 371 void Frame::setSelectionGranularity(TextGranularity granularity) 372 { 373 m_selectionGranularity = granularity; 367 return m_selectionController.granularity(); 374 368 } 375 369 -
trunk/WebCore/page/Frame.h
r55976 r56175 248 248 public: 249 249 TextGranularity selectionGranularity() const; 250 void setSelectionGranularity(TextGranularity);251 250 252 251 bool shouldChangeSelection(const VisibleSelection&) const; … … 346 345 float m_zoomFactor; 347 346 348 TextGranularity m_selectionGranularity;349 350 347 mutable SelectionController m_selectionController; 351 348 mutable VisibleSelection m_mark; -
trunk/WebCore/rendering/RenderTextControl.cpp
r54748 r56175 267 267 if (Frame* frame = document()->frame()) 268 268 frame->selection()->setSelection(newSelection); 269 270 // FIXME: Granularity is stored separately on the frame, but also in the selection controller.271 // The granularity in the selection controller should be used, and then this line of code would not be needed.272 if (Frame* frame = document()->frame())273 frame->setSelectionGranularity(CharacterGranularity);274 269 } 275 270 -
trunk/WebKit/chromium/ChangeLog
r56168 r56175 1 2010-03-12 Ojan Vafai <ojan@chromium.org> 2 3 Reviewed by David Levin. 4 5 smartdelete should only occur after double-click 6 https://bugs.webkit.org/show_bug.cgi?id=35314 7 8 * src/WebFrameImpl.cpp: 9 (WebKit::WebFrameImpl::selectWordAroundPosition): 10 1 11 2010-03-18 Nate Chapin <japhet@chromium.org> 2 12 -
trunk/WebKit/chromium/src/WebFrameImpl.cpp
r56098 r56175 1185 1185 selection.expandUsingGranularity(WordGranularity); 1186 1186 1187 if (selection.isRange()) 1188 frame->setSelectionGranularity(WordGranularity); 1189 1190 if (frame->shouldChangeSelection(selection)) 1191 frame->selection()->setSelection(selection); 1187 if (frame->shouldChangeSelection(selection)) { 1188 TextGranularity granularity = selection.isRange() ? WordGranularity : CharacterGranularity; 1189 frame->selection()->setSelection(selection, granularity); 1190 } 1192 1191 } 1193 1192
Note: See TracChangeset
for help on using the changeset viewer.