diff options
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp | 18 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 20 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 6 |
3 files changed, 42 insertions, 2 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp b/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp index 785f0a8..042c227 100644 --- a/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp +++ b/Source/WebKit/android/WebCoreSupport/EditorClientAndroid.cpp @@ -228,8 +228,22 @@ void EditorClientAndroid::checkGrammarOfString(unsigned short const*, int, WTF:: void EditorClientAndroid::checkSpellingOfString(unsigned short const*, int, int*, int*) {} String EditorClientAndroid::getAutoCorrectSuggestionForMisspelledWord(const String&) { return String(); } void EditorClientAndroid::textFieldDidEndEditing(Element*) {} -void EditorClientAndroid::textDidChangeInTextArea(Element*) {} -void EditorClientAndroid::textDidChangeInTextField(Element*) {} +void EditorClientAndroid::textDidChangeInTextArea(Element* element) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->view()) + return; + WebViewCore* webViewCore = WebViewCore::getWebViewCore(frame->view()); + webViewCore->updateTextSizeAndScroll(element); +} +void EditorClientAndroid::textDidChangeInTextField(Element* element) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->view()) + return; + WebViewCore* webViewCore = WebViewCore::getWebViewCore(frame->view()); + webViewCore->updateTextSizeAndScroll(element); +} void EditorClientAndroid::textFieldDidBeginEditing(Element*) {} void EditorClientAndroid::ignoreWordInSpellDocument(String const&) {} diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index d263a22..4fbf6ed 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -337,6 +337,7 @@ struct WebViewCore::JavaGlue { jmethodID m_sendViewInvalidate; jmethodID m_updateTextfield; jmethodID m_updateTextSelection; + jmethodID m_updateTextSizeAndScroll; jmethodID m_clearTextEntry; jmethodID m_restoreScale; jmethodID m_needTouchEvents; @@ -471,6 +472,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_sendViewInvalidate = GetJMethod(env, clazz, "sendViewInvalidate", "(IIII)V"); m_javaGlue->m_updateTextfield = GetJMethod(env, clazz, "updateTextfield", "(IZLjava/lang/String;I)V"); m_javaGlue->m_updateTextSelection = GetJMethod(env, clazz, "updateTextSelection", "(IIIII)V"); + m_javaGlue->m_updateTextSizeAndScroll = GetJMethod(env, clazz, "updateTextSizeAndScroll", "(IIIII)V"); m_javaGlue->m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V"); m_javaGlue->m_restoreScale = GetJMethod(env, clazz, "restoreScale", "(FF)V"); m_javaGlue->m_needTouchEvents = GetJMethod(env, clazz, "needTouchEvents", "(Z)V"); @@ -3802,6 +3804,24 @@ void WebViewCore::updateTextSelection() checkException(env); } +void WebViewCore::updateTextSizeAndScroll(WebCore::Node* node) +{ + JNIEnv* env = JSC::Bindings::getJNIEnv(); + AutoJObject javaObject = m_javaGlue->object(env); + if (!javaObject.get()) + return; + RenderTextControl* rtc = toRenderTextControl(node); + if (!rtc) + return; + int width = rtc->scrollWidth(); + int height = rtc->contentHeight(); + int scrollX = rtc->scrollLeft(); + int scrollY = rtc->scrollTop(); + env->CallVoidMethod(javaObject.get(), m_javaGlue->m_updateTextSizeAndScroll, + reinterpret_cast<int>(node), width, height, scrollX, scrollY); + checkException(env); +} + void WebViewCore::updateTextfield(WebCore::Node* ptr, bool changeToPassword, const WTF::String& text) { diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index baf9995..6850111 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -229,6 +229,12 @@ namespace android { */ void updateTextSelection(); + /** + * Updates the java side with the node's content size and scroll + * position. + */ + void updateTextSizeAndScroll(WebCore::Node* node); + void clearTextEntry(); // JavaScript support void jsAlert(const WTF::String& url, const WTF::String& text); |