Changeset 163056 in webkit


Ignore:
Timestamp:
Jan 29, 2014 5:53:42 PM (10 years ago)
Author:
rniwa@webkit.org
Message:

EventHandler::handleMouseReleaseEvent shouldn't call updateSelectionCachesIfSelectionIsInsideTextFormControl
and selectFrameElementInParentIfFullySelected
https://bugs.webkit.org/show_bug.cgi?id=127834

Reviewed by Alexey Proskuryakov.

Removed the calls and made setNonDirectionalSelectionIfNeeded pass in UserTriggered option.

In addition, removed the rather error-prone function override of setSelection since TextGranularity,
which is an enum, could be implicitly coerced into SetSelectionOptions which is a typedefed unsigned int.

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::setSelectionByMouseIfDifferent): Renamed from setNonDirectionalSelectionIfNeeded.
Pass in DoNotRevealSelection to avoid revealing the selection to preserve the existing behavior.
There are two layout tests that fail without this.
(WebCore::FrameSelection::setSelection): Check the newly addeed DoNotRevealSelection option.
(WebCore::FrameSelection::wordSelectionContainingCaretSelection): Call

  • editing/FrameSelection.h: Made updateSelectionCachesIfSelectionIsInsideTextFormControl and

selectFrameElementInParentIfFullySelected private as they are no longer called outside of FrameSelection.

  • page/EventHandler.cpp:

(WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart):
(WebCore::EventHandler::updateSelectionForMouseDrag):
(WebCore::EventHandler::handleMouseReleaseEvent): Removed calls to the functions.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163055 r163056  
     12014-01-29  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        EventHandler::handleMouseReleaseEvent shouldn't call updateSelectionCachesIfSelectionIsInsideTextFormControl
     4        and selectFrameElementInParentIfFullySelected
     5        https://bugs.webkit.org/show_bug.cgi?id=127834
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Removed the calls and made setNonDirectionalSelectionIfNeeded pass in UserTriggered option.
     10
     11        In addition, removed the rather error-prone function override of setSelection since TextGranularity,
     12        which is an enum, could be implicitly coerced into SetSelectionOptions which is a typedefed unsigned int.
     13
     14        * editing/FrameSelection.cpp:
     15        (WebCore::FrameSelection::setSelectionByMouseIfDifferent): Renamed from setNonDirectionalSelectionIfNeeded.
     16        Pass in DoNotRevealSelection to avoid revealing the selection to preserve the existing behavior.
     17        There are two layout tests that fail without this.
     18        (WebCore::FrameSelection::setSelection): Check the newly addeed DoNotRevealSelection option.
     19        (WebCore::FrameSelection::wordSelectionContainingCaretSelection): Call
     20
     21        * editing/FrameSelection.h: Made updateSelectionCachesIfSelectionIsInsideTextFormControl and
     22        selectFrameElementInParentIfFullySelected private as they are no longer called outside of FrameSelection.
     23
     24        * page/EventHandler.cpp:
     25        (WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart):
     26        (WebCore::EventHandler::updateSelectionForMouseDrag):
     27        (WebCore::EventHandler::handleMouseReleaseEvent): Removed calls to the functions.
     28
    1292014-01-29  Jer Noble  <jer.noble@apple.com>
    230
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r163012 r163056  
    221221}
    222222
    223 void FrameSelection::setNonDirectionalSelectionIfNeeded(const VisibleSelection& passedNewSelection, TextGranularity granularity,
     223void FrameSelection::setSelectionByMouseIfDifferent(const VisibleSelection& passedNewSelection, TextGranularity granularity,
    224224    EndPointsAdjustmentMode endpointsAdjustmentMode)
    225225{
     
    248248        return;
    249249
    250     setSelection(newSelection, granularity);
     250    setSelection(newSelection, UserTriggered | DoNotRevealSelection | CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, granularity);
    251251}
    252252
     
    323323    updateSelectionCachesIfSelectionIsInsideTextFormControl(userTriggered);
    324324    m_frame->editor().respondToChangedSelection(oldSelection, options);
    325     if (userTriggered == UserTriggered) {
     325    if (userTriggered == UserTriggered && !(options & DoNotRevealSelection)) {
    326326        ScrollAlignment alignment;
    327327
     
    24302430    VisibleSelection newSelection = frameSelection.selection();
    24312431    newSelection.expandUsingGranularity(WordGranularity);
    2432     frameSelection.setSelection(newSelection, frameSelection.granularity());
     2432    frameSelection.setSelection(newSelection, CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, frameSelection.granularity());
    24332433
    24342434    Position startPos(frameSelection.selection().start());
  • trunk/Source/WebCore/editing/FrameSelection.h

    r163012 r163056  
    126126        DictationTriggered = 1 << 5,
    127127        DoNotUpdateAppearance = 1 << 6,
     128        DoNotRevealSelection = 1 << 7,
    128129    };
    129130    typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOption and EUserTriggered
     
    150151    const VisibleSelection& selection() const { return m_selection; }
    151152    void setSelection(const VisibleSelection&, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
    152     void setSelection(const VisibleSelection& selection, TextGranularity granularity) { setSelection(selection, CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, granularity); }
    153153    bool setSelectedRange(Range*, EAffinity, bool closeTyping);
    154154    void selectAll();
    155155    void clear();
    156156    void prepareForDestruction();
    157 
    158     // Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
    159     void selectFrameElementInParentIfFullySelected();
    160157
    161158    bool contains(const LayoutPoint&);
     
    273270    bool shouldDeleteSelection(const VisibleSelection&) const;
    274271    enum EndPointsAdjustmentMode { AdjustEndpointsAtBidiBoundary, DoNotAdjsutEndpoints };
    275     void setNonDirectionalSelectionIfNeeded(const VisibleSelection&, TextGranularity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints);
    276     void updateSelectionCachesIfSelectionIsInsideTextFormControl(EUserTriggered);
     272    void setSelectionByMouseIfDifferent(const VisibleSelection&, TextGranularity, EndPointsAdjustmentMode = DoNotAdjsutEndpoints);
    277273
    278274    void paintDragCaret(GraphicsContext*, const LayoutPoint&, const LayoutRect& clipRect) const;
     
    322318#endif
    323319
     320    void updateSelectionCachesIfSelectionIsInsideTextFormControl(EUserTriggered);
     321
     322    void selectFrameElementInParentIfFullySelected();
     323
    324324    void setFocusedElementIfNeeded();
    325325    void focusedOrActiveStateChanged();
  • trunk/Source/WebCore/page/EventHandler.cpp

    r163018 r163056  
    507507    }
    508508
    509     m_frame.selection().setNonDirectionalSelectionIfNeeded(selection, granularity);
     509    m_frame.selection().setSelectionByMouseIfDifferent(selection, granularity);
    510510
    511511    return true;
     
    919919        newSelection.expandUsingGranularity(m_frame.selection().granularity());
    920920
    921     m_frame.selection().setNonDirectionalSelectionIfNeeded(newSelection, m_frame.selection().granularity(),
     921    m_frame.selection().setSelectionByMouseIfDifferent(newSelection, m_frame.selection().granularity(),
    922922        FrameSelection::AdjustEndpointsAtBidiBoundary);
    923923}
     
    985985        handled = true;
    986986    }
    987 
    988     m_frame.selection().updateSelectionCachesIfSelectionIsInsideTextFormControl(UserTriggered);
    989 
    990     m_frame.selection().selectFrameElementInParentIfFullySelected();
    991987
    992988    if (event.event().button() == MiddleButton) {
Note: See TracChangeset for help on using the changeset viewer.