Changeset 81095 in webkit


Ignore:
Timestamp:
Mar 14, 2011 7:07:09 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

2011-03-14 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

EventHandler calls shouldChangeSelection needlessly
https://bugs.webkit.org/show_bug.cgi?id=56324

Extracted setSelectionIfNeeded and setNonDirectionalSelectionIfNeeded and
avoided calling shouldChangeSelection and setSelection when the existing
selection is identical to that of new selection.

  • page/EventHandler.cpp: (WebCore::setSelectionIfNeeded): Extracted. (WebCore::setNonDirectionalSelectionIfNeeded): Extracted. (WebCore::EventHandler::selectClosestWordFromMouseEvent): Calls a helper function above. (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent): Ditto. (WebCore::EventHandler::handleMousePressEventTripleClick): Ditto. (WebCore::EventHandler::handleMousePressEventSingleClick): Ditto. (WebCore::EventHandler::updateSelectionForMouseDrag): Ditto. (WebCore::EventHandler::handleMouseReleaseEvent): Ditto.

2011-03-14 Anton Muhin <antonm@chromium.org>

Reviewed by Adam Barth.

[v8] Rework object group building.
https://bugs.webkit.org/show_bug.cgi?id=55399

Instead of going top-down (from owner to owned elements), go up---from objects
to their group ids. That fits better to v8's object grouping model and guarantees
that each wrapper belongs to the single group.

Alas, this cannot be implemented for one kind of objects---CSSProperties.

