Changeset 231967 in webkit


Ignore:
Timestamp:
May 18, 2018 11:23:45 AM (6 years ago)
Author:
Wenson Hsieh
Message:

[Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
https://bugs.webkit.org/show_bug.cgi?id=185769
<rdar://problem/40368261>

Reviewed by Tim Horton.

Source/WebKit:

When setting the text of the currently focused element to the empty string, just delete the text instead of
pretending to insert an empty string. This mimics deleting content using the delete key on macOS, and fires an
input event with inputType "deleteContent" instead of "insertText".

Test: fast/forms/extrazoom/delete-content-in-text-field.html

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setTextAsync):

LayoutTests:

Adds a new test to inspect the input events dispatched as a result of inserting and deleting text in a form
control. The inputTypes should be "insertText" and "deleteContent", respectively; the data values should be the
inserted string and null, respectively.

  • fast/forms/extrazoom/delete-content-in-text-field-expected.txt: Added.
  • fast/forms/extrazoom/delete-content-in-text-field.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r231965 r231967  
     12018-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
     4        https://bugs.webkit.org/show_bug.cgi?id=185769
     5        <rdar://problem/40368261>
     6
     7        Reviewed by Tim Horton.
     8
     9        Adds a new test to inspect the input events dispatched as a result of inserting and deleting text in a form
     10        control. The inputTypes should be "insertText" and "deleteContent", respectively; the data values should be the
     11        inserted string and null, respectively.
     12
     13        * fast/forms/extrazoom/delete-content-in-text-field-expected.txt: Added.
     14        * fast/forms/extrazoom/delete-content-in-text-field.html: Added.
     15
    1162018-05-18  Youenn Fablet  <youenn@apple.com>
    217
  • trunk/Source/WebKit/ChangeLog

    r231966 r231967  
     12018-05-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
     4        https://bugs.webkit.org/show_bug.cgi?id=185769
     5        <rdar://problem/40368261>
     6
     7        Reviewed by Tim Horton.
     8
     9        When setting the text of the currently focused element to the empty string, just delete the text instead of
     10        pretending to insert an empty string. This mimics deleting content using the delete key on macOS, and fires an
     11        input event with inputType "deleteContent" instead of "insertText".
     12
     13        Test: fast/forms/extrazoom/delete-content-in-text-field.html
     14
     15        * WebProcess/WebPage/WebPage.cpp:
     16        (WebKit::WebPage::setTextAsync):
     17
    1182018-05-18  Keith Rollin  <krollin@apple.com>
    219
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r231779 r231967  
    46204620        UserTypingGestureIndicator indicator(frame.get());
    46214621        frame->selection().selectAll();
    4622         frame->editor().insertText(text, nullptr, TextEventInputKeyboard);
     4622        if (text.isEmpty())
     4623            frame->editor().deleteSelectionWithSmartDelete(false);
     4624        else
     4625            frame->editor().insertText(text, nullptr, TextEventInputKeyboard);
    46234626        return;
    46244627    }
Note: See TracChangeset for help on using the changeset viewer.