Make the caret/selection draw when gaining window focus.

When the WebView loses WindowFocus, we stop drawing the
selection.  We need to resume drawing it, especially for
the context menu, which steals WindowFocus.  Corresponds
to a change in Webkit.
This commit is contained in:
Leon Scroggins
2009-06-30 08:47:04 -04:00
parent 5e79e32357
commit 8cdad88915
2 changed files with 9 additions and 6 deletions

View File

@@ -3510,6 +3510,9 @@ public class WebView extends AbsoluteLayout
mDrawCursorRing = true;
if (mNativeClass != 0) {
nativeRecordButtons(true, false, true);
if (inEditingMode()) {
mWebViewCore.sendMessage(EventHub.SET_ACTIVE, 1, 0);
}
}
} else {
// If our window gained focus, but we do not have it, do not
@@ -3552,7 +3555,7 @@ public class WebView extends AbsoluteLayout
// Do not need to also check whether mWebViewCore is null, because
// mNativeClass is only set if mWebViewCore is non null
if (mNativeClass == 0) return;
mWebViewCore.sendMessage(EventHub.SET_INACTIVE);
mWebViewCore.sendMessage(EventHub.SET_ACTIVE, 0, 0);
}
@Override

View File

@@ -376,7 +376,7 @@ final class WebViewCore {
String currentText, int keyCode, int keyValue, boolean down,
boolean cap, boolean fn, boolean sym);
private native void nativeSetFocusControllerInactive();
private native void nativeSetFocusControllerActive(boolean active);
private native void nativeSaveDocumentState(int frame);
@@ -613,7 +613,7 @@ final class WebViewCore {
"LOAD_DATA", // = 139;
"TOUCH_UP", // = 140;
"TOUCH_EVENT", // = 141;
"SET_INACTIVE", // = 142;
"SET_ACTIVE", // = 142;
"ON_PAUSE", // = 143
"ON_RESUME", // = 144
"FREE_MEMORY", // = 145
@@ -671,7 +671,7 @@ final class WebViewCore {
// Used to tell the focus controller not to draw the blinking cursor,
// based on whether the WebView has focus and whether the WebView's
// cursor matches the webpage's focus.
static final int SET_INACTIVE = 142;
static final int SET_ACTIVE = 142;
// lifecycle activities for just this DOM (unlike pauseTimers, which
// is global)
@@ -954,8 +954,8 @@ final class WebViewCore {
break;
}
case SET_INACTIVE:
nativeSetFocusControllerInactive();
case SET_ACTIVE:
nativeSetFocusControllerActive(msg.arg1 == 1);
break;
case ADD_JS_INTERFACE: