Move logic for calling mouseDidMoveOverElement into WebCore
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jul 2007 03:00:29 +0000 (03:00 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jul 2007 03:00:29 +0000 (03:00 +0000)
WebCore:

        Move logic for calling mouseDidMoveOverElement into WebCore

        Reviewed by Sam.

        * page/EventHandler.cpp:
        (WebCore::EventHandler::mouseMoved): Added. Calls Chrome::mouseDidMoveOverElement.
        (WebCore::EventHandler::handleMouseMoveEvent): Now takes an optional
        HitTestResult* parameter which is used to communicate to the caller the
        node the mouse is over.
        * page/EventHandler.h:
        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::mouseMoved): Changed to call the overloaded
        mouseMoved().
        (WebCore::EventHandler::passMouseMoveEventToSubframe): Pass hoveredNode
        through to the subframe so we can get the deepest node hovered, not
        just the node's parent frame.
        * page/win/EventHandlerWin.cpp:
        (WebCore::EventHandler::passMouseMoveEventToSubframe): Ditto.

WebKit:

        Removed call to mouseDidMoveOverElement now that WebCore handles it

        Reviewed by Sam.

        * WebView/WebHTMLView.mm:
        (-[WebHTMLView _updateMouseoverWithEvent:]):

WebKit/win:

        Removed call to mouseDidMoveOverElement now that WebCore handles it

        Reviewed by Sam.

        * WebView.cpp:
        (WebView::handleMouseEvent):

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

WebCore/ChangeLog
WebCore/page/EventHandler.cpp
WebCore/page/EventHandler.h
WebCore/page/mac/EventHandlerMac.mm
WebCore/page/win/EventHandlerWin.cpp
WebKit/ChangeLog
WebKit/WebView/WebHTMLView.mm
WebKit/win/ChangeLog
WebKit/win/WebView.cpp

index b7ad5e37559b6c5fb653c576dc04768fdf90fd7d..9a20584f17b23d28a5249ef4ae6838a07332fb94 100644 (file)
@@ -1,3 +1,24 @@
+2007-07-04  Adam Roben  <aroben@apple.com>
+
+        Move logic for calling mouseDidMoveOverElement into WebCore
+
+        Reviewed by Sam.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::mouseMoved): Added. Calls Chrome::mouseDidMoveOverElement.
+        (WebCore::EventHandler::handleMouseMoveEvent): Now takes an optional
+        HitTestResult* parameter which is used to communicate to the caller the
+        node the mouse is over.
+        * page/EventHandler.h:
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::mouseMoved): Changed to call the overloaded
+        mouseMoved().
+        (WebCore::EventHandler::passMouseMoveEventToSubframe): Pass hoveredNode
+        through to the subframe so we can get the deepest node hovered, not
+        just the node's parent frame.
+        * page/win/EventHandlerWin.cpp:
+        (WebCore::EventHandler::passMouseMoveEventToSubframe): Ditto.
+
 2007-07-04  Adam Roben  <aroben@apple.com>
 
         Add Chrome::mouseDidMoveOverElement
index 245065eacc5ea53b8e177c911e7a81cf479a88c8..194d1a159f0423c6c5a953015362b8dccc82babb 100644 (file)
@@ -882,7 +882,21 @@ bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEv
     return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent;
 }
 
-bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
+bool EventHandler::mouseMoved(const PlatformMouseEvent& event)
+{
+    HitTestResult hoveredNode = HitTestResult(IntPoint());
+    bool result = handleMouseMoveEvent(event, &hoveredNode);
+
+    Page* page = m_frame->page();
+    if (!page)
+        return result;
+
+    hoveredNode.setToNonShadowAncestor();
+    page->chrome()->mouseDidMoveOverElement(hoveredNode, event.modifierFlags());
+    return result;
+}
+
+bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, HitTestResult* hoveredNode)
 {
     // in Radar 3703768 we saw frequent crashes apparently due to the
     // part being null here, which seems impossible, so check for nil
@@ -894,7 +908,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
 
     RefPtr<FrameView> protector(m_frame->view());
     m_currentMousePosition = mouseEvent.pos();
-   
+
     if (m_hoverTimer.isActive())
         m_hoverTimer.stop();
 
@@ -917,6 +931,8 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
     // was pressed, rather than updating for nodes the mouse moves over as you hold the mouse down.
     HitTestRequest request(m_mousePressed && m_mouseDownMayStartSelect, m_mousePressed, true);
     MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent);
+    if (hoveredNode)
+        *hoveredNode = mev.hitTestResult();
 
     PlatformScrollbar* scrollbar = 0;
 
