diff options
author | John Reck <jreck@google.com> | 2012-03-06 18:22:11 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-03-06 18:22:11 -0800 |
commit | d62f390122ad9098adea5ba31b9eee83e2129aa6 (patch) | |
tree | 720445718bcf37402e5a872736b26eab0c1b9434 /Source | |
parent | 45affaf529022d400844698d81d318be913c7748 (diff) | |
parent | ef193cdbf0553b24f23bb9707f7e91259a142673 (diff) | |
download | external_webkit-d62f390122ad9098adea5ba31b9eee83e2129aa6.zip external_webkit-d62f390122ad9098adea5ba31b9eee83e2129aa6.tar.gz external_webkit-d62f390122ad9098adea5ba31b9eee83e2129aa6.tar.bz2 |
Merge "Fix cursor rings for buttons"
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebKit/android/jni/AndroidHitTestResult.cpp | 4 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 29 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 1 |
3 files changed, 26 insertions, 8 deletions
diff --git a/Source/WebKit/android/jni/AndroidHitTestResult.cpp b/Source/WebKit/android/jni/AndroidHitTestResult.cpp index 16dd809..9be5613 100644 --- a/Source/WebKit/android/jni/AndroidHitTestResult.cpp +++ b/Source/WebKit/android/jni/AndroidHitTestResult.cpp @@ -135,11 +135,15 @@ void AndroidHitTestResult::buildHighlightRects() node = m_hitTestResult.innerNode(); if (!node || !node->renderer()) return; + if (!WebViewCore::nodeIsClickableOrFocusable(node)) + return; Frame* frame = node->document()->frame(); IntPoint frameOffset = m_webViewCore->convertGlobalContentToFrameContent(IntPoint(), frame); RenderObject* renderer = node->renderer(); Vector<FloatQuad> quads; renderer->absoluteFocusRingQuads(quads); + if (!quads.size()) + renderer->absoluteQuads(quads); // No fancy rings, grab some backups 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 397f9c1..af25b3b 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -1674,6 +1674,23 @@ void WebViewCore::selectText(int startX, int startY, int endX, int endY) sc->setSelection(selection); } +bool WebViewCore::nodeIsClickableOrFocusable(Node* node) +{ + if (!node) + return false; + if (node->disabled()) + return false; + if (!node->inDocument()) + return false; + if (!node->renderer() || node->renderer()->style()->visibility() != VISIBLE) + return false; + return node->supportsFocus() + || node->hasEventListeners(eventNames().clickEvent) + || node->hasEventListeners(eventNames().mousedownEvent) + || node->hasEventListeners(eventNames().mouseupEvent) + || node->hasEventListeners(eventNames().mouseoverEvent); +} + // get the highlight rectangles for the touch point (x, y) with the slop AndroidHitTestResult WebViewCore::hitTestAtPoint(int x, int y, int slop, bool doMoveMouse) { @@ -1715,11 +1732,7 @@ AndroidHitTestResult WebViewCore::hitTestAtPoint(int x, int y, int slop, bool do RenderObject* render = eventNode->renderer(); if (render && (render->isBody() || render->isRenderView())) break; - if (eventNode->supportsFocus() - || eventNode->hasEventListeners(eventNames().clickEvent) - || eventNode->hasEventListeners(eventNames().mousedownEvent) - || eventNode->hasEventListeners(eventNames().mouseupEvent) - || eventNode->hasEventListeners(eventNames().mouseoverEvent)) { + if (nodeIsClickableOrFocusable(eventNode)) { found = true; break; } @@ -1820,15 +1833,15 @@ AndroidHitTestResult WebViewCore::hitTestAtPoint(int x, int y, int slop, bool do } // now get the node's highlight rectangles in the page coordinate system if (final.mUrlNode) { + // Update innerNode and innerNonSharedNode + androidHitResult.hitTestResult().setInnerNode(final.mInnerNode); + androidHitResult.hitTestResult().setInnerNonSharedNode(final.mInnerNode); if (final.mUrlNode->isElementNode()) { // We found a URL element. Update the hitTestResult androidHitResult.setURLElement(static_cast<Element*>(final.mUrlNode)); } else { androidHitResult.setURLElement(0); } - // Update innerNode and innerNonSharedNode - androidHitResult.hitTestResult().setInnerNode(final.mInnerNode); - androidHitResult.hitTestResult().setInnerNonSharedNode(final.mInnerNode); IntPoint frameAdjust; if (frame != m_mainFrame) { frameAdjust = frame->view()->contentsToWindow(IntPoint()); diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index 1db498b..c5704e0 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -512,6 +512,7 @@ namespace android { Node** node, HitTestResult* hitTestResult); // This does a sloppy hit test AndroidHitTestResult hitTestAtPoint(int x, int y, int slop, bool doMoveMouse = false); + static bool nodeIsClickableOrFocusable(Node* node); // Open a file chooser for selecting a file to upload void openFileChooser(PassRefPtr<WebCore::FileChooser> ); |