OSDN Git Service

resolved conflicts for merge of bb074ef9 to master
authorJean-Baptiste Queru <jbq@google.com>
Thu, 28 Jan 2010 23:14:57 +0000 (15:14 -0800)
committerJean-Baptiste Queru <jbq@google.com>
Thu, 28 Jan 2010 23:21:25 +0000 (15:21 -0800)
Change-Id: I2d78d1280b56928f65517203348ddbd403fa9eae

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

@@@ -510,13 -478,7 +510,14 @@@ public class WebView extends AbsoluteLa
      // obj=Rect in doc coordinates
      static final int INVAL_RECT_MSG_ID                  = 26;
      static final int REQUEST_KEYBOARD                   = 27;
 -    static final int SHOW_RECT_MSG_ID                   = 28;
 +    static final int DO_MOTION_UP                       = 28;
 +    static final int SHOW_FULLSCREEN                    = 29;
 +    static final int HIDE_FULLSCREEN                    = 30;
 +    static final int DOM_FOCUS_CHANGED                  = 31;
 +    static final int IMMEDIATE_REPAINT_MSG_ID           = 32;
 +    static final int SET_ROOT_LAYER_MSG_ID              = 33;
 +    static final int RETURN_LABEL                       = 34;
++    static final int FIND_AGAIN                         = 35;
  
      static final String[] HandlerDebugString = {
          "REMEMBER_PASSWORD", //              = 1;
          "WEBCORE_NEED_TOUCH_EVENTS", //      = 25;
          "INVAL_RECT_MSG_ID", //              = 26;
          "REQUEST_KEYBOARD", //               = 27;
 -        "SHOW_RECT_MSG_ID" //                = 28;
 +        "DO_MOTION_UP", //                   = 28;
 +        "SHOW_FULLSCREEN", //                = 29;
 +        "HIDE_FULLSCREEN", //                = 30;
 +        "DOM_FOCUS_CHANGED", //              = 31;
 +        "IMMEDIATE_REPAINT_MSG_ID", //       = 32;
 +        "SET_ROOT_LAYER_MSG_ID", //          = 33;
-         "RETURN_LABEL" //                    = 34;
++        "RETURN_LABEL", //                   = 34;
++        "FIND_AGAIN" //                      = 35;
      };
  
 +    // If the site doesn't use the viewport meta tag to specify the viewport,
 +    // use DEFAULT_VIEWPORT_WIDTH as the default viewport width
 +    static final int DEFAULT_VIEWPORT_WIDTH = 800;
 +
 +    // normally we try to fit the content to the minimum preferred width
 +    // calculated by the Webkit. To avoid the bad behavior when some site's
 +    // minimum preferred width keeps growing when changing the viewport width or
 +    // the minimum preferred width is huge, an upper limit is needed.
 +    static int sMaxViewportWidth = DEFAULT_VIEWPORT_WIDTH;
 +
      // default scale limit. Depending on the display density
      private static float DEFAULT_MAX_ZOOM_SCALE;
      private static float DEFAULT_MIN_ZOOM_SCALE;
      class PrivateHandler extends Handler {
          @Override
          public void handleMessage(Message msg) {
 -            if (DebugFlags.WEB_VIEW) {
 -                Log.v(LOGTAG, msg.what < REMEMBER_PASSWORD
 -                        || msg.what > SHOW_RECT_MSG_ID ? Integer
 -                        .toString(msg.what) : HandlerDebugString[msg.what
 -                        - REMEMBER_PASSWORD]);
 +            // exclude INVAL_RECT_MSG_ID since it is frequently output
 +            if (DebugFlags.WEB_VIEW && msg.what != INVAL_RECT_MSG_ID) {
 +                Log.v(LOGTAG, msg.what < REMEMBER_PASSWORD || msg.what
-                         > RETURN_LABEL ? Integer.toString(msg.what)
++                        > FIND_AGAIN ? Integer.toString(msg.what)
 +                        : HandlerDebugString[msg.what - REMEMBER_PASSWORD]);
              }
              if (mWebViewCore == null) {
                  // after WebView's destroy() is called, skip handling messages.
                      final Point viewSize = draw.mViewPoint;
                      boolean useWideViewport = settings.getUseWideViewPort();
                      WebViewCore.RestoreState restoreState = draw.mRestoreState;
 -                    if (restoreState != null) {
 +                    boolean hasRestoreState = restoreState != null;
 +                    if (hasRestoreState) {
                          mInZoomOverview = false;
-                         if (restoreState.mMinScale == 0) {
-                             if (restoreState.mMobileSite) {
-                                 if (draw.mMinPrefWidth >
-                                         Math.max(0, draw.mViewPoint.x)) {
-                                     mMinZoomScale = (float) viewWidth
-                                             / draw.mMinPrefWidth;
-                                     mMinZoomScaleFixed = false;
-                                     mInZoomOverview = useWideViewport &&
-                                             settings.getLoadWithOverviewMode();
-                                 } else {
-                                     mMinZoomScale = restoreState.mDefaultScale;
-                                     mMinZoomScaleFixed = true;
-                                 }
-                             } else {
-                                 mMinZoomScale = DEFAULT_MIN_ZOOM_SCALE;
-                                 mMinZoomScaleFixed = false;
-                             }
-                         } else {
-                             mMinZoomScale = restoreState.mMinScale;
-                             mMinZoomScaleFixed = true;
-                         }
-                         if (restoreState.mMaxScale == 0) {
-                             mMaxZoomScale = DEFAULT_MAX_ZOOM_SCALE;
-                         } else {
-                             mMaxZoomScale = restoreState.mMaxScale;
-                         }
+                         updateZoomRange(restoreState, viewSize.x,
+                                 draw.mMinPrefWidth, true);
                          if (mInitialScaleInPercent > 0) {
                              setNewZoomScale(mInitialScaleInPercent / 100.0f,
                                      mInitialScaleInPercent != mTextWrapScale * 100,