Non-local keyboards don't update scroll view parameters
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Apr 2015 19:18:00 +0000 (19:18 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Apr 2015 19:18:00 +0000 (19:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143791
<rdar://problem/18974020>

Reviewed by Enrica Casucci.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _shouldUpdateKeyboardWithInfo:]):
(-[WKWebView _keyboardWillChangeFrame:]):
(-[WKWebView _keyboardWillShow:]):
Make sure that we update scroll view parameters (obscured insets, etc.)
if we have a non-local keyboard, in addition to the cases where we have an assisted node.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182851 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

index 14654e9..e569f30 100644 (file)
@@ -1,3 +1,18 @@
+2015-04-15  Tim Horton  <timothy_horton@apple.com>
+
+        Non-local keyboards don't update scroll view parameters
+        https://bugs.webkit.org/show_bug.cgi?id=143791
+        <rdar://problem/18974020>
+
+        Reviewed by Enrica Casucci.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _shouldUpdateKeyboardWithInfo:]):
+        (-[WKWebView _keyboardWillChangeFrame:]):
+        (-[WKWebView _keyboardWillShow:]):
+        Make sure that we update scroll view parameters (obscured insets, etc.)
+        if we have a non-local keyboard, in addition to the cases where we have an assisted node.
+
 2015-04-15  Dan Bernstein  <mitz@apple.com>
 
         <rdar://problem/20549298> No matching __NSi_ definition for postprocessed value of WK_{MAC,IOS}_TBA
index 450365b..3bce00b 100644 (file)
@@ -1548,9 +1548,18 @@ static WebCore::FloatPoint constrainContentOffset(WebCore::FloatPoint contentOff
         [_scrollView _adjustForAutomaticKeyboardInfo:keyboardInfo animated:YES lastAdjustment:&_lastAdjustmentForScroller];
 }
 
-- (void)_keyboardWillChangeFrame:(NSNotification *)notification
+- (BOOL)_shouldUpdateKeyboardWithInfo:(NSDictionary *)keyboardInfo
 {
     if ([_contentView isAssistingNode])
+        return YES;
+
+    NSNumber *isLocalKeyboard = [keyboardInfo valueForKey:UIKeyboardIsLocalUserInfoKey];
+    return isLocalKeyboard && !isLocalKeyboard.boolValue;
+}
+
+- (void)_keyboardWillChangeFrame:(NSNotification *)notification
+{
+    if ([self _shouldUpdateKeyboardWithInfo:notification.userInfo])
         [self _keyboardChangedWithInfo:notification.userInfo adjustScrollView:YES];
 }
 
@@ -1561,7 +1570,7 @@ static WebCore::FloatPoint constrainContentOffset(WebCore::FloatPoint contentOff
 
 - (void)_keyboardWillShow:(NSNotification *)notification
 {
-    if ([_contentView isAssistingNode])
+    if ([self _shouldUpdateKeyboardWithInfo:notification.userInfo])
         [self _keyboardChangedWithInfo:notification.userInfo adjustScrollView:YES];
 }