<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[244220] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/244220">244220</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2019-04-12 10:30:00 -0700 (Fri, 12 Apr 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Software keyboard is shown too frequently on some websites
https://bugs.webkit.org/show_bug.cgi?id=195856
<rdar://problem/49191395>

Reviewed by Darin Adler.

Source/WebCore/PAL:

Declare new GraphicsServices SPI.

* pal/spi/ios/GraphicsServicesSPI.h:

Source/WebKit:

On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
when the element is focused.

However, since we disabled support for inputmode="none" in <a href="http://trac.webkit.org/projects/webkit/changeset/240497">r240497</a>, the software keyboard is no longer
suppressed, and becomes a big nuissance. <a href="http://trac.webkit.org/projects/webkit/changeset/240497">r240497</a> removed support for this feature because, when using a hardware
keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
hardware keyboard is not attached.

* UIProcess/API/Cocoa/WKWebView.mm:
(hardwareKeyboardAvailabilityChangedCallback):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView shouldShowAutomaticKeyboardUI]):

Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.

(-[WKContentView _hardwareKeyboardAvailabilityChanged]):

Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
element with inputmode="none", we'll show the input accessory view once again.

Tools:

Add support for attaching or detaching the hardware keyboard on iOS in layout tests.

* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setHardwareKeyboardAttached):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setHardwareKeyboardAttached):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig:

Additionally link against GraphicsServices in WebKitTestRunner.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
(WTR::UIScriptController::setHardwareKeyboardAttached):

WebKitLibraries:

Add a symbol for GSEventSetHardwareKeyboardAttached.

* WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd:

LayoutTests:

Fix a failing layout test, which (among other reasons) is currently failing because support for inputmode="none"
is disabled.

* fast/forms/ios/inputmode-none-expected.txt:
* fast/forms/ios/inputmode-none.html:
* resources/ui-helper.js:

Add a UIHelper method for attaching or detaching the hardware keyboard.

