Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: webkit/port/page/EventHandlerWin.cpp

Issue 7419: Move many files that were suffixed Win.cpp to Chromium.cpp, and place them in... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "config.h"
27 #include "EventHandler.h"
28
29 #include "ClipboardWin.h"
30 #include "Cursor.h"
31 #include "FloatPoint.h"
32 #include "FocusController.h"
33 #include "FrameView.h"
34 #include "Frame.h"
35 #include "HitTestRequest.h"
36 #include "HitTestResult.h"
37 #include "MouseEventWithHitTestResults.h"
38 #include "Page.h"
39 #include "PlatformKeyboardEvent.h"
40 #include "PlatformScrollBar.h"
41 #include "PlatformWheelEvent.h"
42 #include "RenderWidget.h"
43 #include "SelectionController.h"
44 #include "WCDataObject.h"
45 #include "NotImplemented.h"
46
47 namespace WebCore {
48
49 unsigned EventHandler::s_accessKeyModifiers = PlatformKeyboardEvent::AltKey;
50
51 const double EventHandler::TextDragDelay = 0.0;
52
53 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& m ev, Frame* subframe)
54 {
55 // If we're clicking into a frame that is selected, the frame will appear
56 // greyed out even though we're clicking on the selection. This looks
57 // really strange (having the whole frame be greyed out), so we deselect the
58 // selection.
59 IntPoint p = m_frame->view()->windowToContents(mev.event().pos());
60 if (m_frame->selection()->contains(p)) {
61 VisiblePosition visiblePos(
62 mev.targetNode()->renderer()->positionForPoint(mev.localPoint()));
63 Selection newSelection(visiblePos);
64 if (m_frame->shouldChangeSelection(newSelection))
65 m_frame->selection()->setSelection(newSelection);
66 }
67
68 subframe->eventHandler()->handleMousePressEvent(mev.event());
69 return true;
70 }
71
72 bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& me v, Frame* subframe, HitTestResult* hoveredNode)
73 {
74 if (m_mouseDownMayStartDrag && !m_mouseDownWasInSubframe)
75 return false;
76 subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode);
77 return true;
78 }
79
80 bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
81 {
82 subframe->eventHandler()->handleMouseReleaseEvent(mev.event());
83 return true;
84 }
85
86 bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& wheelEvent, Widget * widget)
87 {
88 if (!widget) {
89 // We can sometimes get a null widget! EventHandlerMac handles a null
90 // widget by returning false, so we do the same.
91 return false;
92 }
93
94 if (!widget->isFrameView()) {
95 // Probably a plugin widget. They will receive the event via an
96 // EventTargetNode dispatch when this returns false.
97 return false;
98 }
99
100 return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheel Event(wheelEvent);
101 }
102
103 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev, PlatformScrollbar* scrollbar)
104 {
105 if (!scrollbar || !scrollbar->isEnabled())
106 return false;
107 return scrollbar->handleMousePressEvent(mev.event());
108 }
109
110 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestR esults& event)
111 {
112 // Figure out which view to send the event to.
113 if (!event.targetNode() || !event.targetNode()->renderer() || !event.targetN ode()->renderer()->isWidget())
114 return false;
115
116 return passMouseDownEventToWidget(static_cast<RenderWidget*>(event.targetNod e()->renderer())->widget());
117 }
118
119 bool EventHandler::passMouseDownEventToWidget(Widget* widget)
120 {
121 notImplemented();
122 return false;
123 }
124
125 bool EventHandler::tabsToAllControls(KeyboardEvent*) const
126 {
127 return true;
128 }
129
130 bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
131 {
132 // TODO(darin): Apple's EventHandlerWin.cpp does the following:
133 // return event.activatedWebView();
134 return false;
135 }
136
137 PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
138 {
139 COMPtr<WCDataObject> dataObject;
140 WCDataObject::createInstance(&dataObject);
141 return ClipboardWin::create(true, dataObject.get(), ClipboardWritable);
142 }
143
144 void EventHandler::focusDocumentView()
145 {
146 Page* page = m_frame->page();
147 if (!page)
148 return;
149 page->focusController()->setFocusedFrame(m_frame);
150 }
151
152 bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget)
153 {
154 return passMouseDownEventToWidget(renderWidget->widget());
155 }
156
157 }
OLDNEW
« no previous file with comments | « webkit/port/page/DragControllerWin.cpp ('k') | webkit/port/page/chromium/AXObjectCacheChromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698