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

Commit e6fb0f1d authored by Teng-Hui Zhu's avatar Teng-Hui Zhu
Browse files

Properly set the viewport for WebView when using GL

This is the first step, get the calculation right.
We still need to get the right message handling to get
the correct animation in Gmail .

http://b/issue?id=3103077

Change-Id: I3ed186b62ddb285e92a71d3ba5c02d4965068282
parent 63635c69
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -4836,13 +4836,19 @@ public class WebView extends AbsoluteLayout
    }

    void setGLRectViewport() {
        View window = getRootView();
        int[] location = new int[2];
        getLocationInWindow(location);
        mGLRectViewport = new Rect(location[0], window.getHeight()
                             - (location[1] + getHeight()),
                             location[0] + getWidth(),
                             window.getHeight() - location[1]);
        // Use the getGlobalVisibleRect() to get the intersection among the parents
        Rect webViewRect = new Rect();
        boolean visible = getGlobalVisibleRect(webViewRect);

        // Then need to invert the Y axis, just for GL
        View rootView = getRootView();
        int rootViewHeight = rootView.getHeight();
        int savedWebViewBottom = webViewRect.bottom;
        webViewRect.bottom = rootViewHeight - webViewRect.top;
        webViewRect.top = rootViewHeight - savedWebViewBottom;

        // Store the viewport
        mGLRectViewport = webViewRect;
    }

    /**