diff options
author | Leon Scroggins <scroggo@google.com> | 2009-09-21 13:27:02 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-09-21 14:18:09 -0400 |
commit | d7b95aa702f9d3f8694b1a066ae7ef44879ffb1a (patch) | |
tree | d3d06099b6b2d75293d5151dd28864e407f0c8b0 /core | |
parent | a13ccc908ee54d6c606b5a73b3a57e4dda13e44a (diff) | |
download | frameworks_base-d7b95aa702f9d3f8694b1a066ae7ef44879ffb1a.zip frameworks_base-d7b95aa702f9d3f8694b1a066ae7ef44879ffb1a.tar.gz frameworks_base-d7b95aa702f9d3f8694b1a066ae7ef44879ffb1a.tar.bz2 |
Always interpret (0,0) scrolls as top of title bar.
Move the specialized code in NEW_PICTURE_MSG_ID to
setContentScrollTo so that a scroll to (0,0), whether
a result of a NEW_PICTURE_MSG_ID or from an initial
layout (or otherwise) is treated as scrolling to the
top of the content, including showing the title bar.
Scrolls to (0,1) will trigger code that animates the
title bar off screen.
Change-Id: Ia6db6d4620dea2bfe62407c4394a8ead38501b2f
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebView.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 9101578..95e2e43 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2505,16 +2505,26 @@ public class WebView extends AbsoluteLayout // saved scroll position, it is ok to skip this. return false; } - int vx = contentToViewX(cx); - int vy = contentToViewY(cy); + int vx; + int vy; + if ((cx | cy) == 0) { + // If the page is being scrolled to (0,0), do not add in the title + // bar's height, and simply scroll to (0,0). (The only other work + // in contentToView_ is to multiply, so this would not change 0.) + vx = 0; + vy = 0; + } else { + vx = contentToViewX(cx); + vy = contentToViewY(cy); + } // Log.d(LOGTAG, "content scrollTo [" + cx + " " + cy + "] view=[" + // vx + " " + vy + "]"); // Some mobile sites attempt to scroll the title bar off the page by - // scrolling to (0,0) or (0,1). If we are at the top left corner of the + // scrolling to (0,1). If we are at the top left corner of the // page, assume this is an attempt to scroll off the title bar, and // animate the title bar off screen slowly enough that the user can see // it. - if (cx == 0 && cy <= 1 && mScrollX == 0 && mScrollY == 0) { + if (cx == 0 && cy == 1 && mScrollX == 0 && mScrollY == 0) { pinScrollTo(vx, vy, true, SLIDE_TITLE_DURATION); // Since we are animating, we have not yet reached the desired // scroll position. Do not return true to request another attempt @@ -4862,17 +4872,8 @@ public class WebView extends AbsoluteLayout mMaxZoomScale = restoreState.mMaxScale; } setNewZoomScale(mLastScale, false); - 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); - } + setContentScrollTo(restoreState.mScrollX, + restoreState.mScrollY); if (useWideViewport && settings.getLoadWithOverviewMode()) { if (restoreState.mViewScale == 0 |