Changeset 56175 in webkit


Ignore:
Timestamp:
Mar 18, 2010 11:23:45 AM (14 years ago)
Author:
ojan@chromium.org
Message:

2010-03-12 Ojan Vafai <ojan@chromium.org>

Reviewed by David Levin.

smartdelete should only occur after double-click
https://bugs.webkit.org/show_bug.cgi?id=35314

  • editing/deleting/non-smart-delete.html:
  • editing/pasteboard/drag-drop-modifies-page.html:
  • editing/pasteboard/page-zoom-expected.txt: Space is removed because we used to incorrectly smartpaste here. New behavior matches NSTextView.
  • editing/style/apply-through-end-of-document-expected.txt: The change here is that selectall + smartpaste doesn't put a BR, but selectall + normal-paste does. Not sure if that's a bug or not, but it's not a side effect of this change.
  • editing/style/style-boundary-005.html:
  • platform/mac/editing/deleting/non-smart-delete-expected.checksum:
  • platform/mac/editing/deleting/non-smart-delete-expected.png:
  • platform/mac/editing/deleting/non-smart-delete-expected.txt:
  • platform/mac/editing/execCommand/paste-1-expected.txt:
  • platform/mac/editing/execCommand/paste-2-expected.txt:
  • platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.checksum:
  • platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.png:
  • platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.txt:
  • platform/mac/editing/selection/expanding-selections-expected.txt:
  • platform/mac/editing/selection/expanding-selections2-expected.txt:
  • platform/mac/editing/selection/triple-click-in-pre-expected.txt: The above three results change because granularity is no longer part of the seleciton, so changes in granularity don't fire selection change notifications.
  • platform/mac/editing/style/style-boundary-005-expected.checksum:
  • platform/mac/editing/style/style-boundary-005-expected.png:
  • platform/mac/editing/style/style-boundary-005-expected.txt:

2010-03-12 Ojan Vafai <ojan@chromium.org>

Reviewed by David Levin.

smartdelete should only occur after double-click
https://bugs.webkit.org/show_bug.cgi?id=35314

  1. Consolidate all notions of selection-granularity into SelectionController.
  2. Now only mouse-based selections store a selection-granularity. This matches NSTextView.

New tests were added in http://trac.webkit.org/changeset/55913.

  • WebCore.base.exp:
  • editing/MoveSelectionCommand.cpp: (WebCore::MoveSelectionCommand::MoveSelectionCommand): (WebCore::MoveSelectionCommand::doApply):
  • editing/MoveSelectionCommand.h: (WebCore::MoveSelectionCommand::create):
  • editing/SelectionController.cpp: (WebCore::SelectionController::SelectionController): (WebCore::SelectionController::setSelection): (WebCore::SelectionController::modify): (WebCore::SelectionController::clear):
  • editing/SelectionController.h: (WebCore::SelectionController::setSelection): (WebCore::SelectionController::granularity):
  • editing/VisibleSelection.cpp: (WebCore::VisibleSelection::VisibleSelection): (WebCore::VisibleSelection::expandUsingGranularity): (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): (WebCore::VisibleSelection::validate):
  • editing/VisibleSelection.h: (WebCore::operator==):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::clear):
  • page/DOMSelection.cpp: (WebCore::DOMSelection::extend):
  • page/DragController.cpp: (WebCore::DragController::concludeEditDrag):
  • page/EventHandler.cpp: (WebCore::EventHandler::selectClosestWordFromMouseEvent): (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent): (WebCore::EventHandler::handleMousePressEventTripleClick): (WebCore::EventHandler::handleMousePressEventSingleClick): (WebCore::EventHandler::updateSelectionForMouseDrag):
  • page/Frame.cpp: (WebCore::Frame::Frame): (WebCore::Frame::selectionGranularity):
  • page/Frame.h:
  • rendering/RenderTextControl.cpp: (WebCore::RenderTextControl::setSelectionRange):

2010-03-12 Ojan Vafai <ojan@chromium.org>

Reviewed by David Levin.

