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

Side by Side Diff: third_party/WebKit/Source/web/PageWidgetDelegate.cpp

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: Creating CoalescedWebInputEvent Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void PageWidgetDelegate::paintIgnoringCompositing(Page& page, 108 void PageWidgetDelegate::paintIgnoringCompositing(Page& page,
109 WebCanvas* canvas, 109 WebCanvas* canvas,
110 const WebRect& rect, 110 const WebRect& rect,
111 LocalFrame& root) { 111 LocalFrame& root) {
112 paintInternal(page, canvas, rect, root, GlobalPaintFlattenCompositingLayers); 112 paintInternal(page, canvas, rect, root, GlobalPaintFlattenCompositingLayers);
113 } 113 }
114 114
115 WebInputEventResult PageWidgetDelegate::handleInputEvent( 115 WebInputEventResult PageWidgetDelegate::handleInputEvent(
116 PageWidgetEventHandler& handler, 116 PageWidgetEventHandler& handler,
117 const WebInputEvent& event, 117 const CoalescedWebInputEvent& coalescedEvent,
118 LocalFrame* root) { 118 LocalFrame* root) {
119 const WebInputEvent& event = coalescedEvent.event();
119 if (event.modifiers & WebInputEvent::IsTouchAccessibility && 120 if (event.modifiers & WebInputEvent::IsTouchAccessibility &&
120 WebInputEvent::isMouseEventType(event.type)) { 121 WebInputEvent::isMouseEventType(event.type)) {
121 PlatformMouseEventBuilder pme(root->view(), 122 PlatformMouseEventBuilder pme(root->view(),
122 static_cast<const WebMouseEvent&>(event)); 123 static_cast<const WebMouseEvent&>(event));
123 124
124 IntPoint docPoint(root->view()->rootFrameToContents(pme.position())); 125 IntPoint docPoint(root->view()->rootFrameToContents(pme.position()));
125 HitTestResult result = root->eventHandler().hitTestResultAtPoint( 126 HitTestResult result = root->eventHandler().hitTestResultAtPoint(
126 docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); 127 docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active);
127 result.setToShadowHostIfInUserAgentShadowRoot(); 128 result.setToShadowHostIfInUserAgentShadowRoot();
128 if (result.innerNodeFrame()) { 129 if (result.innerNodeFrame()) {
129 Document* document = result.innerNodeFrame()->document(); 130 Document* document = result.innerNodeFrame()->document();
130 if (document) { 131 if (document) {
131 AXObjectCache* cache = document->existingAXObjectCache(); 132 AXObjectCache* cache = document->existingAXObjectCache();
132 if (cache) 133 if (cache)
133 cache->onTouchAccessibilityHover( 134 cache->onTouchAccessibilityHover(
134 result.roundedPointInInnerNodeFrame()); 135 result.roundedPointInInnerNodeFrame());
135 } 136 }
136 } 137 }
137 } 138 }
138 139
139 switch (event.type) { 140 switch (event.type) {
140 // FIXME: WebKit seems to always return false on mouse events processing 141 // FIXME: WebKit seems to always return false on mouse events processing
141 // methods. For now we'll assume it has processed them (as we are only 142 // methods. For now we'll assume it has processed them (as we are only
142 // interested in whether keyboard events are processed). 143 // interested in whether keyboard events are processed).
143 // FIXME: Why do we return HandleSuppressed when there is no root or 144 // FIXME: Why do we return HandleSuppressed when there is no root or
144 // the root is detached? 145 // the root is detached?
145 case WebInputEvent::MouseMove: 146 case WebInputEvent::MouseMove:
146 if (!root || !root->view()) 147 if (!root || !root->view())
147 return WebInputEventResult::HandledSuppressed; 148 return WebInputEventResult::HandledSuppressed;
148 handler.handleMouseMove(*root, static_cast<const WebMouseEvent&>(event)); 149 handler.handleMouseMove(*root, static_cast<const WebMouseEvent&>(event),
150 coalescedEvent.getCoalescedEventsPointers());
149 return WebInputEventResult::HandledSystem; 151 return WebInputEventResult::HandledSystem;
150 case WebInputEvent::MouseLeave: 152 case WebInputEvent::MouseLeave:
151 if (!root || !root->view()) 153 if (!root || !root->view())
152 return WebInputEventResult::HandledSuppressed; 154 return WebInputEventResult::HandledSuppressed;
153 handler.handleMouseLeave(*root, static_cast<const WebMouseEvent&>(event)); 155 handler.handleMouseLeave(*root, static_cast<const WebMouseEvent&>(event));
154 return WebInputEventResult::HandledSystem; 156 return WebInputEventResult::HandledSystem;
155 case WebInputEvent::MouseDown: 157 case WebInputEvent::MouseDown:
156 if (!root || !root->view()) 158 if (!root || !root->view())
157 return WebInputEventResult::HandledSuppressed; 159 return WebInputEventResult::HandledSuppressed;
158 handler.handleMouseDown(*root, static_cast<const WebMouseEvent&>(event)); 160 handler.handleMouseDown(*root, static_cast<const WebMouseEvent&>(event));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return handler.handleGestureEvent( 196 return handler.handleGestureEvent(
195 static_cast<const WebGestureEvent&>(event)); 197 static_cast<const WebGestureEvent&>(event));
196 198
197 case WebInputEvent::TouchStart: 199 case WebInputEvent::TouchStart:
198 case WebInputEvent::TouchMove: 200 case WebInputEvent::TouchMove:
199 case WebInputEvent::TouchEnd: 201 case WebInputEvent::TouchEnd:
200 case WebInputEvent::TouchCancel: 202 case WebInputEvent::TouchCancel:
201 case WebInputEvent::TouchScrollStarted: 203 case WebInputEvent::TouchScrollStarted:
202 if (!root || !root->view()) 204 if (!root || !root->view())
203 return WebInputEventResult::NotHandled; 205 return WebInputEventResult::NotHandled;
204 return handler.handleTouchEvent(*root, 206 return handler.handleTouchEvent(
205 static_cast<const WebTouchEvent&>(event)); 207 *root, static_cast<const WebTouchEvent&>(event),
208 coalescedEvent.getCoalescedEventsPointers());
206 case WebInputEvent::GesturePinchBegin: 209 case WebInputEvent::GesturePinchBegin:
207 case WebInputEvent::GesturePinchEnd: 210 case WebInputEvent::GesturePinchEnd:
208 case WebInputEvent::GesturePinchUpdate: 211 case WebInputEvent::GesturePinchUpdate:
209 // Touchscreen pinch events are currently not handled in main thread. 212 // Touchscreen pinch events are currently not handled in main thread.
210 // Once they are, these should be passed to |handleGestureEvent| similar 213 // Once they are, these should be passed to |handleGestureEvent| similar
211 // to gesture scroll events. 214 // to gesture scroll events.
212 return WebInputEventResult::NotHandled; 215 return WebInputEventResult::NotHandled;
213 default: 216 default:
214 return WebInputEventResult::NotHandled; 217 return WebInputEventResult::NotHandled;
215 } 218 }
216 } 219 }
217 220
218 // ---------------------------------------------------------------- 221 // ----------------------------------------------------------------
219 // Default handlers for PageWidgetEventHandler 222 // Default handlers for PageWidgetEventHandler
220 223
221 void PageWidgetEventHandler::handleMouseMove(LocalFrame& mainFrame, 224 void PageWidgetEventHandler::handleMouseMove(
222 const WebMouseEvent& event) { 225 LocalFrame& mainFrame,
226 const WebMouseEvent& event,
227 const std::vector<const WebInputEvent*>& coalescedEvents) {
223 mainFrame.eventHandler().handleMouseMoveEvent( 228 mainFrame.eventHandler().handleMouseMoveEvent(
224 PlatformMouseEventBuilder(mainFrame.view(), event)); 229 PlatformMouseEventBuilder(mainFrame.view(), event),
230 createPlatformMouseEventVector(mainFrame.view(), coalescedEvents));
225 } 231 }
226 232
227 void PageWidgetEventHandler::handleMouseLeave(LocalFrame& mainFrame, 233 void PageWidgetEventHandler::handleMouseLeave(LocalFrame& mainFrame,
228 const WebMouseEvent& event) { 234 const WebMouseEvent& event) {
229 mainFrame.eventHandler().handleMouseLeaveEvent( 235 mainFrame.eventHandler().handleMouseLeaveEvent(
230 PlatformMouseEventBuilder(mainFrame.view(), event)); 236 PlatformMouseEventBuilder(mainFrame.view(), event));
231 } 237 }
232 238
233 void PageWidgetEventHandler::handleMouseDown(LocalFrame& mainFrame, 239 void PageWidgetEventHandler::handleMouseDown(LocalFrame& mainFrame,
234 const WebMouseEvent& event) { 240 const WebMouseEvent& event) {
235 mainFrame.eventHandler().handleMousePressEvent( 241 mainFrame.eventHandler().handleMousePressEvent(
236 PlatformMouseEventBuilder(mainFrame.view(), event)); 242 PlatformMouseEventBuilder(mainFrame.view(), event));
237 } 243 }
238 244
239 void PageWidgetEventHandler::handleMouseUp(LocalFrame& mainFrame, 245 void PageWidgetEventHandler::handleMouseUp(LocalFrame& mainFrame,
240 const WebMouseEvent& event) { 246 const WebMouseEvent& event) {
241 mainFrame.eventHandler().handleMouseReleaseEvent( 247 mainFrame.eventHandler().handleMouseReleaseEvent(
242 PlatformMouseEventBuilder(mainFrame.view(), event)); 248 PlatformMouseEventBuilder(mainFrame.view(), event));
243 } 249 }
244 250
245 WebInputEventResult PageWidgetEventHandler::handleMouseWheel( 251 WebInputEventResult PageWidgetEventHandler::handleMouseWheel(
246 LocalFrame& mainFrame, 252 LocalFrame& mainFrame,
247 const WebMouseWheelEvent& event) { 253 const WebMouseWheelEvent& event) {
248 return mainFrame.eventHandler().handleWheelEvent( 254 return mainFrame.eventHandler().handleWheelEvent(
249 PlatformWheelEventBuilder(mainFrame.view(), event)); 255 PlatformWheelEventBuilder(mainFrame.view(), event));
250 } 256 }
251 257
252 WebInputEventResult PageWidgetEventHandler::handleTouchEvent( 258 WebInputEventResult PageWidgetEventHandler::handleTouchEvent(
253 LocalFrame& mainFrame, 259 LocalFrame& mainFrame,
254 const WebTouchEvent& event) { 260 const WebTouchEvent& event,
261 const std::vector<const WebInputEvent*>& coalescedEvents) {
255 return mainFrame.eventHandler().handleTouchEvent( 262 return mainFrame.eventHandler().handleTouchEvent(
256 PlatformTouchEventBuilder(mainFrame.view(), event)); 263 PlatformTouchEventBuilder(mainFrame.view(), event),
264 createPlatformTouchEventVector(mainFrame.view(), coalescedEvents));
257 } 265 }
258 266
259 } // namespace blink 267 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698