summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebView.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-01-07 06:00:17 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-01-07 06:00:17 -0800
commit283ae234a71cb83c5cd9f58fe2c2a9414987113e (patch)
treea9069b90b09c87df545b6389b8a375e200fc20da /core/java/android/webkit/WebView.java
parent1b4a031954baebd4491ad4db91de39d4f5ee74ad (diff)
parentbd6029fc5171e1094a00cdecb3f33aae6fe69c9f (diff)
downloadframeworks_base-283ae234a71cb83c5cd9f58fe2c2a9414987113e.zip
frameworks_base-283ae234a71cb83c5cd9f58fe2c2a9414987113e.tar.gz
frameworks_base-283ae234a71cb83c5cd9f58fe2c2a9414987113e.tar.bz2
am bd6029fc: am 3a503399: Request <label> info only when accessing a textfield.
Merge commit 'bd6029fc5171e1094a00cdecb3f33aae6fe69c9f' * commit 'bd6029fc5171e1094a00cdecb3f33aae6fe69c9f': Request <label> info only when accessing a textfield.
Diffstat (limited to 'core/java/android/webkit/WebView.java')
-rw-r--r--core/java/android/webkit/WebView.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 4124650..a6a48cb 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -499,6 +499,7 @@ public class WebView extends AbsoluteLayout
static final int DOM_FOCUS_CHANGED = 31;
static final int IMMEDIATE_REPAINT_MSG_ID = 32;
static final int SET_ROOT_LAYER_MSG_ID = 33;
+ static final int RETURN_LABEL = 34;
static final String[] HandlerDebugString = {
"REMEMBER_PASSWORD", // = 1;
@@ -533,7 +534,8 @@ public class WebView extends AbsoluteLayout
"HIDE_FULLSCREEN", // = 30;
"DOM_FOCUS_CHANGED", // = 31;
"IMMEDIATE_REPAINT_MSG_ID", // = 32;
- "SET_ROOT_LAYER_MSG_ID" // = 33;
+ "SET_ROOT_LAYER_MSG_ID", // = 33;
+ "RETURN_LABEL" // = 34;
};
// If the site doesn't use the viewport meta tag to specify the viewport,
@@ -3308,6 +3310,17 @@ public class WebView extends AbsoluteLayout
}
}
+ /**
+ * Pass a message to find out the <label> associated with the <input>
+ * identified by nodePointer
+ * @param framePointer Pointer to the frame containing the <input> node
+ * @param nodePointer Pointer to the node for which a <label> is desired.
+ */
+ /* package */ void requestLabel(int framePointer, int nodePointer) {
+ mWebViewCore.sendMessage(EventHub.REQUEST_LABEL, framePointer,
+ nodePointer);
+ }
+
/*
* This class runs the layers animations in their own thread,
* so that we do not slow down the UI.
@@ -5369,7 +5382,7 @@ public class WebView extends AbsoluteLayout
// exclude INVAL_RECT_MSG_ID since it is frequently output
if (DebugFlags.WEB_VIEW && msg.what != INVAL_RECT_MSG_ID) {
Log.v(LOGTAG, msg.what < REMEMBER_PASSWORD || msg.what
- > SET_ROOT_LAYER_MSG_ID ? Integer.toString(msg.what)
+ > RETURN_LABEL ? Integer.toString(msg.what)
: HandlerDebugString[msg.what - REMEMBER_PASSWORD]);
}
if (mWebViewCore == null) {
@@ -5600,6 +5613,20 @@ public class WebView extends AbsoluteLayout
tData.mEnd);
}
break;
+ case RETURN_LABEL:
+ if (inEditingMode()
+ && mWebTextView.isSameTextField(msg.arg1)) {
+ mWebTextView.setHint((String) msg.obj);
+ InputMethodManager imm
+ = InputMethodManager.peekInstance();
+ // The hint is propagated to the IME in
+ // onCreateInputConnection. If the IME is already
+ // active, restart it so that its hint text is updated.
+ if (imm != null && imm.isActive(mWebTextView)) {
+ imm.restartInput(mWebTextView);
+ }
+ }
+ break;
case MOVE_OUT_OF_PLUGIN:
navHandledKey(msg.arg1, 1, false, 0, true);
break;
@@ -6345,12 +6372,11 @@ public class WebView extends AbsoluteLayout
private native void nativeDumpDisplayTree(String urlOrNull);
private native int nativeFindAll(String findLower, String findUpper);
private native void nativeFindNext(boolean forward);
- private native int nativeFocusCandidateFramePointer();
+ /* package */ native int nativeFocusCandidateFramePointer();
private native boolean nativeFocusCandidateIsPassword();
private native boolean nativeFocusCandidateIsPlugin();
private native boolean nativeFocusCandidateIsRtlText();
private native boolean nativeFocusCandidateIsTextInput();
- /* package */ native String nativeFocusCandidateLabel();
/* package */ native int nativeFocusCandidateMaxLength();
/* package */ native String nativeFocusCandidateName();
private native Rect nativeFocusCandidateNodeBounds();