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

Commit 3f71cfc1 authored by Steve Block's avatar Steve Block Committed by Android (Google) Code Review
Browse files

Merge "Fix thread violation in WebView.getViewHeight()"

parents 8fa10d44 92c99162
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -1395,6 +1395,10 @@ public class WebView extends AbsoluteLayout
     */
    public int getVisibleTitleHeight() {
        checkThread();
        return getVisibleTitleHeightImpl();
    }

    private int getVisibleTitleHeightImpl() {
        // need to restrict mScrollY due to over scroll
        return Math.max(getTitleHeight() - Math.max(0, mScrollY), 0);
    }
@@ -1405,7 +1409,7 @@ public class WebView extends AbsoluteLayout
     * Note: this can be called from WebCoreThread.
     */
    /* package */ int getViewHeight() {
        return getViewHeightWithTitle() - getVisibleTitleHeight();
        return getViewHeightWithTitle() - getVisibleTitleHeightImpl();
    }

    int getViewHeightWithTitle() {
@@ -2768,7 +2772,7 @@ public class WebView extends AbsoluteLayout
        // the visible height back in to account for the fact that if the title
        // bar is partially visible, the part of the visible rect which is
        // displaying our content is displaced by that amount.
        r.top = viewToContentY(r.top + getVisibleTitleHeight());
        r.top = viewToContentY(r.top + getVisibleTitleHeightImpl());
        r.right = viewToContentX(r.right);
        r.bottom = viewToContentY(r.bottom);
    }
@@ -2785,7 +2789,7 @@ public class WebView extends AbsoluteLayout
        // the visible height back in to account for the fact that if the title
        // bar is partially visible, the part of the visible rect which is
        // displaying our content is displaced by that amount.
        r.top = viewToContentYf(ri.top + getVisibleTitleHeight());
        r.top = viewToContentYf(ri.top + getVisibleTitleHeightImpl());
        r.right = viewToContentXf(ri.right);
        r.bottom = viewToContentYf(ri.bottom);
    }
@@ -2934,7 +2938,7 @@ public class WebView extends AbsoluteLayout
        if (mScrollY < 0) {
            t -= mScrollY;
        }
        scrollBar.setBounds(l, t + getVisibleTitleHeight(), r, b);
        scrollBar.setBounds(l, t + getVisibleTitleHeightImpl(), r, b);
        scrollBar.draw(canvas);
    }

@@ -5179,7 +5183,7 @@ public class WebView extends AbsoluteLayout
            Rect rect = nativeCursorNodeBounds();
            mSelectX = contentToViewX(rect.left);
            mSelectY = contentToViewY(rect.top);
        } else if (mLastTouchY > getVisibleTitleHeight()) {
        } else if (mLastTouchY > getVisibleTitleHeightImpl()) {
            mSelectX = mScrollX + mLastTouchX;
            mSelectY = mScrollY + mLastTouchY;
        } else {
@@ -5497,7 +5501,7 @@ public class WebView extends AbsoluteLayout
            int rootViewHeight = rootView.getHeight();
            mViewRectViewport.set(mGLRectViewport);
            int savedWebViewBottom = mGLRectViewport.bottom;
            mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeight();
            mGLRectViewport.bottom = rootViewHeight - mGLRectViewport.top - getVisibleTitleHeightImpl();
            mGLRectViewport.top = rootViewHeight - savedWebViewBottom;
            mGLViewportEmpty = false;
        } else {
@@ -5554,7 +5558,7 @@ public class WebView extends AbsoluteLayout
        if (!mInOverScrollMode) {
            sendOurVisibleRect();
            // update WebKit if visible title bar height changed. The logic is same
            // as getVisibleTitleHeight.
            // as getVisibleTitleHeightImpl.
            int titleHeight = getTitleHeight();
            if (Math.max(titleHeight - t, 0) != Math.max(titleHeight - oldt, 0)) {
                sendViewSizeZoom(false);
@@ -8324,7 +8328,7 @@ public class WebView extends AbsoluteLayout
                            (Math.min(maxHeight, y + viewHeight) - viewHeight));
                    // We need to take into account the visible title height
                    // when scrolling since y is an absolute view position.
                    y = Math.max(0, y - getVisibleTitleHeight());
                    y = Math.max(0, y - getVisibleTitleHeightImpl());
                    scrollTo(x, y);
                    }
                    break;