WebKit Bugzilla
Attachment 357497 Details for
Bug 192785
: Calling setValue() while typing should invoke -textDidChangeInTextField in the injected bundle
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192785-20181217163038.patch (text/plain), 8.42 KB, created by
Wenson Hsieh
on 2018-12-17 16:30:39 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-12-17 16:30:39 PST
Size:
8.42 KB
patch
obsolete
>Subversion Revision: 239262 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 05949be24b6755555509935ddeb5f9f31f963327..ec452c8ed95c54f4ddca21eeaed46894faec07ed 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-12-17 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ Makes a minor adjustment in `TextFieldInputType::setValue` to consider value changes as "user editing", if we're >+ currently processing a key command and the focused element is the same as the element whose value is being >+ updated. 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): >+ > 2018-12-15 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > Null pointer dereference in JSC::WriteBarrierBase() >diff --git a/Source/WebCore/html/TextFieldInputType.cpp b/Source/WebCore/html/TextFieldInputType.cpp >index 471b77ae9913369683a9d1a5c27de47b4134ec13..e5929e8c4d27e309492564a6c02d5573a35a2731 100644 >--- a/Source/WebCore/html/TextFieldInputType.cpp >+++ b/Source/WebCore/html/TextFieldInputType.cpp >@@ -57,6 +57,7 @@ > #include "TextEvent.h" > #include "TextIterator.h" > #include "TextNodeTraversal.h" >+#include "UserTypingGestureIndicator.h" > #include "WheelEvent.h" > > #if ENABLE(DATALIST_ELEMENT) >@@ -168,6 +169,9 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange > // FIXME: Why do we do this when eventBehavior == DispatchNoEvent > if (!input->focused() || eventBehavior == DispatchNoEvent) > input->setTextAsOfLastFormControlChangeEvent(sanitizedValue); >+ >+ if (UserTypingGestureIndicator::focusedElementAtGestureStart() == input.ptr()) >+ didSetValueByUserEdit(); > } > > #if ENABLE(DATALIST_ELEMENT) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 28d445a7e29d4973bf15c1efc13310112a215c30..50e3921d2db77deaba57d1dde2e2ec8e96263dd6 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,21 @@ >+2018-12-17 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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: >+ > 2018-12-15 Youenn Fablet <youenn@apple.com> > > Make RTCRtpSender.setParameters to activate specific encodings >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index d75b0e97913c69c841cf9508f25be12af5f56ffd..f5643c2c3a4c029c1b72f27729ca58cc21b87c96 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -129,6 +129,7 @@ http/tests/storageAccess/ [ Skip ] > http/tests/navigation/process-swap-window-open.html [ Skip ] > http/tests/navigation/useragent-reload.php [ Skip ] > storage/indexeddb/modern/opendatabase-after-storage-crash.html [ Skip ] >+fast/forms/call-text-did-change-in-text-field-when-typing.html [ Skip ] > > # Only Mac and iOS have an implementation of UIScriptController::doAsyncTask(). > fast/harness/uiscriptcontroller [ Skip ] >diff --git a/LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing-expected.txt b/LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2336acec5cd40939afe8c2738946a09a2dbf47c2 >--- /dev/null >+++ b/LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing-expected.txt >@@ -0,0 +1,19 @@ >+ >+Verifies that programmatically changing text field values with user interaction invokes the -didChangeInTextField injected bundle method. This test requires WebKitTestRunner. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+1. Changing text field value with user typing gesture: >+Text did change in text field. >+The value of the text field is: "a" >+ >+2. Changing text field value with non-typing user gesture: >+PASS buttonClicked became true >+The value of the text field is: "ab" >+ >+3. Changing text field value without user gesture: >+The value of the text field is: "abc" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing.html b/LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing.html >new file mode 100644 >index 0000000000000000000000000000000000000000..53ebb1d68016e394da8aab1842c364c9e0864382 >--- /dev/null >+++ b/LayoutTests/fast/forms/call-text-did-change-in-text-field-when-typing.html >@@ -0,0 +1,72 @@ >+ >+<!DOCTYPE html> >+<html> >+<head> >+ <meta name="viewport" content="width=device-width, user-scalable=no"> >+ <script src="../../resources/js-test.js"></script> >+ <script src="../../resources/ui-helper.js"></script> >+ <style> >+ body { >+ margin: 0; >+ } >+ >+ input, button { >+ width: 100%; >+ height: 100px; >+ display: block; >+ } >+ </style> >+</head> >+<body> >+<input type="text" id="field"></input> >+<button value="Insert text" id="button"></button> >+<div id="description"></div> >+<div id="console"></div> >+</body> >+<script> >+ description("Verifies that programmatically changing text field values with user interaction invokes the -didChangeInTextField" >+ + " injected bundle method. This test requires WebKitTestRunner."); >+ >+ buttonClicked = false; >+ >+ if (window.testRunner) { >+ jsTestIsAsync = true; >+ testRunner.installTextDidChangeInTextFieldCallback(() => debug("Text did change in text field.")); >+ } >+ >+ field.addEventListener("keypress", event => { >+ field.value += event.key; >+ event.preventDefault(); >+ }); >+ >+ button.addEventListener("click", event => { >+ field.focus(); >+ field.value += "b"; >+ buttonClicked = true; >+ }); >+ >+ addEventListener("load", async () => { >+ if (!window.testRunner) >+ return; >+ >+ await UIHelper.activateAndWaitForInputSessionAt(100, 50); >+ >+ debug("1. Changing text field value with user typing gesture:"); >+ await UIHelper.typeCharacter("a"); >+ debug(`The value of the text field is: "${field.value}"`); >+ debug(""); >+ >+ debug("2. Changing text field value with non-typing user gesture:"); >+ UIHelper.activateAt(100, 150); >+ await new Promise(resolve => shouldBecomeEqual("buttonClicked", "true", resolve)); >+ debug(`The value of the text field is: "${field.value}"`); >+ debug(""); >+ >+ debug("3. Changing text field value without user gesture:"); >+ field.value += "c"; >+ debug(`The value of the text field is: "${field.value}"`); >+ >+ finishJSTest(); >+ }); >+</script> >+</html> >\ No newline at end of file >diff --git a/LayoutTests/platform/wk2/TestExpectations b/LayoutTests/platform/wk2/TestExpectations >index c50535d67daecc99d51e4aa964f2fa2c4a451341..8e959edaffd8927ef9c2aac316e9e3100cd140cb 100644 >--- a/LayoutTests/platform/wk2/TestExpectations >+++ b/LayoutTests/platform/wk2/TestExpectations >@@ -742,6 +742,8 @@ http/wpt/cross-origin-resource-policy/ [ Pass ] > http/tests/navigation/useragent-reload.php [ Pass ] > storage/indexeddb/modern/opendatabase-after-storage-crash.html [ Pass ] > >+fast/forms/call-text-did-change-in-text-field-when-typing.html [ Pass ] >+ > ### END OF (5) Progressions, expected successes that are expected failures in WebKit1. > ######################################## >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192785
:
357497
|
357537