diff options
-rw-r--r-- | WebCore/config.h | 4 | ||||
-rw-r--r-- | WebCore/rendering/HitTestResult.cpp | 17 | ||||
-rw-r--r-- | WebCore/rendering/RenderBlock.cpp | 9 | ||||
-rw-r--r-- | WebCore/rendering/RenderBox.cpp | 5 | ||||
-rw-r--r-- | WebCore/rendering/RenderLayer.cpp | 6 | ||||
-rw-r--r-- | WebCore/rendering/RenderLineBoxList.cpp | 3 | ||||
-rw-r--r-- | WebCore/rendering/RenderSVGRoot.cpp | 7 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 22 |
8 files changed, 12 insertions, 61 deletions
diff --git a/WebCore/config.h b/WebCore/config.h index 0575422..188f212 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -200,9 +200,6 @@ // Enable prefetching when specified via the rel element of <link> elements. #define ENABLE_LINK_PREFETCH 1 -// Enable hit test with point plus a size -#define ANDROID_HITTEST_WITHSIZE - // Enable scrollable divs in separate layers. This might be upstreamed to // webkit.org but for now, it is just an Android feature. #define ENABLE_ANDROID_OVERFLOW_SCROLL 1 @@ -318,4 +315,3 @@ typedef float CGFloat; #if PLATFORM(WIN) && PLATFORM(CG) #define WTF_USE_SAFARI_THEME 1 #endif - diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index 8a986d6..dd96e0e 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -57,13 +57,9 @@ HitTestResult::HitTestResult(const IntPoint& centerPoint, const IntSize& padding : m_point(centerPoint) , m_isOverWidget(false) { -#ifdef ANDROID_HITTEST_WITHSIZE - m_isRectBased = !padding.isEmpty(); -#else // If a zero padding is passed in or either width or height is negative, then it // is not a valid padding and hence not a rect based hit test. m_isRectBased = !(padding.isZero() || (padding.width() < 0 || padding.height() < 0)); -#endif m_padding = m_isRectBased ? padding : IntSize(); } @@ -76,16 +72,12 @@ HitTestResult::HitTestResult(const HitTestResult& other) , m_scrollbar(other.scrollbar()) , m_isOverWidget(other.isOverWidget()) { -#ifndef ANDROID_HITTEST_WITHSIZE // Only copy the padding and ListHashSet in case of rect hit test. // Copying the later is rather expensive. if ((m_isRectBased = other.isRectBasedTest())) { -#endif m_padding = other.padding(); m_rectBasedTestResult = other.rectBasedTestResult(); -#ifndef ANDROID_HITTEST_WITHSIZE } -#endif } HitTestResult::~HitTestResult() @@ -101,16 +93,12 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other) m_innerURLElement = other.URLElement(); m_scrollbar = other.scrollbar(); m_isOverWidget = other.isOverWidget(); -#ifndef ANDROID_HITTEST_WITHSIZE // Only copy the padding and ListHashSet in case of rect hit test. // Copying the later is rather expensive. if ((m_isRectBased = other.isRectBasedTest())) { -#endif m_padding = other.padding(); m_rectBasedTestResult = other.rectBasedTestResult(); -#ifndef ANDROID_HITTEST_WITHSIZE } -#endif return *this; } @@ -404,17 +392,12 @@ bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const if (!isRectBasedTest()) return false; -#ifdef ANDROID_HITTEST_WITHSIZE - if (node) - m_rectBasedTestResult.add(node); -#else // If node is null, return true so the hit test can continue. if (!node) return true; node = node->shadowAncestorNode(); m_rectBasedTestResult.add(node); -#endif return !rect.contains(rectFromPoint(x, y)); } diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 574d389..02b0079 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -3774,17 +3774,8 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) && isPointInOverflowControl(result, _x, _y, tx, ty)) { updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet. -#ifdef ANDROID_HITTEST_WITHSIZE - // FIXME: This looks wrong - the return value does not depend on the hit test result. - result.addNodeToRectBasedTestResult(node(), _x, _y); - if (result.isRectBasedTest()) - ASSERT(node() || isAnonymous()); - else - return true; -#else if (!result.addNodeToRectBasedTestResult(node(), _x, _y)) return true; -#endif } // If we have clipping, then we can't have any spillout. diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 8a3ea8e..d614081 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -35,9 +35,6 @@ #include "htmlediting.h" #include "HTMLElement.h" #include "HTMLNames.h" -#ifdef ANDROID_HITTEST_WITHSIZE -#include "HitTestResult.h" -#endif #include "ImageBuffer.h" #include "FloatQuad.h" #include "Frame.h" @@ -563,6 +560,8 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result } } + // Check our bounds next. For this purpose always assume that we can only be hit in the + // foreground phase (which is true for replaced elements like images). IntRect boundsRect = IntRect(tx, ty, width(), height()); if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectFromPoint(xPos, yPos))) { updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 7c63af9..df80a7c 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -2997,15 +2997,9 @@ RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* r result.append(tempResult); if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) { -#ifdef ANDROID_HITTEST_WITHSIZE - if (!result.isRectBasedTest()) - resultLayer = hitLayer; - result = tempResult; -#else resultLayer = hitLayer; if (!result.isRectBasedTest()) result = tempResult; -#endif if (!depthSortDescendants) break; } diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp index d8b4e75..4d0dcd6 100644 --- a/WebCore/rendering/RenderLineBoxList.cpp +++ b/WebCore/rendering/RenderLineBoxList.cpp @@ -31,9 +31,6 @@ #include "HitTestResult.h" #include "InlineTextBox.h" -#ifdef ANDROID_HITTEST_WITHSIZE -#include "HitTestResult.h" -#endif #include "RenderArena.h" #include "RenderInline.h" #include "RenderView.h" diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 75e2bd2..b66a870 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -334,14 +334,7 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re updateHitTestResult(result, pointInBorderBox); // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. result.addNodeToRectBasedTestResult(child->node(), _x, _y); -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRectBasedTest()) - ASSERT(node() || isAnonymous()); - else - return true; -#else return true; -#endif } } diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index e81e335..42aa718 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1403,7 +1403,6 @@ Vector<IntRect> WebViewCore::getTouchHighlightRects(int x, int y, int slop) { Vector<IntRect> rects; m_mousePos = IntPoint(x - m_scrollOffsetX, y - m_scrollOffsetY); -#ifdef ANDROID_HITTEST_WITHSIZE HitTestResult hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(IntPoint(x, y), false, false, DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest::ReadOnly, IntSize(slop, slop)); if (!hitTestResult.innerNode() || !hitTestResult.innerNode()->inDocument()) { @@ -1437,7 +1436,7 @@ Vector<IntRect> WebViewCore::getTouchHighlightRects(int x, int y, int slop) found = true; break; } - // the nodes in the rawNodeList() are ordered based on z-index during hit testing. + // the nodes in the rectBasedTestResult() are ordered based on z-index during hit testing. // so do not search for the eventNode across explicit z-index border. // TODO: this is a hard one to call. z-index is quite complicated as its value only // matters when you compare two RenderLayer in the same hierarchy level. e.g. in @@ -1618,7 +1617,6 @@ Vector<IntRect> WebViewCore::getTouchHighlightRects(int x, int y, int slop) m_scrollOffsetX, m_scrollOffsetY); } } -#endif return rects; } @@ -2340,15 +2338,15 @@ void WebViewCore::touchUp(int touchGeneration, frame = 0; DBG_NAV_LOGD("touch up on (%d, %d), scrollOffset is (%d, %d), node:%p, frame:%p", m_mousePos.x() + m_scrollOffsetX, m_mousePos.y() + m_scrollOffsetY, m_scrollOffsetX, m_scrollOffsetY, node, frame); } else { - if (m_touchGeneration > touchGeneration) { - DBG_NAV_LOGD("m_touchGeneration=%d > touchGeneration=%d" - " x=%d y=%d", m_touchGeneration, touchGeneration, x, y); - 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(frame, x, y); - m_lastGeneration = touchGeneration; + if (m_touchGeneration > touchGeneration) { + DBG_NAV_LOGD("m_touchGeneration=%d > touchGeneration=%d" + " x=%d y=%d", m_touchGeneration, touchGeneration, x, y); + 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(frame, x, y); + m_lastGeneration = touchGeneration; } if (frame && CacheBuilder::validNode(m_mainFrame, frame, 0)) { frame->loader()->resetMultipleFormSubmissionProtection(); |