summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-04-16 06:21:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-04-16 06:21:10 -0700
commit7a430cf152fa6a55be2f04e1318baafb69bb5bc0 (patch)
tree4348ff41cd3fd579401b565114f1a6412d52f463
parentbdacd875628804def120b77021d3fdc03caae7a7 (diff)
parent63dda1c7b405524384e53a67be5735d9026650db (diff)
downloadframeworks_base-7a430cf152fa6a55be2f04e1318baafb69bb5bc0.zip
frameworks_base-7a430cf152fa6a55be2f04e1318baafb69bb5bc0.tar.gz
frameworks_base-7a430cf152fa6a55be2f04e1318baafb69bb5bc0.tar.bz2
Merge change 195
* changes: Make webkit's cursor draw at the correct times.
-rw-r--r--core/java/android/webkit/WebView.java17
-rw-r--r--core/java/android/webkit/WebViewCore.java12
2 files changed, 28 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 67ebc53..34709aa 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3430,6 +3430,7 @@ public class WebView extends AbsoluteLayout
if (mNativeClass != 0) {
nativeRecordButtons(true, false, true);
}
+ setFocusControllerActive(true);
} else {
// If our window gained focus, but we do not have it, do not
// draw the focus ring.
@@ -3455,11 +3456,22 @@ public class WebView extends AbsoluteLayout
if (mNativeClass != 0) {
nativeRecordButtons(false, false, true);
}
+ setFocusControllerActive(false);
}
invalidate();
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
protected void onFocusChanged(boolean focused, int direction,
Rect previouslyFocusedRect) {
@@ -3478,6 +3490,10 @@ public class WebView extends AbsoluteLayout
if (mNativeClass != 0) {
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 {
// The WebView has gained focus while we do not have
// windowfocus. When our window lost focus, we should have
@@ -3491,6 +3507,7 @@ public class WebView extends AbsoluteLayout
if (mNativeClass != 0) {
nativeRecordButtons(false, false, true);
}
+ setFocusControllerActive(false);
}
mGotKeyDown = false;
}
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index e520ba3..302bc1a 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -330,6 +330,8 @@ final class WebViewCore {
String currentText, int keyCode, int keyValue, boolean down,
boolean cap, boolean fn, boolean sym);
+ private native void nativeSetFocusControllerActive(boolean active);
+
private native void nativeSaveDocumentState(int frame);
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
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
static final int CLEAR_SSL_PREF_TABLE = 150;
@@ -644,7 +650,7 @@ final class WebViewCore {
public void handleMessage(Message msg) {
if (LOGV_ENABLED) {
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]);
}
switch (msg.what) {
@@ -866,6 +872,10 @@ final class WebViewCore {
break;
}
+ case SET_ACTIVE:
+ nativeSetFocusControllerActive(msg.arg1 == 1);
+ break;
+
case ADD_JS_INTERFACE:
HashMap map = (HashMap) msg.obj;
Object obj = map.get("object");