WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
updated patch based on the comment
patch.txt (text/plain), 28.94 KB, created by
Grace Kloba
on 2010-06-14 10:42:31 PDT
(
hide
)
Description:
updated patch based on the comment
Filename:
MIME Type:
Creator:
Grace Kloba
Created:
2010-06-14 10:42:31 PDT
Size:
28.94 KB
patch
obsolete
>Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 61129) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,54 @@ >+2010-06-14 Grace Kloba <klobag@gmail.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enhance the hit testing to take a rectangle instead of a point >+ https://bugs.webkit.org/show_bug.cgi?id=40197 >+ >+ No new tests. (OOPS!) >+ >+ * WebCore.base.exp: >+ * page/EventHandler.cpp: >+ (WebCore::EventHandler::hitTestResultAtPoint): >+ * page/EventHandler.h: >+ * rendering/EllipsisBox.cpp: >+ (WebCore::EllipsisBox::nodeAtPoint): >+ * rendering/HitTestResult.cpp: >+ (WebCore::HitTestResult::HitTestResult): >+ (WebCore::HitTestResult::operator=): >+ (WebCore::HitTestResult::append): >+ (WebCore::HitTestResult::addRawNodeForRegionTest): >+ * rendering/HitTestResult.h: >+ (WebCore::HitTestResult::padding): >+ (WebCore::HitTestResult::isRegionTest): >+ (WebCore::HitTestResult::rawNodeList): >+ (WebCore::HitTestResult::regionFromPoint): >+ * rendering/InlineFlowBox.cpp: >+ (WebCore::InlineFlowBox::nodeAtPoint): >+ * rendering/InlineTextBox.cpp: >+ (WebCore::InlineTextBox::nodeAtPoint): >+ * rendering/RenderBlock.cpp: >+ (WebCore::RenderBlock::nodeAtPoint): >+ (WebCore::RenderBlock::hitTestColumns): >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::nodeAtPoint): >+ * rendering/RenderImage.cpp: >+ (WebCore::RenderImage::nodeAtPoint): >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::hitTestLayer): >+ (WebCore::RenderLayer::hitTestList): >+ (WebCore::RenderLayer::hitTestChildLayerColumns): >+ * rendering/RenderLineBoxList.cpp: >+ (WebCore::RenderLineBoxList::hitTest): >+ * rendering/RenderSVGRoot.cpp: >+ (WebCore::RenderSVGRoot::nodeAtPoint): >+ * rendering/RenderTable.cpp: >+ (WebCore::RenderTable::nodeAtPoint): >+ * rendering/RenderTableSection.cpp: >+ (WebCore::RenderTableSection::nodeAtPoint): >+ * rendering/RenderWidget.cpp: >+ (WebCore::RenderWidget::nodeAtPoint): >+ > 2010-06-14 Chang Shu <chang.shu@nokia.com> > > Reviewed by Kenneth Rohde Christiansen. >Index: WebCore/WebCore.base.exp >=================================================================== >--- WebCore/WebCore.base.exp (revision 61129) >+++ WebCore/WebCore.base.exp (working copy) >@@ -214,7 +214,7 @@ __ZN7WebCore12EventHandler14scrollOverfl > __ZN7WebCore12EventHandler15sendScrollEventEv > __ZN7WebCore12EventHandler16handleWheelEventERNS_18PlatformWheelEventE > __ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb >-__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsE >+__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsERKNS_7IntSizeE > __ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE > __ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE > __ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv >Index: WebCore/page/EventHandler.cpp >=================================================================== >--- WebCore/page/EventHandler.cpp (revision 61129) >+++ WebCore/page/EventHandler.cpp (working copy) >@@ -859,9 +859,9 @@ void EventHandler::allowDHTMLDrag(bool& > } > #endif // ENABLE(DRAG_SUPPORT) > >-HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars) >+HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, const IntSize& padding) > { >- HitTestResult result(point); >+ HitTestResult result(point, padding); > if (!m_frame->contentRenderer()) > return result; > int hitType = HitTestRequest::ReadOnly | HitTestRequest::Active; >@@ -883,7 +883,7 @@ HitTestResult EventHandler::hitTestResul > 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()); >- HitTestResult widgetHitTestResult(widgetPoint); >+ HitTestResult widgetHitTestResult(widgetPoint, padding); > frame->contentRenderer()->layer()->hitTest(HitTestRequest(hitType), widgetHitTestResult); > result = widgetHitTestResult; > >@@ -905,7 +905,7 @@ HitTestResult EventHandler::hitTestResul > if (resultView && mainView) { > IntPoint windowPoint = resultView->contentsToWindow(result.point()); > IntPoint mainFramePoint = mainView->windowToContents(windowPoint); >- result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping); >+ result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, padding); > } > } > } >Index: WebCore/page/EventHandler.h >=================================================================== >--- WebCore/page/EventHandler.h (revision 61129) >+++ WebCore/page/EventHandler.h (working copy) >@@ -105,7 +105,7 @@ public: > > void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); > >- HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars); >+ HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, const IntSize& padding = IntSize()); > > bool mousePressed() const { return m_mousePressed; } > void setMousePressed(bool pressed) { m_mousePressed = pressed; } >Index: WebCore/rendering/EllipsisBox.cpp >=================================================================== >--- WebCore/rendering/EllipsisBox.cpp (revision 61129) >+++ WebCore/rendering/EllipsisBox.cpp (working copy) >@@ -113,9 +113,11 @@ bool EllipsisBox::nodeAtPoint(const HitT > } > } > >- if (visibleToHitTesting() && IntRect(tx, ty, m_width, m_height).contains(x, y)) { >+ IntRect boundsRect = IntRect(tx, ty, m_width, m_height); >+ if (visibleToHitTesting() && boundsRect.intersects(result.regionFromPoint(x, y))) { > renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); >- return true; >+ if (!result.addRawNodeForRegionTest(renderer()->node(), x, y, boundsRect)) >+ return true; > } > > return false; >Index: WebCore/rendering/HitTestResult.cpp >=================================================================== >--- WebCore/rendering/HitTestResult.cpp (revision 61129) >+++ WebCore/rendering/HitTestResult.cpp (working copy) >@@ -52,6 +52,13 @@ HitTestResult::HitTestResult(const IntPo > { > } > >+HitTestResult::HitTestResult(const IntPoint& point, const IntSize& padding) >+ : m_point(point) >+ , m_padding(padding) >+ , m_isOverWidget(false) >+{ >+} >+ > HitTestResult::HitTestResult(const HitTestResult& other) > : m_innerNode(other.innerNode()) > , m_innerNonSharedNode(other.innerNonSharedNode()) >@@ -59,6 +66,8 @@ HitTestResult::HitTestResult(const HitTe > , m_localPoint(other.localPoint()) > , m_innerURLElement(other.URLElement()) > , m_scrollbar(other.scrollbar()) >+ , m_padding(other.padding()) >+ , m_rawNodeList(other.rawNodeList()) > , m_isOverWidget(other.isOverWidget()) > { > } >@@ -75,6 +84,8 @@ HitTestResult& HitTestResult::operator=( > m_localPoint = other.localPoint(); > m_innerURLElement = other.URLElement(); > m_scrollbar = other.scrollbar(); >+ m_padding = other.padding(); >+ m_rawNodeList = other.rawNodeList(); > m_isOverWidget = other.isOverWidget(); > return *this; > } >@@ -362,4 +373,33 @@ bool HitTestResult::isContentEditable() > return m_innerNonSharedNode->isContentEditable(); > } > >+void HitTestResult::append(const HitTestResult& other) >+{ >+ ASSERT(isRegionTest()); >+ >+ if (!m_innerNode && other.innerNode()) { >+ m_innerNode = other.innerNode(); >+ m_innerNonSharedNode = other.innerNonSharedNode(); >+ m_localPoint = other.localPoint(); >+ m_innerURLElement = other.URLElement(); >+ m_scrollbar = other.scrollbar(); >+ m_isOverWidget = other.isOverWidget(); >+ } >+ >+ const ListHashSet<RefPtr<Node> >& list = other.rawNodeList(); >+ ListHashSet<RefPtr<Node> >::const_iterator last = list.end(); >+ for (ListHashSet<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) >+ m_rawNodeList.add(it->get()); >+} >+ >+bool HitTestResult::addRawNodeForRegionTest(Node* node, int x, int y, const IntRect& rect) >+{ >+ if (!isRegionTest() || !node) >+ return false; >+ >+ m_rawNodeList.add(node); >+ >+ return !rect.contains(regionFromPoint(x, y)); >+} >+ > } // namespace WebCore >Index: WebCore/rendering/HitTestResult.h >=================================================================== >--- WebCore/rendering/HitTestResult.h (revision 61129) >+++ WebCore/rendering/HitTestResult.h (working copy) >@@ -21,7 +21,10 @@ > #define HitTestResult_h > > #include "IntPoint.h" >+#include "IntRect.h" >+#include "IntSize.h" > #include "TextDirection.h" >+#include <wtf/ListHashSet.h> > #include <wtf/RefPtr.h> > > namespace WebCore { >@@ -38,6 +41,7 @@ class String; > class HitTestResult { > public: > HitTestResult(const IntPoint&); >+ HitTestResult(const IntPoint&, const IntSize&); > HitTestResult(const HitTestResult&); > ~HitTestResult(); > HitTestResult& operator=(const HitTestResult&); >@@ -49,6 +53,11 @@ public: > Element* URLElement() const { return m_innerURLElement.get(); } > Scrollbar* scrollbar() const { return m_scrollbar.get(); } > bool isOverWidget() const { return m_isOverWidget; } >+ IntSize padding() const { return m_padding; } >+ bool isRegionTest() const { return !m_padding.isEmpty(); } >+ IntRect regionFromPoint(int x, int y) const; >+ IntRect regionFromPoint(const IntPoint&) const; >+ const ListHashSet<RefPtr<Node> >& rawNodeList() const { return m_rawNodeList; } > > void setToNonShadowAncestor(); > >@@ -76,6 +85,10 @@ public: > bool isLiveLink() const; > bool isContentEditable() const; > >+ void append(const HitTestResult&); >+ // return true if it is region test and the hit test needs to continue as the region is not fully covered by the rect >+ bool addRawNodeForRegionTest(Node*, int x, int y, const IntRect& rect = IntRect()); >+ > private: > RefPtr<Node> m_innerNode; > RefPtr<Node> m_innerNonSharedNode; >@@ -84,9 +97,21 @@ private: > // determine where inside the renderer we hit on subsequent operations. > RefPtr<Element> m_innerURLElement; > RefPtr<Scrollbar> m_scrollbar; >+ IntSize m_padding; >+ ListHashSet<RefPtr<Node> > m_rawNodeList; > bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example). > }; > >+inline IntRect HitTestResult::regionFromPoint(int x, int y) const >+{ >+ return IntRect(x - m_padding.width(), y - m_padding.height(), 2 * m_padding.width() + 1, 2 * m_padding.height() + 1); >+} >+ >+inline IntRect HitTestResult::regionFromPoint(const IntPoint& p) const >+{ >+ return IntRect(p.x() - m_padding.width(), p.y() - m_padding.height(), 2 * m_padding.width() + 1, 2 * m_padding.height() + 1); >+} >+ > String displayString(const String&, const Node*); > > } // namespace WebCore >Index: WebCore/rendering/InlineFlowBox.cpp >=================================================================== >--- WebCore/rendering/InlineFlowBox.cpp (revision 61129) >+++ WebCore/rendering/InlineFlowBox.cpp (working copy) >@@ -611,7 +611,7 @@ bool InlineFlowBox::nodeAtPoint(const Hi > { > IntRect overflowRect(visibleOverflowRect()); > overflowRect.move(tx, ty); >- if (!overflowRect.contains(x, y)) >+ if (!overflowRect.intersects(result.regionFromPoint(x, y))) > return false; > > // Check children first. >@@ -624,9 +624,10 @@ bool InlineFlowBox::nodeAtPoint(const Hi > > // Now check ourselves. > IntRect rect(tx + m_x, ty + m_y, m_width, height()); >- if (visibleToHitTesting() && rect.contains(x, y)) { >+ if (visibleToHitTesting() && rect.intersects(result.regionFromPoint(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. >- return true; >+ if (!result.addRawNodeForRegionTest(renderer()->node(), x, y, rect)) >+ return true; > } > > return false; >Index: WebCore/rendering/InlineTextBox.cpp >=================================================================== >--- WebCore/rendering/InlineTextBox.cpp (revision 61129) >+++ WebCore/rendering/InlineTextBox.cpp (working copy) >@@ -266,9 +266,10 @@ bool InlineTextBox::nodeAtPoint(const Hi > return false; > > IntRect rect(tx + m_x, ty + m_y, m_width, height()); >- if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.contains(x, y)) { >+ if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.regionFromPoint(x, y))) { > renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); >- return true; >+ if (!result.addRawNodeForRegionTest(renderer()->node(), x, y, rect)) >+ return true; > } > return false; > } >Index: WebCore/rendering/RenderBlock.cpp >=================================================================== >--- WebCore/rendering/RenderBlock.cpp (revision 61129) >+++ WebCore/rendering/RenderBlock.cpp (working copy) >@@ -3747,19 +3747,21 @@ bool RenderBlock::nodeAtPoint(const HitT > // Check if we need to do anything at all. > IntRect overflowBox = visibleOverflowRect(); > overflowBox.move(tx, ty); >- if (!overflowBox.contains(_x, _y)) >+ if (!overflowBox.intersects(result.regionFromPoint(_x, _y))) > return false; > } > > if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) && isPointInOverflowControl(result, _x, _y, tx, ty)) { > updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); >- return true; >+ // TODO: isPointInOverflowControl() doesn't handle region test yet. >+ if (!result.addRawNodeForRegionTest(node(), _x, _y)) >+ return true; > } > > // If we have clipping, then we can't have any spillout. > bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); > bool useClip = (hasControlClip() || useOverflowClip); >- bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).contains(_x, _y) : overflowClipRect(tx, ty).contains(_x, _y)); >+ bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).intersects(result.regionFromPoint(_x, _y)) : overflowClipRect(tx, ty).intersects(result.regionFromPoint(_x, _y))); > if (checkChildren) { > // Hit test descendants first. > int scrolledX = tx; >@@ -3807,9 +3809,10 @@ bool RenderBlock::nodeAtPoint(const HitT > // Now hit test our background > if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) { > IntRect boundsRect(tx, ty, width(), height()); >- if (visibleToHitTesting() && boundsRect.contains(_x, _y)) { >+ if (visibleToHitTesting() && boundsRect.intersects(result.regionFromPoint(_x, _y))) { > updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); >- return true; >+ if (!result.addRawNodeForRegionTest(node(), _x, _y, boundsRect)) >+ return true; > } > } > >@@ -3834,13 +3837,16 @@ bool RenderBlock::hitTestColumns(const H > currYOffset += colRect.height(); > colRect.move(tx, ty); > >- if (colRect.contains(x, y)) { >+ if (colRect.intersects(result.regionFromPoint(x, y))) { > // The point is inside this column. > // Adjust tx and ty to change where we hit test. > > int finalX = tx + currXOffset; > int finalY = ty + currYOffset; >- return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); >+ if (result.isRegionTest() && !colRect.contains(result.regionFromPoint(x, y))) >+ hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); >+ else >+ return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); > } > } > >Index: WebCore/rendering/RenderBox.cpp >=================================================================== >--- WebCore/rendering/RenderBox.cpp (revision 61129) >+++ WebCore/rendering/RenderBox.cpp (working copy) >@@ -31,6 +31,7 @@ > #include "Document.h" > #include "FrameView.h" > #include "GraphicsContext.h" >+#include "HitTestResult.h" > #include "htmlediting.h" > #include "HTMLElement.h" > #include "HTMLNames.h" >@@ -552,9 +553,11 @@ bool RenderBox::nodeAtPoint(const HitTes > > // 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). >- if (visibleToHitTesting() && action == HitTestForeground && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) { >+ IntRect boundsRect = IntRect(tx, ty, width(), height()); >+ if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.regionFromPoint(xPos, yPos))) { > updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); >- return true; >+ if (!result.addRawNodeForRegionTest(node(), xPos, yPos, boundsRect)) >+ return true; > } > > return false; >Index: WebCore/rendering/RenderImage.cpp >=================================================================== >--- WebCore/rendering/RenderImage.cpp (revision 61129) >+++ WebCore/rendering/RenderImage.cpp (working copy) >@@ -504,10 +504,10 @@ HTMLMapElement* RenderImage::imageMap() > > bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) > { >- HitTestResult tempResult(result.point()); >+ HitTestResult tempResult(result.point(), result.padding()); > bool inside = RenderReplaced::nodeAtPoint(request, tempResult, x, y, tx, ty, hitTestAction); > >- if (inside && node()) { >+ if (tempResult.innerNode() && node()) { > if (HTMLMapElement* map = imageMap()) { > IntRect contentBox = contentBoxRect(); > float zoom = style()->effectiveZoom(); >@@ -518,6 +518,8 @@ bool RenderImage::nodeAtPoint(const HitT > } > } > >+ if (!inside && result.isRegionTest()) >+ result.append(tempResult); > if (inside) > result = tempResult; > return inside; >Index: WebCore/rendering/RenderLayer.cpp >=================================================================== >--- WebCore/rendering/RenderLayer.cpp (revision 61129) >+++ WebCore/rendering/RenderLayer.cpp (working copy) >@@ -2737,7 +2737,7 @@ RenderLayer* RenderLayer::hitTestLayer(R > if (parent()) { > IntRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects); > // Go ahead and test the enclosing clip now. >- if (!clipRect.contains(hitTestPoint)) >+ if (!clipRect.intersects(result.regionFromPoint(hitTestPoint))) > return 0; > } > >@@ -2850,17 +2850,21 @@ RenderLayer* RenderLayer::hitTestLayer(R > } > > // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. >- if (fgRect.contains(hitTestPoint) && isSelfPaintingLayer()) { >+ if (fgRect.intersects(result.regionFromPoint(hitTestPoint)) && 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()); >+ HitTestResult tempResult(result.point(), result.padding()); > if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestDescendants) && > isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { >- result = tempResult; >+ if (result.isRegionTest()) >+ result.append(tempResult); >+ else >+ result = tempResult; > if (!depthSortDescendants) > return this; > // Foreground can depth-sort with descendant layers, so keep this as a candidate. > candidateLayer = this; >- } >+ } else if (result.isRegionTest()) >+ result.append(tempResult); > } > > // Now check our negative z-index children. >@@ -2876,13 +2880,17 @@ RenderLayer* RenderLayer::hitTestLayer(R > if (candidateLayer) > return candidateLayer; > >- if (bgRect.contains(hitTestPoint) && isSelfPaintingLayer()) { >- HitTestResult tempResult(result.point()); >+ if (bgRect.intersects(result.regionFromPoint(hitTestPoint)) && isSelfPaintingLayer()) { >+ HitTestResult tempResult(result.point(), result.padding()); > if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestSelf) && > isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { >- result = tempResult; >+ if (result.isRegionTest()) >+ result.append(tempResult); >+ else >+ result = tempResult; > return this; >- } >+ } else if (result.isRegionTest()) >+ result.append(tempResult); > } > > return 0; >@@ -2929,14 +2937,17 @@ RenderLayer* RenderLayer::hitTestList(Ve > for (int i = list->size() - 1; i >= 0; --i) { > RenderLayer* childLayer = list->at(i); > RenderLayer* hitLayer = 0; >- HitTestResult tempResult(result.point()); >+ HitTestResult tempResult(result.point(), result.padding()); > 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); >+ if (result.isRegionTest()) >+ result.append(tempResult); > if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) { > resultLayer = hitLayer; >- result = tempResult; >+ if (!result.isRegionTest()) >+ result = tempResult; > if (!depthSortDescendants) > break; > } >@@ -2996,7 +3007,7 @@ RenderLayer* RenderLayer::hitTestChildLa > IntRect localClipRect(hitTestRect); > localClipRect.intersect(colRect); > >- if (!localClipRect.isEmpty() && localClipRect.contains(hitTestPoint)) { >+ if (!localClipRect.isEmpty() && localClipRect.intersects(result.regionFromPoint(hitTestPoint))) { > RenderLayer* hitLayer = 0; > if (!columnIndex) { > // Apply a translation transform to change where the layer paints. >Index: WebCore/rendering/RenderLineBoxList.cpp >=================================================================== >--- WebCore/rendering/RenderLineBoxList.cpp (revision 61129) >+++ WebCore/rendering/RenderLineBoxList.cpp (working copy) >@@ -29,6 +29,7 @@ > #include "config.h" > #include "RenderLineBoxList.h" > >+#include "HitTestResult.h" > #include "InlineTextBox.h" > #include "RenderArena.h" > #include "RenderInline.h" >@@ -245,14 +246,14 @@ bool RenderLineBoxList::hitTest(RenderBo > // 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. >- if ((y >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y < ty + firstLineBox()->root()->topVisibleOverflow())) >+ if ((y - result.padding().height() >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y + result.padding().height() < ty + firstLineBox()->root()->topVisibleOverflow())) > 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()) { >- if (y >= ty + curr->root()->topVisibleOverflow() && y < ty + curr->root()->bottomVisibleOverflow()) { >+ if (y + result.padding().height() >= ty + curr->root()->topVisibleOverflow() && y - result.padding().height() < ty + curr->root()->bottomVisibleOverflow()) { > bool inside = curr->nodeAtPoint(request, result, x, y, tx, ty); > if (inside) { > renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty)); >Index: WebCore/rendering/RenderSVGRoot.cpp >=================================================================== >--- WebCore/rendering/RenderSVGRoot.cpp (revision 61129) >+++ WebCore/rendering/RenderSVGRoot.cpp (working copy) >@@ -26,6 +26,7 @@ > #include "RenderSVGRoot.h" > > #include "GraphicsContext.h" >+#include "HitTestResult.h" > #include "RenderSVGContainer.h" > #include "RenderView.h" > #include "SVGLength.h" >@@ -313,6 +314,8 @@ bool RenderSVGRoot::nodeAtPoint(const Hi > if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { > // FIXME: CSS/HTML assumes the local point is relative to the border box, right? > updateHitTestResult(result, pointInBorderBox); >+ // TODO: nodeAtFloatPoint() doesn't handle region test yet. >+ result.addRawNodeForRegionTest(child->node(), _x, _y); > return true; > } > } >Index: WebCore/rendering/RenderTable.cpp >=================================================================== >--- WebCore/rendering/RenderTable.cpp (revision 61129) >+++ WebCore/rendering/RenderTable.cpp (working copy) >@@ -31,6 +31,7 @@ > #include "Document.h" > #include "FixedTableLayout.h" > #include "FrameView.h" >+#include "HitTestResult.h" > #include "HTMLNames.h" > #include "RenderLayer.h" > #include "RenderTableCell.h" >@@ -1135,7 +1136,7 @@ bool RenderTable::nodeAtPoint(const HitT > ty += y(); > > // Check kids first. >- if (!hasOverflowClip() || overflowClipRect(tx, ty).contains(xPos, yPos)) { >+ if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.regionFromPoint(xPos, yPos))) { > 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)) { >@@ -1146,9 +1147,11 @@ bool RenderTable::nodeAtPoint(const HitT > } > > // Check our bounds next. >- if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) { >+ IntRect boundsRect = IntRect(tx, ty, width(), height()); >+ if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.regionFromPoint(xPos, yPos))) { > updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); >- return true; >+ if (!result.addRawNodeForRegionTest(node(), xPos, yPos, boundsRect)) >+ return true; > } > > return false; >Index: WebCore/rendering/RenderTableSection.cpp >=================================================================== >--- WebCore/rendering/RenderTableSection.cpp (revision 61129) >+++ WebCore/rendering/RenderTableSection.cpp (working copy) >@@ -28,6 +28,7 @@ > > #include "CachedImage.h" > #include "Document.h" >+#include "HitTestResult.h" > #include "HTMLNames.h" > #include "RenderTableCell.h" > #include "RenderTableCol.h" >@@ -1152,7 +1153,7 @@ bool RenderTableSection::nodeAtPoint(con > tx += x(); > ty += y(); > >- if (hasOverflowClip() && !overflowClipRect(tx, ty).contains(xPos, yPos)) >+ if (hasOverflowClip() && !overflowClipRect(tx, ty).intersects(result.regionFromPoint(xPos, yPos))) > return false; > > for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { >Index: WebCore/rendering/RenderWidget.cpp >=================================================================== >--- WebCore/rendering/RenderWidget.cpp (revision 61129) >+++ WebCore/rendering/RenderWidget.cpp (working copy) >@@ -380,7 +380,7 @@ bool RenderWidget::nodeAtPoint(const Hit > bool inside = RenderReplaced::nodeAtPoint(request, result, x, y, tx, ty, action); > > // Check to see if we are really over the widget itself (and not just in the border/padding area). >- if (inside && !hadResult && result.innerNode() == node()) >+ if ((inside || result.isRegionTest()) && !hadResult && result.innerNode() == node()) > result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); > return inside; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 40197
:
57979
|
57980
|
58324
|
58617
|
58669
|
59789
|
60772
|
62029
|
62175
|
62313
|
62453
|
62569
|
62761