am d82bc515: Avoid the rounding error, as Math.round(Math.round(viewWidth * mInvActualScale) * mActualScale) not necessary to be viewWidth, we special case when the content exactly fit in the view case.

Merge commit 'd82bc5158c764bdd30b7d22f32258ad3c2c0c0f6' into eclair-plus-aosp

* commit 'd82bc5158c764bdd30b7d22f32258ad3c2c0c0f6':
  Avoid the rounding error, as Math.round(Math.round(viewWidth * mInvActualScale) * mActualScale) not necessary to be viewWidth, we special case when the content exactly fit in the view case.
This commit is contained in:
Grace Kloba
2009-09-09 14:02:05 -07:00
committed by Android Git Automerger

View File

@@ -2049,6 +2049,10 @@ 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); return contentToViewDimension(mContentWidth);
} }
@@ -2062,7 +2066,14 @@ public class WebView extends AbsoluteLayout
if (mDrawHistory) { if (mDrawHistory) {
return mHistoryHeight; return mHistoryHeight;
} else { } else {
int height = contentToViewDimension(mContentHeight); int height;
// special case to avoid rounding error. Otherwise we may get a
// faked scrollbar sometimes.
if (mLastHeightSent == mContentHeight) {
height = getViewHeight();
} else {
height = contentToViewDimension(mContentHeight);
}
if (mFindIsUp) { if (mFindIsUp) {
height += FIND_HEIGHT; height += FIND_HEIGHT;
} }