Changeset 198904 in webkit


Ignore:
Timestamp:
Mar 31, 2016 11:50:55 AM (8 years ago)
Author:
tonikitoo@webkit.org
Message:

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

Reviewed by Darin Adler.

SSIA.

No new tests needed.

  • editing/EditingBehavior.h:

(WebCore::EditingBehavior::shouldAlwaysExtendSelectionFromExtentEndpoint):

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::positionForPlatform):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r198901 r198904  
     12016-03-31  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        SelectionController::positionForPlatform should ask EditingBehavior for platform specific behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=41976
     5
     6        Reviewed by Darin Adler.
     7
     8        SSIA.
     9
     10        No new tests needed.
     11
     12        * editing/EditingBehavior.h:
     13        (WebCore::EditingBehavior::shouldAlwaysExtendSelectionFromExtentEndpoint):
     14        * editing/FrameSelection.cpp:
     15        (WebCore::FrameSelection::positionForPlatform):
     16
    1172016-03-31  Jeremy Jones  <jeremyj@apple.com>
    218
  • trunk/Source/WebCore/editing/EditingBehavior.h

    r183138 r198904  
    9292    bool shouldSelectBasedOnDictionaryLookup() const { return m_type == EditingMacBehavior; }
    9393
     94    // Linux and Windows always extend selections from the extent endpoint.
     95    bool shouldAlwaysExtendSelectionFromExtentEndpoint() const { return m_type != EditingMacBehavior && m_type != EditingIOSBehavior; }
     96
    9497private:
    9598    EditingBehaviorType m_type;
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r197024 r198904  
    621621VisiblePosition FrameSelection::positionForPlatform(bool isGetStart) const
    622622{
    623     if (m_frame && (m_frame->settings().editingBehaviorType() == EditingMacBehavior || m_frame->settings().editingBehaviorType() == EditingIOSBehavior))
    624         return isGetStart ? m_selection.visibleStart() : m_selection.visibleEnd();
    625     // Linux and Windows always extend selections from the extent endpoint.
    626623    // FIXME: VisibleSelection should be fixed to ensure as an invariant that
    627624    // base/extent always point to the same nodes as start/end, but which points
    628625    // to which depends on the value of isBaseFirst. Then this can be changed
    629626    // to just return m_sel.extent().
    630     return m_selection.isBaseFirst() ? m_selection.visibleEnd() : m_selection.visibleStart();
     627    if (m_frame && m_frame->editor().behavior().shouldAlwaysExtendSelectionFromExtentEndpoint())
     628        return m_selection.isBaseFirst() ? m_selection.visibleEnd() : m_selection.visibleStart();
     629
     630    return isGetStart ? m_selection.visibleStart() : m_selection.visibleEnd();
    631631}
    632632
Note: See TracChangeset for help on using the changeset viewer.