diff options
author | Leon Scroggins <scroggo@google.com> | 2011-01-21 11:57:40 -0500 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2011-01-21 15:41:50 -0500 |
commit | f0425628b4e83bf9e1c8275d809d433baeaf768c (patch) | |
tree | da8a9a68c7757953bb893373cb865a25656fe5eb /WebKit/android/jni/WebViewCore.cpp | |
parent | 7ab151a3c6a4efc42f6e3a4d09254c6767d13fec (diff) | |
download | external_webkit-f0425628b4e83bf9e1c8275d809d433baeaf768c.zip external_webkit-f0425628b4e83bf9e1c8275d809d433baeaf768c.tar.gz external_webkit-f0425628b4e83bf9e1c8275d809d433baeaf768c.tar.bz2 |
Line up text with WebTextView.
Bug:3321608
Bug:3085564
Scroll the UI layer for a <textarea> when scrolling the
WebTextView. When clicking on a <textarea>, send the scroll
point so the click happens properly.
Requires a change to frameworks/base.
Change-Id: I3b32a53db350b6c49fdbf8dd177c34854aae66b4
Diffstat (limited to 'WebKit/android/jni/WebViewCore.cpp')
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 51565bb..6fd7b9c 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -2811,7 +2811,7 @@ void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node, bool fake) { = static_cast<EditorClientAndroid*>( m_mainFrame->editor()->client()); client->setShouldChangeSelectedRange(false); - handleMouseClick(frame, node, fake); + handleMouseClick(frame, node, fake, -1); client->setShouldChangeSelectedRange(true); } } @@ -2890,7 +2890,7 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint } void WebViewCore::touchUp(int touchGeneration, - WebCore::Frame* frame, WebCore::Node* node, int x, int y) + WebCore::Frame* frame, WebCore::Node* node, int x, int y, int scrollY) { if (touchGeneration == 0) { // m_mousePos should be set in getTouchHighlightRects() @@ -2917,7 +2917,7 @@ void WebViewCore::touchUp(int touchGeneration, } DBG_NAV_LOGD("touchGeneration=%d handleMouseClick frame=%p node=%p" " x=%d y=%d", touchGeneration, frame, node, x, y); - handleMouseClick(frame, node, false); + handleMouseClick(frame, node, false, scrollY); } // Return the RenderLayer for the given RenderObject only if the layer is @@ -2968,7 +2968,7 @@ static void scrollLayer(WebCore::RenderObject* renderer, WebCore::IntPoint* pos) // Common code for both clicking with the trackball and touchUp // Also used when typing into a non-focused textfield to give the textfield focus, // in which case, 'fake' is set to true -bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr, bool fake) +bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr, bool fake, int scrollY) { m_lastClickWasOnTextInput = false; bool valid = framePtr == NULL @@ -3024,18 +3024,19 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node DBG_NAV_LOG("list box"); return true; } - } - if (!valid || !framePtr) - framePtr = m_mainFrame; - if (nodePtr && valid) { - scrollLayer(nodePtr->renderer(), &m_mousePos); - if (isContentEditable(nodePtr) || (nodePtr->renderer() - && (nodePtr->renderer()-> isTextArea() || nodePtr->renderer()->isTextField()))) { + if (scrollY != -1 && renderer && renderer->isTextArea()) + static_cast<RenderTextControl*>(renderer)->setScrollTop(scrollY); + else + scrollLayer(renderer, &m_mousePos); + if (isContentEditable(nodePtr) || (renderer + && (renderer->isTextArea() || renderer->isTextField()))) { // The user clicked on a text input field. If this causes a blur event // on a different text input, do not hide the keyboard in formDidBlur m_lastClickWasOnTextInput = true; } } + if (!valid || !framePtr) + framePtr = m_mainFrame; webFrame->setUserInitiatedAction(true); WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, WebCore::MouseEventPressed, 1, false, false, false, false, @@ -3832,7 +3833,7 @@ static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArra } static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, - jint frame, jint node, jint x, jint y) + jint frame, jint node, jint x, jint y, jint scrollY) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); @@ -3840,7 +3841,7 @@ static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->touchUp(touchGeneration, - (WebCore::Frame*) frame, (WebCore::Node*) node, x, y); + (WebCore::Frame*) frame, (WebCore::Node*) node, x, y, scrollY); } static jstring RetrieveHref(JNIEnv *env, jobject obj, jint x, jint y) @@ -4256,7 +4257,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) FindAddress }, { "nativeHandleTouchEvent", "(I[I[I[III)Z", (void*) HandleTouchEvent }, - { "nativeTouchUp", "(IIIII)V", + { "nativeTouchUp", "(IIIIII)V", (void*) TouchUp }, { "nativeRetrieveHref", "(II)Ljava/lang/String;", (void*) RetrieveHref }, |