Refactor the code that sends the mouse down to scrollbars.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Oct 2006 07:26:55 +0000 (07:26 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 1 Oct 2006 07:26:55 +0000 (07:26 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16692 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/FrameViewMac.mm
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/platform/win/TemporaryLinkStubs.cpp

index 5d082fe912c34efc8e7d626e82ef6eb751342197..5a559796826d4b5069e9a1fb0b5b7ca959a9ef7e 100644 (file)
@@ -1,3 +1,20 @@
+2006-10-01  Dave Hyatt  <hyatt@apple.com>
+
+        Refactor the code that passes mouse presses to the Mac scrollbar and make it cross-platform.
+       
+        Reviewed by mitz
+
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::passWidgetMouseDownEventToWidget):
+        * bridge/mac/FrameViewMac.mm:
+        (WebCore::FrameView::passMousePressEventToScrollbar):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::handleMousePressEvent):
+        (WebCore::FrameView::setMousePressed):
+        * page/FrameView.h:
+        * platform/win/TemporaryLinkStubs.cpp:
+        (FrameView::passMousePressEventToScrollbar):
+
 2006-09-30  Sam Weinig  <sam.weinig@gmail.com>
 
         Reviewed by Darin.
index dd8b82aa409f49ae9eebe041c4a4669f2fd9d920..2e8a9d57cac1dde7f0d158e1e0a1163d72195cf6 100644 (file)
@@ -1406,21 +1406,14 @@ bool FrameMac::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResul
 {
     // Figure out which view to send the event to.
     RenderObject *target = event.targetNode() ? event.targetNode()->renderer() : 0;
-    if (!target)
+    if (!target || !target->isWidget())
         return false;
     
-    Widget* widget = event.scrollbar();
-    if (!widget) {
-        if (!target->isWidget())
-            return false;
-        widget = static_cast<RenderWidget*>(target)->widget();
-    }
-    
     // Doubleclick events don't exist in Cocoa.  Since passWidgetMouseDownEventToWidget will
     // just pass _currentEvent down to the widget,  we don't want to call it for events that
     // don't correspond to Cocoa events.  The mousedown/ups will have already been passed on as
     // part of the pressed/released handling.
-    return passMouseDownEventToWidget(widget);
+    return passMouseDownEventToWidget(static_cast<RenderWidget*>(target)->widget());
 }
 
 bool FrameMac::passWidgetMouseDownEventToWidget(RenderWidget *renderWidget)
index 7c22809534f7ab38d5094d29ff1b85dec60a7728..da7bd2602f584389a9d2b19b01a02da02bbfcce3 100644 (file)
@@ -71,5 +71,10 @@ bool FrameView::passWheelEventToSubframe(PlatformWheelEvent&, Frame* subframe)
 {
     return Mac(m_frame.get())->passWheelEventToWidget(subframe->view());
 }
-    
+
+bool FrameView::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev)
+{
+    return Mac(m_frame.get())->passMouseDownEventToWidget(mev.scrollbar());
+}
 }
index eb2c10bfc0f32c6d9d2058b7047e1d90654c06dd..1134cc67d5f3e85dcc0cb7738f1091492ed9d307 100644 (file)
@@ -613,7 +613,9 @@ void FrameView::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
         if (mev.targetNode()->isShadowNode() && mev.targetNode()->shadowParentNode()->hasTagName(inputTag))
             mev = prepareMouseEvent(true, true, false, mouseEvent);
 
-        m_frame->handleMousePressEvent(mev);
+        if (!mev.scrollbar() || !passMousePressEventToScrollbar(mev))
+            m_frame->handleMousePressEvent(mev);
+
         // Many AK widgets run their own event loops and consume events while the mouse is down.
         // When they finish, currentEvent is the mouseUp that they exited on.  We need to update
         // the khtml state with this mouseUp, which khtml never saw.
@@ -822,6 +824,11 @@ bool FrameView::mousePressed()
     return d->mousePressed;
 }
 
+void FrameView::setMousePressed(bool pressed)
+{
+    d->mousePressed = pressed;
+}
+
 void FrameView::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
 {
     if (!m_frame->document())
index 9e91eb3383a9e8ab0b47c0551c1483d125fd56a9..139d212aa48ffc372822129d7619b38786433a73 100644 (file)
@@ -144,8 +144,10 @@ public:
     bool passMouseMoveEventToSubframe(MouseEventWithHitTestResults&, Frame*);
     bool passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&, Frame*);
     bool passWheelEventToSubframe(PlatformWheelEvent&, Frame*);
+    bool passMousePressEventToScrollbar(MouseEventWithHitTestResults&);
 
     bool mousePressed();
+    void setMousePressed(bool);
 
     void doAutoScroll();
 
index 1d589335f6a28e807c22e05e992ee70bcac17aaa..eb1a92f21d85e9d5459c4028b9741930f24644c0 100644 (file)
@@ -82,6 +82,7 @@ bool FrameView::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev,
 bool FrameView::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) { return true; }
 bool FrameView::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) { return true; }
 bool FrameView::passWheelEventToSubframe(PlatformWheelEvent& e, Frame* subframe) { return false; }
+bool FrameView::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev) { return false; }
 
 void Widget::enableFlushDrawing() { notImplemented(); }
 bool Widget::isEnabled() const { notImplemented(); return 0; }