Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d82bc515 authored by Grace Kloba's avatar Grace Kloba
Browse files

Avoid the rounding error, as Math.round(Math.round(viewWidth *...

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.

Fix http://b/issue?id=2099889
parent f416264a
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -2049,6 +2049,10 @@ public class WebView extends AbsoluteLayout
    protected int computeHorizontalScrollRange() {
        if (mDrawHistory) {
            return mHistoryWidth;
        } else if (mLastWidthSent == mContentWidth) {
            // special case to avoid rounding error. Otherwise we may get a
            // faked scrollbar sometimes.
            return getViewWidth();
        } else {
            return contentToViewDimension(mContentWidth);
        }
@@ -2062,7 +2066,14 @@ public class WebView extends AbsoluteLayout
        if (mDrawHistory) {
            return mHistoryHeight;
        } 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) {
                height += FIND_HEIGHT;
            }