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

Commit 26723fc8 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

Adjustments to accommodate changes in Find dialog.

Remove mFindHeight, and the associated adjustements. It
is no longer needed because the FindDialog is no longer
on top of the WebView; instead, the WebView is resized to
accommodate it.
Do not take focus if the user touches the WebView while
Find is up.
Add a (hidden) getter to check to see if Find is showing.

Requires a change to packages/apps/Browser

Change-Id: I08cedb02d29eeeaac6860aa0933ccab43ed5c39f
parent 8c3ed8f9
Loading
Loading
Loading
Loading
+9 −22
Original line number Diff line number Diff line
@@ -2213,9 +2213,6 @@ public class WebView extends AbsoluteLayout
        Point p = new Point();
        getGlobalVisibleRect(r, p);
        r.offset(-p.x, -p.y);
        if (mFindIsUp) {
            r.bottom -= mFindHeight;
        }
    }

    // Sets r to be our visible rectangle in content coordinates
@@ -2553,19 +2550,19 @@ public class WebView extends AbsoluteLayout
     */
    public void setFindIsUp(boolean isUp) {
        mFindIsUp = isUp;
        if (isUp) {
            recordNewContentSize(mContentWidth, mContentHeight + mFindHeight,
                    false);
        }
        if (0 == mNativeClass) return; // client isn't initialized
        nativeSetFindIsUp(isUp);
    }

    /**
     * @hide
     */
    public boolean getFindIsUp() { return mFindIsUp; }

    // Used to know whether the find dialog is open.  Affects whether
    // or not we draw the highlights for matches.
    private boolean mFindIsUp;

    private int mFindHeight;
    // Keep track of the last string sent, so we can search again after an
    // orientation change or the dismissal of the soft keyboard.
    private String mLastFind;
@@ -2640,24 +2637,12 @@ public class WebView extends AbsoluteLayout
        }
        clearMatches();
        setFindIsUp(false);
        recordNewContentSize(mContentWidth, mContentHeight - mFindHeight,
                false);
        // Now that the dialog has been removed, ensure that we scroll to a
        // location that is not beyond the end of the page.
        pinScrollTo(mScrollX, mScrollY, false, 0);
        invalidate();
    }

    /**
     * @hide
     */
    public void setFindDialogHeight(int height) {
        if (DebugFlags.WEB_VIEW) {
            Log.v(LOGTAG, "setFindDialogHeight height=" + height);
        }
        mFindHeight = height;
    }

    /**
     * Query the document to see if it contains any image references. The
     * message object will be dispatched with arg1 being set to 1 if images
@@ -5964,6 +5949,9 @@ public class WebView extends AbsoluteLayout

    @Override
    public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
        // FIXME: If a subwindow is showing find, and the user touches the
        // background window, it can steal focus.
        if (mFindIsUp) return false;
        boolean result = false;
        if (inEditingMode()) {
            result = mWebTextView.requestFocus(direction,
@@ -6326,8 +6314,7 @@ public class WebView extends AbsoluteLayout
                    final boolean updateLayout = viewSize.x == mLastWidthSent
                            && viewSize.y == mLastHeightSent;
                    recordNewContentSize(draw.mWidthHeight.x,
                            draw.mWidthHeight.y
                            + (mFindIsUp ? mFindHeight : 0), updateLayout);
                            draw.mWidthHeight.y, updateLayout);
                    if (DebugFlags.WEB_VIEW) {
                        Rect b = draw.mInvalRegion.getBounds();
                        Log.v(LOGTAG, "NEW_PICTURE_MSG_ID {" +