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;
"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,
}
}
+ /**
+ * 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.
// 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) {
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;
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();
}
static final String[] HandlerDebugString = {
+ "REQUEST_LABEL", // 97
"UPDATE_FRAME_CACHE_IF_LOADING", // = 98
"SCROLL_TEXT_INPUT", // = 99
"LOAD_URL", // = 100;
class EventHub {
// Message Ids
+ static final int REQUEST_LABEL = 97;
static final int UPDATE_FRAME_CACHE_IF_LOADING = 98;
static final int SCROLL_TEXT_INPUT = 99;
static final int LOAD_URL = 100;
@Override
public void handleMessage(Message msg) {
if (DebugFlags.WEB_VIEW_CORE) {
- Log.v(LOGTAG, (msg.what < UPDATE_FRAME_CACHE_IF_LOADING
+ Log.v(LOGTAG, (msg.what < REQUEST_LABEL
|| msg.what
> VALID_NODE_BOUNDS ? Integer.toString(msg.what)
: HandlerDebugString[msg.what
- - UPDATE_FRAME_CACHE_IF_LOADING])
+ - REQUEST_LABEL])
+ " arg1=" + msg.arg1 + " arg2=" + msg.arg2
+ " obj=" + msg.obj);
}
}
break;
+ case REQUEST_LABEL:
+ if (mWebView != null) {
+ int nodePointer = msg.arg2;
+ String label = nativeRequestLabel(msg.arg1,
+ nodePointer);
+ if (label != null && label.length() > 0) {
+ Message.obtain(mWebView.mPrivateHandler,
+ WebView.RETURN_LABEL, nodePointer,
+ 0, label).sendToTarget();
+ }
+ }
+ break;
+
case UPDATE_FRAME_CACHE_IF_LOADING:
nativeUpdateFrameCacheIfLoading();
break;
}
private native void nativeUpdateFrameCacheIfLoading();
-
+ private native String nativeRequestLabel(int framePtr, int nodePtr);
/**
* Scroll the focused textfield to (xPercent, y) in document space
*/