(window.UIHelper.setHardwareKeyboardAttached):
(window.UIHelper):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastformsiosinputmodenoneexpectedtxt">trunk/LayoutTests/fast/forms/ios/inputmode-none-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsiosinputmodenonehtml">trunk/LayoutTests/fast/forms/ios/inputmode-none.html</a></li>
<li><a href="#trunkLayoutTestsresourcesuihelperjs">trunk/LayoutTests/resources/ui-helper.js</a></li>
<li><a href="#trunkSourceWebCorePALChangeLog">trunk/Source/WebCore/PAL/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePALpalspiiosGraphicsServicesSPIh">trunk/Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionh">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeiosUIScriptControllerIOSmm">trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl">trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextUIScriptControllercpp">trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextUIScriptControllerh">trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerConfigurationsWebKitTestRunnerAppxcconfig">trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosTestControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
<li><a href="#trunkWebKitLibrariesChangeLog">trunk/WebKitLibraries/ChangeLog</a></li>
<li><a href="#trunkWebKitLibrariesWebKitPrivateFrameworkStubsiOS12GraphicsServicesframeworkGraphicsServicestbd">trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/LayoutTests/ChangeLog 2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Software keyboard is shown too frequently on some websites
+        https://bugs.webkit.org/show_bug.cgi?id=195856
+        <rdar://problem/49191395>
+
+        Reviewed by Darin Adler.
+
+        Fix a failing layout test, which (among other reasons) is currently failing because support for inputmode="none"
+        is disabled.
+
+        * fast/forms/ios/inputmode-none-expected.txt:
+        * fast/forms/ios/inputmode-none.html:
+        * resources/ui-helper.js:
+
+        Add a UIHelper method for attaching or detaching the hardware keyboard.
+
+        (window.UIHelper.setHardwareKeyboardAttached):
+        (window.UIHelper):
+
</ins><span class="cx"> 2019-04-12  Ryan Haddad  <ryanhaddad@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [macOS WK1] ASSERTION FAILED: formData in WebCore::ResourceRequest::doUpdateResourceHTTPBody()
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsiosinputmodenoneexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/ios/inputmode-none-expected.txt (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/inputmode-none-expected.txt     2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/LayoutTests/fast/forms/ios/inputmode-none-expected.txt        2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -1,27 +1,27 @@
</span><ins>+
+
</ins><span class="cx"> This test verifies that the system keyboard is not visible when tapping on an input field with inputmode=none.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> ACTIVATE input with inputmode=text
</span><del>-PASS textKeyboardHeight = systemKeyboardRect.height; systemKeyboardRect.height > 0 is true
-PASS inputWithSystemKeyboard.value is "Text"
</del><ins>+PASS systemKeyboardRect.height > 0 is true
+PASS inputWithSystemKeyboard.value is 'Text'
</ins><span class="cx"> 
</span><span class="cx"> ACTIVATE input with inputmode=none
</span><del>-PASS systemKeyboardRect.height is textKeyboardHeight
</del><ins>+PASS Successfully dismissed keyboard
</ins><span class="cx"> 
</span><span class="cx"> TEST enter text in input with inputmode=none
</span><del>-PASS inputWithoutSystemKeyboard.value is "None"
</del><ins>+PASS inputWithoutSystemKeyboard.value is 'None'
</ins><span class="cx"> 
</span><span class="cx"> TEST selection in input with inputmode=none
</span><span class="cx"> PASS selectionRects.length is 1
</span><del>-PASS selectionRects[0].left is 159
-PASS selectionRects[0].top is 261
-PASS selectionRects[0].width is 28
</del><ins>+PASS selectionRects[0].left is 16
+PASS selectionRects[0].top is 38
+PASS selectionRects[0].width is 27
</ins><span class="cx"> PASS selectionRects[0].height is 15
</span><del>-
</del><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span><del>- 
</del><ins>+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosinputmodenonehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/forms/ios/inputmode-none.html (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/inputmode-none.html     2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/LayoutTests/fast/forms/ios/inputmode-none.html        2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -1,48 +1,53 @@
</span><del>-<!DOCTYPE html>
</del><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
</ins><span class="cx"> <html>
</span><span class="cx"> <head>
</span><del>-<meta name="viewport" content="width=device-width, initial-scale=1">
</del><ins>+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</ins><span class="cx"> <script src="../../../resources/js-test.js"></script>
</span><span class="cx"> <script src="../../../resources/ui-helper.js"></script>
</span><span class="cx"> </head>
</span><span class="cx"> <body onload="runTest()">
</span><del>-<input id="input-keyboard" inputmode="text">
-<input id="input-nokeyboard" inputmode="none">
</del><ins>+<div><input id="input-keyboard" inputmode="text"></div>
+<div><input id="input-nokeyboard" inputmode="none"></div>
+<pre id="description"></pre>
+<pre id="console"></pre>
</ins><span class="cx"> <script>
</span><span class="cx"> jsTestIsAsync = true;
</span><span class="cx"> 
</span><span class="cx"> async function runTest() {
</span><ins>+    await UIHelper.setHardwareKeyboardAttached(false);
</ins><span class="cx">     inputWithSystemKeyboard = document.getElementById("input-keyboard");
</span><span class="cx">     inputWithoutSystemKeyboard = document.getElementById("input-nokeyboard");
</span><span class="cx"> 
</span><del>-    description('This test verifies that the system keyboard is not visible when tapping on an input field with inputmode=none.');
</del><ins>+    description("This test verifies that the system keyboard is not visible when tapping on an input field with inputmode=none.");
</ins><span class="cx"> 
</span><del>-    debug('\nACTIVATE input with inputmode=text');
-    await UIHelper.activateFormControl(inputWithSystemKeyboard);
</del><ins>+    debug("\nACTIVATE input with inputmode=text");
+    await UIHelper.activateElementAndWaitForInputSession(inputWithSystemKeyboard);
</ins><span class="cx">     systemKeyboardRect = await UIHelper.inputViewBounds();
</span><del>-    shouldBe('textKeyboardHeight = systemKeyboardRect.height; systemKeyboardRect.height > 0', 'true');
</del><ins>+    shouldBe("systemKeyboardRect.height > 0", "true");
</ins><span class="cx">     await UIHelper.enterText("Text");
</span><del>-    shouldBe('inputWithSystemKeyboard.value', '"Text"');
</del><ins>+    shouldBe("inputWithSystemKeyboard.value", "'Text'");
</ins><span class="cx"> 
</span><del>-    debug('\nACTIVATE input with inputmode=none');
-    await UIHelper.activateFormControl(inputWithoutSystemKeyboard);
-    systemKeyboardRect = await UIHelper.inputViewBounds();
-    shouldBe('systemKeyboardRect.height', 'textKeyboardHeight');
</del><ins>+    debug("\nACTIVATE input with inputmode=none");
+    await UIHelper.activateElement(inputWithoutSystemKeyboard);
+    await UIHelper.waitForKeyboardToHide();
+    testPassed("Successfully dismissed keyboard");
</ins><span class="cx"> 
</span><del>-    debug('\nTEST enter text in input with inputmode=none');
</del><ins>+    debug("\nTEST enter text in input with inputmode=none");
</ins><span class="cx">     await UIHelper.enterText("None");
</span><del>-    shouldBe('inputWithoutSystemKeyboard.value', '"None"');
</del><ins>+    shouldBe("inputWithoutSystemKeyboard.value", "'None'");
</ins><span class="cx"> 
</span><del>-    debug('\nTEST selection in input with inputmode=none');
-    inputWithoutSystemKeyboard.setSelectionRange(0, inputWithSystemKeyboard.value.length);
-    selectionRects = await UIHelper.getUISelectionRects();
-    shouldBe('selectionRects.length', '1');
-    shouldBe('selectionRects[0].left', '159');
-    shouldBe('selectionRects[0].top', '261');
-    shouldBe('selectionRects[0].width', '28');
-    shouldBe('selectionRects[0].height', '15');
</del><ins>+    debug("\nTEST selection in input with inputmode=none");
+    inputWithoutSystemKeyboard.select();
</ins><span class="cx"> 
</span><del>-    debug('');
</del><ins>+    selectionRects = [];
+    while (!selectionRects.length)
+        selectionRects = await UIHelper.getUISelectionViewRects();
+
+    shouldBe("selectionRects.length", "1");
+    shouldBe("selectionRects[0].left", "16");
+    shouldBe("selectionRects[0].top", "38");
+    shouldBe("selectionRects[0].width", "27");
+    shouldBe("selectionRects[0].height", "15");
</ins><span class="cx">     finishJSTest();
</span><span class="cx"> }
</span><span class="cx"> </script>
</span></span></pre></div>
<a id="trunkLayoutTestsresourcesuihelperjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/ui-helper.js (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/ui-helper.js 2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/LayoutTests/resources/ui-helper.js    2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -833,4 +833,9 @@
</span><span class="cx">             testRunner.runUIScript("JSON.stringify(uiController.menuRect)", result => resolve(JSON.parse(result)));
</span><span class="cx">         });
</span><span class="cx">     }
</span><ins>+
+    static setHardwareKeyboardAttached(attached)
+    {
+        return new Promise(resolve => testRunner.runUIScript(`uiController.setHardwareKeyboardAttached(${attached ? "true" : "false"})`, resolve));
+    }
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorePALChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PAL/ChangeLog (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PAL/ChangeLog       2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Source/WebCore/PAL/ChangeLog  2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Software keyboard is shown too frequently on some websites
+        https://bugs.webkit.org/show_bug.cgi?id=195856
+        <rdar://problem/49191395>
+
+        Reviewed by Darin Adler.
+
+        Declare new GraphicsServices SPI.
+
+        * pal/spi/ios/GraphicsServicesSPI.h:
+
</ins><span class="cx"> 2019-04-10  Antoine Quint  <graouts@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Enable Pointer Events on watchOS
</span></span></pre></div>
<a id="trunkSourceWebCorePALpalspiiosGraphicsServicesSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h       2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h  2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> typedef struct __GSKeyboard* GSKeyboardRef;
</span><span class="cx"> uint32_t GSKeyboardGetModifierState(GSKeyboardRef);
</span><span class="cx"> Boolean GSEventIsHardwareKeyboardAttached();
</span><ins>+void GSEventSetHardwareKeyboardAttached(Boolean attached, uint8_t country);
</ins><span class="cx"> 
</span><span class="cx"> extern const char *kGSEventHardwareKeyboardAvailabilityChangedNotification;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Source/WebKit/ChangeLog       2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Software keyboard is shown too frequently on some websites
+        https://bugs.webkit.org/show_bug.cgi?id=195856
+        <rdar://problem/49191395>
+
+        Reviewed by Darin Adler.
+
+        On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
+        causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
+        inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
+        when the element is focused.
+
+        However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
+        suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
+        keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
+        none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
+        and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
+        this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
+        hardware keyboard is not attached.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (hardwareKeyboardAvailabilityChangedCallback):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView shouldShowAutomaticKeyboardUI]):
+
+        Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
+
+        (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
+
+        Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
+        element with inputmode="none", we'll show the input accessory view once again.
+
</ins><span class="cx"> 2019-04-12  Antoine Quint  <graouts@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm     2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm        2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -3335,6 +3335,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(observer);
</span><span class="cx">     WKWebView *webView = (__bridge WKWebView *)observer;
</span><ins>+    [webView->_contentView _hardwareKeyboardAvailabilityChanged];
</ins><span class="cx">     webView._page->hardwareKeyboardAvailabilityChanged(GSEventIsHardwareKeyboardAttached());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h     2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h        2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -415,6 +415,7 @@
</span><span class="cx"> - (void)_elementDidBlur;
</span><span class="cx"> - (void)_didUpdateInputMode:(WebCore::InputMode)mode;
</span><span class="cx"> - (void)_didReceiveEditorStateUpdateAfterFocus;
</span><ins>+- (void)_hardwareKeyboardAvailabilityChanged;
</ins><span class="cx"> - (void)_selectionChanged;
</span><span class="cx"> - (void)_updateChangedSelection;
</span><span class="cx"> - (BOOL)_interpretKeyEvent:(::WebEvent *)theEvent isCharEvent:(BOOL)isCharEvent;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -100,6 +100,7 @@
</span><span class="cx"> #import <pal/spi/cg/CoreGraphicsSPI.h>
</span><span class="cx"> #import <pal/spi/cocoa/DataDetectorsCoreSPI.h>
</span><span class="cx"> #import <pal/spi/ios/DataDetectorsUISPI.h>
</span><ins>+#import <pal/spi/ios/GraphicsServicesSPI.h>
</ins><span class="cx"> #import <wtf/Optional.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</span><span class="cx"> #import <wtf/SetForScope.h>
</span><span class="lines">@@ -118,7 +119,6 @@
</span><span class="cx"> #import "NativeWebMouseEvent.h"
</span><span class="cx"> #import <UIKit/UIHoverGestureRecognizer.h>
</span><span class="cx"> #import <UIKit/_UILookupGestureRecognizer.h>
</span><del>-#import <pal/spi/ios/GraphicsServicesSPI.h>
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INPUT_TYPE_COLOR)
</span><span class="lines">@@ -1595,7 +1595,12 @@
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)shouldShowAutomaticKeyboardUI
</span><span class="cx"> {
</span><del>-    // FIXME: Make this function knowledgeable about the HTML attribute inputmode.
</del><ins>+    // FIXME: We should support inputmode="none" when the hardware keyboard is attached.
+    // We currently refrain from doing so because that would prevent UIKit from showing
+    // the language picker when pressing the globe key to change the input language.
+    if (_focusedElementInformation.inputMode == WebCore::InputMode::None && !GSEventIsHardwareKeyboardAttached())
+        return NO;
+
</ins><span class="cx">     switch (_focusedElementInformation.elementType) {
</span><span class="cx">     case WebKit::InputType::None:
</span><span class="cx">     case WebKit::InputType::Drawing:
</span><span class="lines">@@ -5133,6 +5138,12 @@
</span><span class="cx">         _didAccessoryTabInitiateFocus = NO;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_hardwareKeyboardAvailabilityChanged
+{
+    if (hasFocusedElement(_focusedElementInformation) && _focusedElementInformation.inputMode == WebCore::InputMode::None)
+        [self reloadInputViews];
+}
+
</ins><span class="cx"> - (void)_didUpdateInputMode:(WebCore::InputMode)mode
</span><span class="cx"> {
</span><span class="cx">     if (!self.inputDelegate || _focusedElementInformation.elementType == WebKit::InputType::None)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/ChangeLog       2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Software keyboard is shown too frequently on some websites
+        https://bugs.webkit.org/show_bug.cgi?id=195856
+        <rdar://problem/49191395>
+
+        Reviewed by Darin Adler.
+
+        Add support for attaching or detaching the hardware keyboard on iOS in layout tests.
+
+        * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::setHardwareKeyboardAttached):
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::setHardwareKeyboardAttached):
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig:
+
+        Additionally link against GraphicsServices in WebKitTestRunner.
+
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::TestController::platformResetStateToConsistentValues):
+        (WTR::UIScriptController::setHardwareKeyboardAttached):
+
</ins><span class="cx"> 2019-04-12  Ludovico de Nittis  <ludovico.denittis@collabora.com>
</span><span class="cx"> 
</span><span class="cx">         [GTK][WPE] Fix pacman install-dependencies packages
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeiosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm  2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm     2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -535,6 +535,10 @@
</span><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::setHardwareKeyboardAttached(bool)
+{
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS_FAMILY)
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl     2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl        2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -311,6 +311,8 @@
</span><span class="cx">     void makeWindowContentViewFirstResponder();
</span><span class="cx">     readonly attribute boolean isWindowContentViewFirstResponder;
</span><span class="cx"> 
</span><ins>+    void setHardwareKeyboardAttached(boolean attached);
+
</ins><span class="cx">     object attachmentInfo(DOMString attachmentIdentifier);
</span><span class="cx"> 
</span><span class="cx">     // Editing
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextUIScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp      2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -638,6 +638,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::setHardwareKeyboardAttached(bool)
+{
+}
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextUIScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h        2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h   2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -240,6 +240,8 @@
</span><span class="cx"> 
</span><span class="cx">     JSObjectRef attachmentInfo(JSStringRef attachmentIdentifier);
</span><span class="cx"> 
</span><ins>+    void setHardwareKeyboardAttached(bool);
+
</ins><span class="cx"> private:
</span><span class="cx">     UIScriptController(UIScriptContext&);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerConfigurationsWebKitTestRunnerAppxcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig 2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/WebKitTestRunner/Configurations/WebKitTestRunnerApp.xcconfig    2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> GCC_ENABLE_OBJC_EXCEPTIONS = YES;
</span><span class="cx"> 
</span><del>-OTHER_LDFLAGS = $(inherited) -lWebKitTestRunner -lWebCoreTestSupport -framework JavaScriptCore -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation;
</del><ins>+OTHER_LDFLAGS = $(inherited) -lWebKitTestRunner -lWebCoreTestSupport -framework JavaScriptCore -framework CoreGraphics -framework QuartzCore -framework ImageIO -framework IOKit -framework UIKit -framework WebKit -framework Foundation -framework GraphicsServices;
</ins><span class="cx"> 
</span><span class="cx"> SKIP_INSTALL[sdk=macosx*] = YES;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosTestControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm    2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm       2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #import <WebKit/WKWebViewConfigurationPrivate.h>
</span><span class="cx"> #import <WebKit/WKWebViewPrivate.h>
</span><span class="cx"> #import <objc/runtime.h>
</span><ins>+#import <pal/spi/ios/GraphicsServicesSPI.h>
</ins><span class="cx"> #import <wtf/MainThread.h>
</span><span class="cx"> 
</span><span class="cx"> static BOOL overrideIsInHardwareKeyboardMode()
</span><span class="lines">@@ -141,6 +142,7 @@
</span><span class="cx"> 
</span><span class="cx">     [[UIApplication sharedApplication] _cancelAllTouches];
</span><span class="cx">     [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait animated:NO];
</span><ins>+    GSEventSetHardwareKeyboardAttached(true, 0);
</ins><span class="cx"> 
</span><span class="cx">     m_inputModeSwizzlers.clear();
</span><span class="cx">     m_overriddenKeyboardInputMode = nil;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm   2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #import <WebCore/FloatRect.h>
</span><span class="cx"> #import <WebKit/WKWebViewPrivate.h>
</span><span class="cx"> #import <WebKit/WebKit.h>
</span><ins>+#import <pal/spi/ios/GraphicsServicesSPI.h>
</ins><span class="cx"> #import <wtf/SoftLinking.h>
</span><span class="cx"> #import <wtf/Vector.h>
</span><span class="cx"> 
</span><span class="lines">@@ -1140,6 +1141,11 @@
</span><span class="cx">     return JSValueToObject(jsContext, [JSValue valueWithObject:calendarTypeString inContext:[JSContext contextWithJSGlobalContextRef:jsContext]].JSValueRef, nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::setHardwareKeyboardAttached(bool attached)
+{
+    GSEventSetHardwareKeyboardAttached(attached, 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS_FAMILY)
</span></span></pre></div>
<a id="trunkWebKitLibrariesChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/ChangeLog (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/ChangeLog  2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/WebKitLibraries/ChangeLog     2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS] Software keyboard is shown too frequently on some websites
+        https://bugs.webkit.org/show_bug.cgi?id=195856
+        <rdar://problem/49191395>
+
+        Reviewed by Darin Adler.
+
+        Add a symbol for GSEventSetHardwareKeyboardAttached.
+
+        * WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd:
+
</ins><span class="cx"> 2019-01-01  Jeff Miller  <jeffm@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Update user-visible copyright strings to include 2019
</span></span></pre></div>
<a id="trunkWebKitLibrariesWebKitPrivateFrameworkStubsiOS12GraphicsServicesframeworkGraphicsServicestbd"></a>
<div class="modfile"><h4>Modified: trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd (244219 => 244220)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd 2019-04-12 17:12:37 UTC (rev 244219)
+++ trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd    2019-04-12 17:30:00 UTC (rev 244220)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx">     symbols:
</span><span class="cx">       - _GSCurrentEventTimestamp
</span><span class="cx">       - _GSEventIsHardwareKeyboardAttached
</span><ins>+      - _GSEventSetHardwareKeyboardAttached
</ins><span class="cx">       - _GSFontInitialize
</span><span class="cx">       - _GSFontPurgeFontCache
</span><span class="cx">       - _GSInitialize
</span></span></pre>
</div>
</div>

</body>
</html>