diff options
author | Steve Block <steveblock@google.com> | 2010-08-05 11:07:27 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-08-09 13:25:51 +0100 |
commit | ad3386af2204fbbc9033a6dcced2f9b0adcd6f10 (patch) | |
tree | 093ada87dd1caff6efd1f3118e533c159c43256a | |
parent | db14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (diff) | |
download | external_webkit-ad3386af2204fbbc9033a6dcced2f9b0adcd6f10.zip external_webkit-ad3386af2204fbbc9033a6dcced2f9b0adcd6f10.tar.gz external_webkit-ad3386af2204fbbc9033a6dcced2f9b0adcd6f10.tar.bz2 |
Merge WebKit at r64523 : Fix conflicts due to ANDROID_HITTEST_WITHSIZE
A modified version of this Android-specific code was upstreamed in
http://trac.webkit.org/changeset/64272
For the most part, the differences between the Android and upstreamed
versions are syntactic only. In these cases, we take the upstream
version.
In a small number of cases, logical changes exist. In these cases, the
Android logic has been retained, guarded with ANDROID_HITTEST_WITHSIZE,
but using the new syntax.
In particular ...
- Android's HitTestResult::intersects(x, y, rect) is logically equivalent
to the uspstream IntRect::intersects(HitTestPoint::rectFromPoint(x, y))).
- Android's HitTestResult::addRawNode() is logically equivalent to the
upstream HitTestResult::m_rectBasedTestResult.add().
- Android's HitTestResult::isRegionTest() is slightly different from the
upstream HitTestResult::isRectBasedTest(). The latter is modified with
a new ANDROID_HITTEST_WITHSIZE guard in HitTestResult::HitTestResult()
to maintain the same behaviour.
- The upstreamed code uses
HitTestResult::addNodeToRectBasedTestResult() as a helper method in
place of inline logic in the Android version. The slight difference
in behaviour between this helper and the Android logic is reflected in
the new ANDROID_HITTEST_WITHSIZE guard in the helper.
This change should introduce no change in behaviour.
Change-Id: I974d68e3ac963f18334418e32b08c3fd9ab1182e
-rw-r--r-- | WebCore/page/EventHandler.cpp | 22 | ||||
-rw-r--r-- | WebCore/page/EventHandler.h | 8 | ||||
-rw-r--r-- | WebCore/rendering/EllipsisBox.cpp | 19 | ||||
-rw-r--r-- | WebCore/rendering/HitTestResult.cpp | 82 | ||||
-rw-r--r-- | WebCore/rendering/HitTestResult.h | 30 | ||||
-rw-r--r-- | WebCore/rendering/InlineFlowBox.cpp | 26 | ||||
-rw-r--r-- | WebCore/rendering/InlineTextBox.cpp | 18 | ||||
-rw-r--r-- | WebCore/rendering/RenderBlock.cpp | 69 | ||||
-rw-r--r-- | WebCore/rendering/RenderBox.cpp | 21 | ||||
-rw-r--r-- | WebCore/rendering/RenderImage.cpp | 22 | ||||
-rw-r--r-- | WebCore/rendering/RenderLayer.cpp | 84 | ||||
-rw-r--r-- | WebCore/rendering/RenderLineBoxList.cpp | 16 | ||||
-rw-r--r-- | WebCore/rendering/RenderSVGRoot.cpp | 23 | ||||
-rw-r--r-- | WebCore/rendering/RenderTable.cpp | 33 | ||||
-rw-r--r-- | WebCore/rendering/RenderTableSection.cpp | 14 | ||||
-rw-r--r-- | WebCore/rendering/RenderWidget.cpp | 6 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 8 |
17 files changed, 41 insertions, 460 deletions
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 8f213c6..20ceed9 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -870,23 +870,9 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const } #endif // ENABLE(DRAG_SUPPORT) -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE -HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& pointPadding) -#else -HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType) -#endif -{ -#ifdef ANDROID_HITTEST_WITHSIZE - HitTestResult result(point, pointPadding); -#else - HitTestResult result(point); -#endif -======= HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& padding) { HitTestResult result(point, padding); ->>>>>>> webkit.org at r64523 if (!m_frame->contentRenderer()) return result; if (ignoreClipping) @@ -907,15 +893,7 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all FrameView* view = static_cast<FrameView*>(widget); IntPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(), result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop()); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - HitTestResult widgetHitTestResult(widgetPoint, pointPadding); -#else - HitTestResult widgetHitTestResult(widgetPoint); -#endif -======= HitTestResult widgetHitTestResult(widgetPoint, padding); ->>>>>>> webkit.org at r64523 frame->contentRenderer()->layer()->hitTest(HitTestRequest(hitType), widgetHitTestResult); result = widgetHitTestResult; diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index 34b7e28..242601b 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -106,18 +106,10 @@ public: void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, const IntSize& pointPadding = IntSize()); -#else - HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active); -#endif -======= HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, const IntSize& padding = IntSize()); ->>>>>>> webkit.org at r64523 bool mousePressed() const { return m_mousePressed; } void setMousePressed(bool pressed) { m_mousePressed = pressed; } diff --git a/WebCore/rendering/EllipsisBox.cpp b/WebCore/rendering/EllipsisBox.cpp index 951df9f..61cd524 100644 --- a/WebCore/rendering/EllipsisBox.cpp +++ b/WebCore/rendering/EllipsisBox.cpp @@ -113,30 +113,11 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } } -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - IntRect boundsRect = IntRect(tx, ty, m_width, m_height); - if (visibleToHitTesting() && result.intersects(x, y, boundsRect)) { -#else - if (visibleToHitTesting() && IntRect(tx, ty, m_width, m_height).contains(x, y)) { -#endif - renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) { - ASSERT(renderer()->node() || renderer()->isAnonymous()); - result.addRawNode(renderer()->node()); - if (!result.containedBy(x, y, boundsRect)) - return false; - } -#endif - return true; -======= IntRect boundsRect = IntRect(tx, ty, m_width, m_height); if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(x, y))) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, boundsRect)) return true; ->>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index e1dfecb..8a986d6 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -53,26 +53,19 @@ HitTestResult::HitTestResult(const IntPoint& point) { } -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE -HitTestResult::HitTestResult(const IntPoint& point, const IntSize& padding) - : m_point(point) - , m_pointPadding(padding) - , m_isOverWidget(false) -{ -} -#endif -======= 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(); } ->>>>>>> webkit.org at r64523 HitTestResult::HitTestResult(const HitTestResult& other) : m_innerNode(other.innerNode()) @@ -82,17 +75,17 @@ HitTestResult::HitTestResult(const HitTestResult& other) , m_innerURLElement(other.URLElement()) , m_scrollbar(other.scrollbar()) , m_isOverWidget(other.isOverWidget()) -#ifdef ANDROID_HITTEST_WITHSIZE - , m_pointPadding(other.pointPadding()) - , m_rawNodeList(other.rawNodeList()) -#endif { +#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() @@ -108,19 +101,16 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other) m_innerURLElement = other.URLElement(); m_scrollbar = other.scrollbar(); m_isOverWidget = other.isOverWidget(); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - m_pointPadding = other.pointPadding(); - m_rawNodeList = other.rawNodeList(); -#endif -======= +#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 } ->>>>>>> webkit.org at r64523 +#endif return *this; } @@ -407,24 +397,6 @@ bool HitTestResult::isContentEditable() const return m_innerNonSharedNode->isContentEditable(); } -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - -bool HitTestResult::intersects(int x, int y, const IntRect& other) const -{ - IntRect pointRect(x - m_pointPadding.width(), y - m_pointPadding.height(), 2 * m_pointPadding.width() + 1, 2* m_pointPadding.height() + 1); - return other.intersects(pointRect); -} - -bool HitTestResult::containedBy(int x, int y, const IntRect& other) const -{ - IntRect pointRect(x - m_pointPadding.width(), y - m_pointPadding.height(), 2 * m_pointPadding.width() + 1, 2* m_pointPadding.height() + 1); - return other.contains(pointRect); -} - -void HitTestResult::merge(const HitTestResult& other) -{ -======= bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const IntRect& rect) { // If it is not a rect-based hit test, this method has to be no-op. @@ -432,12 +404,17 @@ 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)); } @@ -446,7 +423,6 @@ void HitTestResult::append(const HitTestResult& other) { ASSERT(isRectBasedTest() && other.isRectBasedTest()); ->>>>>>> webkit.org at r64523 if (!m_innerNode && other.innerNode()) { m_innerNode = other.innerNode(); m_innerNonSharedNode = other.innerNonSharedNode(); @@ -456,34 +432,10 @@ void HitTestResult::append(const HitTestResult& other) m_isOverWidget = other.isOverWidget(); } -<<<<<<< HEAD - const Vector<RefPtr<Node> >& list = other.rawNodeList(); - Vector<RefPtr<Node> >::const_iterator last = list.end(); - for (Vector<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) - addRawNode(it->get()); -} - -void HitTestResult::addRawNode(Node* node) -{ - if (!node) - return; - - Vector<RefPtr<Node> >::const_iterator last = m_rawNodeList.end(); - for (Vector<RefPtr<Node> >::const_iterator it = m_rawNodeList.begin(); it != last; ++it) - if ((*it) == node) - return; - - m_rawNodeList.append(node); -} - -#endif // ANDROID_HITTEST_WITHSIZE - -======= const ListHashSet<RefPtr<Node> >& list = other.rectBasedTestResult(); ListHashSet<RefPtr<Node> >::const_iterator last = list.end(); for (ListHashSet<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) m_rectBasedTestResult.add(it->get()); } ->>>>>>> webkit.org at r64523 } // namespace WebCore diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h index 6d39e8d..f47e2a5 100644 --- a/WebCore/rendering/HitTestResult.h +++ b/WebCore/rendering/HitTestResult.h @@ -24,14 +24,7 @@ #include "IntRect.h" #include "IntSize.h" #include "TextDirection.h" -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE -#include <IntSize.h> -#include <wtf/Vector.h> -#endif -======= #include <wtf/ListHashSet.h> ->>>>>>> webkit.org at r64523 #include <wtf/RefPtr.h> namespace WebCore { @@ -88,20 +81,6 @@ public: bool isLiveLink() const; bool isContentEditable() const; -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - HitTestResult(const IntPoint&, const IntSize&); - - IntSize pointPadding() const { return m_pointPadding; } - bool isRegionTest() const { return !m_pointPadding.isEmpty(); } - bool intersects(int, int, const IntRect&) const; - bool containedBy(int, int, const IntRect&) const; - - void merge(const HitTestResult&); - void addRawNode(Node*); - const Vector<RefPtr<Node> >& rawNodeList() const { return m_rawNodeList; } -#endif -======= // Rect-based hit test related methods. bool isRectBasedTest() const { return m_isRectBased; } IntRect rectFromPoint(int x, int y) const; @@ -114,7 +93,6 @@ public: bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& rect = IntRect()); const ListHashSet<RefPtr<Node> >& rectBasedTestResult() const { return m_rectBasedTestResult; } void append(const HitTestResult&); ->>>>>>> webkit.org at r64523 private: @@ -126,17 +104,9 @@ private: RefPtr<Element> m_innerURLElement; RefPtr<Scrollbar> m_scrollbar; bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example). -<<<<<<< HEAD - -#ifdef ANDROID_HITTEST_WITHSIZE - IntSize m_pointPadding; - Vector<RefPtr<Node> > m_rawNodeList; -#endif -======= bool m_isRectBased; IntSize m_padding; ListHashSet<RefPtr<Node> > m_rectBasedTestResult; ->>>>>>> webkit.org at r64523 }; inline IntRect HitTestResult::rectFromPoint(int x, int y) const diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index daa48f2..dfe7561 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -611,15 +611,7 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re { IntRect overflowRect(visibleOverflowRect()); overflowRect.move(tx, ty); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (!result.intersects(x, y, overflowRect)) -#else - if (!overflowRect.contains(x, y)) -#endif -======= if (!overflowRect.intersects(result.rectFromPoint(x, y))) ->>>>>>> webkit.org at r64523 return false; // Check children first. @@ -632,28 +624,10 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re // Now check ourselves. IntRect rect(tx + m_x, ty + m_y, m_width, height()); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (visibleToHitTesting() && result.intersects(x, y, rect)) { -#else - if (visibleToHitTesting() && rect.contains(x, y)) { -#endif - renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); // Don't add in m_x or m_y here, we want coords in the containing block's space. -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) { - ASSERT(renderer()->node() || renderer()->isAnonymous()); - result.addRawNode(renderer()->node()); - if (!result.containedBy(x, y, rect)) - return false; - } -#endif - return true; -======= if (visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); // Don't add in m_x or m_y here, we want coords in the containing block's space. if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) return true; ->>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp index b0e2887..50f6cfa 100644 --- a/WebCore/rendering/InlineTextBox.cpp +++ b/WebCore/rendering/InlineTextBox.cpp @@ -287,28 +287,10 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in return false; IntRect rect(tx + m_x, ty + m_y, m_width, height()); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (m_truncation != cFullTruncation && visibleToHitTesting() && result.intersects(x, y, rect)) { -#else - if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.contains(x, y)) { -#endif - renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) { - ASSERT(renderer()->node() || renderer()->isAnonymous()); - result.addRawNode(renderer()->node()); - if (!result.containedBy(x, y, rect)) - return false; - } -#endif - return true; -======= if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) return true; ->>>>>>> webkit.org at r64523 } return false; } diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 3f369c3..c982d26 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -3767,49 +3767,31 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // Check if we need to do anything at all. IntRect overflowBox = visibleOverflowRect(); overflowBox.move(tx, ty); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (!result.intersects(_x, _y, overflowBox)) -#else - if (!overflowBox.contains(_x, _y)) -#endif -======= if (!overflowBox.intersects(result.rectFromPoint(_x, _y))) ->>>>>>> webkit.org at r64523 return false; } if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) && isPointInOverflowControl(result, _x, _y, tx, ty)) { updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); -<<<<<<< HEAD + // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet. #ifdef ANDROID_HITTEST_WITHSIZE - // TODO: isPointInOverflowControl() doesn't handle region test yet. - if (result.isRegionTest()) { + // 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()); - result.addRawNode(node()); - } else -#endif - return true; -======= - // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet. + else + return true; +#else if (!result.addNodeToRectBasedTestResult(node(), _x, _y)) return true; ->>>>>>> webkit.org at r64523 +#endif } // If we have clipping, then we can't have any spillout. bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); bool useClip = (hasControlClip() || useOverflowClip); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - bool checkChildren = !useClip || (hasControlClip() ? result.intersects(_x, _y, controlClipRect(tx, ty)) : result.intersects(_x, _y, overflowClipRect(tx, ty))); -#else - bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).contains(_x, _y) : overflowClipRect(tx, ty).contains(_x, _y)); -#endif -======= IntRect hitTestArea(result.rectFromPoint(_x, _y)); bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).intersects(hitTestArea) : overflowClipRect(tx, ty).intersects(hitTestArea)); ->>>>>>> webkit.org at r64523 if (checkChildren) { // Hit test descendants first. int scrolledX = tx; @@ -3857,28 +3839,10 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // Now hit test our background if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) { IntRect boundsRect(tx, ty, width(), height()); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (visibleToHitTesting() && result.intersects(_x, _y, boundsRect)) { -#else - if (visibleToHitTesting() && boundsRect.contains(_x, _y)) { -#endif - updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) { - ASSERT(node() || isAnonymous()); - result.addRawNode(node()); - if (!result.containedBy(_x, _y, boundsRect)) - return false; - } -#endif - return true; -======= if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(_x, _y))) { updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); if (!result.addNodeToRectBasedTestResult(node(), _x, _y, boundsRect)) return true; ->>>>>>> webkit.org at r64523 } } @@ -3903,33 +3867,16 @@ bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& r currYOffset += colRect.height(); colRect.move(tx, ty); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.intersects(x, y, colRect)) { -#else - if (colRect.contains(x, y)) { -#endif -======= if (colRect.intersects(result.rectFromPoint(x, y))) { ->>>>>>> webkit.org at r64523 // The point is inside this column. // Adjust tx and ty to change where we hit test. int finalX = tx + currXOffset; int finalY = ty + currYOffset; -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest() && !result.containedBy(x, y, colRect)) - hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); - else -#endif - return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); -======= if (result.isRectBasedTest() && !colRect.contains(result.rectFromPoint(x, y))) hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); else return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); ->>>>>>> webkit.org at r64523 } } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index b546893..e11c7ad 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -563,32 +563,11 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result } } -#ifdef ANDROID_HITTEST_WITHSIZE - IntRect boundsRect = IntRect(tx, ty, width(), height()); - if (visibleToHitTesting() && action == HitTestForeground && result.intersects(xPos, yPos, boundsRect)) { -#else - // 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). -<<<<<<< HEAD - if (visibleToHitTesting() && action == HitTestForeground && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) { -#endif - updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) { - ASSERT(node() || isAnonymous()); - result.addRawNode(node()); - if (!result.containedBy(xPos, yPos, boundsRect)) - return false; - } -#endif - return true; -======= IntRect boundsRect = IntRect(tx, ty, width(), height()); if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectFromPoint(xPos, yPos))) { updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect)) return true; ->>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 3612ed5..f34b691 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -387,25 +387,10 @@ HTMLMapElement* RenderImage::imageMap() const bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) { -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - HitTestResult tempResult(result.point(), result.pointPadding()); -#else - HitTestResult tempResult(result.point()); -#endif - bool inside = RenderReplaced::nodeAtPoint(request, tempResult, x, y, tx, ty, hitTestAction); - -#ifdef ANDROID_HITTEST_WITHSIZE - if (tempResult.innerNode() && node()) { -#else - if (inside && node()) { -#endif -======= HitTestResult tempResult(result.point(), result.padding()); bool inside = RenderReplaced::nodeAtPoint(request, tempResult, x, y, tx, ty, hitTestAction); if (tempResult.innerNode() && node()) { ->>>>>>> webkit.org at r64523 if (HTMLMapElement* map = imageMap()) { IntRect contentBox = contentBoxRect(); float zoom = style()->effectiveZoom(); @@ -416,15 +401,8 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } } -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (!inside && result.isRegionTest()) - result.merge(tempResult); -#endif -======= if (!inside && result.isRectBasedTest()) result.append(tempResult); ->>>>>>> webkit.org at r64523 if (inside) result = tempResult; return inside; diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 998ffa7..51b9326 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -2761,15 +2761,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (parent()) { IntRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects); // Go ahead and test the enclosing clip now. -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (!result.intersects(hitTestPoint.x(), hitTestPoint.y(), clipRect)) -#else - if (!clipRect.contains(hitTestPoint)) -#endif -======= if (!clipRect.intersects(hitTestArea)) ->>>>>>> webkit.org at r64523 return 0; } @@ -2882,27 +2874,6 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont } // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.intersects(hitTestPoint.x(), hitTestPoint.y(), fgRect) && isSelfPaintingLayer()) { -#else - if (fgRect.contains(hitTestPoint) && isSelfPaintingLayer()) { -#endif - // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost. -#ifdef ANDROID_HITTEST_WITHSIZE - HitTestResult tempResult(result.point(), result.pointPadding()); -#else - HitTestResult tempResult(result.point()); -#endif - if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestDescendants) && - isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) - result.merge(tempResult); - else -#endif - result = tempResult; -======= if (fgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost. HitTestResult tempResult(result.point(), result.padding()); @@ -2912,21 +2883,12 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont result.append(tempResult); else result = tempResult; ->>>>>>> webkit.org at r64523 if (!depthSortDescendants) return this; // Foreground can depth-sort with descendant layers, so keep this as a candidate. candidateLayer = this; -<<<<<<< HEAD - } -#ifdef ANDROID_HITTEST_WITHSIZE - else if (result.isRegionTest()) - result.merge(tempResult); -#endif -======= } else if (result.isRectBasedTest()) result.append(tempResult); ->>>>>>> webkit.org at r64523 } // Now check our negative z-index children. @@ -2942,29 +2904,6 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (candidateLayer) return candidateLayer; -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.intersects(hitTestPoint.x(), hitTestPoint.y(), bgRect) && isSelfPaintingLayer()) { - HitTestResult tempResult(result.point(), result.pointPadding()); -#else - if (bgRect.contains(hitTestPoint) && isSelfPaintingLayer()) { - HitTestResult tempResult(result.point()); -#endif - if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestSelf) && - isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) - result.merge(tempResult); - else -#endif - result = tempResult; - return this; - } -#ifdef ANDROID_HITTEST_WITHSIZE - else if (result.isRegionTest()) - result.merge(tempResult); -#endif -======= if (bgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { HitTestResult tempResult(result.point(), result.padding()); if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestSelf) && @@ -2976,7 +2915,6 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont return this; } else if (result.isRectBasedTest()) result.append(tempResult); ->>>>>>> webkit.org at r64523 } return 0; @@ -3024,39 +2962,27 @@ RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* r for (int i = list->size() - 1; i >= 0; --i) { RenderLayer* childLayer = list->at(i); RenderLayer* hitLayer = 0; -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - HitTestResult tempResult(result.point(), result.pointPadding()); -#else - HitTestResult tempResult(result.point()); -#endif -======= HitTestResult tempResult(result.point(), result.padding()); ->>>>>>> webkit.org at r64523 if (childLayer->isPaginated()) hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestPoint, transformState, zOffsetForDescendants); else hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempResult, hitTestRect, hitTestPoint, false, transformState, zOffsetForDescendants); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) - result.merge(tempResult); -#endif -======= // If it a rect-based test, we can safely append the temporary result since it might had hit // nodes but not necesserily had hitLayer set. if (result.isRectBasedTest()) result.append(tempResult); ->>>>>>> webkit.org at r64523 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) { #ifdef ANDROID_HITTEST_WITHSIZE - if (!result.isRegionTest()) -#endif + 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 06aab89..d8b4e75 100644 --- a/WebCore/rendering/RenderLineBoxList.cpp +++ b/WebCore/rendering/RenderLineBoxList.cpp @@ -249,32 +249,16 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq // contain the point. This is a quick short-circuit that we can take to avoid walking any lines. // FIXME: This check is flawed in the following extremely obscure way: // if some line in the middle has a huge overflow, it might actually extend below the last line. -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if ((y - result.pointPadding().height() >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y + result.pointPadding().height() < ty + firstLineBox()->root()->topVisibleOverflow())) -#else - if ((y >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y < ty + firstLineBox()->root()->topVisibleOverflow())) -#endif -======= if (y - result.paddingHeight() >= ty + lastLineBox()->root()->bottomVisibleOverflow() || y + result.paddingHeight() < ty + firstLineBox()->root()->topVisibleOverflow()) ->>>>>>> webkit.org at r64523 return false; // See if our root lines contain the point. If so, then we hit test // them further. Note that boxes can easily overlap, so we can't make any assumptions // based off positions of our first line box or our last line box. for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) { -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (y + result.pointPadding().height() >= ty + curr->root()->topVisibleOverflow() && y - result.pointPadding().height() < ty + curr->root()->bottomVisibleOverflow()) { -#else - if (y >= ty + curr->root()->topVisibleOverflow() && y < ty + curr->root()->bottomVisibleOverflow()) { -#endif -======= if (y + result.paddingHeight() >= ty + curr->root()->topVisibleOverflow() && y - result.paddingHeight() < ty + curr->root()->bottomVisibleOverflow()) { ->>>>>>> webkit.org at r64523 bool inside = curr->nodeAtPoint(request, result, x, y, tx, ty); if (inside) { renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty)); diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 7ddebf2..75e2bd2 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -26,13 +26,7 @@ #include "RenderSVGRoot.h" #include "GraphicsContext.h" -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE -#include "HitTestResult.h" -#endif -======= #include "HitTestResult.h" ->>>>>>> webkit.org at r64523 #include "RenderSVGContainer.h" #include "RenderSVGResource.h" #include "RenderView.h" @@ -338,19 +332,16 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { // FIXME: CSS/HTML assumes the local point is relative to the border box, right? updateHitTestResult(result, pointInBorderBox); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - // TODO: nodeAtFloatPoint() doesn't handle region test yet. - if (result.isRegionTest()) { - ASSERT(node() || isAnonymous()); - result.addRawNode(node()); - } else -#endif -======= // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. result.addNodeToRectBasedTestResult(child->node(), _x, _y); ->>>>>>> webkit.org at r64523 +#ifdef ANDROID_HITTEST_WITHSIZE + if (result.isRectBasedTest()) + ASSERT(node() || isAnonymous()); + else + return true; +#else return true; +#endif } } diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 7c54837..f9f0f56 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -31,13 +31,7 @@ #include "Document.h" #include "FixedTableLayout.h" #include "FrameView.h" -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" -#endif -======= -#include "HitTestResult.h" ->>>>>>> webkit.org at r64523 #include "HTMLNames.h" #include "RenderLayer.h" #include "RenderTableCell.h" @@ -1187,15 +1181,7 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu ty += y(); // Check kids first. -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (!hasOverflowClip() || result.intersects(xPos, yPos, overflowClipRect(tx, ty))) { -#else - if (!hasOverflowClip() || overflowClipRect(tx, ty).contains(xPos, yPos)) { -#endif -======= if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.rectFromPoint(xPos, yPos))) { ->>>>>>> webkit.org at r64523 for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption) && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { @@ -1206,30 +1192,11 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } // Check our bounds next. -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - IntRect boundsRect = IntRect(tx, ty, width(), height()); - if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && result.intersects(xPos, yPos, boundsRect)) { -#else - if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) { -#endif - updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); -#ifdef ANDROID_HITTEST_WITHSIZE - if (result.isRegionTest()) { - ASSERT(node() || isAnonymous()); - result.addRawNode(node()); - if (!result.containedBy(xPos, yPos, boundsRect)) - return false; - } -#endif - return true; -======= IntRect boundsRect = IntRect(tx, ty, width(), height()); if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectFromPoint(xPos, yPos))) { updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect)) return true; ->>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp index e094f36..e192e29 100644 --- a/WebCore/rendering/RenderTableSection.cpp +++ b/WebCore/rendering/RenderTableSection.cpp @@ -28,13 +28,7 @@ #include "CachedImage.h" #include "Document.h" -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" -#endif -======= -#include "HitTestResult.h" ->>>>>>> webkit.org at r64523 #include "HTMLNames.h" #include "RenderTableCell.h" #include "RenderTableCol.h" @@ -1293,15 +1287,7 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul tx += x(); ty += y(); -<<<<<<< HEAD -#ifdef ANDROID_HITTEST_WITHSIZE - if (hasOverflowClip() && !result.intersects(xPos, yPos, overflowClipRect(tx, ty))) -#else - if (hasOverflowClip() && !overflowClipRect(tx, ty).contains(xPos, yPos)) -#endif -======= if (hasOverflowClip() && !overflowClipRect(tx, ty).intersects(result.rectFromPoint(xPos, yPos))) ->>>>>>> webkit.org at r64523 return false; for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp index 3854e6a..763371f 100644 --- a/WebCore/rendering/RenderWidget.cpp +++ b/WebCore/rendering/RenderWidget.cpp @@ -398,12 +398,6 @@ bool RenderWidget::nodeAtPoint(const HitTestRequest& request, HitTestResult& res // Check to see if we are really over the widget itself (and not just in the border/padding area). if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == node()) result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); -#ifdef ANDROID_HITTEST_WITHSIZE - else if (result.isRegionTest() && !hadResult && result.innerNode() == node()) { - result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); - return false; - } -#endif return inside; } diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index de9c30f..3c0556d 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1399,15 +1399,15 @@ Vector<IntRect> WebViewCore::getTouchHighlightRects(int x, int y, int slop) LOGE("Should not happen: no in document Node found"); return rects; } - const Vector<RefPtr<Node> >& list = hitTestResult.rawNodeList(); + const ListHashSet<RefPtr<Node> >& list = hitTestResult.rectBasedTestResult(); if (list.isEmpty()) { - LOGE("Should not happen: no raw node found"); + LOGE("Should not happen: no rect-based-test nodes found"); return rects; } Frame* frame = hitTestResult.innerNode()->document()->frame(); Vector<TouchNodeData> nodeDataList; - Vector<RefPtr<Node> >::const_iterator last = list.end(); - for (Vector<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) { + ListHashSet<RefPtr<Node> >::const_iterator last = list.end(); + for (ListHashSet<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) { // TODO: it seems reasonable to not search across the frame. Isn't it? // if the node is not in the same frame as the innerNode, skip it if (it->get()->document()->frame() != frame) |