summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/nav/WebView.cpp
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2012-01-12 13:40:49 -0800
committerGeorge Mount <mount@google.com>2012-01-18 16:29:03 -0800
commit7c77e50c5cdcaa7074e8db703224450fef254107 (patch)
tree3f536ba84c8284732d115cc4c727e1a1391155d9 /Source/WebKit/android/nav/WebView.cpp
parentf41a6c48daf18b146426dfb9887c3caff55b4ebc (diff)
downloadexternal_webkit-7c77e50c5cdcaa7074e8db703224450fef254107.zip
external_webkit-7c77e50c5cdcaa7074e8db703224450fef254107.tar.gz
external_webkit-7c77e50c5cdcaa7074e8db703224450fef254107.tar.bz2
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
Diffstat (limited to 'Source/WebKit/android/nav/WebView.cpp')
-rw-r--r--Source/WebKit/android/nav/WebView.cpp21
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)