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

Commit 180403ac authored by Mike Reed's avatar Mike Reed
Browse files

pin our visible content bounds to the bounds of the doc itself, to account for overscroll

Change-Id: I3c8165338e31da45a70b3f65ba8389a7a50d6e07
http://b/issue?id=2496502
parent 36ad54ac
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2199,14 +2199,15 @@ public class WebView extends AbsoluteLayout
    // Sets r to be our visible rectangle in content coordinates
    private void calcOurContentVisibleRect(Rect r) {
        calcOurVisibleRect(r);
        r.left = viewToContentX(r.left);
        // since we might overscroll, pin the rect to the bounds of the content
        r.left = Math.max(viewToContentX(r.left), 0);
        // viewToContentY will remove the total height of the title bar.  Add
        // 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.right = viewToContentX(r.right);
        r.bottom = viewToContentY(r.bottom);
        r.top = Math.max(viewToContentY(r.top + getVisibleTitleHeight()), 0);
        r.right = Math.min(viewToContentX(r.right), mContentWidth);
        r.bottom = Math.min(viewToContentY(r.bottom), mContentHeight);
    }

    static class ViewSizeData {