resolved conflicts for merge of bb074ef9 to master

Change-Id: I2d78d1280b56928f65517203348ddbd403fa9eae
This commit is contained in:
Jean-Baptiste Queru
2010-01-28 15:14:57 -08:00
2 changed files with 60 additions and 31 deletions

View File

@@ -499,7 +499,7 @@ public class WebView extends AbsoluteLayout
static final int UPDATE_TEXT_ENTRY_MSG_ID = 15;
static final int WEBCORE_INITIALIZED_MSG_ID = 16;
static final int UPDATE_TEXTFIELD_TEXT_MSG_ID = 17;
static final int FIND_AGAIN = 18;
static final int UPDATE_ZOOM_RANGE = 18;
static final int MOVE_OUT_OF_PLUGIN = 19;
static final int CLEAR_TEXT_ENTRY = 20;
static final int UPDATE_TEXT_SELECTION_MSG_ID = 21;
@@ -517,6 +517,7 @@ public class WebView extends AbsoluteLayout
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;
@@ -536,7 +537,7 @@ public class WebView extends AbsoluteLayout
"UPDATE_TEXT_ENTRY_MSG_ID", // = 15;
"WEBCORE_INITIALIZED_MSG_ID", // = 16;
"UPDATE_TEXTFIELD_TEXT_MSG_ID", // = 17;
"FIND_AGAIN", // = 18;
"UPDATE_ZOOM_RANGE", // = 18;
"MOVE_OUT_OF_PLUGIN", // = 19;
"CLEAR_TEXT_ENTRY", // = 20;
"UPDATE_TEXT_SELECTION_MSG_ID", // = 21;
@@ -552,7 +553,8 @@ public class WebView extends AbsoluteLayout
"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,
@@ -5587,7 +5589,7 @@ public class WebView extends AbsoluteLayout
// 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) {
@@ -5683,6 +5685,14 @@ public class WebView extends AbsoluteLayout
case SPAWN_SCROLL_TO_MSG_ID:
spawnContentScrollTo(msg.arg1, msg.arg2);
break;
case UPDATE_ZOOM_RANGE: {
WebViewCore.RestoreState restoreState
= (WebViewCore.RestoreState) msg.obj;
// mScrollX contains the new minPrefWidth
updateZoomRange(restoreState, getViewWidth(),
restoreState.mScrollX, false);
break;
}
case NEW_PICTURE_MSG_ID: {
WebSettings settings = mWebViewCore.getSettings();
// called for new content
@@ -5695,32 +5705,8 @@ public class WebView extends AbsoluteLayout
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,
@@ -6411,6 +6397,37 @@ public class WebView extends AbsoluteLayout
new InvokeListBox(array, enabledArray, selectedArray));
}
private void updateZoomRange(WebViewCore.RestoreState restoreState,
int viewWidth, int minPrefWidth, boolean updateZoomOverview) {
if (restoreState.mMinScale == 0) {
if (restoreState.mMobileSite) {
if (minPrefWidth > Math.max(0, viewWidth)) {
mMinZoomScale = (float) viewWidth / minPrefWidth;
mMinZoomScaleFixed = false;
if (updateZoomOverview) {
WebSettings settings = getSettings();
mInZoomOverview = settings.getUseWideViewPort() &&
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;
}
}
/*
* Request a dropdown menu for a listbox with single selection or a single
* <select> element.

View File

@@ -2053,7 +2053,19 @@ final class WebViewCore {
}
// if mViewportWidth is 0, it means device-width, always update.
if (mViewportWidth != 0 && !updateRestoreState) return;
if (mViewportWidth != 0 && !updateRestoreState) {
RestoreState restoreState = new RestoreState();
restoreState.mMinScale = mViewportMinimumScale / 100.0f;
restoreState.mMaxScale = mViewportMaximumScale / 100.0f;
restoreState.mDefaultScale = adjust;
// as mViewportWidth is not 0, it is not mobile site.
restoreState.mMobileSite = false;
// for non-mobile site, we don't need minPrefWidth, set it as 0
restoreState.mScrollX = 0;
Message.obtain(mWebView.mPrivateHandler,
WebView.UPDATE_ZOOM_RANGE, restoreState).sendToTarget();
return;
}
// now notify webview
// webViewWidth refers to the width in the view system