WebCore:
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Oct 2006 23:39:47 +0000 (23:39 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Oct 2006 23:39:47 +0000 (23:39 +0000)
        Reviewed by Maciej.

        Fix layout tests that broke after r17933. Mitz discovered that the
        failures were caused by HitTestResult::m_point being uninitialized
        much of the time. HitTestResults are now always constructed with a
        point, and RenderLayer::hitTest and RenderLayer::hitTestLayer use that
        point instead of being passed one explicitly.

        * WebCore.exp: Change constructor symbol.
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::eventMayStartDrag): Update to new constructor and
        hitTest().
        (WebCore::FrameMac::handleMouseMoveEvent): Ditto.
        * bridge/mac/WebCoreAXObject.mm:
        (-[WebCoreAXObject doAXTextMarkerForPosition:]): Ditto.
        (-[WebCoreAXObject accessibilityHitTest:]): Ditto.
        * dom/Document.cpp:
        (WebCore::Document::elementFromPoint): Ditto.
        (WebCore::Document::prepareMouseEvent): Ditto.
        * page/Frame.cpp:
        (WebCore::Frame::isPointInsideSelection): Ditto.
        (WebCore::Frame::hitTestResultAtPoint): Ditto.
        * page/FrameView.cpp:
        (WebCore::FrameView::handleWheelEvent): Ditto.
        * rendering/HitTestResult.cpp:
        (WebCore::HitTestResult::HitTestResult): Initalize m_point with the
        passed point.
        * rendering/HitTestResult.h: Update constructor declaration.
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::autoscroll): Update to new constructor and
        hitTest().
        (WebCore::RenderLayer::hitTest): Use the IntPoint stored in the
        HitTestResult instead of being passed one.
        (WebCore::RenderLayer::hitTestLayer): Ditto.
        * rendering/RenderLayer.h: Update declarations.

WebKit:

        Reviewed by Maciej.

        Fix layout tests that broke after r17933. Mitz discovered that the
        failures were caused by HitTestResult::m_point being uninitialized
        much of the time. HitTestResults are now always constructed with a
        point.

        * WebView/WebHTMLView.m:
        (-[WebHTMLView elementAtPoint:allowShadowContent:]): Pass point to
        HitTestResult constructor.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17402 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/WebCoreAXObject.mm
WebCore/dom/Document.cpp
WebCore/page/Frame.cpp
WebCore/page/FrameView.cpp
WebCore/rendering/HitTestResult.cpp
WebCore/rendering/HitTestResult.h
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderLayer.h
WebKit/ChangeLog
WebKit/WebView/WebHTMLView.m

index b7cbf69eb8b1082a41218dea2f6dc44ebc8358e8..2271586c3a6087ca5cfb9128cdf096ae4cad89bd 100644 (file)
@@ -1,3 +1,41 @@
+2006-10-28  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Maciej.
+
+        Fix layout tests that broke after r17933. Mitz discovered that the
+        failures were caused by HitTestResult::m_point being uninitialized
+        much of the time. HitTestResults are now always constructed with a
+        point, and RenderLayer::hitTest and RenderLayer::hitTestLayer use that
+        point instead of being passed one explicitly.
+
+        * WebCore.exp: Change constructor symbol.
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::eventMayStartDrag): Update to new constructor and
+        hitTest().
+        (WebCore::FrameMac::handleMouseMoveEvent): Ditto.
+        * bridge/mac/WebCoreAXObject.mm:
+        (-[WebCoreAXObject doAXTextMarkerForPosition:]): Ditto.
+        (-[WebCoreAXObject accessibilityHitTest:]): Ditto.
+        * dom/Document.cpp:
+        (WebCore::Document::elementFromPoint): Ditto.
+        (WebCore::Document::prepareMouseEvent): Ditto.
+        * page/Frame.cpp:
+        (WebCore::Frame::isPointInsideSelection): Ditto.
+        (WebCore::Frame::hitTestResultAtPoint): Ditto.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::handleWheelEvent): Ditto.
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::HitTestResult): Initalize m_point with the
+        passed point.
+        * rendering/HitTestResult.h: Update constructor declaration.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::autoscroll): Update to new constructor and
+        hitTest().
+        (WebCore::RenderLayer::hitTest): Use the IntPoint stored in the
+        HitTestResult instead of being passed one.
+        (WebCore::RenderLayer::hitTestLayer): Ditto.
+        * rendering/RenderLayer.h: Update declarations.
+
 2006-10-28  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by Anders.
