Title: [114288] trunk/Source/WebKit/blackberry
Revision
114288
Author
[email protected]
Date
2012-04-16 13:00:42 -0700 (Mon, 16 Apr 2012)

Log Message

2012-04-16  Antonio Gomes  <[email protected]>

        Screen shift down when VKB shows by clicking in a input box MKS_3601371
        PR #149846

        Reviewed by Rob Buis.

        After switching from ScrollView::canOverscroll to ScrollView::constrainsScrollingToContentEdge
        we had a less restricted code path allowing/disallowing overscrolling. That caused
        some webpages like google.com to get on overscroll when adjusting the scroll
        position to ensure the focused input field is visible.

        Patch restricts the way we allow overscrolling to the bottom, where the virtual
        keyboard pops up from, clamping it to 0, 0 if it tries to
        overscroll upwards, and to maximum scroll position if it overscrolls
        downwards.

        Internally reviewed by Mike Fenton.
        PR #149846

        * WebKitSupport/InputHandler.cpp:
        (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (114287 => 114288)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-04-16 19:34:24 UTC (rev 114287)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-04-16 20:00:42 UTC (rev 114288)
@@ -1,3 +1,26 @@
+2012-04-16  Antonio Gomes  <[email protected]>
+
+        Screen shift down when VKB shows by clicking in a input box MKS_3601371
+        https://bugs.webkit.org/show_bug.cgi?id=84057
+
+        Reviewed by Rob Buis.
+
+        After switching from ScrollView::canOverscroll to ScrollView::constrainsScrollingToContentEdge
+        we had a less restricted code path allowing/disallowing overscrolling. That caused
+        some webpages like google.com to get on overscroll when adjusting the scroll
+        position to ensure the focused input field is visible.
+
+        Patch restricts the way we allow overscrolling to the bottom, where the virtual
+        keyboard pops up from, clamping it to 0, 0 if it tries to
+        overscroll upwards, and to maximum scroll position if it overscrolls
+        downwards.
+
+        PR #149846
+        Internally reviewed by Mike Fenton.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible):
+
 2012-04-16  Yongxin Dai  <[email protected]>
 
         [BlackBerry] Increase padding for text element

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (114287 => 114288)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-04-16 19:34:24 UTC (rev 114287)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2012-04-16 20:00:42 UTC (rev 114288)
@@ -634,7 +634,16 @@
                                                                  horizontalScrollAlignment,
                                                                  verticalScrollAlignment);
 
-            mainFrameView->setScrollPosition(revealRect.location());
+            mainFrameView->setConstrainsScrollingToContentEdge(false);
+            // In order to adjust the scroll position to ensure the focused input field is visible,
+            // we allow overscrolling. However this overscroll has to be strictly allowed towards the
+            // bottom of the page on the y axis only, where the virtual keyboard pops up from.
+            WebCore::IntPoint scrollLocation = revealRect.location();
+            scrollLocation.clampNegativeToZero();
+            WebCore::IntPoint maximumScrollPosition = WebCore::IntPoint(mainFrameView->contentsWidth() - actualScreenRect.width(), mainFrameView->contentsHeight() - actualScreenRect.height());
+            scrollLocation = scrollLocation.shrunkTo(maximumScrollPosition);
+            mainFrameView->setScrollPosition(scrollLocation);
+            mainFrameView->setConstrainsScrollingToContentEdge(true);
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to