@@ -948,7 +964,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent)
     if (newSubframe) {
         // Update over/out state before passing the event to the subframe.
         updateMouseEventTargetNode(mev.targetNode(), mouseEvent, true);
-        swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get());
+        swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get(), hoveredNode);
     } else {
         if (scrollbar && !m_mousePressed)
             scrollbar->handleMouseMoveEvent(mouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering.
index 94d555d4aef4914fdda226a3da7e2f2df5468aac..df61bbf8508512a996c24dd2e0d051c1c0c98b2e 100644 (file)
@@ -121,8 +121,10 @@ public:
 
     bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
 
+    bool mouseMoved(const PlatformMouseEvent&);
+
     bool handleMousePressEvent(const PlatformMouseEvent&);
-    bool handleMouseMoveEvent(const PlatformMouseEvent&);
+    bool handleMouseMoveEvent(const PlatformMouseEvent&, HitTestResult* hoveredNode = 0);
     bool handleMouseReleaseEvent(const PlatformMouseEvent&);
     bool handleWheelEvent(PlatformWheelEvent&);
 
@@ -223,7 +225,7 @@ private:
     bool dragHysteresisExceeded(const IntPoint&) const;
 
     bool passMousePressEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
-    bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
+    bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult* hoveredNode = 0);
     bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
 
     bool passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe);
index 04760a032f2998b05f4aa7ca339a5792f96fcc48..762abd72a2f9d7a6d7007cdee3d9035e541b16e9 100644 (file)
@@ -597,7 +597,7 @@ void EventHandler::mouseMoved(NSEvent *event)
     RetainPtr<NSEvent> oldCurrentEvent = currentEvent();
     currentEvent() = event;
     
-    handleMouseMoveEvent(event);
+    mouseMoved(PlatformMouseEvent(event));
     
     ASSERT(currentEvent() == event);
     currentEvent() = oldCurrentEvent;
@@ -610,9 +610,9 @@ bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m
     return passSubframeEventToSubframe(mev, subframe);
 }
 
-bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
+bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
 {
-    return passSubframeEventToSubframe(mev, subframe);
+    return passSubframeEventToSubframe(mev, subframe, hoveredNode);
 }
 
 bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
index c1c12fb3d30fb1a6f026d3877e1b1467676207ee..c8020f39654aa367a8d3c0370d6a283be7e28c5f 100644 (file)
@@ -50,9 +50,9 @@ bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m
     return true;
 }
 
-bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
+bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
 {
-    subframe->eventHandler()->handleMouseMoveEvent(mev.event());
+    subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode);
     return true;
 }
 
index a63881cac12f82cf5bebb477f6180d605bf8c58f..8126de3b710a48e8ee39b70161f13162dc039356 100644 (file)
@@ -1,3 +1,12 @@
+2007-07-04  Adam Roben  <aroben@apple.com>
+
+        Removed call to mouseDidMoveOverElement now that WebCore handles it
+
+        Reviewed by Sam.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _updateMouseoverWithEvent:]):
+
 2007-07-04  Adam Roben  <aroben@apple.com>
 
         Add WebChromeClient::mouseDidMoveOverElement
index 82e27c086192a0434c61613e3ad968f60eeb7753..4004c6c6a1ba5c51532c7ed9142167c0a453c4be 100644 (file)
@@ -1188,9 +1188,6 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
         NSPoint point = [view convertPoint:[event locationInWindow] fromView:nil];
         NSDictionary *element = [view elementAtPoint:point];
 
-        // Have the web view send a message to the delegate so it can do status bar display.
-        [[view _webView] _mouseDidMoveOverElement:element modifierFlags:[event modifierFlags]];
-
         // Set a tool tip; it won't show up right away but will if the user pauses.
 
         // First priority is a potential toolTip representing a spelling or grammar error
index 7f35debd9c13eed8b7c552d112be3263cdbac9ef..14fd9289de676d538308302bea5c43b701dc381d 100644 (file)
@@ -1,3 +1,12 @@
+2007-07-04  Adam Roben  <aroben@apple.com>
+
+        Removed call to mouseDidMoveOverElement now that WebCore handles it
+
+        Reviewed by Sam.
+
+        * WebView.cpp:
+        (WebView::handleMouseEvent):
+
 2007-07-04  Adam Roben  <aroben@apple.com>
 
         Add WebChromeClient::mouseDidMoveOverElement
index 8722067f491341361de94e529fb9cdb5d582fc10..a557233811d475d8bd8b11d01493b7a2487381df 100644 (file)
@@ -797,14 +797,7 @@ bool WebView::handleMouseEvent(UINT message, WPARAM wParam, LPARAM lParam)
         if (!insideThreshold)
             globalClickCount = 0;
         mouseEvent.setClickCount(globalClickCount);
-        handled = m_page->mainFrame()->eventHandler()->handleMouseMoveEvent(mouseEvent);
-
-        if (m_uiDelegate) {
-            COMPtr<IPropertyBag> props;
-            POINT contentsPoint = m_page->mainFrame()->view()->windowToContents(mouseEvent.pos());
-            if (SUCCEEDED(elementAtPoint(&contentsPoint, &props)))
-                m_uiDelegate->mouseDidMoveOverElement((IWebView*)this, props.get(), (UINT)wParam);
-        }
+        handled = m_page->mainFrame()->eventHandler()->mouseMoved(mouseEvent);
     }
     setMouseActivated(false);
     return handled;