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

Commit 2f55ac04 authored by Nicolas Roard's avatar Nicolas Roard Committed by Android (Google) Code Review
Browse files

Merge "Fix embed webview"

parents 2794eb3b 12c18e69
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -319,6 +319,8 @@ public class WebView extends AbsoluteLayout

    private ZoomManager mZoomManager;

    private Rect mGLRectViewport;

    /**
     *  Transportation object for returning WebView across thread boundaries.
     */
@@ -3718,8 +3720,11 @@ public class WebView extends AbsoluteLayout
        if (canvas.isHardwareAccelerated()) {
            try {
                if (canvas.acquireContext()) {
                      Rect rect = new Rect(getLeft(), getTop(), getRight(),
                                           getBottom() - getVisibleTitleHeight());
                      Rect rect = new Rect(mGLRectViewport.left,
                                           mGLRectViewport.top,
                                           mGLRectViewport.right,
                                           mGLRectViewport.bottom
                                           - getVisibleTitleHeight());
                      if (nativeDrawGL(rect, getScale(), extras)) {
                          invalidate();
                      }
@@ -4622,6 +4627,16 @@ public class WebView extends AbsoluteLayout
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
    }

    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]);
    }

    /**
     * @hide
     */
@@ -4637,6 +4652,7 @@ public class WebView extends AbsoluteLayout
            // notify the WebKit about the new dimensions.
            sendViewSizeZoom(false);
        }
        setGLRectViewport();
        return changed;
    }