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

Commit 2ca912ec authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Lazily initialize the TextDialog.

parent 190b7573
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -2959,19 +2959,16 @@ public class WebView extends AbsoluteLayout
    }

    private void updateTextEntry() {
        if (mTextEntry == null) {
            mTextEntry = new TextDialog(mContext, WebView.this);
            // Initialize our generation number.
            mTextGeneration = 0;
        }
        // If we do not have focus, do nothing until we gain focus.
        if (!hasFocus() && !mTextEntry.hasFocus()
        if (!hasFocus() && (null == mTextEntry || !mTextEntry.hasFocus())
                || (mTouchMode >= FIRST_SCROLL_ZOOM 
                && mTouchMode <= LAST_SCROLL_ZOOM)) {
            mNeedsUpdateTextEntry = true;
            return;
        }
        boolean alreadyThere = inEditingMode();
        // inEditingMode can only return true if mTextEntry is non-null,
        // so we can safely call remove() if (alreadyThere)
        if (0 == mNativeClass || !nativeUpdateFocusNode()) {
            if (alreadyThere) {
                mTextEntry.remove();
@@ -2985,6 +2982,13 @@ public class WebView extends AbsoluteLayout
            }
            return;
        }
        // At this point, we know we have found an input field, so go ahead
        // and create the TextDialog if necessary.
        if (mTextEntry == null) {
            mTextEntry = new TextDialog(mContext, WebView.this);
            // Initialize our generation number.
            mTextGeneration = 0;
        }
        mTextEntry.setTextSize(contentToView(node.mTextSize));
        Rect visibleRect = sendOurVisibleRect();
        // Note that sendOurVisibleRect calls viewToContent, so the coordinates