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

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

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 years 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 overlayMainFrame()->view()->updateAllLifecyclePhases(); 226 overlayMainFrame()->view()->updateAllLifecyclePhases();
227 } 227 }
228 228
229 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { 229 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) {
230 bool handled = false; 230 bool handled = false;
231 231
232 if (isEmpty()) 232 if (isEmpty())
233 return false; 233 return false;
234 234
235 if (WebInputEvent::isGestureEventType(inputEvent.type) && 235 if (WebInputEvent::isGestureEventType(inputEvent.type()) &&
236 inputEvent.type == WebInputEvent::GestureTap) { 236 inputEvent.type() == WebInputEvent::GestureTap) {
237 // Only let GestureTab in (we only need it and we know 237 // Only let GestureTab in (we only need it and we know
238 // PlatformGestureEventBuilder supports it). 238 // PlatformGestureEventBuilder supports it).
239 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder( 239 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(
240 m_frameImpl->frameView(), 240 m_frameImpl->frameView(),
241 static_cast<const WebGestureEvent&>(inputEvent)); 241 static_cast<const WebGestureEvent&>(inputEvent));
242 handled = handleGestureEvent(gestureEvent); 242 handled = handleGestureEvent(gestureEvent);
243 if (handled) 243 if (handled)
244 return true; 244 return true;
245 245
246 overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent); 246 overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent);
247 } 247 }
248 if (WebInputEvent::isMouseEventType(inputEvent.type) && 248 if (WebInputEvent::isMouseEventType(inputEvent.type()) &&
249 inputEvent.type != WebInputEvent::MouseEnter) { 249 inputEvent.type() != WebInputEvent::MouseEnter) {
250 // PlatformMouseEventBuilder does not work with MouseEnter type, so we 250 // PlatformMouseEventBuilder does not work with MouseEnter type, so we
251 // filter it out manually. 251 // filter it out manually.
252 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder( 252 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder(
253 m_frameImpl->frameView(), 253 m_frameImpl->frameView(),
254 static_cast<const WebMouseEvent&>(inputEvent)); 254 static_cast<const WebMouseEvent&>(inputEvent));
255 255
256 if (mouseEvent.type() == PlatformEvent::MouseMoved) 256 if (mouseEvent.type() == PlatformEvent::MouseMoved)
257 handled = handleMouseMove(mouseEvent); 257 handled = handleMouseMove(mouseEvent);
258 else if (mouseEvent.type() == PlatformEvent::MousePressed) 258 else if (mouseEvent.type() == PlatformEvent::MousePressed)
259 handled = handleMousePress(); 259 handled = handleMousePress();
260 260
261 if (handled) 261 if (handled)
262 return true; 262 return true;
263 263
264 if (mouseEvent.type() == PlatformEvent::MouseMoved) { 264 if (mouseEvent.type() == PlatformEvent::MouseMoved) {
265 handled = overlayMainFrame()->eventHandler().handleMouseMoveEvent( 265 handled = overlayMainFrame()->eventHandler().handleMouseMoveEvent(
266 mouseEvent, createPlatformMouseEventVector( 266 mouseEvent, createPlatformMouseEventVector(
267 m_frameImpl->frameView(), 267 m_frameImpl->frameView(),
268 std::vector<const WebInputEvent*>())) != 268 std::vector<const WebInputEvent*>())) !=
269 WebInputEventResult::NotHandled; 269 WebInputEventResult::NotHandled;
270 } 270 }
271 if (mouseEvent.type() == PlatformEvent::MousePressed) 271 if (mouseEvent.type() == PlatformEvent::MousePressed)
272 handled = overlayMainFrame()->eventHandler().handleMousePressEvent( 272 handled = overlayMainFrame()->eventHandler().handleMousePressEvent(
273 mouseEvent) != WebInputEventResult::NotHandled; 273 mouseEvent) != WebInputEventResult::NotHandled;
274 if (mouseEvent.type() == PlatformEvent::MouseReleased) 274 if (mouseEvent.type() == PlatformEvent::MouseReleased)
275 handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent( 275 handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent(
276 mouseEvent) != WebInputEventResult::NotHandled; 276 mouseEvent) != WebInputEventResult::NotHandled;
277 } 277 }
278 278
279 if (WebInputEvent::isTouchEventType(inputEvent.type)) { 279 if (WebInputEvent::isTouchEventType(inputEvent.type())) {
280 PlatformTouchEvent touchEvent = PlatformTouchEventBuilder( 280 PlatformTouchEvent touchEvent = PlatformTouchEventBuilder(
281 m_frameImpl->frameView(), 281 m_frameImpl->frameView(),
282 static_cast<const WebTouchEvent&>(inputEvent)); 282 static_cast<const WebTouchEvent&>(inputEvent));
283 handled = handleTouchEvent(touchEvent); 283 handled = handleTouchEvent(touchEvent);
284 if (handled) 284 if (handled)
285 return true; 285 return true;
286 overlayMainFrame()->eventHandler().handleTouchEvent( 286 overlayMainFrame()->eventHandler().handleTouchEvent(
287 touchEvent, 287 touchEvent,
288 createPlatformTouchEventVector(m_frameImpl->frameView(), 288 createPlatformTouchEventVector(m_frameImpl->frameView(),
289 std::vector<const WebInputEvent*>())); 289 std::vector<const WebInputEvent*>()));
290 } 290 }
291 if (WebInputEvent::isKeyboardEventType(inputEvent.type)) { 291 if (WebInputEvent::isKeyboardEventType(inputEvent.type())) {
292 overlayMainFrame()->eventHandler().keyEvent( 292 overlayMainFrame()->eventHandler().keyEvent(
293 static_cast<const WebKeyboardEvent&>(inputEvent)); 293 static_cast<const WebKeyboardEvent&>(inputEvent));
294 } 294 }
295 295
296 if (inputEvent.type == WebInputEvent::MouseWheel) { 296 if (inputEvent.type() == WebInputEvent::MouseWheel) {
297 PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder( 297 PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder(
298 m_frameImpl->frameView(), 298 m_frameImpl->frameView(),
299 static_cast<const WebMouseWheelEvent&>(inputEvent)); 299 static_cast<const WebMouseWheelEvent&>(inputEvent));
300 handled = overlayMainFrame()->eventHandler().handleWheelEvent(wheelEvent) != 300 handled = overlayMainFrame()->eventHandler().handleWheelEvent(wheelEvent) !=
301 WebInputEventResult::NotHandled; 301 WebInputEventResult::NotHandled;
302 } 302 }
303 303
304 return handled; 304 return handled;
305 } 305 }
306 306
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 bool InspectorOverlay::shouldSearchForNode() { 784 bool InspectorOverlay::shouldSearchForNode() {
785 return m_inspectMode != InspectorDOMAgent::NotSearching; 785 return m_inspectMode != InspectorDOMAgent::NotSearching;
786 } 786 }
787 787
788 void InspectorOverlay::inspect(Node* node) { 788 void InspectorOverlay::inspect(Node* node) {
789 if (m_domAgent) 789 if (m_domAgent)
790 m_domAgent->inspect(node); 790 m_domAgent->inspect(node);
791 } 791 }
792 792
793 } // namespace blink 793 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698