2 * Copyright (C) 2010 Company 100, Inc.
3 * Copyright 2009, The Android Open Source Project
4 * Copyright (C) 2006 Zack Rusin <zack@kde.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include "EventHandler.h"
31 #include "ClipboardBrew.h"
32 #include "EventNames.h"
33 #include "FocusController.h"
35 #include "FrameView.h"
36 #include "HitTestResult.h"
37 #include "KeyboardEvent.h"
38 #include "MouseEventWithHitTestResults.h"
39 #include "NotImplemented.h"
41 #include "PlatformKeyboardEvent.h"
42 #include "PlatformWheelEvent.h"
43 #include "RenderWidget.h"
47 bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
52 void EventHandler::focusDocumentView()
54 Page* page = m_frame->page();
56 page->focusController()->setFocusedFrame(m_frame);
59 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
61 // Figure out which view to send the event to.
62 RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
63 if (!target || !target->isWidget())
65 return passMouseDownEventToWidget(toRenderWidget(target)->widget());
68 bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget)
70 return passMouseDownEventToWidget(renderWidget->widget());
73 // This function is used to route the mouse down event to the native widgets, it seems like a
74 // work around for the Mac platform which does not support double clicks, but browsers do.
75 bool EventHandler::passMouseDownEventToWidget(Widget* widget)
81 bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const
87 // This function is called for mouse events by FrameView::handleMousePressEvent().
88 // It is used to ensure that events are sync'ed correctly between frames. For example
89 // if the user presses down in one frame and up in another frame, this function will
90 // returns true, and pass the event to the correct frame.
91 bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& event, Frame* subframe, HitTestResult*)
97 // This is called to route wheel events to child widgets when they are RenderWidget
98 // as the parent usually gets wheel event. Don't have a mouse with a wheel to confirm
99 // the operation of this function.
100 bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* widget)
106 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
108 return passSubframeEventToSubframe(mev, subframe);
111 bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
113 return passSubframeEventToSubframe(mev, subframe, hoveredNode);
116 bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
118 return passSubframeEventToSubframe(mev, subframe);
121 unsigned EventHandler::accessKeyModifiers()
123 return PlatformKeyboardEvent::AltKey;
126 } // namespace WebCore