@@ -683,7 +683,6 @@ public void onTrimMemory(int level) {
683683 private static final int SWITCH_TO_LONGPRESS = 4 ;
684684 private static final int RELEASE_SINGLE_TAP = 5 ;
685685 private static final int REQUEST_FORM_DATA = 6 ;
686- private static final int RESUME_WEBCORE_PRIORITY = 7 ;
687686 private static final int DRAG_HELD_MOTIONLESS = 8 ;
688687 private static final int AWAKEN_SCROLL_BARS = 9 ;
689688 private static final int PREVENT_DEFAULT_TIMEOUT = 10 ;
@@ -2850,46 +2849,47 @@ private void recordNewContentSize(int w, int h, boolean updateLayout) {
28502849 // Used to avoid sending many visible rect messages.
28512850 private Rect mLastVisibleRectSent ;
28522851 private Rect mLastGlobalRect ;
2852+ private Rect mVisibleRect = new Rect ();
2853+ private Rect mGlobalVisibleRect = new Rect ();
2854+ private Point mScrollOffset = new Point ();
28532855
28542856 Rect sendOurVisibleRect () {
28552857 if (mZoomManager .isPreventingWebkitUpdates ()) return mLastVisibleRectSent ;
2856- Rect rect = new Rect ();
2857- calcOurContentVisibleRect (rect );
2858+ calcOurContentVisibleRect (mVisibleRect );
28582859 // Rect.equals() checks for null input.
2859- if (!rect .equals (mLastVisibleRectSent )) {
2860+ if (!mVisibleRect .equals (mLastVisibleRectSent )) {
28602861 if (!mBlockWebkitViewMessages ) {
2861- Point pos = new Point ( rect .left , rect .top );
2862+ mScrollOffset . set ( mVisibleRect .left , mVisibleRect .top );
28622863 mWebViewCore .removeMessages (EventHub .SET_SCROLL_OFFSET );
28632864 mWebViewCore .sendMessage (EventHub .SET_SCROLL_OFFSET ,
2864- nativeMoveGeneration (), mSendScrollEvent ? 1 : 0 , pos );
2865+ nativeMoveGeneration (), mSendScrollEvent ? 1 : 0 , mScrollOffset );
28652866 }
2866- mLastVisibleRectSent = rect ;
2867+ mLastVisibleRectSent = mVisibleRect ;
28672868 mPrivateHandler .removeMessages (SWITCH_TO_LONGPRESS );
28682869 }
2869- Rect globalRect = new Rect ();
2870- if (getGlobalVisibleRect (globalRect )
2871- && !globalRect .equals (mLastGlobalRect )) {
2870+ if (getGlobalVisibleRect (mGlobalVisibleRect )
2871+ && !mGlobalVisibleRect .equals (mLastGlobalRect )) {
28722872 if (DebugFlags .WEB_VIEW ) {
2873- Log .v (LOGTAG , "sendOurVisibleRect=(" + globalRect .left + ","
2874- + globalRect .top + ",r=" + globalRect .right + ",b="
2875- + globalRect .bottom );
2873+ Log .v (LOGTAG , "sendOurVisibleRect=(" + mGlobalVisibleRect .left + ","
2874+ + mGlobalVisibleRect .top + ",r=" + mGlobalVisibleRect .right + ",b="
2875+ + mGlobalVisibleRect .bottom );
28762876 }
28772877 // TODO: the global offset is only used by windowRect()
28782878 // in ChromeClientAndroid ; other clients such as touch
28792879 // and mouse events could return view + screen relative points.
28802880 if (!mBlockWebkitViewMessages ) {
2881- mWebViewCore .sendMessage (EventHub .SET_GLOBAL_BOUNDS , globalRect );
2881+ mWebViewCore .sendMessage (EventHub .SET_GLOBAL_BOUNDS , mGlobalVisibleRect );
28822882 }
2883- mLastGlobalRect = globalRect ;
2883+ mLastGlobalRect = mGlobalVisibleRect ;
28842884 }
2885- return rect ;
2885+ return mVisibleRect ;
28862886 }
28872887
2888+ private Point mGlobalVisibleOffset = new Point ();
28882889 // Sets r to be the visible rectangle of our webview in view coordinates
28892890 private void calcOurVisibleRect (Rect r ) {
2890- Point p = new Point ();
2891- getGlobalVisibleRect (r , p );
2892- r .offset (-p .x , -p .y );
2891+ getGlobalVisibleRect (r , mGlobalVisibleOffset );
2892+ r .offset (-mGlobalVisibleOffset .x , -mGlobalVisibleOffset .y );
28932893 }
28942894
28952895 // Sets r to be our visible rectangle in content coordinates
@@ -2905,21 +2905,21 @@ private void calcOurContentVisibleRect(Rect r) {
29052905 r .bottom = viewToContentY (r .bottom );
29062906 }
29072907
2908+ private Rect mContentVisibleRect = new Rect ();
29082909 // Sets r to be our visible rectangle in content coordinates. We use this
29092910 // method on the native side to compute the position of the fixed layers.
29102911 // Uses floating coordinates (necessary to correctly place elements when
29112912 // the scale factor is not 1)
29122913 private void calcOurContentVisibleRectF (RectF r ) {
2913- Rect ri = new Rect (0 ,0 ,0 ,0 );
2914- calcOurVisibleRect (ri );
2915- r .left = viewToContentXf (ri .left );
2914+ calcOurVisibleRect (mContentVisibleRect );
2915+ r .left = viewToContentXf (mContentVisibleRect .left );
29162916 // viewToContentY will remove the total height of the title bar. Add
29172917 // the visible height back in to account for the fact that if the title
29182918 // bar is partially visible, the part of the visible rect which is
29192919 // displaying our content is displaced by that amount.
2920- r .top = viewToContentYf (ri .top + getVisibleTitleHeightImpl ());
2921- r .right = viewToContentXf (ri .right );
2922- r .bottom = viewToContentYf (ri .bottom );
2920+ r .top = viewToContentYf (mContentVisibleRect .top + getVisibleTitleHeightImpl ());
2921+ r .right = viewToContentXf (mContentVisibleRect .right );
2922+ r .bottom = viewToContentYf (mContentVisibleRect .bottom );
29232923 }
29242924
29252925 static class ViewSizeData {
@@ -3569,7 +3569,6 @@ public void computeScroll() {
35693569 mScrollingLayerRect .top = y ;
35703570 }
35713571 abortAnimation ();
3572- mPrivateHandler .removeMessages (RESUME_WEBCORE_PRIORITY );
35733572 nativeSetIsScrolling (false );
35743573 if (!mBlockWebkitViewMessages ) {
35753574 WebViewCore .resumePriority ();
@@ -5992,7 +5991,6 @@ private boolean handleTouchEventCommon(MotionEvent ev, int action, int x, int y)
59925991 mScroller .abortAnimation ();
59935992 mTouchMode = TOUCH_DRAG_START_MODE ;
59945993 mConfirmMove = true ;
5995- mPrivateHandler .removeMessages (RESUME_WEBCORE_PRIORITY );
59965994 nativeSetIsScrolling (false );
59975995 } else if (mPrivateHandler .hasMessages (RELEASE_SINGLE_TAP )) {
59985996 mPrivateHandler .removeMessages (RELEASE_SINGLE_TAP );
@@ -7329,7 +7327,6 @@ private void updateSelection() {
73297327 mLastTouchTime = eventTime ;
73307328 if (!mScroller .isFinished ()) {
73317329 abortAnimation ();
7332- mPrivateHandler .removeMessages (RESUME_WEBCORE_PRIORITY );
73337330 }
73347331 mSnapScrollMode = SNAP_NONE ;
73357332 mVelocityTracker = VelocityTracker .obtain ();
@@ -8461,10 +8458,6 @@ public void handleMessage(Message msg) {
84618458 mWebTextView .setAdapterCustom (adapter );
84628459 }
84638460 break ;
8464- case RESUME_WEBCORE_PRIORITY :
8465- WebViewCore .resumePriority ();
8466- WebViewCore .resumeUpdatePicture (mWebViewCore );
8467- break ;
84688461
84698462 case LONG_PRESS_CENTER :
84708463 // as this is shared by keydown and trackballdown, reset all
0 commit comments