smartdelete should only occur after double-click
https://bugs.webkit.org/show_bug.cgi?id=35314

  • src/WebFrameImpl.cpp: (WebKit::WebFrameImpl::selectWordAroundPosition):
Location:
trunk
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56174 r56175  
     12010-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
    1372010-03-18  Alexey Proskuryakov  <ap@apple.com>
    238
  • trunk/LayoutTests/editing/deleting/non-smart-delete.html

    r55913 r56175  
    4141Expected Results:
    4242<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):
     43The first word should be deleted. The space following it should remain. It should look like this:
    4444<BR>
    4545" bar baz"
  • trunk/LayoutTests/editing/pasteboard/drag-drop-modifies-page.html

    r55913 r56175  
    3030<body>
    3131<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>
     32but not reinserted on drop, resulting in "worldhello".</p>
    3433<div contenteditable="true" id="test"><span id="dragme">hello</span> world</div>
    3534<script>runEditingTest();</script>
  • trunk/LayoutTests/editing/pasteboard/page-zoom-expected.txt

    r54932 r56175  
    11Copy this 16px text.
    2 Paste Copy this 16px text it here.
     2PasteCopy this 16px text it here.
    33The pasted text should have a font size of 16px.
    44
    55
    66Copy this x-small text.
    7 Paste Copy this x-small it here.
     7PasteCopy this x-small it here.
    88The pasted text should have a font size of x-small.
    99
  • trunk/LayoutTests/editing/style/apply-through-end-of-document-expected.txt

    r43420 r56175  
    2525        RenderText {#text} at (0,0) size 24x15
    2626          text run at (0,0) width 24: "the"
     27        RenderBR {BR} at (24,12) size 0x0
    2728caret: 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  
    5252Expected Results:
    5353<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):
     54Should see this content in the red box below:
    5655<br><div>one two three <b>four</b>one</div>
    5756</div>
  • trunk/LayoutTests/platform/mac/editing/deleting/non-smart-delete-expected.checksum

    r55913 r56175  
    1 25614efd3493758eb76da8f4748cdd48
     1d3f2f03e7a6b3460b751bb500f812b0d
  • trunk/LayoutTests/platform/mac/editing/deleting/non-smart-delete-expected.txt

    r55913 r56175  
    1212  RenderBlock {HTML} at (0,0) size 800x600
    1313    RenderBody {BODY} at (8,8) size 784x584
    14       RenderBlock {DIV} at (0,0) size 784x240 [border: (2px solid #0000FF)]
     14      RenderBlock {DIV} at (0,0) size 784x212 [border: (2px solid #0000FF)]
    1515        RenderBlock {DIV} at (14,14) size 756x56
    1616          RenderText {#text} at (0,0) size 67x28
     
    1919          RenderText {#text} at (0,28) size 642x28
    2020            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 756x140
     21        RenderBlock {DIV} at (14,86) size 756x112
    2222          RenderText {#text} at (0,0) size 189x28
    2323            text run at (0,0) width 189: "Expected Results: "
    2424          RenderBR {BR} at (189,22) size 0x0
    25           RenderText {#text} at (0,28) size 715x84
     25          RenderText {#text} at (0,28) size 715x56
    2626            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
    3332        RenderBlock {DIV} at (0,0) size 784x32 [border: (2px solid #FF0000)]
    34           RenderText {#text} at (2,2) size 71x28
    35             text run at (2,2) width 71: "bar baz"
     33          RenderText {#text} at (2,2) size 77x28
     34            text run at (2,2) width 77: " bar baz"
    3635caret: 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  
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING 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 7 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     7EDITING 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
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    10 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 7 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    11 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 4 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     10EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted
     11EDITING 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
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2828            RenderBlock {HTML} at (0,0) size 300x150
    2929              RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
    30                 RenderText {#text} at (0,0) size 45x18
    31                   text run at (0,0) width 45: "foo bar"
    32                 RenderText {#text} at (45,0) size 26x18
    33                   text run at (45,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"
    3434        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/editing/execCommand/paste-2-expected.txt

    r30635 r56175  
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    66EDITING 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 7 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     7EDITING 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
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
    10 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 7 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted
    11 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 4 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     10EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 8 of #text > BODY > HTML > #document to 8 of #text > BODY > HTML > #document givenAction:WebViewInsertActionPasted
     11EDITING 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
    1212EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    1313EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    2828            RenderBlock {HTML} at (0,0) size 300x150
    2929              RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
    30                 RenderText {#text} at (0,0) size 45x18
    31                   text run at (0,0) width 45: "foo bar"
    32                 RenderText {#text} at (45,0) size 26x18
    33                   text run at (45,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"
    3434        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.checksum

    r55913 r56175  
    1 3d3191296d52f9a79e4d6cc041582b91
     1935cba8b736643ed7cbb0133e973c810
  • trunk/LayoutTests/platform/mac/editing/pasteboard/drag-drop-modifies-page-expected.txt

    r55913 r56175  
    55EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionDropped
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    7 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     7EDITING 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
    88EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    99EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    1313  RenderBlock {HTML} at (0,0) size 800x600
    1414    RenderBody {BODY} at (8,8) size 784x584
    15       RenderBlock {P} at (0,0) size 784x54
    16         RenderText {#text} at (0,0) size 756x54
     15      RenderBlock {P} at (0,0) size 784x36
     16        RenderText {#text} at (0,0) size 719x36
    1717          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
    2120        RenderText {#text} at (0,0) size 37x18
    2221          text run at (0,0) width 37: "world"
    23         RenderText {#text} at (37,0) size 35x18
    24           text run at (37,0) width 35: " hello"
     22        RenderText {#text} at (37,0) size 31x18
     23          text run at (37,0) width 31: "hello"
    2524selection 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 6 of child 1 {#text} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
     25selection 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  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING 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:WebViewDidChangeSelectionNotification
    76layer at (0,0) size 800x600
    87  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/selection/expanding-selections2-expected.txt

    r25970 r56175  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING 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:WebViewDidChangeSelectionNotification
    76layer at (0,0) size 800x600
    87  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/selection/triple-click-in-pre-expected.txt

    r25970 r56175  
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    77EDITING 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:WebViewDidChangeSelectionNotification
    98layer at (0,0) size 800x600
    109  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/style/style-boundary-005-expected.checksum

    r55913 r56175  
    1 28d32961a9388737065e99d4c3cb04a2
     11c5a6f9e02365f6d0d5c5c13c592c2a3
  • trunk/LayoutTests/platform/mac/editing/style/style-boundary-005-expected.txt

    r55913 r56175  
    2525EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2626EDITING 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 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     27EDITING 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
    2828EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    2929EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
     
    3333  RenderBlock {HTML} at (0,0) size 800x600
    3434    RenderBody {BODY} at (8,8) size 784x584
    35       RenderBlock {DIV} at (0,0) size 784x240 [border: (2px solid #0000FF)]
     35      RenderBlock {DIV} at (0,0) size 784x184 [border: (2px solid #0000FF)]
    3636        RenderBlock {DIV} at (14,14) size 756x56
    3737          RenderText {#text} at (0,0) size 67x28
     
    4040          RenderText {#text} at (0,28) size 698x28
    4141            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 756x140
    43           RenderBlock (anonymous) at (0,0) size 756x112
     42        RenderBlock {DIV} at (14,86) size 756x84
     43          RenderBlock (anonymous) at (0,0) size 756x56
    4444            RenderText {#text} at (0,0) size 189x28
    4545              text run at (0,0) width 189: "Expected Results: "
    4646            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
    5351            RenderText {#text} at (0,0) size 138x28
    5452              text run at (0,0) width 138: "one two three "
     
    5856            RenderText {#text} at (182,0) size 35x28
    5957              text run at (182,0) width 35: "one"
    60       RenderBlock {DIV} at (0,264) size 784x22
     58      RenderBlock {DIV} at (0,208) size 784x22
    6159        RenderBlock {DIV} at (0,0) size 784x22 [border: (2px solid #FF0000)]
    6260          RenderText {#text} at (2,2) size 86x18
     
    6563            RenderText {#text} at (88,2) size 33x18
    6664              text run at (88,2) width 33: " four"
    67           RenderText {#text} at (121,2) size 27x18
    68             text run at (121,2) width 27: " one"
     65          RenderText {#text} at (121,2) size 23x18
     66            text run at (121,2) width 23: "one"
    6967        RenderBlock (anonymous) at (0,22) size 784x0
    7068          RenderText {#text} at (0,0) size 0x0
    71 caret: position 4 of child 2 {#text} of child 1 {DIV} of child 3 {DIV} of child 1 {BODY} of child 0 {HTML} of document
     69caret: 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  
     12010-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
    1532010-03-18  Dimitri Glazkov  <dglazkov@chromium.org>
    254
  • trunk/WebCore/WebCore.base.exp

    r56051 r56175  
    408408__ZN7WebCore19InspectorController34inspectorStartsAttachedSettingNameEv
    409409__ZN7WebCore19SelectionController10setFocusedEb
    410 __ZN7WebCore19SelectionController12setSelectionERKNS_16VisibleSelectionEbbb
     410__ZN7WebCore19SelectionController12setSelectionERKNS_16VisibleSelectionEbbbNS_15TextGranularityE
    411411__ZN7WebCore19SelectionController16setSelectedRangeEPNS_5RangeENS_9EAffinityEb
    412412__ZN7WebCore19SelectionController5clearEv
  • trunk/WebCore/editing/MoveSelectionCommand.cpp

    r43035 r56175  
    3232namespace WebCore {
    3333
    34 MoveSelectionCommand::MoveSelectionCommand(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartMove)
    35     : CompositeEditCommand(position.node()->document()), m_fragment(fragment), m_position(position), m_smartMove(smartMove)
     34MoveSelectionCommand::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)
    3636{
    3737    ASSERT(m_fragment);
     
    6161    }
    6262
    63     deleteSelection(m_smartMove);
     63    deleteSelection(m_smartDelete);
    6464
    6565    // If the node for the destination has been removed as a result of the deletion,
     
    7575        return;
    7676    }
    77     applyCommandToComposite(ReplaceSelectionCommand::create(positionNode->document(), m_fragment, true, m_smartMove));
     77    applyCommandToComposite(ReplaceSelectionCommand::create(positionNode->document(), m_fragment, true, m_smartInsert));
    7878}
    7979
  • trunk/WebCore/editing/MoveSelectionCommand.h

    r34536 r56175  
    3535class MoveSelectionCommand : public CompositeEditCommand {
    3636public:
    37     static PassRefPtr<MoveSelectionCommand> create(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartMove = false)
     37    static PassRefPtr<MoveSelectionCommand> create(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartInsert = false, bool smartDelete = false)
    3838    {
    39         return adoptRef(new MoveSelectionCommand(fragment, position, smartMove));
     39        return adoptRef(new MoveSelectionCommand(fragment, position, smartInsert, smartDelete));
    4040    }
    4141
    4242private:
    43     MoveSelectionCommand(PassRefPtr<DocumentFragment>, const Position&, bool smartMove);
     43    MoveSelectionCommand(PassRefPtr<DocumentFragment>, const Position&, bool smartInsert, bool smartDelete);
    4444
    4545    virtual void doApply();
     
    4848    RefPtr<DocumentFragment> m_fragment;
    4949    Position m_position;
    50     bool m_smartMove;
     50    bool m_smartInsert;
     51    bool m_smartDelete;
    5152};
    5253
  • trunk/WebCore/editing/SelectionController.cpp

    r55990 r56175  
    6767    : m_frame(frame)
    6868    , m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation)
     69    , m_granularity(CharacterGranularity)
    6970    , m_caretBlinkTimer(this, &SelectionController::caretBlinkTimerFired)
    7071    , m_needsLayout(true)
     
    105106}
    106107
    107 void SelectionController::setSelection(const VisibleSelection& s, bool closeTyping, bool clearTypingStyle, bool userTriggered)
    108 {
     108void SelectionController::setSelection(const VisibleSelection& s, bool closeTyping, bool clearTypingStyle, bool userTriggered, TextGranularity granularity)
     109{
     110    m_granularity = granularity;
     111
    109112    m_lastChangeWasHorizontalExtension = false;
    110113
     
    603606    }
    604607
    605     if (m_frame)
    606         m_frame->setSelectionGranularity(granularity);
    607    
    608608    willBeModified(alter, dir);
    609609
     
    638638    if (pos.isNull())
    639639        return false;
    640    
     640
    641641    // Some of the above operations set an xPosForVerticalArrowNavigation.
    642642    // Setting a selection will clear it, so save it to possibly restore later.
     
    657657        m_xPosForVerticalArrowNavigation = x;
    658658
    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
    667662
    668663    setNeedsLayout();
     
    759754
    760755    if (userTriggered)
    761         m_frame->setSelectionGranularity(CharacterGranularity);
     756        m_granularity = CharacterGranularity;
    762757
    763758    m_lastChangeWasHorizontalExtension = alter == EXTEND;
    764759
    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;
    775760    return true;
    776761}
     
    818803void SelectionController::clear()
    819804{
     805    m_granularity = CharacterGranularity;
    820806    setSelection(VisibleSelection());
    821807}
  • trunk/WebCore/editing/SelectionController.h

    r55673 r56175  
    6060
    6161    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); }
    6364    bool setSelectedRange(Range*, EAffinity, bool closeTyping);
    6465    void selectAll();
     
    7677    bool modify(EAlteration, EDirection, TextGranularity, bool userTriggered = false);
    7778    bool modify(EAlteration, int verticalDistance, bool userTriggered = false);
    78     bool expandUsingGranularity(TextGranularity);
     79    TextGranularity granularity() const { return m_granularity; }
    7980
    8081    void setBase(const VisiblePosition&, bool userTriggered = false);
     
    179180
    180181    VisibleSelection m_selection;
     182    TextGranularity m_granularity;
    181183
    182184    Timer<SelectionController> m_caretBlinkTimer;
  • trunk/WebCore/editing/VisibleSelection.cpp

    r55752 r56175  
    4444VisibleSelection::VisibleSelection()
    4545    : m_affinity(DOWNSTREAM)
    46     , m_granularity(CharacterGranularity)
    4746    , m_selectionType(NoSelection)
    4847    , m_baseIsFirst(true)
     
    5453    , m_extent(pos)
    5554    , m_affinity(affinity)
    56     , m_granularity(CharacterGranularity)
    5755{
    5856    validate();
     
    6361    , m_extent(extent)
    6462    , m_affinity(affinity)
    65     , m_granularity(CharacterGranularity)
    6663{
    6764    validate();
     
    7269    , m_extent(pos.deepEquivalent())
    7370    , m_affinity(pos.affinity())
    74     , m_granularity(CharacterGranularity)
    7571{
    7672    validate();
     
    8177    , m_extent(extent.deepEquivalent())
    8278    , m_affinity(base.affinity())
    83     , m_granularity(CharacterGranularity)
    8479{
    8580    validate();
     
    9085    , m_extent(range->endPosition())
    9186    , m_affinity(affinity)
    92     , m_granularity(CharacterGranularity)
    9387{
    9488    validate();
     
    191185        return false;
    192186
    193     m_granularity = granularity;
    194     validate();
     187    validate(granularity);
    195188    return true;
    196189}
     
    269262}
    270263
    271 void VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity()
     264void VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity(TextGranularity granularity)
    272265{
    273266    if (m_baseIsFirst) {
     
    279272    }
    280273
    281     switch (m_granularity) {
     274    switch (granularity) {
    282275        case CharacterGranularity:
    283276            // Don't do any expansion.
     
    409402}
    410403
    411 void VisibleSelection::validate()
     404void VisibleSelection::validate(TextGranularity granularity)
    412405{
    413406    setBaseAndExtentToDeepEquivalents();
    414     setStartAndEndFromBaseAndExtentRespectingGranularity();
     407    setStartAndEndFromBaseAndExtentRespectingGranularity(granularity);
    415408    adjustSelectionToAvoidCrossingEditingBoundaries();
    416409    updateSelectionType();
  • trunk/WebCore/editing/VisibleSelection.h

    r53085 r56175  
    8282
    8383    bool expandUsingGranularity(TextGranularity granularity);
    84     TextGranularity granularity() const { return m_granularity; }
    85 
     84   
    8685    // We don't yet support multi-range selections, so we only ever have one range to return.
    8786    PassRefPtr<Range> firstRange() const;
     
    107106
    108107private:
    109     void validate();
     108    void validate(TextGranularity = CharacterGranularity);
    110109
    111110    // Support methods for validate()
    112111    void setBaseAndExtentToDeepEquivalents();
    113     void setStartAndEndFromBaseAndExtentRespectingGranularity();
     112    void setStartAndEndFromBaseAndExtentRespectingGranularity(TextGranularity);
    114113    void adjustSelectionToAvoidCrossingEditingBoundaries();
    115114    void updateSelectionType();
     
    126125
    127126    EAffinity m_affinity;           // the upstream/downstream affinity of the caret
    128     TextGranularity m_granularity;  // granularity of start/end selection
    129127
    130128    // these are cached, can be recalculated by validate()
     
    135133inline bool operator==(const VisibleSelection& a, const VisibleSelection& b)
    136134{
    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();
    138136}
    139137
  • trunk/WebCore/loader/FrameLoader.cpp

    r56070 r56175  
    731731        m_frame->view()->clear();
    732732
    733     m_frame->setSelectionGranularity(CharacterGranularity);
    734 
    735733    // Do not drop the document before the ScriptController and view are cleared
    736734    // as some destructors might still try to access the document.
  • trunk/WebCore/page/DOMSelection.cpp

    r46982 r56175  
    327327
    328328    SelectionController* selection = m_frame->selection();
    329     selection->expandUsingGranularity(CharacterGranularity);
    330329    selection->setExtent(VisiblePosition(node, offset, DOWNSTREAM));
    331330}
  • trunk/WebCore/page/DragController.cpp

    r55977 r56175  
    433433        m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData);
    434434        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));
    439440        } else {
    440441            if (setSelectionToDragCaret(innerFrame, dragCaret, range, point))
  • trunk/WebCore/page/EventHandler.cpp

    r56096 r56175  
    240240    if (innerNode && innerNode->renderer() && m_mouseDownMayStartSelect) {
    241241        VisiblePosition pos(innerNode->renderer()->positionForPoint(result.localPoint()));
     242        TextGranularity granularity = CharacterGranularity;
    242243        if (pos.isNotNull()) {
    243244            newSelection = VisibleSelection(pos);
     
    246247   
    247248        if (newSelection.isRange()) {
    248             m_frame->setSelectionGranularity(WordGranularity);
     249            granularity = WordGranularity;
    249250            m_beganSelectingText = true;
    250251            if (result.event().clickCount() == 2 && m_frame->editor()->isSelectTrailingWhitespaceEnabled())
     
    253254       
    254255        if (m_frame->shouldChangeSelection(newSelection))
    255             m_frame->selection()->setSelection(newSelection);
     256            m_frame->selection()->setSelection(newSelection, granularity);
    256257    }
    257258}
     
    271272            newSelection = VisibleSelection::selectionFromContentsOfNode(URLElement);
    272273   
     274        TextGranularity granularity = CharacterGranularity;
    273275        if (newSelection.isRange()) {
    274             m_frame->setSelectionGranularity(WordGranularity);
     276            granularity = WordGranularity;
    275277            m_beganSelectingText = true;
    276278        }
    277279
    278280        if (m_frame->shouldChangeSelection(newSelection))
    279             m_frame->selection()->setSelection(newSelection);
     281            m_frame->selection()->setSelection(newSelection, granularity);
    280282    }
    281283}
     
    314316        newSelection.expandUsingGranularity(ParagraphGranularity);
    315317    }
     318   
     319    TextGranularity granularity = CharacterGranularity;
    316320    if (newSelection.isRange()) {
    317         m_frame->setSelectionGranularity(ParagraphGranularity);
     321        granularity = ParagraphGranularity;
    318322        m_beganSelectingText = true;
    319323    }
    320324   
    321325    if (m_frame->shouldChangeSelection(newSelection))
    322         m_frame->selection()->setSelection(newSelection);
     326        m_frame->selection()->setSelection(newSelection, granularity);
    323327
    324328    return true;
     
    350354   
    351355    VisibleSelection newSelection = m_frame->selection()->selection();
     356    TextGranularity granularity = CharacterGranularity;
     357
    352358    if (extendSelection && newSelection.isCaretOrRange()) {
    353359        m_frame->selection()->setLastChangeWasHorizontalExtension(false);
     
    362368            newSelection = VisibleSelection(start, pos);
    363369
    364         if (m_frame->selectionGranularity() != CharacterGranularity)
     370        if (m_frame->selectionGranularity() != CharacterGranularity) {
     371            granularity = m_frame->selectionGranularity();
    365372            newSelection.expandUsingGranularity(m_frame->selectionGranularity());
     373        }
     374
    366375        m_beganSelectingText = true;
    367     } else {
     376    } else
    368377        newSelection = VisibleSelection(visiblePos);
    369         m_frame->setSelectionGranularity(CharacterGranularity);
    370     }
    371378   
    372379    if (m_frame->shouldChangeSelection(newSelection))
    373         m_frame->selection()->setSelection(newSelection);
     380        m_frame->selection()->setSelection(newSelection, granularity);
    374381
    375382    return true;
     
    586593    if (m_frame->shouldChangeSelection(newSelection)) {
    587594        m_frame->selection()->setLastChangeWasHorizontalExtension(false);
    588         m_frame->selection()->setSelection(newSelection);
     595        m_frame->selection()->setSelection(newSelection, m_frame->selectionGranularity());
    589596    }
    590597}
  • trunk/WebCore/page/Frame.cpp

    r56068 r56175  
    133133    , m_ownerElement(ownerElement)
    134134    , m_script(this)
    135     , m_selectionGranularity(CharacterGranularity)
    136135    , m_selectionController(this)
    137136    , m_editor(this)
     
    366365TextGranularity Frame::selectionGranularity() const
    367366{
    368     return m_selectionGranularity;
    369 }
    370 
    371 void Frame::setSelectionGranularity(TextGranularity granularity)
    372 {
    373     m_selectionGranularity = granularity;
     367    return m_selectionController.granularity();
    374368}
    375369
  • trunk/WebCore/page/Frame.h

    r55976 r56175  
    248248    public:
    249249        TextGranularity selectionGranularity() const;
    250         void setSelectionGranularity(TextGranularity);
    251250
    252251        bool shouldChangeSelection(const VisibleSelection&) const;
     
    346345        float m_zoomFactor;
    347346
    348         TextGranularity m_selectionGranularity;
    349 
    350347        mutable SelectionController m_selectionController;
    351348        mutable VisibleSelection m_mark;
  • trunk/WebCore/rendering/RenderTextControl.cpp

    r54748 r56175  
    267267    if (Frame* frame = document()->frame())
    268268        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);
    274269}
    275270
  • trunk/WebKit/chromium/ChangeLog

    r56168 r56175  
     12010-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
    1112010-03-18  Nate Chapin  <japhet@chromium.org>
    212
  • trunk/WebKit/chromium/src/WebFrameImpl.cpp

    r56098 r56175  
    11851185    selection.expandUsingGranularity(WordGranularity);
    11861186
    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    }
    11921191}
    11931192
Note: See TracChangeset for help on using the changeset viewer.