From bed911a44a3df311c3af7d8cb821544609bced9a Mon Sep 17 00:00:00 2001 From: Leon Scroggins <> Date: Tue, 31 Mar 2009 14:29:35 -0700 Subject: [PATCH] AI 143733: Fix for issue 1648553: IME overlaps over focus ring in gmail search box. In WebView::requestChildRectangleOnScreen we now move a rectangle up if its bottom is offscreen, even if its top is not. We also move it so that its top is at the top third of the WebView's height (if it still fits on screen) so that you can see space (and potentially other input fields) below it. BUG=1648553 Automated import of CL 143733 --- core/java/android/webkit/WebView.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 052c2d3835d30..17ab8c92365d4 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -4405,14 +4405,19 @@ public class WebView extends AbsoluteLayout int scrollYDelta = 0; - if (rect.bottom > screenBottom && rect.top > screenTop) { - if (rect.height() > height) { - scrollYDelta += (rect.top - screenTop); + if (rect.bottom > screenBottom) { + int oneThirdOfScreenHeight = height / 3; + if (rect.height() > 2 * oneThirdOfScreenHeight) { + // If the rectangle is too tall to fit in the bottom two thirds + // of the screen, place it at the top. + scrollYDelta = rect.top - screenTop; } else { - scrollYDelta += (rect.bottom - screenBottom); + // If the rectangle will still fit on screen, we want its + // top to be in the top third of the screen. + scrollYDelta = rect.top - (screenTop + oneThirdOfScreenHeight); } } else if (rect.top < screenTop) { - scrollYDelta -= (screenTop - rect.top); + scrollYDelta = rect.top - screenTop; } int width = getWidth() - getVerticalScrollbarWidth();