@@ -1074,7 +1074,6 @@ public void onTrimMemory(int level) {
10741074 private static final int STD_SPEED = 480 ; // pixels per second
10751075 // time for the longest scroll animation
10761076 private static final int MAX_DURATION = 750 ; // milliseconds
1077- private static final int SLIDE_TITLE_DURATION = 500 ; // milliseconds
10781077
10791078 // Used by OverScrollGlow
10801079 OverScroller mScroller ;
@@ -4012,17 +4011,6 @@ private boolean setContentScrollBy(int cx, int cy, boolean animate) {
40124011 * @param url The URL of the page which has finished loading.
40134012 */
40144013 /* package */ void onPageFinished (String url ) {
4015- if (mPageThatNeedsToSlideTitleBarOffScreen != null ) {
4016- // If the user is now on a different page, or has scrolled the page
4017- // past the point where the title bar is offscreen, ignore the
4018- // scroll request.
4019- if (mPageThatNeedsToSlideTitleBarOffScreen .equals (url )
4020- && getScrollX () == 0 && getScrollY () == 0 ) {
4021- pinScrollTo (0 , mYDistanceToSlideTitleOffScreen , true ,
4022- SLIDE_TITLE_DURATION );
4023- }
4024- mPageThatNeedsToSlideTitleBarOffScreen = null ;
4025- }
40264014 mZoomManager .onPageFinished (url );
40274015 injectAccessibilityForUrl (url );
40284016 }
@@ -4134,93 +4122,16 @@ private int getAxsUrlParameterValue(String url) {
41344122 return -1 ;
41354123 }
41364124
4137- /**
4138- * The URL of a page that sent a message to scroll the title bar off screen.
4139- *
4140- * Many mobile sites tell the page to scroll to (0,1) in order to scroll the
4141- * title bar off the screen. Sometimes, the scroll position is set before
4142- * the page finishes loading. Rather than scrolling while the page is still
4143- * loading, keep track of the URL and new scroll position so we can perform
4144- * the scroll once the page finishes loading.
4145- */
4146- private String mPageThatNeedsToSlideTitleBarOffScreen ;
4147-
4148- /**
4149- * The destination Y scroll position to be used when the page finishes
4150- * loading. See mPageThatNeedsToSlideTitleBarOffScreen.
4151- */
4152- private int mYDistanceToSlideTitleOffScreen ;
4153-
4154- // scale from content to view coordinates, and pin
4155- // return true if pin caused the final x/y different than the request cx/cy,
4156- // and a future scroll may reach the request cx/cy after our size has
4157- // changed
4158- // return false if the view scroll to the exact position as it is requested,
4159- // where negative numbers are taken to mean 0
4160- private boolean setContentScrollTo (int cx , int cy ) {
4161- if (mDrawHistory ) {
4162- // disallow WebView to change the scroll position as History Picture
4163- // is used in the view system.
4164- // One known case where this is called is that WebCore tries to
4165- // restore the scroll position. As history Picture already uses the
4166- // saved scroll position, it is ok to skip this.
4167- return false ;
4168- }
4169- int vx ;
4170- int vy ;
4171- if ((cx | cy ) == 0 ) {
4172- // If the page is being scrolled to (0,0), do not add in the title
4173- // bar's height, and simply scroll to (0,0). (The only other work
4174- // in contentToView_ is to multiply, so this would not change 0.)
4175- vx = 0 ;
4176- vy = 0 ;
4177- } else {
4178- vx = contentToViewX (cx );
4179- vy = contentToViewY (cy );
4180- }
4181- // Log.d(LOGTAG, "content scrollTo [" + cx + " " + cy + "] view=[" +
4182- // vx + " " + vy + "]");
4183- // Some mobile sites attempt to scroll the title bar off the page by
4184- // scrolling to (0,1). If we are at the top left corner of the
4185- // page, assume this is an attempt to scroll off the title bar, and
4186- // animate the title bar off screen slowly enough that the user can see
4187- // it.
4188- if (cx == 0 && cy == 1 && getScrollX () == 0 && getScrollY () == 0
4189- && getTitleHeight () > 0 ) {
4190- // FIXME: 100 should be defined somewhere as our max progress.
4191- if (getProgress () < 100 ) {
4192- // Wait to scroll the title bar off screen until the page has
4193- // finished loading. Keep track of the URL and the destination
4194- // Y position
4195- mPageThatNeedsToSlideTitleBarOffScreen = getUrl ();
4196- mYDistanceToSlideTitleOffScreen = vy ;
4197- } else {
4198- pinScrollTo (vx , vy , true , SLIDE_TITLE_DURATION );
4199- }
4200- // Since we are animating, we have not yet reached the desired
4201- // scroll position. Do not return true to request another attempt
4202- return false ;
4203- }
4204- pinScrollTo (vx , vy , false , 0 );
4205- // If the request was to scroll to a negative coordinate, treat it as if
4206- // it was a request to scroll to 0
4207- if ((getScrollX () != vx && cx >= 0 ) || (getScrollY () != vy && cy >= 0 )) {
4208- return true ;
4209- } else {
4210- return false ;
4211- }
4212- }
4213-
42144125 // scale from content to view coordinates, and pin
4215- private void spawnContentScrollTo (int cx , int cy ) {
4126+ private void contentScrollTo (int cx , int cy , boolean animate ) {
42164127 if (mDrawHistory ) {
42174128 // disallow WebView to change the scroll position as History Picture
42184129 // is used in the view system.
42194130 return ;
42204131 }
4221- int vx = contentToViewDimension (cx - mScrollOffset . x );
4222- int vy = contentToViewDimension (cy - mScrollOffset . y );
4223- pinScrollBy (vx , vy , true , 0 );
4132+ int vx = contentToViewX (cx );
4133+ int vy = contentToViewY (cy );
4134+ pinScrollTo (vx , vy , animate , 0 );
42244135 }
42254136
42264137 /**
@@ -7427,11 +7338,7 @@ public void handleMessage(Message msg) {
74277338 }
74287339 }
74297340 final Point p = (Point ) msg .obj ;
7430- if (msg .arg1 == 1 ) {
7431- spawnContentScrollTo (p .x , p .y );
7432- } else {
7433- setContentScrollTo (p .x , p .y );
7434- }
7341+ contentScrollTo (p .x , p .y , msg .arg1 == 1 );
74357342 break ;
74367343 }
74377344 case UPDATE_ZOOM_RANGE : {
@@ -8072,7 +7979,7 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
80727979 int scrollX = viewState .mShouldStartScrolledRight
80737980 ? getContentWidth () : viewState .mScrollX ;
80747981 int scrollY = viewState .mScrollY ;
8075- setContentScrollTo (scrollX , scrollY );
7982+ contentScrollTo (scrollX , scrollY , false );
80767983 if (!mDrawHistory ) {
80777984 // As we are on a new page, hide the keyboard
80787985 hideSoftKeyboard ();
0 commit comments