Title: [165095] trunk/Source/WebKit2
Revision
165095
Author
[email protected]
Date
2014-03-04 21:37:40 -0800 (Tue, 04 Mar 2014)

Log Message

[iOS][WK2] Account for the keyboard when computing the unobscuredRect
https://bugs.webkit.org/show_bug.cgi?id=129660

Patch by Benjamin Poulain <[email protected]> on 2014-03-04
Reviewed by Enrica Casucci.

Adjust the unobscuredRect when a docked keyboard is on screen.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateVisibleContentRectsWithStableState:]):
(-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (165094 => 165095)


--- trunk/Source/WebKit2/ChangeLog	2014-03-05 05:30:25 UTC (rev 165094)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-05 05:37:40 UTC (rev 165095)
@@ -1,3 +1,16 @@
+2014-03-04  Benjamin Poulain  <[email protected]>
+
+        [iOS][WK2] Account for the keyboard when computing the unobscuredRect
+        https://bugs.webkit.org/show_bug.cgi?id=129660
+
+        Reviewed by Enrica Casucci.
+
+        Adjust the unobscuredRect when a docked keyboard is on screen.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _updateVisibleContentRectsWithStableState:]):
+        (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
+
 2014-03-04  Andy Estes  <[email protected]>
 
         [iOS][WebKit2] Exclude plug-in sandbox profiles from the build

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (165094 => 165095)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-03-05 05:30:25 UTC (rev 165094)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2014-03-05 05:37:40 UTC (rev 165095)
@@ -63,6 +63,10 @@
 - (void)_adjustForAutomaticKeyboardInfo:(NSDictionary*)info animated:(BOOL)animated lastAdjustment:(CGFloat*)lastAdjustment;
 @end
 
+@interface UIPeripheralHost(UIKitInternal)
+- (CGFloat)getVerticalOverlapForView:(UIView *)view usingKeyboardInfo:(NSDictionary *)info;
+@end
+
 #endif
 
 #if PLATFORM(MAC)
@@ -88,6 +92,7 @@
     UIEdgeInsets _obscuredInsets;
     bool _isChangingObscuredInsetsInteractively;
     CGFloat _lastAdjustmentForScroller;
+    CGFloat _keyboardVerticalOverlap;
 
     std::unique_ptr<WebKit::ViewGestureController> _gestureController;
     BOOL _allowsBackForwardNavigationGestures;
@@ -537,7 +542,9 @@
     CGRect fullViewRect = self.bounds;
     CGRect visibleRectInContentCoordinates = [self convertRect:fullViewRect toView:_contentView.get()];
 
-    CGRect unobscuredRect = UIEdgeInsetsInsetRect(fullViewRect, _obscuredInsets);
+    UIEdgeInsets obscuredInsets = _obscuredInsets;
+    obscuredInsets.bottom = std::max(_obscuredInsets.bottom, _keyboardVerticalOverlap);
+    CGRect unobscuredRect = UIEdgeInsetsInsetRect(fullViewRect, obscuredInsets);
     CGRect unobscuredRectInContentCoordinates = [self convertRect:unobscuredRect toView:_contentView.get()];
 
     CGFloat scaleFactor = [_scrollView zoomScale];
@@ -548,7 +555,9 @@
 
 - (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
 {
-    // FIXME: We will also need to adjust the unobscured rect by taking into account the keyboard rect and the obscured insets.
+    _keyboardVerticalOverlap = [[UIPeripheralHost sharedInstance] getVerticalOverlapForView:self usingKeyboardInfo:keyboardInfo];
+    [self _updateVisibleContentRectsWithStableState:YES];
+
     if (adjustScrollView)
         [_scrollView _adjustForAutomaticKeyboardInfo:keyboardInfo animated:YES lastAdjustment:&_lastAdjustmentForScroller];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to