Changeset 233311 in webkit


Ignore:
Timestamp:
Jun 28, 2018 10:12:05 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION (r232040): Cursor jumping in Safari text fields
https://bugs.webkit.org/show_bug.cgi?id=187142
<rdar://problem/41397577>

Patch by Aditya Keerthi <Aditya Keerthi> on 2018-06-28
Reviewed by Tim Horton.

Source/WebCore:

r232040 enabled click events to fire on nodes that are already being edited in
iOS. This resulted FrameSelection::setSelection being called twice. One call
originated from the UIWKTextInteractionAssistant, which snaps the caret to word
boundaries. The other call originates from handleMousePressEvent in EventHandler,
and uses character boundaries. Consequently, we see the caret jumping around.

To fix this issue, an early return was added in the handleMousePressEvent
codepath, which prevents FrameSelection::setSelection from being called when
clicking on a node that is already being edited. This ensures that the
UIWKTextInteractionAssistant codepath is the only influence on the caret position.

Test: fast/events/ios/click-selectionchange-once.html

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleMousePressEventSingleClick):

LayoutTests:

Added test to ensure that the 'selectionchange' event is only fired once per
click in an editable node.

  • fast/events/ios/click-selectionchange-once-expected.txt: Added.
  • fast/events/ios/click-selectionchange-once.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r233302 r233311  
     12018-06-28  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        REGRESSION (r232040): Cursor jumping in Safari text fields
     4        https://bugs.webkit.org/show_bug.cgi?id=187142
     5        <rdar://problem/41397577>
     6
     7        Reviewed by Tim Horton.
     8
     9        Added test to ensure that the 'selectionchange' event is only fired once per
     10        click in an editable node.
     11
     12        * fast/events/ios/click-selectionchange-once-expected.txt: Added.
     13        * fast/events/ios/click-selectionchange-once.html: Added.
     14
    1152018-06-28  Dirk Schulze  <krit@webkit.org>
    216
  • trunk/Source/WebCore/ChangeLog

    r233309 r233311  
     12018-06-28  Aditya Keerthi  <akeerthi@apple.com>
     2
     3        REGRESSION (r232040): Cursor jumping in Safari text fields
     4        https://bugs.webkit.org/show_bug.cgi?id=187142
     5        <rdar://problem/41397577>
     6
     7        Reviewed by Tim Horton.
     8
     9        r232040 enabled click events to fire on nodes that are already being edited in
     10        iOS. This resulted FrameSelection::setSelection being called twice. One call
     11        originated from the UIWKTextInteractionAssistant, which snaps the caret to word
     12        boundaries. The other call originates from handleMousePressEvent in EventHandler,
     13        and uses character boundaries. Consequently, we see the caret jumping around.
     14
     15        To fix this issue, an early return was added in the handleMousePressEvent
     16        codepath, which prevents FrameSelection::setSelection from being called when
     17        clicking on a node that is already being edited. This ensures that the
     18        UIWKTextInteractionAssistant codepath is the only influence on the caret position.
     19
     20        Test: fast/events/ios/click-selectionchange-once.html
     21
     22        * page/EventHandler.cpp:
     23        (WebCore::EventHandler::handleMousePressEventSingleClick):
     24
    1252018-06-28  Chris Dumez  <cdumez@apple.com>
    226
  • trunk/Source/WebCore/page/EventHandler.cpp

    r233122 r233311  
    682682    TextGranularity granularity = CharacterGranularity;
    683683
     684#if PLATFORM(IOS)
     685    // The text selection assistant will handle selection in the case where we are already editing the node
     686    if (newSelection.rootEditableElement() == targetNode->rootEditableElement())
     687        return true;
     688#endif
     689
    684690    if (extendSelection && newSelection.isCaretOrRange()) {
    685691        VisibleSelection selectionInUserSelectAll = expandSelectionToRespectSelectOnMouseDown(*targetNode, VisibleSelection(pos));
Note: See TracChangeset for help on using the changeset viewer.