WebKit Bugzilla
Attachment 340708 Details for
Bug 185769
: [Extra zoom mode] Clearing text fields should dispatch input events of type "deleteContent"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185769-20180518102105.patch (text/plain), 5.10 KB, created by
Wenson Hsieh
on 2018-05-18 10:21:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-05-18 10:21:06 PDT
Size:
5.10 KB
patch
obsolete
>Subversion Revision: 231938 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 4068cc976f3ac30a1c4ab69beba0a33be62320c0..0a2a6961494f68b4298e8cea43b53d3c6346627a 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2018-05-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ 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): >+ > 2018-05-17 Nan Wang <n_wang@apple.com> > > AX: [macOS] Expose the primary screen height through AX API >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 45a2356f4d7511b50f1ad80c03a5e27ae741c06d..84a43c919f74440b63724134e459c417e5bf98cb 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -4619,7 +4619,10 @@ void WebPage::setTextAsync(const String& text) > if (frame->selection().selection().isContentEditable()) { > UserTypingGestureIndicator indicator(frame.get()); > frame->selection().selectAll(); >- frame->editor().insertText(text, nullptr, TextEventInputKeyboard); >+ if (text.isEmpty()) >+ frame->editor().deleteSelectionWithSmartDelete(false); >+ else >+ frame->editor().insertText(text, nullptr, TextEventInputKeyboard); > return; > } > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 62b3983db49f1b08f6ae7cc4d53cc0b05c865625..ba9582bee79d7f812dbb334a0843ec10c3b86f73 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2018-05-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ 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.html: Added. >+ > 2018-05-17 Nan Wang <n_wang@apple.com> > > AX: [macOS] Expose the primary screen height through AX API >diff --git a/LayoutTests/fast/forms/extrazoom/delete-content-in-text-field.html b/LayoutTests/fast/forms/extrazoom/delete-content-in-text-field.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a00a9c06cb6347a386ff06fcffb2ec4f436b4d42 >--- /dev/null >+++ b/LayoutTests/fast/forms/extrazoom/delete-content-in-text-field.html >@@ -0,0 +1,60 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<meta name="viewport" content="width=device-width"> >+<head> >+<script src="../../../resources/js-test.js"></script> >+<script src="../../../resources/ui-helper.js"></script> >+<script> >+doneCount = 0; >+lastInputEvent = null; >+jsTestIsAsync = true; >+ >+function enterTextAndWaitForKeyboardToHide(text) { >+ return new Promise(async resolve => { >+ await UIHelper.activateAndWaitForInputSessionAt(100, 100); >+ UIHelper.waitForKeyboardToHide().then(resolve); >+ UIHelper.enterText(text); >+ }); >+} >+ >+async function runTest() { >+ if (!window.testRunner) { >+ description(`This test requires WebKitTestRunner.`); >+ return; >+ } >+ >+ await enterTextAndWaitForKeyboardToHide("testing"); >+ inputEventAfterInsertingText = lastInputEvent; >+ valueAfterInsertingText = field.value; >+ >+ await enterTextAndWaitForKeyboardToHide(""); >+ inputEventAfterDeletingText = lastInputEvent; >+ valueAfterDeletingText = field.value; >+ >+ shouldBe("inputEventAfterInsertingText.type", "'input'"); >+ shouldBe("inputEventAfterInsertingText.inputType", "'insertText'"); >+ shouldBe("inputEventAfterInsertingText.data", "'testing'"); >+ shouldBe("valueAfterInsertingText", "'testing'"); >+ >+ shouldBe("inputEventAfterDeletingText.type", "'input'"); >+ shouldBe("inputEventAfterDeletingText.inputType", "'deleteContent'"); >+ shouldBe("inputEventAfterDeletingText.data", "null"); >+ shouldBe("valueAfterDeletingText", "''"); >+ >+ checkDone(); >+} >+ >+function handleInput(event) { >+ lastInputEvent = event; >+} >+ >+function checkDone() { >+ if (++doneCount === 3) >+ finishJSTest(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<input id="field" style="width: 320px; height: 568px;" oninput="handleInput(event)" onblur="checkDone()"></input> >+</body> >+</html>
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 185769
:
340708
|
340711