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

Commit a7aa3b07 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 4932

* changes:
  In WebView, fix calcVisibleRect bugs
parents 92eef877 3524be90
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1759,9 +1759,6 @@ public class WebView extends AbsoluteLayout
    private Rect sendOurVisibleRect() {
        Rect rect = new Rect();
        calcOurContentVisibleRect(rect);
        if (mFindIsUp) {
            rect.bottom -= viewToContent(FIND_HEIGHT);
        }
        // Rect.equals() checks for null input.
        if (!rect.equals(mLastVisibleRectSent)) {
            Point pos = new Point(rect.left, rect.top);
@@ -1772,6 +1769,11 @@ public class WebView extends AbsoluteLayout
        Rect globalRect = new Rect();
        if (getGlobalVisibleRect(globalRect)
                && !globalRect.equals(mLastGlobalRect)) {
            if (DebugFlags.WEB_VIEW) {
                Log.v(LOGTAG, "sendOurVisibleRect=(" + globalRect.left + ","
                        + globalRect.top + ",r=" + globalRect.right + ",b="
                        + globalRect.bottom);
            }
            // TODO: the global offset is only used by windowRect()
            // in ChromeClientAndroid ; other clients such as touch
            // and mouse events could return view + screen relative points.
@@ -1786,6 +1788,9 @@ public class WebView extends AbsoluteLayout
        Point p = new Point();
        getGlobalVisibleRect(r, p);
        r.offset(-p.x, -p.y);
        if (mFindIsUp) {
            r.bottom -= FIND_HEIGHT;
        }
    }

    // Sets r to be our visible rectangle in content coordinates
@@ -3006,7 +3011,8 @@ public class WebView extends AbsoluteLayout
            mTextGeneration = 0;
        }
        mWebTextView.setTextSize(contentToView(nativeFocusCandidateTextSize()));
        Rect visibleRect = sendOurVisibleRect();
        Rect visibleRect = new Rect();
        calcOurContentVisibleRect(visibleRect);
        // Note that sendOurVisibleRect calls viewToContent, so the coordinates
        // should be in content coordinates.
        Rect bounds = nativeFocusCandidateNodeBounds();