summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-07-23 16:03:42 -0400
committerLeon Scroggins <scroggo@google.com>2009-07-23 16:34:04 -0400
commitcff94c91f1bb3dfbb5ca3ca2c454ad8aad0c5af3 (patch)
treef7b04667fbd49cc477d559f0982b6b8f210e795f /WebKit
parent0516e5ebbe0e0ced8bd40f67f06c38a4d373be9c (diff)
downloadexternal_webkit-cff94c91f1bb3dfbb5ca3ca2c454ad8aad0c5af3.zip
external_webkit-cff94c91f1bb3dfbb5ca3ca2c454ad8aad0c5af3.tar.gz
external_webkit-cff94c91f1bb3dfbb5ca3ca2c454ad8aad0c5af3.tar.bz2
Improve dragging on WebTextView.
When the WebTextView scrolls, scroll the corresponding RenderTextControl in webkit. Requires a change in frameworks/base.
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp33
-rw-r--r--WebKit/android/jni/WebViewCore.h4
2 files changed, 36 insertions, 1 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 9f457f4..51293b8 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1517,6 +1517,26 @@ void WebViewCore::passToJs(int generation, const WebCore::String& current,
updateTextfield(focus, false, test);
}
+void WebViewCore::scrollFocusedTextInput(int x, int y)
+{
+ WebCore::Node* focus = currentFocus();
+ if (!focus) {
+ DBG_NAV_LOG("!focus");
+ clearTextEntry();
+ return;
+ }
+ WebCore::RenderObject* renderer = focus->renderer();
+ if (!renderer || (!renderer->isTextField() && !renderer->isTextArea())) {
+ DBG_NAV_LOGD("renderer==%p || not text", renderer);
+ clearTextEntry();
+ return;
+ }
+ WebCore::RenderTextControl* renderText =
+ static_cast<WebCore::RenderTextControl*>(renderer);
+ renderText->setScrollLeft(x);
+ renderText->setScrollTop(y);
+}
+
void WebViewCore::setFocusControllerActive(bool active)
{
m_mainFrame->page()->focusController()->setActive(active);
@@ -2180,6 +2200,15 @@ static void PassToJs(JNIEnv *env, jobject obj,
PlatformKeyboardEvent(keyCode, keyValue, 0, down, cap, fn, sym));
}
+static void ScrollFocusedTextInput(JNIEnv *env, jobject obj, jint x, jint y)
+{
+#ifdef ANDROID_INSTRUMENT
+ TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
+#endif
+ WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
+ viewImpl->scrollFocusedTextInput(x, y);
+}
+
static void SetFocusControllerActive(JNIEnv *env, jobject obj, jboolean active)
{
#ifdef ANDROID_INSTRUMENT
@@ -2630,7 +2659,9 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
{ "nativeMoveMouseIfLatest", "(IIII)V",
(void*) MoveMouseIfLatest },
{ "passToJs", "(ILjava/lang/String;IIZZZZ)V",
- (void*) PassToJs } ,
+ (void*) PassToJs },
+ { "nativeScrollFocusedTextInput", "(II)V",
+ (void*) ScrollFocusedTextInput },
{ "nativeSetFocusControllerActive", "(Z)V",
(void*) SetFocusControllerActive },
{ "nativeSaveDocumentState", "(I)V",
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 66ef470..be08830 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -266,6 +266,10 @@ namespace android {
int textGeneration);
void passToJs(int generation,
const WebCore::String& , const WebCore::PlatformKeyboardEvent& );
+ /**
+ * Scroll the focused textfield to (x, y) in document space
+ */
+ void scrollFocusedTextInput(int x, int y);
void setFocusControllerActive(bool active);
void saveDocumentState(WebCore::Frame* frame);