diff options
author | Leon Scroggins <scroggo@google.com> | 2009-07-06 14:30:20 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-07-07 10:07:05 -0400 |
commit | e7e9096e60607e1d7da272c331f7a8edc8b5ef78 (patch) | |
tree | 189b36750681ced995227d5cfb07d9c2fe7ef5f5 /WebKit/android | |
parent | 4e48b773e59c23311633b641def8f0f16f951de8 (diff) | |
download | external_webkit-e7e9096e60607e1d7da272c331f7a8edc8b5ef78.zip external_webkit-e7e9096e60607e1d7da272c331f7a8edc8b5ef78.tar.gz external_webkit-e7e9096e60607e1d7da272c331f7a8edc8b5ef78.tar.bz2 |
Update text webcore thread's text generation number.
When the user edits text in a textfield, we increase a generation
number so we can mark changes from webkit to be out of date. With
this change, update webcore's notion of the text generation number
in deleteSelection and replaceTextfieldText, in addition to
passToJs. Requires a change in frameworks/base.
Diffstat (limited to 'WebKit/android')
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 21 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 5 |
2 files changed, 16 insertions, 10 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 57d324c..c83a465 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1438,7 +1438,7 @@ void WebViewCore::setSelection(int start, int end) setFocusControllerActive(true); } -void WebViewCore::deleteSelection(int start, int end) +void WebViewCore::deleteSelection(int start, int end, int textGeneration) { setSelection(start, end); if (start == end) @@ -1447,10 +1447,12 @@ void WebViewCore::deleteSelection(int start, int end) if (!focus) return; WebCore::TypingCommand::deleteSelection(focus->document()); + m_textGeneration = textGeneration; } void WebViewCore::replaceTextfieldText(int oldStart, - int oldEnd, const WebCore::String& replace, int start, int end) + int oldEnd, const WebCore::String& replace, int start, int end, + int textGeneration) { WebCore::Node* focus = currentFocus(); if (!focus) @@ -1459,6 +1461,7 @@ void WebViewCore::replaceTextfieldText(int oldStart, WebCore::TypingCommand::insertText(focus->document(), replace, false); setSelection(start, end); + m_textGeneration = textGeneration; } void WebViewCore::passToJs(int generation, const WebCore::String& current, @@ -2085,13 +2088,14 @@ static void Click(JNIEnv *env, jobject obj, int framePtr, int nodePtr) reinterpret_cast<WebCore::Node*>(nodePtr)); } -static void DeleteSelection(JNIEnv *env, jobject obj, jint start, jint end) +static void DeleteSelection(JNIEnv *env, jobject obj, jint start, jint end, + jint textGeneration) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); #endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); - viewImpl->deleteSelection(start, end); + viewImpl->deleteSelection(start, end, textGeneration); } static void SetSelection(JNIEnv *env, jobject obj, jint start, jint end) @@ -2105,7 +2109,8 @@ static void SetSelection(JNIEnv *env, jobject obj, jint start, jint end) static void ReplaceTextfieldText(JNIEnv *env, jobject obj, - jint oldStart, jint oldEnd, jstring replace, jint start, jint end) + jint oldStart, jint oldEnd, jstring replace, jint start, jint end, + jint textGeneration) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); @@ -2113,7 +2118,7 @@ static void ReplaceTextfieldText(JNIEnv *env, jobject obj, WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); WebCore::String webcoreString = to_string(env, replace); viewImpl->replaceTextfieldText(oldStart, - oldEnd, webcoreString, start, end); + oldEnd, webcoreString, start, end, textGeneration); } static void PassToJs(JNIEnv *env, jobject obj, @@ -2547,9 +2552,9 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SetGlobalBounds }, { "nativeSetSelection", "(II)V", (void*) SetSelection } , - { "nativeDeleteSelection", "(II)V", + { "nativeDeleteSelection", "(III)V", (void*) DeleteSelection } , - { "nativeReplaceTextfieldText", "(IILjava/lang/String;II)V", + { "nativeReplaceTextfieldText", "(IILjava/lang/String;III)V", (void*) ReplaceTextfieldText } , { "nativeMoveMouse", "(III)V", (void*) MoveMouse }, diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index fe1caa2..2af849f 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -248,7 +248,7 @@ namespace android { * If there is no focus, silently fail. * If start and end are out of order, swap them. */ - void deleteSelection(int start, int end); + void deleteSelection(int start, int end, int textGeneration); /** * Set the selection of the currently focused textfield to (start, end). @@ -261,7 +261,8 @@ namespace android { * and set the selection to (start, end). */ void replaceTextfieldText(int oldStart, - int oldEnd, const WebCore::String& replace, int start, int end); + int oldEnd, const WebCore::String& replace, int start, int end, + int textGeneration); void passToJs(int generation, const WebCore::String& , const WebCore::PlatformKeyboardEvent& ); void setFocusControllerActive(bool active); |