diff options
Diffstat (limited to 'Source/WebKit/android')
-rw-r--r-- | Source/WebKit/android/jni/AndroidHitTestResult.cpp | 5 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 123 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 21 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 12 |
4 files changed, 22 insertions, 139 deletions
diff --git a/Source/WebKit/android/jni/AndroidHitTestResult.cpp b/Source/WebKit/android/jni/AndroidHitTestResult.cpp index 9be5613..a135c42 100644 --- a/Source/WebKit/android/jni/AndroidHitTestResult.cpp +++ b/Source/WebKit/android/jni/AndroidHitTestResult.cpp @@ -141,9 +141,10 @@ void AndroidHitTestResult::buildHighlightRects() IntPoint frameOffset = m_webViewCore->convertGlobalContentToFrameContent(IntPoint(), frame); RenderObject* renderer = node->renderer(); Vector<FloatQuad> quads; - renderer->absoluteFocusRingQuads(quads); + if (renderer->isInline()) + renderer->absoluteFocusRingQuads(quads); if (!quads.size()) - renderer->absoluteQuads(quads); // No fancy rings, grab some backups + renderer->absoluteQuads(quads); // No fancy rings, grab a bounding box for (size_t i = 0; i < quads.size(); i++) { IntRect boundingBox = quads[i].enclosingBoundingBox(); boundingBox.move(-frameOffset.x(), -frameOffset.y()); diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index cdd484b..7da8103 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -457,7 +457,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(IIZZ)V"); m_javaGlue->m_contentDraw = GetJMethod(env, clazz, "contentDraw", "()V"); m_javaGlue->m_requestListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[I[I)V"); - m_javaGlue->m_openFileChooser = GetJMethod(env, clazz, "openFileChooser", "(Ljava/lang/String;)Ljava/lang/String;"); + m_javaGlue->m_openFileChooser = GetJMethod(env, clazz, "openFileChooser", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); m_javaGlue->m_requestSingleListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[II)V"); m_javaGlue->m_jsAlert = GetJMethod(env, clazz, "jsAlert", "(Ljava/lang/String;Ljava/lang/String;)V"); m_javaGlue->m_jsConfirm = GetJMethod(env, clazz, "jsConfirm", "(Ljava/lang/String;Ljava/lang/String;)Z"); @@ -3008,11 +3008,19 @@ void WebViewCore::openFileChooser(PassRefPtr<WebCore::FileChooser> chooser) return; WTF::String acceptType = chooser->acceptTypes(); + WTF::String capture; + +#if ENABLE(MEDIA_CAPTURE) + capture = chooser->capture(); +#endif + jstring jAcceptType = wtfStringToJstring(env, acceptType, true); + jstring jCapture = wtfStringToJstring(env, capture, true); jstring jName = (jstring) env->CallObjectMethod( - javaObject.get(), m_javaGlue->m_openFileChooser, jAcceptType); + javaObject.get(), m_javaGlue->m_openFileChooser, jAcceptType, jCapture); checkException(env); env->DeleteLocalRef(jAcceptType); + env->DeleteLocalRef(jCapture); WTF::String wtfString = jstringToWtfString(env, jName); env->DeleteLocalRef(jName); @@ -3124,27 +3132,6 @@ void WebViewCore::chromeTakeFocus(FocusDirection direction) env->CallVoidMethod(javaObject.get(), m_javaGlue->m_chromeTakeFocus, direction); } -// For when the user clicks the trackball, presses dpad center, or types into an -// unfocused textfield. In the latter case, 'fake' will be true -void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node, bool fake) { - if (!node) { - WebCore::IntPoint pt = m_mousePos; - pt.move(m_scrollOffsetX, m_scrollOffsetY); - WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()-> - hitTestResultAtPoint(pt, false); - node = hitTestResult.innerNode(); - frame = node->document()->frame(); - } - if (node) { - EditorClientAndroid* client - = static_cast<EditorClientAndroid*>( - m_mainFrame->editor()->client()); - client->setShouldChangeSelectedRange(false); - handleMouseClick(frame, node, fake); - client->setShouldChangeSelectedRange(true); - } -} - #if USE(ACCELERATED_COMPOSITING) GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const { @@ -3199,14 +3186,6 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint type = WebCore::TouchEnd; defaultTouchState = WebCore::PlatformTouchPoint::TouchStationary; break; - case 0x100: // WebViewCore.ACTION_LONGPRESS - type = WebCore::TouchLongPress; - defaultTouchState = WebCore::PlatformTouchPoint::TouchPressed; - break; - case 0x200: // WebViewCore.ACTION_DOUBLETAP - type = WebCore::TouchDoubleTap; - defaultTouchState = WebCore::PlatformTouchPoint::TouchPressed; - break; default: // We do not support other kinds of touch event inside WebCore // at the moment. @@ -3240,31 +3219,6 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint return preventDefault; } -void WebViewCore::touchUp(int touchGeneration, - WebCore::Frame* frame, WebCore::Node* node, int x, int y) -{ - if (touchGeneration == 0) { - // m_mousePos should be set in getTouchHighlightRects() - WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(m_mousePos, false); - node = hitTestResult.innerNode(); - if (node) - frame = node->document()->frame(); - else - frame = 0; - } else { - if (m_touchGeneration > touchGeneration) - return; // short circuit if a newer touch has been generated - // This moves m_mousePos to the correct place, and handleMouseClick uses - // m_mousePos to determine where the click happens. - moveMouse(x, y); - m_lastGeneration = touchGeneration; - } - if (frame && validNode(m_mainFrame, frame, 0)) { - frame->loader()->resetMultipleFormSubmissionProtection(); - } - handleMouseClick(frame, node, false); -} - bool WebViewCore::performMouseClick() { WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, @@ -3298,38 +3252,6 @@ static bool shouldSuppressKeyboard(const WebCore::Node* node) { return false; } -// 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 valid = !framePtr || validNode(m_mainFrame, framePtr, nodePtr); - WebFrame* webFrame = WebFrame::getWebFrame(m_mainFrame); - if (valid && nodePtr) { - // Need to special case area tags because an image map could have an area element in the middle - // so when attempting to get the default, the point chosen would be follow the wrong link. - if (nodePtr->hasTagName(WebCore::HTMLNames::areaTag)) { - nodePtr->dispatchSimulatedClick(0, true, true); - return true; - } - } - if (!valid || !framePtr) - framePtr = m_mainFrame; - WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton, - WebCore::MouseEventPressed, 1, false, false, false, false, - WTF::currentTime()); - // ignore the return from as it will return true if the hit point can trigger selection change - framePtr->eventHandler()->handleMousePressEvent(mouseDown); - WebCore::PlatformMouseEvent mouseUp(m_mousePos, m_mousePos, WebCore::LeftButton, - WebCore::MouseEventReleased, 1, false, false, false, false, - WTF::currentTime()); - bool handled = framePtr->eventHandler()->handleMouseReleaseEvent(mouseUp); - - WebCore::Node* focusNode = currentFocus(); - initializeTextInput(focusNode, fake); - return handled; -} - WebViewCore::InputType WebViewCore::getInputType(Node* node) { WebCore::RenderObject* renderer = node->renderer(); @@ -4479,16 +4401,6 @@ static jboolean Key(JNIEnv* env, jobject obj, jint nativeClass, jint keyCode, unichar, repeatCount, isDown, isShift, isAlt, isSym)); } -static void Click(JNIEnv* env, jobject obj, jint nativeClass, int framePtr, - int nodePtr, jboolean fake) -{ - WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); - ALOG_ASSERT(viewImpl, "viewImpl not set in Click"); - - viewImpl->click(reinterpret_cast<WebCore::Frame*>(framePtr), - reinterpret_cast<WebCore::Node*>(nodePtr), fake); -} - static void ContentInvalidateAll(JNIEnv* env, jobject obj, jint nativeClass) { reinterpret_cast<WebViewCore*>(nativeClass)->contentInvalidateAll(); @@ -4666,15 +4578,6 @@ static jboolean HandleTouchEvent(JNIEnv* env, jobject obj, jint nativeClass, return viewImpl->handleTouchEvent(action, ids, points, actionIndex, metaState); } -static void TouchUp(JNIEnv* env, jobject obj, jint nativeClass, - jint touchGeneration, jint frame, jint node, jint x, jint y) -{ - WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); - ALOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); - viewImpl->touchUp(touchGeneration, - (WebCore::Frame*) frame, (WebCore::Node*) node, x, y); -} - static bool MouseClick(JNIEnv* env, jobject obj, jint nativeClass) { WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); @@ -5064,8 +4967,6 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) FocusBoundsChanged } , { "nativeKey", "(IIIIZZZZ)Z", (void*) Key }, - { "nativeClick", "(IIIZ)V", - (void*) Click }, { "nativeContentInvalidateAll", "(I)V", (void*) ContentInvalidateAll }, { "nativeSendListBoxChoices", "(I[ZI)V", @@ -5099,9 +5000,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, { "nativeHandleTouchEvent", "(II[I[I[IIII)Z", - (void*) HandleTouchEvent }, - { "nativeTouchUp", "(IIIIII)V", - (void*) TouchUp }, + (void*) HandleTouchEvent }, { "nativeMouseClick", "(I)Z", (void*) MouseClick }, { "nativeRetrieveHref", "(III)Ljava/lang/String;", diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index 00b4bda..82a65cf 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -323,13 +323,6 @@ namespace android { void chromeTakeFocus(WebCore::FocusDirection direction); /** - * Handle (trackball) click event / dpad center press from Java. - * Also used when typing into an unfocused textfield, in which case 'fake' - * will be true. - */ - void click(WebCore::Frame* frame, WebCore::Node* node, bool fake); - - /** * Handle touch event */ bool handleTouchEvent(int action, WTF::Vector<int>& ids, @@ -337,19 +330,6 @@ namespace android { int actionIndex, int metaState); /** - * Handle motionUp event from the UI thread (called touchUp in the - * WebCore thread). - * @param touchGeneration Generation number for touches so we can ignore - * touches when a newer one has been generated. - * @param frame Pointer to Frame containing the node that was touched. - * @param node Pointer to Node that was touched. - * @param x x-position of the touch. - * @param y y-position of the touch. - */ - void touchUp(int touchGeneration, WebCore::Frame* frame, - WebCore::Node* node, int x, int y); - - /** * Clicks the mouse at its current location */ bool performMouseClick(); @@ -659,7 +639,6 @@ namespace android { * @param fake This is a fake mouse click, used to put a textfield into focus. Do not * open the IME. */ - bool handleMouseClick(WebCore::Frame*, WebCore::Node*, bool fake); WebCore::HTMLAnchorElement* retrieveAnchorElement(int x, int y); WebCore::HTMLElement* retrieveElement(int x, int y, const WebCore::QualifiedName& ); diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 44ad1c5..22598eb 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -711,13 +711,17 @@ class GLDrawFunctor : Functor { int titlebarHeight = webViewRect.height() - viewRect.height(); uirenderer::DrawGlInfo* info = reinterpret_cast<uirenderer::DrawGlInfo*>(data); - WebCore::IntRect localViewRect = viewRect; - if (info->isLayer) - localViewRect.move(-1 * localViewRect.x(), -1 * localViewRect.y()); - WebCore::IntRect clip(info->clipLeft, info->clipTop, info->clipRight - info->clipLeft, info->clipBottom - info->clipTop); + + WebCore::IntRect localViewRect = viewRect; + if (info->isLayer) { + // When webview is on a layer, we need to use the viewport relative + // to the FBO, rather than the screen(which will use viewRect). + localViewRect.setX(clip.x()); + localViewRect.setY(info->height - clip.y() - clip.height()); + } bool shouldDraw = (messageId == uirenderer::DrawGlInfo::kModeDraw); TilesManager::instance()->shader()->setWebViewMatrix(info->transform, info->isLayer); int returnFlags = (*wvInstance.*funcPtr)(localViewRect, &inval, webViewRect, |