summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebView.java
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2010-03-10 11:34:26 -0500
committerMike Reed <reed@google.com>2010-03-10 13:11:48 -0500
commit180403ac103e8ee1eeb07c5e3377748ee6a03917 (patch)
tree90c8e23c0f49b3e83deefefa429f163cd7f37e82 /core/java/android/webkit/WebView.java
parent36ad54acef82f80dbf0ecdd8c44f5764df1be119 (diff)
downloadframeworks_base-180403ac103e8ee1eeb07c5e3377748ee6a03917.zip
frameworks_base-180403ac103e8ee1eeb07c5e3377748ee6a03917.tar.gz
frameworks_base-180403ac103e8ee1eeb07c5e3377748ee6a03917.tar.bz2
pin our visible content bounds to the bounds of the doc itself, to account for overscroll
Change-Id: I3c8165338e31da45a70b3f65ba8389a7a50d6e07 http://b/issue?id=2496502
Diffstat (limited to 'core/java/android/webkit/WebView.java')
-rw-r--r--core/java/android/webkit/WebView.java9
1 files changed, 5 insertions, 4 deletions
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 {