From 180403ac103e8ee1eeb07c5e3377748ee6a03917 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Wed, 10 Mar 2010 11:34:26 -0500 Subject: pin our visible content bounds to the bounds of the doc itself, to account for overscroll Change-Id: I3c8165338e31da45a70b3f65ba8389a7a50d6e07 http://b/issue?id=2496502 --- core/java/android/webkit/WebView.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/java/android/webkit/WebView.java') diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 6f6ee1d..6f2d070 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2199,14 +2199,15 @@ public class WebView extends AbsoluteLayout // Sets r to be our visible rectangle in content coordinates private void calcOurContentVisibleRect(Rect r) { calcOurVisibleRect(r); - r.left = viewToContentX(r.left); + // since we might overscroll, pin the rect to the bounds of the content + r.left = Math.max(viewToContentX(r.left), 0); // viewToContentY will remove the total height of the title bar. Add // the visible height back in to account for the fact that if the title // bar is partially visible, the part of the visible rect which is // displaying our content is displaced by that amount. - r.top = viewToContentY(r.top + getVisibleTitleHeight()); - r.right = viewToContentX(r.right); - r.bottom = viewToContentY(r.bottom); + r.top = Math.max(viewToContentY(r.top + getVisibleTitleHeight()), 0); + r.right = Math.min(viewToContentX(r.right), mContentWidth); + r.bottom = Math.min(viewToContentY(r.bottom), mContentHeight); } static class ViewSizeData { -- cgit v1.1