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

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

Merge change 195

* changes:
  Make webkit's cursor draw at the correct times.
parents bdacd875 63dda1c7
Loading
Loading
Loading
Loading
+17 −0
Original line number Original line Diff line number Diff line
@@ -3430,6 +3430,7 @@ public class WebView extends AbsoluteLayout
                if (mNativeClass != 0) {
                if (mNativeClass != 0) {
                    nativeRecordButtons(true, false, true);
                    nativeRecordButtons(true, false, true);
                }
                }
                setFocusControllerActive(true);
            } else {
            } else {
                // If our window gained focus, but we do not have it, do not
                // If our window gained focus, but we do not have it, do not
                // draw the focus ring.
                // draw the focus ring.
@@ -3455,11 +3456,22 @@ public class WebView extends AbsoluteLayout
            if (mNativeClass != 0) {
            if (mNativeClass != 0) {
                nativeRecordButtons(false, false, true);
                nativeRecordButtons(false, false, true);
            }
            }
            setFocusControllerActive(false);
        }
        }
        invalidate();
        invalidate();
        super.onWindowFocusChanged(hasWindowFocus);
        super.onWindowFocusChanged(hasWindowFocus);
    }
    }


    /*
     * Pass a message to WebCore Thread, determining whether the WebCore::Page's
     * FocusController is "active" so that it will draw the blinking cursor.
     */
    private void setFocusControllerActive(boolean active) {
        if (mWebViewCore != null) {
            mWebViewCore.sendMessage(EventHub.SET_ACTIVE, active ? 1 : 0, 0);
        }
    }

    @Override
    @Override
    protected void onFocusChanged(boolean focused, int direction,
    protected void onFocusChanged(boolean focused, int direction,
            Rect previouslyFocusedRect) {
            Rect previouslyFocusedRect) {
@@ -3478,6 +3490,10 @@ public class WebView extends AbsoluteLayout
                if (mNativeClass != 0) {
                if (mNativeClass != 0) {
                    nativeRecordButtons(true, false, true);
                    nativeRecordButtons(true, false, true);
                }
                }
                // FIXME: This is unnecessary if we are gaining focus from the
                // TextDialog.  How can we tell if it was the last thing in
                // focus?
                setFocusControllerActive(true);
            //} else {
            //} else {
                // The WebView has gained focus while we do not have
                // The WebView has gained focus while we do not have
                // windowfocus.  When our window lost focus, we should have
                // windowfocus.  When our window lost focus, we should have
@@ -3491,6 +3507,7 @@ public class WebView extends AbsoluteLayout
                if (mNativeClass != 0) {
                if (mNativeClass != 0) {
                    nativeRecordButtons(false, false, true);
                    nativeRecordButtons(false, false, true);
                }
                }
                setFocusControllerActive(false);
            }
            }
            mGotKeyDown = false;
            mGotKeyDown = false;
        }
        }
+11 −1
Original line number Original line Diff line number Diff line
@@ -330,6 +330,8 @@ final class WebViewCore {
            String currentText, int keyCode, int keyValue, boolean down,
            String currentText, int keyCode, int keyValue, boolean down,
            boolean cap, boolean fn, boolean sym);
            boolean cap, boolean fn, boolean sym);


    private native void nativeSetFocusControllerActive(boolean active);

    private native void nativeSaveDocumentState(int frame);
    private native void nativeSaveDocumentState(int frame);


    private native void nativeSetFinalFocus(int framePtr, int nodePtr, int x,
    private native void nativeSetFinalFocus(int framePtr, int nodePtr, int x,
@@ -596,6 +598,10 @@ final class WebViewCore {
        // message used to pass UI touch events to WebCore
        // message used to pass UI touch events to WebCore
        static final int TOUCH_EVENT = 141;
        static final int TOUCH_EVENT = 141;


        // Used to tell the focus controller whether to draw the blinking cursor
        // or not, based on whether the WebView has focus.
        static final int SET_ACTIVE = 142;

        // Network-based messaging
        // Network-based messaging
        static final int CLEAR_SSL_PREF_TABLE = 150;
        static final int CLEAR_SSL_PREF_TABLE = 150;


@@ -644,7 +650,7 @@ final class WebViewCore {
                public void handleMessage(Message msg) {
                public void handleMessage(Message msg) {
                    if (LOGV_ENABLED) {
                    if (LOGV_ENABLED) {
                        Log.v(LOGTAG, msg.what < LOAD_URL || msg.what 
                        Log.v(LOGTAG, msg.what < LOAD_URL || msg.what 
                                > TOUCH_EVENT ? Integer.toString(msg.what)
                                > SET_ACTIVE ? Integer.toString(msg.what)
                                : HandlerDebugString[msg.what - LOAD_URL]);
                                : HandlerDebugString[msg.what - LOAD_URL]);
                    }
                    }
                    switch (msg.what) {
                    switch (msg.what) {
@@ -866,6 +872,10 @@ final class WebViewCore {
                            break;
                            break;
                        }
                        }


                        case SET_ACTIVE:
                            nativeSetFocusControllerActive(msg.arg1 == 1);
                            break;

                        case ADD_JS_INTERFACE:
                        case ADD_JS_INTERFACE:
                            HashMap map = (HashMap) msg.obj;
                            HashMap map = (HashMap) msg.obj;
                            Object obj = map.get("object");
                            Object obj = map.get("object");