index 4123850e9be98910216b3377f2b07dd4287317fe..5d65f76d6947cc892924ad190837d00ca98867d0 100644 (file)
@@ -160,7 +160,7 @@ __ZN7WebCore11FrameLoader9setClientEPNS_17FrameLoaderClientE
 __ZN7WebCore11RenderLayer18gAlignCenterAlwaysE
 __ZN7WebCore12AtomicString3addEPNS_10StringImplE
 __ZN7WebCore13HitTestResultC1ERKS0_
-__ZN7WebCore13HitTestResultC1Ebbb
+__ZN7WebCore13HitTestResultC1ERKNS_8IntPointEbbb
 __ZN7WebCore13HitTestResultD1Ev
 __ZN7WebCore13HitTestResultaSERKS0_
 __ZN7WebCore14DocumentLoader12setCommittedEb
index 670a3242354d1d6e8e72f1d1c7e6bd8841d3b346..1671e30da074a5b47348d32ba5a148c84c092155 100644 (file)
@@ -1558,8 +1558,8 @@ bool FrameMac::eventMayStartDrag(NSEvent *event) const
 
     NSPoint loc = [event locationInWindow];
     IntPoint mouseDownPos = d->m_view->windowToContents(IntPoint(loc));
-    HitTestResult result(true, false);
-    renderer()->layer()->hitTest(result, mouseDownPos);
+    HitTestResult result(mouseDownPos, true, false);
+    renderer()->layer()->hitTest(result);
     bool srcIsDHTML;
     return result.innerNode()->renderer()->draggableNode(DHTMLFlag, UAFlag, mouseDownPos.x(), mouseDownPos.y(), srcIsDHTML);
 }
