Commit d9530b4c authored by hyatt's avatar hyatt
Browse files

Refactor the code that sends the mouse down to scrollbars.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16692 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ce5ff2a9
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.
......@@ -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)
......
......@@ -72,4 +72,9 @@ 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());
}
}
......@@ -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);
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())
......
......@@ -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();
......
......@@ -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; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment