Calling setValue() while typing should invoke -textDidChangeInTextField in the inject...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Dec 2018 15:37:10 +0000 (15:37 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Dec 2018 15:37:10 +0000 (15:37 +0000)
commit2789e7665fa4e4dd2f214cdb9fcd8c97d7a9c09f
tree14eb3f3c92fc6ad3fd09b92214704b708455ba0f
parentb6706543371f6e8b597e8704ae4a06dfb94684b8
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing.html [new file with mode: 0644]
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/html/TextFieldInputType.cpp