2011-04-07 Alice Boxhall <aboxhall@chromium.org>

        Reviewed by Ryosuke Niwa.

        Move the MouseEventWithHitTestResults::targetNode() method on to EventHandler.
        https://bugs.webkit.org/show_bug.cgi?id=57921

        Moves the MouseEventWithHitTestResults::targetNode() method on to EventHandler, so
        that the same logic can be used for a HitTestResult.

        No visible changes, just cleanup, so no tests.

        * page/EventHandler.cpp:
        (WebCore::EventHandler::selectClosestWordFromMouseEvent):
        (WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent):
        (WebCore::EventHandler::handleMousePressEventTripleClick):
        (WebCore::EventHandler::handleMousePressEventSingleClick):
        (WebCore::EventHandler::handleMousePressEvent):
        (WebCore::EventHandler::handleMouseDraggedEvent):
        (WebCore::EventHandler::handleMouseReleaseEvent):
        (WebCore::EventHandler::subframeForHitTestResult):
        Made public static member, so that it can access targetNode(), and be accessed by
        webkitwebview in gtk.
        (WebCore::EventHandler::selectCursor):
        (WebCore::EventHandler::targetNode):
        (WebCore::EventHandler::handleMouseDoubleClickEvent):
        (WebCore::EventHandler::handleMouseMoveEvent):
        (WebCore::EventHandler::updateDragAndDrop):
        (WebCore::EventHandler::sendContextMenuEvent):
        * page/EventHandler.h:
        * page/MouseEventWithHitTestResults.cpp:
        (WebCore::MouseEventWithHitTestResults::MouseEventWithHitTestResults):
        * page/MouseEventWithHitTestResults.h:
        * page/android/EventHandlerAndroid.cpp:
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
        * page/brew/EventHandlerBrew.cpp:
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
        * page/chromium/EventHandlerChromium.cpp:
        (WebCore::EventHandler::passMousePressEventToSubframe):
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
        * page/efl/EventHandlerEfl.cpp:
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
        * page/gtk/EventHandlerGtk.cpp:
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
        * page/haiku/EventHandlerHaiku.cpp:
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
        (WebCore::EventHandler::passSubframeEventToSubframe):
        * page/wx/EventHandlerWx.cpp:
        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
2011-04-07  Alice Boxhall  <aboxhall@chromium.org>

        Reviewed by Ryosuke Niwa.

        Move the MouseEventWithHitTestResults::targetNode() method on to EventHandler.
        https://bugs.webkit.org/show_bug.cgi?id=57921

        * webkit/webkitwebview.cpp:
        (webkit_web_view_forward_context_menu_event):
        Call subframeForHitTestResult rather than subframeForTargetNode as the targetNode()
        method has moved on to EventHandler.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83153 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 718cfbf4
