summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/jni
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2012-03-15 16:40:30 -0700
committerGeorge Mount <mount@google.com>2012-03-15 16:43:13 -0700
commita9cb027a0b6e5a76a39be3702d3c67f3d162a21f (patch)
treee15851403fc9f8b5c6d21cceccbf547178bfd397 /Source/WebKit/android/jni
parent96ba0dde7ae9e2db6e4558794e1f57090b5b6c2f (diff)
downloadexternal_webkit-a9cb027a0b6e5a76a39be3702d3c67f3d162a21f.zip
external_webkit-a9cb027a0b6e5a76a39be3702d3c67f3d162a21f.tar.gz
external_webkit-a9cb027a0b6e5a76a39be3702d3c67f3d162a21f.tar.bz2
Update edit text size when the text changes so scroll works.
Bug 6176413 Framework Change: I6b8f244cd747d6d19c261d685a3cfb9ef4d71ec3 Change-Id: I487322ca9578c003f937b92ca4e8d46d34ea8c78
Diffstat (limited to 'Source/WebKit/android/jni')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp20
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h6
2 files changed, 26 insertions, 0 deletions
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);