Changeset 67909 in webkit


Ignore:
Timestamp:
Sep 20, 2010 6:51:21 PM (14 years ago)
Author:
tonikitoo@webkit.org
Message:

2010-09-19 Antonio Gomes <agomes@rim.com>

Reviewed by Ojan Vafai.

SelectionController::modify should ask EditingBehavior for platform specific behavior
https://bugs.webkit.org/show_bug.cgi?id=41975

As a follow up of the refactoring work in bug 39854, patch makes SelectionController::modify()
stop accessing EditingBehaviorType values directly, and replaces its use by the EditingBehavior class.

Since the "Settings*" parameter of the private SelectionController::modify() method becomes unneeded
with this change (it was used to query the editingBehaviorType), patch merges two modify() methods.

No behavior change, so no new tests.

  • editing/EditingBehavior.h: (WebCore::EditingBehavior::shouldAlwaysGrowSelectionWhenExtendingToBoundary):
  • editing/SelectionController.cpp: (WebCore::SelectionController::modify):
  • editing/SelectionController.h:
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r67906 r67909  
     12010-09-19  Antonio Gomes  <agomes@rim.com>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        SelectionController::modify should ask EditingBehavior for platform specific behavior
     6        https://bugs.webkit.org/show_bug.cgi?id=41975
     7
     8        As a follow up of the refactoring work in bug 39854, patch makes SelectionController::modify()
     9        stop accessing EditingBehaviorType values directly, and replaces its use by the EditingBehavior
     10        class.
     11
     12        Since the "Settings*" parameter of the private SelectionController::modify() method becomes unneeded
     13        with this change (it was used to query the editingBehaviorType), patch merges two modify() methods.
     14
     15        No behavior change, so no new tests.
     16
     17        * editing/EditingBehavior.h:
     18        (WebCore::EditingBehavior::shouldAlwaysGrowSelectionWhenExtendingToBoundary):
     19        * editing/SelectionController.cpp:
     20        (WebCore::SelectionController::modify):
     21        * editing/SelectionController.h:
     22
    1232010-09-20  Vangelis Kokkevis  <vangelis@chromium.org>
    224
  • trunk/WebCore/editing/EditingBehavior.h

    r62815 r67909  
    5454    bool shouldToggleStyleBasedOnStartOfSelection() const { return m_type == EditingMacBehavior; }
    5555
     56    // Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the base
     57    // in place and moving the extent. Matches NSTextView.
     58    bool shouldAlwaysGrowSelectionWhenExtendingToBoundary() const { return m_type == EditingMacBehavior; }
     59
    5660private:
    5761    EditingBehaviorType m_type;
  • trunk/WebCore/editing/SelectionController.cpp

    r67653 r67909  
    623623}
    624624
    625 bool SelectionController::modify(EAlteration alter, EDirection dir, TextGranularity granularity, bool userTriggered)
    626 {
    627     Settings* settings = m_frame ? m_frame->settings() : 0;
    628     return modify(alter, dir, granularity, userTriggered, settings);
    629 }
    630    
    631625static bool isBoundary(TextGranularity granularity)
    632626{
     
    634628}   
    635629   
    636 bool SelectionController::modify(EAlteration alter, EDirection direction, TextGranularity granularity, bool userTriggered, Settings* settings)
     630bool SelectionController::modify(EAlteration alter, EDirection direction, TextGranularity granularity, bool userTriggered)
    637631{
    638632    if (userTriggered) {
     
    640634        trialSelectionController.setSelection(m_selection);
    641635        trialSelectionController.setIsDirectional(m_isDirectional);
    642         trialSelectionController.modify(alter, direction, granularity, false, settings);
     636        trialSelectionController.modify(alter, direction, granularity, false);
    643637
    644638        bool change = shouldChangeSelection(trialSelectionController.selection());
     
    691685        break;
    692686    case AlterationExtend:
    693         if (!settings || settings->editingBehaviorType() != EditingMacBehavior || m_selection.isCaret() || !isBoundary(granularity))
     687        // Standard Mac behavior when extending to a boundary is grow the selection rather than leaving the
     688        // base in place and moving the extent. Matches NSTextView.
     689        if (!m_frame || !m_frame->editor()->behavior().shouldAlwaysGrowSelectionWhenExtendingToBoundary() || m_selection.isCaret() || !isBoundary(granularity))
    694690            setExtent(position, userTriggered);
    695691        else {
    696             // Standard Mac behavior when extending to a boundary is grow the selection rather
    697             // than leaving the base in place and moving the extent. Matches NSTextView.
    698692            if (direction == DirectionForward || direction == DirectionRight)
    699693                setEnd(position, userTriggered);
     
    701695                setStart(position, userTriggered);
    702696        }
     697        break;
    703698    }
    704699   
  • trunk/WebCore/editing/SelectionController.h

    r67238 r67909  
    182182    VisiblePosition endForPlatform() const;
    183183
    184     bool modify(EAlteration, EDirection, TextGranularity, bool userTriggered, Settings*);
    185 
    186184    VisiblePosition modifyExtendingRight(TextGranularity);
    187185    VisiblePosition modifyExtendingForward(TextGranularity);
Note: See TracChangeset for help on using the changeset viewer.