Changeset 240926 in webkit


Ignore:
Timestamp:
Feb 4, 2019 8:05:18 AM (5 years ago)
Author:
Wenson Hsieh
Message:

[iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site
Followup to https://bugs.webkit.org/show_bug.cgi?id=193758

Reviewed by Daniel Bates.

Put the iOS-specific behavior behind an EditingBehavior check, rather than a compile-time guard. No change in
behavior.

  • editing/EditingBehavior.h:

(WebCore::EditingBehavior::shouldMoveSelectionToEndWhenFocusingTextInput const):

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::setDefaultSelectionAfterFocus):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240924 r240926  
     12019-02-04  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS] Unable to make a selection in jsfiddle.net using arrow keys when requesting desktop site
     4        Followup to https://bugs.webkit.org/show_bug.cgi?id=193758
     5
     6        Reviewed by Daniel Bates.
     7
     8        Put the iOS-specific behavior behind an EditingBehavior check, rather than a compile-time guard. No change in
     9        behavior.
     10
     11        * editing/EditingBehavior.h:
     12        (WebCore::EditingBehavior::shouldMoveSelectionToEndWhenFocusingTextInput const):
     13        * html/HTMLInputElement.cpp:
     14        (WebCore::HTMLInputElement::setDefaultSelectionAfterFocus):
     15
    1162019-02-04  Zalan Bujtas  <zalan@apple.com>
    217
  • trunk/Source/WebCore/editing/EditingBehavior.h

    r222806 r240926  
    9494    bool shouldAlwaysExtendSelectionFromExtentEndpoint() const { return m_type != EditingMacBehavior && m_type != EditingIOSBehavior; }
    9595
     96    // On iOS, we don't want to select all the text when focusing a field. Instead, match platform behavior by going to the end of the line.
     97    bool shouldMoveSelectionToEndWhenFocusingTextInput() const { return m_type == EditingIOSBehavior; }
     98
    9699private:
    97100    EditingBehaviorType m_type;
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r240452 r240926  
    470470{
    471471    ASSERT(isTextField());
    472 #if PLATFORM(IOS_FAMILY)
    473     // We don't want to select all the text on iOS when focusing a field. Instead, match platform behavior by going to the end of the line.
    474     int start = std::numeric_limits<int>::max();
    475     auto direction = SelectionHasForwardDirection;
    476 #else
    477472    int start = 0;
    478473    auto direction = SelectionHasNoDirection;
    479 #endif
     474    auto* frame = document().frame();
     475    if (frame && frame->editor().behavior().shouldMoveSelectionToEndWhenFocusingTextInput()) {
     476        start = std::numeric_limits<int>::max();
     477        direction = SelectionHasForwardDirection;
     478    }
    480479    setSelectionRange(start, std::numeric_limits<int>::max(), direction, revealMode, Element::defaultFocusTextStateChangeIntent());
    481480}
Note: See TracChangeset for help on using the changeset viewer.