- Revision
- 242222
- Author
- [email protected]
- Date
- 2019-02-28 13:39:52 -0800 (Thu, 28 Feb 2019)
Log Message
[iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to the UI process.
https://bugs.webkit.org/show_bug.cgi?id=193683
<rdar://problem/47634345>
Reviewed by Brent Fulgham.
When a keyboard is attached/deattached or the application becomes foreground, send a message from
the UI process to the WebContent process, notifying whether a keyboard is attached or not. Also,
cache the value of [UIKeyboard isInHardwareKeyboardMode] in the UI process, since this call seems
to be expensive.
* UIProcess/API/Cocoa/WKWebView.mm:
(hardwareKeyboardAvailabilityChangedCallback):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::setKeyboardIsAttached):
(WebKit::WebProcessProxy::keyboardIsAttached const):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::applicationWillEnterForeground):
(WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformEditorState const):
(WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (242221 => 242222)
--- trunk/Source/WebKit/ChangeLog 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/ChangeLog 2019-02-28 21:39:52 UTC (rev 242222)
@@ -1,3 +1,33 @@
+2019-02-28 Per Arne Vollan <[email protected]>
+
+ [iOS] Move calls to [UIKeyboard isInHardwareKeyboardMode] to the UI process.
+ https://bugs.webkit.org/show_bug.cgi?id=193683
+ <rdar://problem/47634345>
+
+ Reviewed by Brent Fulgham.
+
+ When a keyboard is attached/deattached or the application becomes foreground, send a message from
+ the UI process to the WebContent process, notifying whether a keyboard is attached or not. Also,
+ cache the value of [UIKeyboard isInHardwareKeyboardMode] in the UI process, since this call seems
+ to be expensive.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (hardwareKeyboardAvailabilityChangedCallback):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebProcessProxy.h:
+ (WebKit::WebProcessProxy::setKeyboardIsAttached):
+ (WebKit::WebProcessProxy::keyboardIsAttached const):
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::applicationWillEnterForeground):
+ (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::platformEditorState const):
+ (WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
+
2019-02-28 Carlos Garcia Campos <[email protected]>
[CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (242221 => 242222)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-02-28 21:39:52 UTC (rev 242222)
@@ -3304,7 +3304,9 @@
{
ASSERT(observer);
WKWebView *webView = (__bridge WKWebView *)observer;
- webView._page->hardwareKeyboardAvailabilityChanged();
+ auto keyboardIsAttached = GSEventIsHardwareKeyboardAttached();
+ webView._page->process().setKeyboardIsAttached(keyboardIsAttached);
+ webView._page->hardwareKeyboardAvailabilityChanged(keyboardIsAttached);
}
- (void)_windowDidRotate:(NSNotification *)notification
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (242221 => 242222)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-02-28 21:39:52 UTC (rev 242222)
@@ -685,7 +685,7 @@
void storeSelectionForAccessibility(bool);
void startAutoscrollAtPosition(const WebCore::FloatPoint& positionInWindow);
void cancelAutoscroll();
- void hardwareKeyboardAvailabilityChanged();
+ void hardwareKeyboardAvailabilityChanged(bool keyboardIsAttached);
bool isScrollingOrZooming() const { return m_isScrollingOrZooming; }
void requestEvasionRectsAboveSelection(CompletionHandler<void(const Vector<WebCore::FloatRect>&)>&&);
#if ENABLE(DATA_INTERACTION)
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (242221 => 242222)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2019-02-28 21:39:52 UTC (rev 242222)
@@ -269,6 +269,11 @@
void sendProcessDidResume() override;
void didSetAssertionState(AssertionState) override;
+#if PLATFORM(IOS_FAMILY)
+ void setKeyboardIsAttached(bool keyboardIsAttached) { m_keyboardIsAttached = keyboardIsAttached; }
+ bool keyboardIsAttached() const { return m_keyboardIsAttached; }
+#endif
+
#if PLATFORM(COCOA)
enum SandboxExtensionType : uint32_t {
None = 0,
@@ -458,6 +463,10 @@
ProcessThrottler::BackgroundActivityToken m_backgroundActivityTokenForFullscreenFormControls;
#endif
+#if PLATFORM(IOS_FAMILY)
+ bool m_keyboardIsAttached { false };
+#endif
+
#if PLATFORM(COCOA)
MediaCaptureSandboxExtensions m_mediaCaptureSandboxExtensions { SandboxExtensionType::None };
#endif
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (242221 => 242222)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-02-28 21:39:52 UTC (rev 242222)
@@ -4849,7 +4849,7 @@
if (_isChangingFocus)
return YES;
- if (UIKeyboard.isInHardwareKeyboardMode)
+ if (_page->process().keyboardIsAttached())
return YES;
#endif
}
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (242221 => 242222)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-02-28 21:39:52 UTC (rev 242222)
@@ -670,6 +670,8 @@
{
bool isSuspendedUnderLock = [UIApp isSuspendedUnderLock];
m_process->send(Messages::WebPage::ApplicationWillEnterForeground(isSuspendedUnderLock), m_pageID);
+ m_process->setKeyboardIsAttached([UIKeyboard isInHardwareKeyboardMode]);
+ m_process->send(Messages::WebPage::HardwareKeyboardAvailabilityChanged(m_process->keyboardIsAttached()), m_pageID);
}
void WebPageProxy::applicationWillResignActive()
@@ -1107,10 +1109,10 @@
m_validationBubble->show();
}
-void WebPageProxy::hardwareKeyboardAvailabilityChanged()
+void WebPageProxy::hardwareKeyboardAvailabilityChanged(bool keyboardIsAttached)
{
updateCurrentModifierState();
- m_process->send(Messages::WebPage::HardwareKeyboardAvailabilityChanged(), m_pageID);
+ m_process->send(Messages::WebPage::HardwareKeyboardAvailabilityChanged(keyboardIsAttached), m_pageID);
}
void WebPageProxy::requestEvasionRectsAboveSelection(CompletionHandler<void(const Vector<WebCore::FloatRect>&)>&& callback)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242221 => 242222)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-02-28 21:39:52 UTC (rev 242222)
@@ -937,7 +937,7 @@
bool platformPrefersTextLegibilityBasedZoomScaling() const;
const WebCore::ViewportConfiguration& viewportConfiguration() const { return m_viewportConfiguration; }
- void hardwareKeyboardAvailabilityChanged();
+ void hardwareKeyboardAvailabilityChanged(bool keyboardIsAttached);
void updateStringForFind(const String&);
#endif
@@ -1843,6 +1843,9 @@
OptionSet<LayerTreeFreezeReason> m_LayerTreeFreezeReasons;
bool m_isSuspended { false };
bool m_needsFontAttributes { false };
+#if PLATFORM(IOS_FAMILY)
+ bool m_keyboardIsAttached { false };
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (242221 => 242222)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-02-28 21:39:52 UTC (rev 242222)
@@ -108,7 +108,7 @@
StartAutoscrollAtPosition(WebCore::FloatPoint positionInWindow)
CancelAutoscroll()
RequestFocusedElementInformation(WebKit::CallbackID callbackID)
- HardwareKeyboardAvailabilityChanged()
+ HardwareKeyboardAvailabilityChanged(bool keyboardIsAttached)
#endif
SetControlledByAutomation(bool controlled)
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (242221 => 242222)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-02-28 21:27:58 UTC (rev 242221)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-02-28 21:39:52 UTC (rev 242222)
@@ -203,7 +203,7 @@
bool needsLayout = !frame.view() || frame.view()->needsLayout();
bool requiresPostLayoutData = frame.editor().hasComposition();
#if !PLATFORM(IOSMAC)
- requiresPostLayoutData |= [UIKeyboard isInHardwareKeyboardMode];
+ requiresPostLayoutData |= m_keyboardIsAttached;
#endif
if (shouldIncludePostLayoutData == IncludePostLayoutDataHint::No && needsLayout && !requiresPostLayoutData) {
result.isMissingPostLayoutData = true;
@@ -3234,8 +3234,10 @@
return String();
}
-void WebPage::hardwareKeyboardAvailabilityChanged()
+void WebPage::hardwareKeyboardAvailabilityChanged(bool keyboardIsAttached)
{
+ m_keyboardIsAttached = keyboardIsAttached;
+
if (auto* focusedFrame = m_page->focusController().focusedFrame())
focusedFrame->eventHandler().capsLockStateMayHaveChanged();
}