Part of core GC algorithm and tested extensively by exisiting layout tests.

  • platform/chromium/test_expectations.txt: Temporary suppress text differences.
Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r81092 r81095  
    1515
    1616        * platform/chromium/test_expectations.txt: Temporary suppress text differences.
     17
     182011-03-14  Ryosuke Niwa  <rniwa@webkit.org>
     19
     20        Reviewed by Darin Adler.
     21
     22        EventHandler calls shouldChangeSelection needlessly
     23        https://bugs.webkit.org/show_bug.cgi?id=56324
     24
     25        Since redundant calls to SelectionController::ShouldChangeSelection has been eliminated
     26        some editing delegate dumps have lost redundant shouldChangeSelectedDOMRange.
     27
     28        * editing/selection/after-line-break-expected.txt:
     29        * editing/selection/anchor-focus2-expected.txt:
     30        * editing/selection/anchor-focus3-expected.txt:
     31        * platform/mac/editing/deleting/smart-delete-001-expected.txt:
     32        * platform/mac/editing/deleting/smart-delete-002-expected.txt:
     33        * platform/mac/editing/pasteboard/smart-drag-drop-expected.txt:
     34        * platform/mac/editing/pasteboard/smart-paste-001-expected.txt:
     35        * platform/mac/editing/pasteboard/smart-paste-003-expected.txt:
     36        * platform/mac/editing/pasteboard/smart-paste-004-expected.txt:
     37        * platform/mac/editing/pasteboard/smart-paste-007-expected.txt:
     38        * platform/mac/editing/pasteboard/smart-paste-008-expected.txt:
     39        * platform/mac/editing/selection/expanding-selections-expected.txt:
     40        * platform/mac/editing/selection/expanding-selections2-expected.txt:
     41        * platform/mac/editing/selection/fake-drag-expected.txt:
     42        * platform/mac/editing/selection/select-from-textfield-outwards-expected.txt:
     43        * platform/mac/editing/selection/triple-click-in-pre-expected.txt:
    1744
    18452011-03-14  Ryosuke Niwa  <rniwa@webkit.org>
  • trunk/LayoutTests/editing/selection/after-line-break-expected.txt

    r71465 r81095  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    6 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document toDOMRange:range from 6 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    76Test for rdar://problem/5973313 REGRESSION (r32508): Down arrow doesn't change caret with non-user entered newlines in textareas.
    87
  • trunk/LayoutTests/editing/selection/anchor-focus2-expected.txt

    r81053 r81095  
    11EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    22EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    3 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    53EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    64EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/editing/selection/anchor-focus3-expected.txt

    r81053 r81095  
    11EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    22EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    3 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    53EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    64EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/smart-delete-001-expected.txt

    r74593 r81095  
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    54EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 4 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    65EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/deleting/smart-delete-002-expected.txt

    r74593 r81095  
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    6 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    76EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 8 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    87EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-drag-drop-expected.txt

    r63291 r81095  
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    54EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > SPAN > DIV > BODY > HTML > #document to 5 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    65EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-001-expected.txt

    r63291 r81095  
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    54EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    65EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-003-expected.txt

    r80121 r81095  
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    54EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    65EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-004-expected.txt

    r80121 r81095  
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    54EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    65EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-007-expected.txt

    r80121 r81095  
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    54EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    65EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-008-expected.txt

    r80121 r81095  
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    33EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    4 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    54EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    65EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/selection/expanding-selections-expected.txt

    r63291 r81095  
    33EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    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
    65layer at (0,0) size 800x600
    76  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/selection/expanding-selections2-expected.txt

    r63403 r81095  
    33EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    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
    65layer at (0,0) size 800x600
    76  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/selection/fake-drag-expected.txt

    r81053 r81095  
    55EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    7 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    87EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    98EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  • trunk/LayoutTests/platform/mac/editing/selection/select-from-textfield-outwards-expected.txt

    r78910 r81095  
    99EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV to 17 of #text > DIV toDOMRange:range from 0 of #text > DIV to 11 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1010EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    11 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 11 of #text > DIV toDOMRange:range from 0 of #text > DIV to 11 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1211EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of #text > DIV to 11 of #text > DIV toDOMRange:range from 6 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1312EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    14 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > DIV to 17 of #text > DIV toDOMRange:range from 6 of #text > DIV to 17 of #text > DIV affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    1513layer at (0,0) size 800x600
    1614  RenderView at (0,0) size 800x600
  • trunk/LayoutTests/platform/mac/editing/selection/triple-click-in-pre-expected.txt

    r63291 r81095  
    55EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 30 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
    66EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    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
    87layer at (0,0) size 800x600
    98  RenderView at (0,0) size 800x600
  • trunk/Source/WebCore/ChangeLog

    r81094 r81095  
     12011-03-14  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        EventHandler calls shouldChangeSelection needlessly
     6        https://bugs.webkit.org/show_bug.cgi?id=56324
     7
     8        Extracted setSelectionIfNeeded and setNonDirectionalSelectionIfNeeded and
     9        avoided calling shouldChangeSelection and setSelection when the existing
     10        selection is identical to that of new selection.
     11
     12        * page/EventHandler.cpp:
     13        (WebCore::setSelectionIfNeeded): Extracted.
     14        (WebCore::setNonDirectionalSelectionIfNeeded): Extracted.
     15        (WebCore::EventHandler::selectClosestWordFromMouseEvent): Calls a helper function above.
     16        (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent): Ditto.
     17        (WebCore::EventHandler::handleMousePressEventTripleClick): Ditto.
     18        (WebCore::EventHandler::handleMousePressEventSingleClick): Ditto.
     19        (WebCore::EventHandler::updateSelectionForMouseDrag): Ditto.
     20        (WebCore::EventHandler::handleMouseReleaseEvent): Ditto.
     21
    1222011-03-14  Daniel Sievers  <sievers@google.com>
    223
  • trunk/Source/WebCore/page/EventHandler.cpp

    r81053 r81095  
    251251}
    252252
     253static void setSelectionIfNeeded(SelectionController* selection, const VisibleSelection& newSelection)
     254{
     255    ASSERT(selection);
     256    if (selection->selection() != newSelection && selection->shouldChangeSelection(newSelection))
     257        selection->setSelection(newSelection);
     258}
     259
     260static void setNonDirectionalSelectionIfNeeded(SelectionController* selection, const VisibleSelection& newSelection, TextGranularity granularity)
     261{
     262    ASSERT(selection);
     263    if (selection->selection() != newSelection && selection->shouldChangeSelection(newSelection))
     264        selection->setSelection(newSelection, granularity, MakeNonDirectionalSelection);
     265}
     266
    253267void EventHandler::selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& result)
    254268{
     
    270284                newSelection.appendTrailingWhitespace();           
    271285        }
    272        
    273         if (m_frame->selection()->shouldChangeSelection(newSelection))
    274             m_frame->selection()->setSelection(newSelection, granularity, MakeNonDirectionalSelection);
     286
     287        setNonDirectionalSelectionIfNeeded(m_frame->selection(), newSelection, granularity);
    275288    }
    276289}
     
    296309        }
    297310
    298         if (m_frame->selection()->shouldChangeSelection(newSelection))
    299             m_frame->selection()->setSelection(newSelection, granularity, MakeNonDirectionalSelection);
     311        setNonDirectionalSelectionIfNeeded(m_frame->selection(), newSelection, granularity);
    300312    }
    301313}
     
    340352        m_beganSelectingText = true;
    341353    }
    342    
    343     if (m_frame->selection()->shouldChangeSelection(newSelection))
    344         m_frame->selection()->setSelection(newSelection, granularity, MakeNonDirectionalSelection);
     354
     355    setNonDirectionalSelectionIfNeeded(m_frame->selection(), newSelection, granularity);
    345356
    346357    return true;
     
    407418    } else
    408419        newSelection = VisibleSelection(visiblePos);
    409    
    410     if (m_frame->selection()->shouldChangeSelection(newSelection))
    411         m_frame->selection()->setSelection(newSelection, granularity, MakeNonDirectionalSelection);
     420
     421    setNonDirectionalSelectionIfNeeded(m_frame->selection(), newSelection, granularity);
    412422
    413423    return true;
     
    650660        newSelection.expandUsingGranularity(m_frame->selection()->granularity());
    651661
    652     if (m_frame->selection()->shouldChangeSelection(newSelection)) {
    653         m_frame->selection()->setIsDirectional(false);
    654         m_frame->selection()->setSelection(newSelection, m_frame->selection()->granularity(), MakeNonDirectionalSelection);
    655     }
     662    setNonDirectionalSelectionIfNeeded(m_frame->selection(), newSelection, m_frame->selection()->granularity());
    656663}
    657664#endif // ENABLE(DRAG_SUPPORT)
     
    714721            newSelection = VisibleSelection(pos);
    715722        }
    716         if (m_frame->selection()->shouldChangeSelection(newSelection))
    717             m_frame->selection()->setSelection(newSelection);
     723
     724        setSelectionIfNeeded(m_frame->selection(), newSelection);
    718725
    719726        handled = true;
Note: See TracChangeset for help on using the changeset viewer.