summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/webkit/WebView.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 740c39e003ad..12eb93498091 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -420,7 +420,6 @@ public class WebView extends AbsoluteLayout
private static final int STD_SPEED = 480; // pixels per second
// time for the longest scroll animation
private static final int MAX_DURATION = 750; // milliseconds
- private static final int SLIDE_TITLE_DURATION = 300; // milliseconds
private Scroller mScroller;
private boolean mWrapContent;
@@ -2418,18 +2417,17 @@ public class WebView extends AbsoluteLayout
if ((dx | dy) == 0) {
return false;
}
+ // By this point we have added in the title bar's height. If the site
+ // is trying to scroll to the top of the page, scroll it to the top
+ // of the WebView including showing the title bar.
// mobile sites prefer to scroll to (0, 1), thus the + 1 below
- boolean slideTitle = getVisibleTitleHeight() > 0
- && y <= getTitleHeight() + 1;
- if (DebugFlags.WEB_VIEW) {
- Log.v(LOGTAG, "pinScrollTo slideTitle=" + slideTitle
- + " getVisibleTitleHeight()=" + getVisibleTitleHeight()
- + " animationDuration=" + animationDuration + " y=" + y);
+ if (getVisibleTitleHeight() > 0 && x == 0
+ && y <= getTitleHeight() + 1) {
+ y = 0;
+ animate = false;
}
- if (slideTitle || animate) {
+ if (animate) {
// Log.d(LOGTAG, "startScroll: " + dx + " " + dy);
- if (slideTitle && animationDuration < SLIDE_TITLE_DURATION)
- animationDuration = SLIDE_TITLE_DURATION;
mScroller.startScroll(mScrollX, mScrollY, dx, dy,
animationDuration > 0 ? animationDuration : computeDuration(dx, dy));
invalidate();
@@ -4809,8 +4807,14 @@ public class WebView extends AbsoluteLayout
mMaxZoomScale = restoreState.mMaxScale;
}
setNewZoomScale(mLastScale, false);
- if (getVisibleTitleHeight() == 0
- || restoreState.mScrollY != 0) {
+ if (getTitleHeight() != 0 && restoreState.mScrollX == 0
+ && restoreState.mScrollY == 0) {
+ // If there is a title bar, and the page is being
+ // restored to (0,0), do not scroll the title bar
+ // off the page.
+ abortAnimation();
+ scrollTo(0,0);
+ } else {
setContentScrollTo(restoreState.mScrollX,
restoreState.mScrollY);
}