am 0fdae4cc: Merge change 24747 into eclair

Merge commit '0fdae4cc744c3be3855b47e82d2244df8503258c' into eclair-plus-aosp

* commit '0fdae4cc744c3be3855b47e82d2244df8503258c':
  Use floor to calculate the range to avoid the rounding error triggered
This commit is contained in:
Grace Kloba
2009-09-14 09:32:57 -07:00
committed by Android Git Automerger

View File

@@ -2049,12 +2049,9 @@ public class WebView extends AbsoluteLayout
protected int computeHorizontalScrollRange() { protected int computeHorizontalScrollRange() {
if (mDrawHistory) { if (mDrawHistory) {
return mHistoryWidth; return mHistoryWidth;
} else if (mLastWidthSent == mContentWidth) {
// special case to avoid rounding error. Otherwise we may get a
// faked scrollbar sometimes.
return getViewWidth();
} else { } else {
return contentToViewDimension(mContentWidth); // to avoid rounding error caused unnecessary scrollbar, use floor
return (int) Math.floor(mContentWidth * mActualScale);
} }
} }
@@ -2066,18 +2063,8 @@ public class WebView extends AbsoluteLayout
if (mDrawHistory) { if (mDrawHistory) {
return mHistoryHeight; return mHistoryHeight;
} else { } else {
int height; // to avoid rounding error caused unnecessary scrollbar, use floor
// special case to avoid rounding error. Otherwise we may get a return (int) Math.floor(mContentHeight * mActualScale);
// faked scrollbar sometimes.
if (mLastHeightSent == mContentHeight) {
height = getViewHeight();
} else {
height = contentToViewDimension(mContentHeight);
}
if (mFindIsUp) {
height += FIND_HEIGHT;
}
return height;
} }
} }
@@ -4582,8 +4569,7 @@ public class WebView extends AbsoluteLayout
} }
private int computeMaxScrollY() { private int computeMaxScrollY() {
int maxContentH = contentToViewDimension(mContentHeight) int maxContentH = computeVerticalScrollRange() + getTitleHeight();
+ getTitleHeight();
return Math.max(maxContentH - getHeight(), 0); return Math.max(maxContentH - getHeight(), 0);
} }
@@ -5023,8 +5009,8 @@ public class WebView extends AbsoluteLayout
int measuredWidth = widthSize; int measuredWidth = widthSize;
// Grab the content size from WebViewCore. // Grab the content size from WebViewCore.
int contentHeight = Math.round(mContentHeight * mActualScale); int contentHeight = contentToViewDimension(mContentHeight);
int contentWidth = Math.round(mContentWidth * mActualScale); int contentWidth = contentToViewDimension(mContentWidth);
// Log.d(LOGTAG, "------- measure " + heightMode); // Log.d(LOGTAG, "------- measure " + heightMode);