OSDN Git Service

don't swap out the history picture too soon
authorCary Clark <cary@android.com>
Thu, 23 Apr 2009 17:12:19 +0000 (13:12 -0400)
committerCary Clark <cary@android.com>
Fri, 24 Apr 2009 14:43:02 +0000 (10:43 -0400)
Wait until either the picture is not blank or
the progress is complete.

core/java/android/webkit/WebView.java
core/java/android/webkit/WebViewCore.java

index 79bd41b..6e79bc9 100644 (file)
@@ -2844,7 +2844,7 @@ public class WebView extends AbsoluteLayout
     // Should only be called in UI thread
     void switchOutDrawHistory() {
         if (null == mWebViewCore) return; // CallbackProxy may trigger this
-        if (mDrawHistory) {
+        if (mDrawHistory && mWebViewCore.pictureReady()) {
             mDrawHistory = false;
             invalidate();
             int oldScrollX = mScrollX;
index 3f7cdef..1415597 100644 (file)
@@ -285,6 +285,11 @@ final class WebViewCore {
      * split into parts. Called from the UI thread.
      */
     private native boolean nativeDrawContent(Canvas canvas, int color);
+
+    /**
+     * check to see if picture is blank and in progress
+     */
+    private native boolean nativePictureReady();
     
     /**
      * Redraw a portion of the picture set. The Point wh returns the
@@ -1347,6 +1352,10 @@ final class WebViewCore {
         }
     }
 
+    /* package */ boolean pictureReady() {
+        return nativePictureReady();
+    }
+
     /*package*/ Picture copyContentPicture() {
         Picture result = new Picture();
         nativeCopyContentToPicture(result);