From 7c77e50c5cdcaa7074e8db703224450fef254107 Mon Sep 17 00:00:00 2001 From: George Mount Date: Thu, 12 Jan 2012 13:40:49 -0800 Subject: Add cut and paste to ContentEditable. Bug 5806267 Use visual selection to determine the webkit selection. The webkit selection can be used to cut text from an editable area. It can also be used to do better complex character text copy. Framework Change: I56543d17670a8c98484314c89c7fa6a94cb809e4 Change-Id: I194c6d9e2add67151b97092a1a54f5c081296000 --- Source/WebKit/android/nav/WebView.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Source/WebKit/android/nav/WebView.cpp') 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(frame ? frame->framePointer() : 0); } +static bool nativeFocusCandidateIsEditableText(JNIEnv* env, jobject obj, + jint nativeClass) +{ + WebView* view = reinterpret_cast(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) -- cgit v1.1