<!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>[277265] 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/277265">277265</a></dd>
<dt>Author</dt> <dd>akeerthi@apple.com</dd>
<dt>Date</dt> <dd>2021-05-10 09:26:17 -0700 (Mon, 10 May 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iPadOS] Do not present custom input peripherals when switching back to a tab with a focused element
https://bugs.webkit.org/show_bug.cgi?id=225541
<rdar://problem/77537795>

Reviewed by Wenson Hsieh.

Source/WebKit:

With the introduction of desktop-class browing on iPad, form control
elements began to retain focus even after their input peripheral
(popover, menu, etc.) was dismissed. This behavior matches macOS - when
a <select> element is clicked, a menu is presented, and when a option
is selected, the menu is dismissed but the element retains focus.

Consequently, when a <select> menu is dismissed by choosing an option on
an iPad with a hardware keyboard, the element retains focus. Now, when
switching tabs and coming back to the tab with the focused <select>, an
activity state update is triggered. Upon recognizing that there is a
focused element, an ElementDidFocus message is sent to the UIProcess.

In [WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:],
the focus is given permission to present the input peripheral (menu)
when the hardware keyboard is attached. This is necessary when necessary
when focusing a text input, because the UCB needs to be displayed and
text selection needs to be set up. However, the behavior is undesirable
for elements that present a popover or a menu (select, color inputs, and
date inputs), since the user is unexpectedly shown an input peripheral.
Even worse, the user's scroll position will be changed to ensure the
focused element is visible.

To fix the undesirable behavior, and get closer to the macOS behavior,
custom input peripherals should not be displayed when switching back
to a tab with a focused element.

Test: fast/forms/ios/focus-select-and-switch-tabs.html

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):

Only show the input peripheral if it is not a keyboard view.

Tools:

Updated a UIScriptController hook that simulates attaching a hardware
keyboard to also swizzle [UIKeyboard isInHardwareKeyboardMode].

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformInitialize):
(WTR::TestController::platformResetStateToConsistentValues):

Moved the default swizzling behavior into this method so that it remains
consistent across tests.

Unfortunately, the default swizzling behavior contrasts with the default
value of GSEventSetHardwareKeyboardAttached. However, this is an existing
inconsistency, and should be looked at more carefully in a separate
investigation.

* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::returnYes):
(WTR::returnNo):
(WTR::UIScriptControllerIOS::setHardwareKeyboardAttached):

LayoutTests:

Added a test which simulates a tab switch by removing and re-adding the
webview to the window.