2011-04-07 Alice Boxhall <aboxhall@chromium.org>
Reviewed by Ryosuke Niwa.
Move the MouseEventWithHitTestResults::targetNode() method on to EventHandler.
https://bugs.webkit.org/show_bug.cgi?id=57921
Moves the MouseEventWithHitTestResults::targetNode() method on to EventHandler, so
that the same logic can be used for a HitTestResult.
No visible changes, just cleanup, so no tests.
* page/EventHandler.cpp:
(WebCore::EventHandler::selectClosestWordFromMouseEvent):
(WebCore::EventHandler::selectClosestWordOrLinkFromMouseEvent):
(WebCore::EventHandler::handleMousePressEventTripleClick):
(WebCore::EventHandler::handleMousePressEventSingleClick):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDraggedEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::subframeForHitTestResult):
Made public static member, so that it can access targetNode(), and be accessed by
webkitwebview in gtk.
(WebCore::EventHandler::selectCursor):
(WebCore::EventHandler::targetNode):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::updateDragAndDrop):
(WebCore::EventHandler::sendContextMenuEvent):
* page/EventHandler.h:
* page/MouseEventWithHitTestResults.cpp:
(WebCore::MouseEventWithHitTestResults::MouseEventWithHitTestResults):
* page/MouseEventWithHitTestResults.h:
* page/android/EventHandlerAndroid.cpp:
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
* page/brew/EventHandlerBrew.cpp:
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
* page/chromium/EventHandlerChromium.cpp:
(WebCore::EventHandler::passMousePressEventToSubframe):
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
* page/efl/EventHandlerEfl.cpp:
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
* page/gtk/EventHandlerGtk.cpp:
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
* page/haiku/EventHandlerHaiku.cpp:
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
(WebCore::EventHandler::passSubframeEventToSubframe):
* page/wx/EventHandlerWx.cpp:
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
2011-04-07 Pavel Podivilov <podivilov@chromium.org>
Reviewed by Pavel Feldman.
This diff is collapsed.
......@@ -143,6 +143,7 @@ public:
void setIgnoreWheelEvents(bool);
static Frame* subframeForTargetNode(Node*);
static Frame* subframeForHitTestResult(const MouseEventWithHitTestResults&);
bool scrollOverflow(ScrollDirection, ScrollGranularity, Node* startingNode = 0);
bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0);
......@@ -261,13 +262,16 @@ private:
PassRefPtr<Clipboard> createDraggingClipboard() const;
#endif // ENABLE(DRAG_SUPPORT)
bool eventActivatedView(const PlatformMouseEvent&) const;
void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&);
void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&);
bool handleMouseDoubleClickEvent(const PlatformMouseEvent&);
static Node* targetNode(const MouseEventWithHitTestResults&);
static Node* targetNode(const HitTestResult&);
bool handleMousePressEvent(const MouseEventWithHitTestResults&);
bool handleMousePressEventSingleClick(const MouseEventWithHitTestResults&);
bool handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
......
......@@ -32,21 +32,6 @@ MouseEventWithHitTestResults::MouseEventWithHitTestResults(const PlatformMouseEv
, m_hitTestResult(hitTestResult)
{
}
Node* MouseEventWithHitTestResults::targetNode() const
{
Node* node = m_hitTestResult.innerNode();
if (!node)
return 0;
if (node->inDocument())
return node;
Element* element = node->parentElement();
if (element && element->inDocument())
return element;
return node;
}
const IntPoint MouseEventWithHitTestResults::localPoint() const
{
......
......@@ -34,7 +34,6 @@ public:
const PlatformMouseEvent& event() const { return m_event; }
const HitTestResult& hitTestResult() const { return m_hitTestResult; }
Node* targetNode() const;
const IntPoint localPoint() const;
Scrollbar* scrollbar() const;
bool isOverLink() const;
......
......@@ -53,7 +53,7 @@ void EventHandler::focusDocumentView()
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
// Figure out which view to send the event to.
RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0;
RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
if (!target || !target->isWidget())
return false;
return passMouseDownEventToWidget(toRenderWidget(target)->widget());
......
......@@ -59,7 +59,7 @@ void EventHandler::focusDocumentView()
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
// Figure out which view to send the event to.
RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0;
RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
if (!target || !target->isWidget())
return false;
return passMouseDownEventToWidget(toRenderWidget(target)->widget());
......
......@@ -61,7 +61,7 @@ bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m
IntPoint p = m_frame->view()->windowToContents(mev.event().pos());
if (m_frame->selection()->contains(p)) {
VisiblePosition visiblePos(
mev.targetNode()->renderer()->positionForPoint(mev.localPoint()));
targetNode(mev)->renderer()->positionForPoint(mev.localPoint()));
VisibleSelection newSelection(visiblePos);
if (m_frame->selection()->shouldChangeSelection(newSelection))
m_frame->selection()->setSelection(newSelection);
......@@ -103,9 +103,9 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& wheelEvent, Widget
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
// Figure out which view to send the event to.
if (!event.targetNode() || !event.targetNode()->renderer() || !event.targetNode()->renderer()->isWidget())
if (!targetNode(event) || !targetNode(event)->renderer() || !targetNode(event)->renderer()->isWidget())
return false;
return passMouseDownEventToWidget(toRenderWidget(event.targetNode()->renderer())->widget());
return passMouseDownEventToWidget(toRenderWidget(targetNode(event)->renderer())->widget());
}
bool EventHandler::passMouseDownEventToWidget(Widget* widget)
......
......@@ -61,7 +61,7 @@ void EventHandler::focusDocumentView()
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0;
RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
if (!target || !target->isWidget())
return false;
......
......@@ -59,7 +59,7 @@ void EventHandler::focusDocumentView()
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
// Figure out which view to send the event to.
RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0;
RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
if (!target || !target->isWidget())
return false;
return passMouseDownEventToWidget(toRenderWidget(target)->widget());
......
......@@ -73,7 +73,7 @@ void EventHandler::focusDocumentView()
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
// Figure out which view to send the event to.
RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0;
RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
if (!target || !target->isWidget())
return false;
return passMouseDownEventToWidget(toRenderWidget(target)->widget());
......
......@@ -168,7 +168,7 @@ void EventHandler::focusDocumentView()
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
// Figure out which view to send the event to.
RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0;
RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
if (!target || !target->isWidget())
return false;
......@@ -381,7 +381,7 @@ bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& eve
return true;
case NSLeftMouseDown: {
Node* node = event.targetNode();
Node* node = targetNode(event);
if (!node)
return false;
RenderObject* renderer = node->renderer();
......
......@@ -63,10 +63,10 @@ bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults&
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
{
// Figure out which view to send the event to.
if (!event.targetNode() || !event.targetNode()->renderer() || !event.targetNode()->renderer()->isWidget())
if (!targetNode(event) || !targetNode(event)->renderer() || !targetNode(event)->renderer()->isWidget())
return false;
return passMouseDownEventToWidget(toRenderWidget(event.targetNode()->renderer())->widget());
return passMouseDownEventToWidget(toRenderWidget(targetNode(event)->renderer())->widget());
}
bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget)
......
2011-04-07 Alice Boxhall <aboxhall@chromium.org>
Reviewed by Ryosuke Niwa.
Move the MouseEventWithHitTestResults::targetNode() method on to EventHandler.
https://bugs.webkit.org/show_bug.cgi?id=57921
* webkit/webkitwebview.cpp:
(webkit_web_view_forward_context_menu_event):
Call subframeForHitTestResult rather than subframeForTargetNode as the targetNode()
method has moved on to EventHandler.
2011-04-05 Martin Robinson <mrobinson@igalia.com>
Reviewed by Eric Seidel.
......
......@@ -319,7 +319,7 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
IntPoint point = mainFrame->view()->windowToContents(event.pos());
MouseEventWithHitTestResults mev = mainFrame->document()->prepareMouseEvent(request, point, event);
Frame* targetFrame = EventHandler::subframeForTargetNode(mev.targetNode());
Frame* targetFrame = EventHandler::subframeForHitTestResult(mev);
if (!targetFrame)
targetFrame = mainFrame;
......
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