@@ -1618,8 +1618,8 @@ void FrameMac::handleMouseMoveEvent(const MouseEventWithHitTestResults& event)
         
         if (mouseDownMayStartDrag() && !_dragSrc) {
             // try to find an element that wants to be dragged
-            HitTestResult result(true, false);
-            renderer()->layer()->hitTest(result, m_mouseDownPos);
+            HitTestResult result(m_mouseDownPos, true, false);
+            renderer()->layer()->hitTest(result);
             Node *node = result.innerNode();
             _dragSrc = (node && node->renderer()) ? node->renderer()->draggableNode(_dragSrcMayBeDHTML, _dragSrcMayBeUA, m_mouseDownPos.x(), m_mouseDownPos.y(), _dragSrcIsDHTML) : 0;
             if (!_dragSrc) {
index d38684e8749248d2f47d219a08e7afb76c605e5f..e7b358896de647750ea035ae35c83d1e0e657940 100644 (file)
@@ -1263,8 +1263,8 @@ static IntRect boundingBoxRect(RenderObject* obj)
         NSPoint windowCoord = [[view window] convertScreenToBase: point];
         ourpoint = [view convertPoint:windowCoord fromView:nil];
         
-        HitTestResult result(true, true);
-        renderer->layer()->hitTest(result, IntPoint(ourpoint));
+        HitTestResult result(IntPoint(ourpoint), true, true);
+        renderer->layer()->hitTest(result);
         innerNode = result.innerNode();
         if (!innerNode || !innerNode->renderer())
             return nil;
@@ -2303,8 +2303,8 @@ static VisiblePosition endOfStyleRange (const VisiblePosition visiblePos)
     if (!m_renderer)
         return NSAccessibilityUnignoredAncestor(self);
     
-    HitTestResult result(true, true);
-    m_renderer->layer()->hitTest(result, IntPoint(point));
+    HitTestResult result(IntPoint(point), true, true);
+    m_renderer->layer()->hitTest(result);
     if (!result.innerNode())
         return NSAccessibilityUnignoredAncestor(self);
     Node* node = result.innerNode()->shadowAncestorNode();
index 2a742e5fe2521ddfd86ef96bdef6d5612c2ec256..5d4b7009ed33b97f69b43e6c73914d4dfeb32339 100644 (file)
@@ -677,8 +677,8 @@ Element* Document::elementFromPoint(int x, int y) const
     if (!renderer())
         return 0;
 
-    HitTestResult result(true, true);
-    renderer()->layer()->hitTest(result, IntPoint(x, y)); 
+    HitTestResult result(IntPoint(x, y), true, true);
+    renderer()->layer()->hitTest(result); 
 
     Node* n = result.innerNode();
     while (n && !n->isElementNode())
@@ -1674,8 +1674,8 @@ MouseEventWithHitTestResults Document::prepareMouseEvent(bool readonly, bool act
         return MouseEventWithHitTestResults(event, 0, 0, false);
 
     assert(renderer()->isRenderView());
-    HitTestResult renderInfo(readonly, active, mouseMove);
-    renderer()->layer()->hitTest(renderInfo, point);
+    HitTestResult renderInfo(point, readonly, active, mouseMove);
+    renderer()->layer()->hitTest(renderInfo);
 
     if (!readonly)
         updateRendering();
index 867698e99df3cbb9a51245e86d431e589a32c541..cd601ce341c4d82651185dc47b31e0250b1bf845 100644 (file)
@@ -1791,8 +1791,8 @@ bool Frame::isPointInsideSelection(const IntPoint& point)
     if (!document()->renderer()) 
         return false;
     
-    HitTestResult result(true, true);
-    document()->renderer()->layer()->hitTest(result, point);
+    HitTestResult result(point, true, true);
+    document()->renderer()->layer()->hitTest(result);
     Node *innerNode = result.innerNode();
     if (!innerNode || !innerNode->renderer())
         return false;
@@ -2926,8 +2926,8 @@ void Frame::setAutoscrollRenderer(RenderObject* renderer)
 
 HitTestResult Frame::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent)
 {
-    HitTestResult result(true, true);
-    renderer()->layer()->hitTest(result, point);
+    HitTestResult result(point, true, true);
+    renderer()->layer()->hitTest(result);
 
     Node *n;
     Widget *widget = 0;
@@ -2949,10 +2949,9 @@ HitTestResult Frame::hitTestResultAtPoint(const IntPoint& point, bool allowShado
         widgetPoint.setX(widgetPoint.x() - absX + view->contentsX());
         widgetPoint.setY(widgetPoint.y() - absY + view->contentsY());
 
-        HitTestResult widgetHitTestResult(true, true);
-        frame->renderer()->layer()->hitTest(widgetHitTestResult, widgetPoint);
+        HitTestResult widgetHitTestResult(widgetPoint, true, true);
+        frame->renderer()->layer()->hitTest(widgetHitTestResult);
         result = widgetHitTestResult;
-        result.setPoint(widgetPoint);
     }
     
     if (!allowShadowContent) {
index 9cc01f6b90e137328fbd9cd39e40d118ccf34c09..ae1823c0e137c10ae6cfe67a75cb3b2a68bf3293 100644 (file)
@@ -1239,8 +1239,8 @@ void FrameView::handleWheelEvent(PlatformWheelEvent& e)
         if (docRenderer) {
             IntPoint vPoint = windowToContents(e.pos());
 
-            HitTestResult hitTestResult(true, false);
-            doc->renderer()->layer()->hitTest(hitTestResult, vPoint); 
+            HitTestResult hitTestResult(vPoint, true, false);
+            doc->renderer()->layer()->hitTest(hitTestResult); 
             Node *node = hitTestResult.innerNode();
             Frame* subframe = subframeForTargetNode(node);
             if (subframe && passWheelEventToSubframe(e, subframe)) {
index 92954597a38e18291777bb72433ea6178c8b04e8..8130c63fbce1875f44aac8df92367f721fc04c13 100644 (file)
@@ -32,8 +32,9 @@
 
 namespace WebCore {
 
-HitTestResult::HitTestResult(bool readonly, bool active, bool mouseMove)
-    : m_readonly(readonly)
+HitTestResult::HitTestResult(const IntPoint& point, bool readonly, bool active, bool mouseMove)
+    : m_point(point)
+    , m_readonly(readonly)
     , m_active(active)
     , m_mouseMove(mouseMove)
 {
index 8d786c64f6d9a6489cd648535c68452065d2a598..1fcf53f46ec7b8242941fbb7c41c9aaca1c31d7c 100644 (file)
@@ -36,7 +36,7 @@ class String;
 
 class HitTestResult {
 public:
-    HitTestResult(bool readonly, bool active, bool mouseMove = false);
+    HitTestResult(const IntPoint&, bool readonly, bool active, bool mouseMove = false);
     HitTestResult(const HitTestResult&);
     ~HitTestResult();
     HitTestResult& operator=(const HitTestResult&);
index f1a6cc46a3a9f679285bc139e9d260f000d7b0da..026ee243c8b981408aba27e99c6d4b6f745c24a9 100644 (file)
@@ -865,8 +865,8 @@ void RenderLayer::autoscroll()
     IntPoint currentPos = currentFrame->view()->windowToContents(currentFrame->view()->currentMousePosition());
     
     if (currentFrame->mouseDownMayStartSelect()) {
-        HitTestResult renderInfo(true, false, true);
-        if (hitTest(renderInfo, currentPos)) {
+        HitTestResult renderInfo(currentPos, true, false, true);
+        if (hitTest(renderInfo)) {
             VisiblePosition pos(renderInfo.innerNode()->renderer()->positionForPoint(currentPos));
             currentFrame->updateSelectionForMouseDragOverPosition(pos);
         }
@@ -1471,14 +1471,14 @@ static inline IntRect frameVisibleRect(RenderObject* renderer)
     return enclosingIntRect(renderer->document()->frame()->view()->visibleContentRect());
 }
 
-bool RenderLayer::hitTest(HitTestResult& info, const IntPoint& point)
+bool RenderLayer::hitTest(HitTestResult& info)
 {
     renderer()->document()->updateLayout();
     
     IntRect boundsRect(m_x, m_y, width(), height());
     boundsRect.intersect(frameVisibleRect(renderer()));
 
-    RenderLayer* insideLayer = hitTestLayer(this, info, point, boundsRect);
+    RenderLayer* insideLayer = hitTestLayer(this, info, boundsRect);
 
     // Now determine if the result is inside an anchor; make sure an image map wins if
     // it already set URLElement and only use the innermost.
@@ -1497,7 +1497,7 @@ bool RenderLayer::hitTest(HitTestResult& info, const IntPoint& point)
     return insideLayer;
 }
 
-RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, HitTestResult& info, const IntPoint& mousePos, const IntRect& hitTestRect)
+RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, HitTestResult& info, const IntRect& hitTestRect)
 {
     // Calculate the clip rects we should use.
     IntRect layerBounds;
@@ -1518,7 +1518,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, HitTestResult& in
     // z-index.
     if (m_posZOrderList) {
         for (int i = m_posZOrderList->size() - 1; i >= 0; --i) {
-            insideLayer = m_posZOrderList->at(i)->hitTestLayer(rootLayer, info, mousePos, hitTestRect);
+            insideLayer = m_posZOrderList->at(i)->hitTestLayer(rootLayer, info, hitTestRect);
             if (insideLayer)
                 return insideLayer;
         }
@@ -1527,15 +1527,15 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, HitTestResult& in
     // Now check our overflow objects.
     if (m_overflowList) {
         for (int i = m_overflowList->size() - 1; i >= 0; --i) {
-            insideLayer = m_overflowList->at(i)->hitTestLayer(rootLayer, info, mousePos, hitTestRect);
+            insideLayer = m_overflowList->at(i)->hitTestLayer(rootLayer, info, hitTestRect);
             if (insideLayer)
                 return insideLayer;
         }
     }
 
     // Next we want to see if the mouse pos is inside the child RenderObjects of the layer.
-    if (fgRect.contains(mousePos) && 
-        renderer()->hitTest(info, mousePos.x(), mousePos.y(),
+    if (fgRect.contains(info.point()) && 
+        renderer()->hitTest(info, info.point().x(), info.point().y(),
                             layerBounds.x() - renderer()->xPos(),
                             layerBounds.y() - renderer()->yPos() + m_object->borderTopExtra(), HitTestDescendants)) {
         // for positioned generated content, we might still not have a
@@ -1565,7 +1565,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, HitTestResult& in
     // Now check our negative z-index children.
     if (m_negZOrderList) {
         for (int i = m_negZOrderList->size() - 1; i >= 0; --i) {
-            insideLayer = m_negZOrderList->at(i)->hitTestLayer(rootLayer, info, mousePos, hitTestRect);
+            insideLayer = m_negZOrderList->at(i)->hitTestLayer(rootLayer, info, hitTestRect);
             if (insideLayer)
                 return insideLayer;
         }
@@ -1575,8 +1575,8 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, HitTestResult& in
     // If this is the root layer and the mouse is down, we want to do this even if it doesn't
     // contain the point so mouse move events keep getting delivered when dragging outside the
     // window.
-    if (bgRect.contains(mousePos) &&
-        renderer()->hitTest(info, mousePos.x(), mousePos.y(),
+    if (bgRect.contains(info.point()) &&
+        renderer()->hitTest(info, info.point().x(), info.point().y(),
                             layerBounds.x() - renderer()->xPos(),
                             layerBounds.y() - renderer()->yPos() + m_object->borderTopExtra(),
                             HitTestSelf))
index 120b546e8c6af6996e1fe20b706f89683c0932fe..5d26bdb5f67676ebd2be5b2d1121d9486b862144 100644 (file)
@@ -292,7 +292,7 @@ public:
     // front.  The hitTest method looks for mouse events by walking
     // layers that intersect the point from front to back.
     void paint(GraphicsContext*, const IntRect& damageRect, PaintRestriction = PaintRestrictionNone, RenderObject* paintingRoot = 0);
-    bool hitTest(HitTestResult&, const IntPoint&);
+    bool hitTest(HitTestResult&);
 
     // This method figures out our layerBounds in coordinates relative to
     // |rootLayer}.  It also computes our background and foreground clip rects
@@ -337,7 +337,7 @@ private:
 
     void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
         bool haveTransparency, PaintRestriction, RenderObject* paintingRoot);
-    RenderLayer* hitTestLayer(RenderLayer* rootLayer, HitTestResult&, const IntPoint&, const IntRect& hitTestRect);
+    RenderLayer* hitTestLayer(RenderLayer* rootLayer, HitTestResult&, const IntRect& hitTestRect);
     void computeScrollDimensions(bool* needHBar = 0, bool* needVBar = 0);
 
     bool shouldBeOverflowOnly() const;
index 3a3b55dffeeb04b9015c603542d18531b5145d75..3bda1ad03fe46d5ca4112ba57789bda0c3b64a60 100644 (file)
@@ -1,3 +1,16 @@
+2006-10-28  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Maciej.
+
+        Fix layout tests that broke after r17933. Mitz discovered that the
+        failures were caused by HitTestResult::m_point being uninitialized
+        much of the time. HitTestResults are now always constructed with a
+        point.
+
+        * WebView/WebHTMLView.m:
+        (-[WebHTMLView elementAtPoint:allowShadowContent:]): Pass point to
+        HitTestResult constructor.
+
 2006-10-28  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Darin.
index 109c003b50c63093afd590c35ff7049b06a2a056..3a42cf9d9d9a2d1305f6fde1c163a514f03f001d 100644 (file)
@@ -6044,7 +6044,7 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 - (NSDictionary *)elementAtPoint:(NSPoint)point allowShadowContent:(BOOL)allow;
 {
     Frame* frame = core([self _frame]);
-    HitTestResult result(true, false);
+    HitTestResult result(IntPoint(point), true, false);
     if (frame->renderer())
         result = frame->hitTestResultAtPoint(IntPoint(point), allow);
     return [[[WebElementDictionary alloc] initWithHitTestResult:result] autorelease];