* fast/forms/ios/focus-select-and-switch-tabs-expected.txt: Added.
* fast/forms/ios/focus-select-and-switch-tabs.html: Added.
* resources/ui-helper.js:
(window.UIHelper.becomeFirstResponder):
(window.UIHelper.removeViewFromWindow):
(window.UIHelper.addViewToWindow):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsresourcesuihelperjs">trunk/LayoutTests/resources/ui-helper.js</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</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="#trunkToolsWebKitTestRunneriosTestControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformsiosfocusselectandswitchtabsexpectedtxt">trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsiosfocusselectandswitchtabshtml">trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (277264 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-05-10 16:08:29 UTC (rev 277264)
+++ trunk/LayoutTests/ChangeLog 2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2021-05-10  Aditya Keerthi  <akeerthi@apple.com>
+
+        [iPadOS] Do not present custom input peripherals when switching back to a tab with a focused element
+        https://bugs.webkit.org/show_bug.cgi?id=225541
+        <rdar://problem/77537795>
+
+        Reviewed by Wenson Hsieh.
+
+        Added a test which simulates a tab switch by removing and re-adding the
+        webview to the window.
+
+        * fast/forms/ios/focus-select-and-switch-tabs-expected.txt: Added.
+        * fast/forms/ios/focus-select-and-switch-tabs.html: Added.
+        * resources/ui-helper.js:
+        (window.UIHelper.becomeFirstResponder):
+        (window.UIHelper.removeViewFromWindow):
+        (window.UIHelper.addViewToWindow):
+
</ins><span class="cx"> 2021-05-10  Philippe Normand  <pnormand@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [GStreamer] fast/mediastream/MediaStream-video-element-video-tracks-disabled.html fails
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsiosfocusselectandswitchtabsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs-expected.txt (0 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs-expected.txt                               (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs-expected.txt  2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This test verifies that focusing a select element, choosing an option, and then switching tabs, does not re-open a menu.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS didShowContextMenu is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosfocusselectandswitchtabshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs.html (0 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs.html                               (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/focus-select-and-switch-tabs.html  2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+    <head>
+        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+        <script src="../../../resources/js-test.js"></script>
+        <script src="../../../resources/ui-helper.js"></script>
+    </head>
+<body>
+<select id="select">
+    <option>A</option>
+    <option>B</option>
+    <option>C</option>
+</select>
+</body>
+<script>
+jsTestIsAsync = true;
+
+addEventListener("load", async () => {
+    description("This test verifies that focusing a select element, choosing an option, and then switching tabs, does not re-open a menu.");
+
+    await UIHelper.setHardwareKeyboardAttached(true);
+
+    // Open and close the <select> menu.
+    await UIHelper.activateElement(select);
+    await UIHelper.waitForContextMenuToShow();
+    await UIHelper.selectFormAccessoryPickerRow(1);
+    await UIHelper.waitForContextMenuToHide();
+
+    // Simulate a tab switch, returning to the current tab.
+    await UIHelper.removeViewFromWindow();
+    await UIHelper.addViewToWindow();
+    await UIHelper.becomeFirstResponder();
+
+    // Check if the menu was presented after returning to the tab.
+    await UIHelper.ensurePresentationUpdate();
+    await UIHelper.selectFormAccessoryPickerRow(0);
+    await UIHelper.ensurePresentationUpdate();
+    didShowContextMenu = select.value === "A";
+    shouldBeFalse("didShowContextMenu");
+
+    finishJSTest();
+});
+</script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsresourcesuihelperjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/ui-helper.js (277264 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/ui-helper.js 2021-05-10 16:08:29 UTC (rev 277264)
+++ trunk/LayoutTests/resources/ui-helper.js    2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -1096,6 +1096,30 @@
</span><span class="cx">         return new Promise(resolve => testRunner.runUIScript(`uiController.resignFirstResponder()`, resolve));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static becomeFirstResponder()
+    {
+        if (!this.isWebKit2())
+            return Promise.resolve();
+
+        return new Promise(resolve => testRunner.runUIScript(`uiController.becomeFirstResponder()`, resolve));
+    }
+
+    static removeViewFromWindow()
+    {
+        if (!this.isWebKit2())
+            return Promise.resolve();
+
+        return new Promise(resolve => testRunner.runUIScript(`uiController.removeViewFromWindow()`, resolve));
+    }
+
+    static addViewToWindow()
+    {
+        if (!this.isWebKit2())
+            return Promise.resolve();
+
+        return new Promise(resolve => testRunner.runUIScript(`uiController.addViewToWindow()`, resolve));
+    }
+
</ins><span class="cx">     static minimumZoomScale()
</span><span class="cx">     {
</span><span class="cx">         if (!this.isWebKit2())
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (277264 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-05-10 16:08:29 UTC (rev 277264)
+++ trunk/Source/WebKit/ChangeLog       2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2021-05-10  Aditya Keerthi  <akeerthi@apple.com>
+
+        [iPadOS] Do not present custom input peripherals when switching back to a tab with a focused element
+        https://bugs.webkit.org/show_bug.cgi?id=225541
+        <rdar://problem/77537795>
+
+        Reviewed by Wenson Hsieh.
+
+        With the introduction of desktop-class browing on iPad, form control
+        elements began to retain focus even after their input peripheral
+        (popover, menu, etc.) was dismissed. This behavior matches macOS - when
+        a <select> element is clicked, a menu is presented, and when a option
+        is selected, the menu is dismissed but the element retains focus.
+
+        Consequently, when a <select> menu is dismissed by choosing an option on
+        an iPad with a hardware keyboard, the element retains focus. Now, when
+        switching tabs and coming back to the tab with the focused <select>, an
+        activity state update is triggered. Upon recognizing that there is a
+        focused element, an ElementDidFocus message is sent to the UIProcess.
+
+        In [WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:],
+        the focus is given permission to present the input peripheral (menu)
+        when the hardware keyboard is attached. This is necessary when necessary
+        when focusing a text input, because the UCB needs to be displayed and
+        text selection needs to be set up. However, the behavior is undesirable
+        for elements that present a popover or a menu (select, color inputs, and
+        date inputs), since the user is unexpectedly shown an input peripheral.
+        Even worse, the user's scroll position will be changed to ensure the
+        focused element is visible.
+
+        To fix the undesirable behavior, and get closer to the macOS behavior,
+        custom input peripherals should not be displayed when switching back
+        to a tab with a focused element.
+
+        Test: fast/forms/ios/focus-select-and-switch-tabs.html
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
+
+        Only show the input peripheral if it is not a keyboard view.
+
</ins><span class="cx"> 2021-05-10  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Remove WKBundlePageGroupRef
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (277264 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2021-05-10 16:08:29 UTC (rev 277264)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -6216,7 +6216,7 @@
</span><span class="cx">                 if (_isChangingFocus)
</span><span class="cx">                     return YES;
</span><span class="cx"> 
</span><del>-                if ([UIKeyboard isInHardwareKeyboardMode])
</del><ins>+                if (_isFocusingElementWithKeyboard && [UIKeyboard isInHardwareKeyboardMode])
</ins><span class="cx">                     return YES;
</span><span class="cx"> #endif
</span><span class="cx">             }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (277264 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-05-10 16:08:29 UTC (rev 277264)
+++ trunk/Tools/ChangeLog       2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2021-05-10  Aditya Keerthi  <akeerthi@apple.com>
+
+        [iPadOS] Do not present custom input peripherals when switching back to a tab with a focused element
+        https://bugs.webkit.org/show_bug.cgi?id=225541
+        <rdar://problem/77537795>
+
+        Reviewed by Wenson Hsieh.
+
+        Updated a UIScriptController hook that simulates attaching a hardware
+        keyboard to also swizzle [UIKeyboard isInHardwareKeyboardMode].
+
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformInitialize):
+        (WTR::TestController::platformResetStateToConsistentValues):
+
+        Moved the default swizzling behavior into this method so that it remains
+        consistent across tests.
+
+        Unfortunately, the default swizzling behavior contrasts with the default
+        value of GSEventSetHardwareKeyboardAttached. However, this is an existing
+        inconsistency, and should be looked at more carefully in a separate
+        investigation.
+
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::returnYes):
+        (WTR::returnNo):
+        (WTR::UIScriptControllerIOS::setHardwareKeyboardAttached):
+
</ins><span class="cx"> 2021-05-10  Alex Christensen  <achristensen@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Remove WKBundlePageGroupRef
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosTestControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (277264 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm    2021-05-10 16:08:29 UTC (rev 277264)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm       2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -110,10 +110,6 @@
</span><span class="cx">     CFNotificationCenterAddObserver(center, this, handleKeyboardDidHideNotification, (CFStringRef)UIKeyboardDidHideNotification, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
</span><span class="cx">     CFNotificationCenterAddObserver(center, this, handleMenuWillHideNotification, (CFStringRef)UIMenuControllerWillHideMenuNotification, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
</span><span class="cx">     CFNotificationCenterAddObserver(center, this, handleMenuDidHideNotification, (CFStringRef)UIMenuControllerDidHideMenuNotification, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
</span><del>-
-    // Override the implementation of +[UIKeyboard isInHardwareKeyboardMode] to ensure that test runs are deterministic
-    // regardless of whether a hardware keyboard is attached. We intentionally never restore the original implementation.
-    method_setImplementation(class_getClassMethod([UIKeyboard class], @selector(isInHardwareKeyboardMode)), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TestController::platformDestroy()
</span><span class="lines">@@ -178,6 +174,12 @@
</span><span class="cx"> 
</span><span class="cx">     GSEventSetHardwareKeyboardAttached(true, 0);
</span><span class="cx"> 
</span><ins>+    // Override the implementation of +[UIKeyboard isInHardwareKeyboardMode] to ensure that test runs are deterministic
+    // regardless of whether a hardware keyboard is attached. We intentionally never restore the original implementation.
+    //
+    // FIXME: Investigate whether this can be removed. The swizzled return value is inconsistent with GSEventSetHardwareKeyboardAttached.
+    method_setImplementation(class_getClassMethod([UIKeyboard class], @selector(isInHardwareKeyboardMode)), reinterpret_cast<IMP>(overrideIsInHardwareKeyboardMode));
+
</ins><span class="cx"> #if !HAVE(NONDESTRUCTIVE_IMAGE_PASTE_SUPPORT_QUERY)
</span><span class="cx">     // FIXME: Remove this workaround once -[UIKeyboardImpl delegateSupportsImagePaste] no longer increments the general pasteboard's changeCount.
</span><span class="cx">     if (!m_keyboardDelegateSupportsImagePasteSwizzler)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (277264 => 277265)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2021-05-10 16:08:29 UTC (rev 277264)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm   2021-05-10 16:26:17 UTC (rev 277265)
</span><span class="lines">@@ -58,6 +58,16 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTR {
</span><span class="cx"> 
</span><ins>+static BOOL returnYes()
+{
+    return YES;
+}
+
+static BOOL returnNo()
+{
+    return NO;
+}
+
</ins><span class="cx"> static NSDictionary *toNSDictionary(CGRect rect)
</span><span class="cx"> {
</span><span class="cx">     return @{
</span><span class="lines">@@ -1210,6 +1220,7 @@
</span><span class="cx"> void UIScriptControllerIOS::setHardwareKeyboardAttached(bool attached)
</span><span class="cx"> {
</span><span class="cx">     GSEventSetHardwareKeyboardAttached(attached, 0);
</span><ins>+    method_setImplementation(class_getClassMethod([UIKeyboard class], @selector(isInHardwareKeyboardMode)), reinterpret_cast<IMP>(attached ? returnYes : returnNo));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void UIScriptControllerIOS::setAllowsViewportShrinkToFit(bool allows)
</span></span></pre>
</div>
</div>

</body>
</html>