Changeset 239337 in webkit


Ignore:
Timestamp:
Dec 18, 2018 7:37:10 AM (5 years ago)
Author:
Wenson Hsieh
Message:

Calling setValue() while typing should invoke -textDidChangeInTextField in the injected bundle
https://bugs.webkit.org/show_bug.cgi?id=192785
<rdar://problem/45321184>

Reviewed by Tim Horton.

Source/WebCore:

Makes a minor adjustment in TextFieldInputType::setValue to consider value changes as "user editing", if we're
currently processing a keystroke from the user. This is useful for certain private clients, such as Safari, that
need to know when the user is typing in a text form control, but the page is preventing default text insertion
behavior and instead updating values programmatically.

Test: fast/forms/call-text-did-change-in-text-field-when-typing.html

  • html/TextFieldInputType.cpp:

(WebCore::TextFieldInputType::setValue):

LayoutTests:

Add a test to verify that:

  1. When typing in a focused field, the injected bundle method is invoked.
  2. When changing the value of the focused field under non-typing user interaction, the method isn't invoked.
  3. When changing the value of the focused field programmatically without user gesture, the method isn't invoked.
  • TestExpectations:
  • fast/forms/call-text-did-change-in-text-field-when-typing-expected.txt: Added.
  • fast/forms/call-text-did-change-in-text-field-when-typing.html: Added.
  • platform/wk2/TestExpectations:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r239323 r239337  
     12018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Calling setValue() while typing should invoke -textDidChangeInTextField in the injected bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=192785
     5        <rdar://problem/45321184>
     6
     7        Reviewed by Tim Horton.
     8
     9        Add a test to verify that:
     10        1. When typing in a focused field, the injected bundle method is invoked.
     11        2. When changing the value of the focused field under non-typing user interaction, the method isn't invoked.
     12        3. When changing the value of the focused field programmatically without user gesture, the method isn't invoked.
     13
     14        * TestExpectations:
     15        * fast/forms/call-text-did-change-in-text-field-when-typing-expected.txt: Added.
     16        * fast/forms/call-text-did-change-in-text-field-when-typing.html: Added.
     17        * platform/wk2/TestExpectations:
     18
    1192018-12-17  Jiewen Tan  <jiewen_tan@apple.com>
    220
  • trunk/LayoutTests/TestExpectations

    r239278 r239337  
    130130http/tests/navigation/useragent-reload.php [ Skip ]
    131131storage/indexeddb/modern/opendatabase-after-storage-crash.html [ Skip ]
     132fast/forms/call-text-did-change-in-text-field-when-typing.html [ Skip ]
    132133
    133134# Only Mac and iOS have an implementation of UIScriptController::doAsyncTask().
  • trunk/LayoutTests/platform/wk2/TestExpectations

    r237986 r239337  
    743743storage/indexeddb/modern/opendatabase-after-storage-crash.html [ Pass ]
    744744
     745fast/forms/call-text-did-change-in-text-field-when-typing.html [ Pass ]
     746
    745747### END OF (5) Progressions, expected successes that are expected failures in WebKit1.
    746748########################################
  • trunk/Source/WebCore/ChangeLog

    r239336 r239337  
     12018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Calling setValue() while typing should invoke -textDidChangeInTextField in the injected bundle
     4        https://bugs.webkit.org/show_bug.cgi?id=192785
     5        <rdar://problem/45321184>
     6
     7        Reviewed by Tim Horton.
     8
     9        Makes a minor adjustment in `TextFieldInputType::setValue` to consider value changes as "user editing", if we're
     10        currently processing a keystroke from the user. This is useful for certain private clients, such as Safari, that
     11        need to know when the user is typing in a text form control, but the page is preventing default text insertion
     12        behavior and instead updating values programmatically.
     13
     14        Test: fast/forms/call-text-did-change-in-text-field-when-typing.html
     15
     16        * html/TextFieldInputType.cpp:
     17        (WebCore::TextFieldInputType::setValue):
     18
    1192018-12-18  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r238545 r239337  
    5858#include "TextIterator.h"
    5959#include "TextNodeTraversal.h"
     60#include "UserTypingGestureIndicator.h"
    6061#include "WheelEvent.h"
    6162
     
    169170    if (!input->focused() || eventBehavior == DispatchNoEvent)
    170171        input->setTextAsOfLastFormControlChangeEvent(sanitizedValue);
     172
     173    if (UserTypingGestureIndicator::processingUserTypingGesture())
     174        didSetValueByUserEdit();
    171175}
    172176
Note: See TracChangeset for help on using the changeset viewer.