|
1 /* |
|
2 * Copyright 2009, The Android Open Source Project |
|
3 * Copyright (C) 2006 Zack Rusin <zack@kde.org> |
|
4 * |
|
5 * Redistribution and use in source and binary forms, with or without |
|
6 * modification, are permitted provided that the following conditions |
|
7 * are met: |
|
8 * 1. Redistributions of source code must retain the above copyright |
|
9 * notice, this list of conditions and the following disclaimer. |
|
10 * 2. Redistributions in binary form must reproduce the above copyright |
|
11 * notice, this list of conditions and the following disclaimer in the |
|
12 * documentation and/or other materials provided with the distribution. |
|
13 * |
|
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
|
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
|
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
25 */ |
|
26 #define LOG_TAG "WebCore" |
|
27 |
|
28 #include "config.h" |
|
29 #include "EventHandler.h" |
|
30 |
|
31 #include "FocusController.h" |
|
32 #include "Frame.h" |
|
33 #include "KeyboardEvent.h" |
|
34 #include "MouseEventWithHitTestResults.h" |
|
35 #include "Page.h" |
|
36 #include "PlatformKeyboardEvent.h" |
|
37 #include "PlatformWheelEvent.h" |
|
38 #include "RenderWidget.h" |
|
39 |
|
40 namespace WebCore { |
|
41 |
|
42 bool EventHandler::tabsToAllControls(KeyboardEvent*) const |
|
43 { |
|
44 return true; |
|
45 } |
|
46 |
|
47 void EventHandler::focusDocumentView() |
|
48 { |
|
49 if (Page* page = m_frame->page()) |
|
50 page->focusController()->setFocusedFrame(m_frame); |
|
51 } |
|
52 |
|
53 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event) |
|
54 { |
|
55 // Figure out which view to send the event to. |
|
56 RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0; |
|
57 if (!target || !target->isWidget()) |
|
58 return false; |
|
59 return passMouseDownEventToWidget(toRenderWidget(target)->widget()); |
|
60 } |
|
61 |
|
62 bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget) |
|
63 { |
|
64 return passMouseDownEventToWidget(renderWidget->widget()); |
|
65 } |
|
66 |
|
67 // This function is used to route the mouse down event to the native widgets, it seems like a |
|
68 // work around for the Mac platform which does not support double clicks, but browsers do. |
|
69 bool EventHandler::passMouseDownEventToWidget(Widget*) |
|
70 { |
|
71 // return false so the normal propogation handles the event |
|
72 return false; |
|
73 } |
|
74 |
|
75 bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const |
|
76 { |
|
77 notImplemented(); |
|
78 return false; |
|
79 } |
|
80 |
|
81 // This function is called for mouse events by FrameView::handleMousePressEvent(). |
|
82 // It is used to ensure that events are sync'ed correctly between frames. For example |
|
83 // if the user presses down in one frame and up in another frame, this function will |
|
84 // returns true, and pass the event to the correct frame. |
|
85 bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame*, HitTestResult*) |
|
86 { |
|
87 notImplemented(); |
|
88 return false; |
|
89 } |
|
90 |
|
91 // This is called to route wheel events to child widgets when they are RenderWidget |
|
92 // as the parent usually gets wheel event. Don't have a mouse with a wheel to confirm |
|
93 // the operation of this function. |
|
94 bool EventHandler::passWheelEventToWidget(PlatformWheelEvent&, Widget*) |
|
95 { |
|
96 notImplemented(); |
|
97 return false; |
|
98 } |
|
99 |
|
100 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) |
|
101 { |
|
102 return passSubframeEventToSubframe(mev, subframe); |
|
103 } |
|
104 |
|
105 bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, |
|
106 Frame* subframe, HitTestResult*) |
|
107 { |
|
108 return passSubframeEventToSubframe(mev, subframe); |
|
109 } |
|
110 |
|
111 bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) |
|
112 { |
|
113 return passSubframeEventToSubframe(mev, subframe); |
|
114 } |
|
115 |
|
116 class Clipboard : public RefCounted<Clipboard> { |
|
117 }; |
|
118 |
|
119 PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const |
|
120 { |
|
121 return PassRefPtr<Clipboard>(0); |
|
122 } |
|
123 |
|
124 unsigned EventHandler::accessKeyModifiers() |
|
125 { |
|
126 return PlatformKeyboardEvent::AltKey; |
|
127 } |
|
128 |
|
129 const double EventHandler::TextDragDelay = 0.0; |
|
130 |
|
131 } // namespace WebCore |