diff options
author | George Mount <mount@google.com> | 2012-01-23 07:30:20 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-23 07:30:20 -0800 |
commit | 2641f0118c78c83b37b7dd9ee6f6cb793cdb8cfb (patch) | |
tree | 8ad9ff3b9a722533f60663e3bf7eb350c9e67a37 /Source/WebKit/android/nav/WebView.cpp | |
parent | 66df18e3ce1aefb177e33918f83161f1d4b1b2d1 (diff) | |
parent | 7c77e50c5cdcaa7074e8db703224450fef254107 (diff) | |
download | external_webkit-2641f0118c78c83b37b7dd9ee6f6cb793cdb8cfb.zip external_webkit-2641f0118c78c83b37b7dd9ee6f6cb793cdb8cfb.tar.gz external_webkit-2641f0118c78c83b37b7dd9ee6f6cb793cdb8cfb.tar.bz2 |
Merge "Add cut and paste to ContentEditable."
Diffstat (limited to 'Source/WebKit/android/nav/WebView.cpp')
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 0d8a716..dede152 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -1983,6 +1983,25 @@ static jint nativeFocusCandidateFramePointer(JNIEnv *env, jobject obj) return reinterpret_cast<int>(frame ? frame->framePointer() : 0); } +static bool nativeFocusCandidateIsEditableText(JNIEnv* env, jobject obj, + jint nativeClass) +{ + WebView* view = reinterpret_cast<WebView*>(nativeClass); + CachedRoot* root = view->getFrameCache(WebView::DontAllowNewer); + bool isEditable = false; + if (root) { + const CachedFrame* frame = NULL; + const CachedNode* cursor = root->currentCursor(&frame); + const CachedNode* focus = cursor; + if (!cursor || !cursor->wantsKeyEvents()) + focus = root->currentFocus(&frame); + if (focus) { + isEditable = (focus->isTextInput() || focus->isContentEditable()); + } + } + return isEditable; +} + static bool nativeFocusCandidateIsPassword(JNIEnv *env, jobject obj) { const CachedInput* input = getInputCandidate(env, obj); @@ -2950,6 +2969,8 @@ static JNINativeMethod gJavaWebViewMethods[] = { (void*) nativeSetPauseDrawing }, { "nativeDisableNavcache", "()Z", (void*) nativeDisableNavcache }, + { "nativeFocusCandidateIsEditableText", "(I)Z", + (void*) nativeFocusCandidateIsEditableText }, }; int registerWebView(JNIEnv* env) |