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

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

Issue 2479123003: WIP Add getCoalescedEvents API using vector of WebInputEvents (Closed)
Patch Set: 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) 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 return; 225 return;
226 226
227 AutoReset<bool> scoped(&m_inLayout, true); 227 AutoReset<bool> scoped(&m_inLayout, true);
228 if (m_needsUpdate) { 228 if (m_needsUpdate) {
229 m_needsUpdate = false; 229 m_needsUpdate = false;
230 rebuildOverlayPage(); 230 rebuildOverlayPage();
231 } 231 }
232 overlayMainFrame()->view()->updateAllLifecyclePhases(); 232 overlayMainFrame()->view()->updateAllLifecyclePhases();
233 } 233 }
234 234
235 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { 235 bool InspectorOverlay::handleInputEvent(
236 const WebInputEvent& inputEvent,
237 const std::vector<const WebInputEvent*>& webCoalescedEvents) {
236 bool handled = false; 238 bool handled = false;
237 239
238 if (isEmpty()) 240 if (isEmpty())
239 return false; 241 return false;
240 242
241 if (WebInputEvent::isGestureEventType(inputEvent.type) && 243 if (WebInputEvent::isGestureEventType(inputEvent.type) &&
242 inputEvent.type == WebInputEvent::GestureTap) { 244 inputEvent.type == WebInputEvent::GestureTap) {
243 // Only let GestureTab in (we only need it and we know 245 // Only let GestureTab in (we only need it and we know
244 // PlatformGestureEventBuilder supports it). 246 // PlatformGestureEventBuilder supports it).
245 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder( 247 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(
(...skipping 14 matching lines...) Expand all
260 static_cast<const WebMouseEvent&>(inputEvent)); 262 static_cast<const WebMouseEvent&>(inputEvent));
261 263
262 if (mouseEvent.type() == PlatformEvent::MouseMoved) 264 if (mouseEvent.type() == PlatformEvent::MouseMoved)
263 handled = handleMouseMove(mouseEvent); 265 handled = handleMouseMove(mouseEvent);
264 else if (mouseEvent.type() == PlatformEvent::MousePressed) 266 else if (mouseEvent.type() == PlatformEvent::MousePressed)
265 handled = handleMousePress(); 267 handled = handleMousePress();
266 268
267 if (handled) 269 if (handled)
268 return true; 270 return true;
269 271
270 if (mouseEvent.type() == PlatformEvent::MouseMoved) 272 if (mouseEvent.type() == PlatformEvent::MouseMoved) {
271 handled = overlayMainFrame()->eventHandler().handleMouseMoveEvent( 273 handled = overlayMainFrame()->eventHandler().handleMouseMoveEvent(
272 mouseEvent) != WebInputEventResult::NotHandled; 274 mouseEvent, createPlatformMouseEventVector(
273 if (mouseEvent.type() == PlatformEvent::MousePressed) 275 m_webViewImpl->mainFrameImpl()->frameView(),
276 webCoalescedEvents)) !=
277 WebInputEventResult::NotHandled;
278 }
279 if (mouseEvent.type() == PlatformEvent::MousePressed) {
274 handled = overlayMainFrame()->eventHandler().handleMousePressEvent( 280 handled = overlayMainFrame()->eventHandler().handleMousePressEvent(
275 mouseEvent) != WebInputEventResult::NotHandled; 281 mouseEvent) != WebInputEventResult::NotHandled;
276 if (mouseEvent.type() == PlatformEvent::MouseReleased) 282 }
283 if (mouseEvent.type() == PlatformEvent::MouseReleased) {
277 handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent( 284 handled = overlayMainFrame()->eventHandler().handleMouseReleaseEvent(
278 mouseEvent) != WebInputEventResult::NotHandled; 285 mouseEvent) != WebInputEventResult::NotHandled;
286 }
279 } 287 }
280 288
281 if (WebInputEvent::isTouchEventType(inputEvent.type)) { 289 if (WebInputEvent::isTouchEventType(inputEvent.type)) {
282 PlatformTouchEvent touchEvent = PlatformTouchEventBuilder( 290 PlatformTouchEvent touchEvent = PlatformTouchEventBuilder(
283 m_webViewImpl->mainFrameImpl()->frameView(), 291 m_webViewImpl->mainFrameImpl()->frameView(),
284 static_cast<const WebTouchEvent&>(inputEvent)); 292 static_cast<const WebTouchEvent&>(inputEvent));
285 handled = handleTouchEvent(touchEvent); 293 handled = handleTouchEvent(touchEvent);
286 if (handled) 294 if (handled)
287 return true; 295 return true;
288 overlayMainFrame()->eventHandler().handleTouchEvent(touchEvent); 296 overlayMainFrame()->eventHandler().handleTouchEvent(
297 touchEvent,
298 createPlatformTouchEventVector(
299 m_webViewImpl->mainFrameImpl()->frameView(), webCoalescedEvents));
289 } 300 }
290 if (WebInputEvent::isKeyboardEventType(inputEvent.type)) { 301 if (WebInputEvent::isKeyboardEventType(inputEvent.type)) {
291 overlayMainFrame()->eventHandler().keyEvent( 302 overlayMainFrame()->eventHandler().keyEvent(
292 static_cast<const WebKeyboardEvent&>(inputEvent)); 303 static_cast<const WebKeyboardEvent&>(inputEvent));
293 } 304 }
294 305
295 if (inputEvent.type == WebInputEvent::MouseWheel) { 306 if (inputEvent.type == WebInputEvent::MouseWheel) {
296 PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder( 307 PlatformWheelEvent wheelEvent = PlatformWheelEventBuilder(
297 m_webViewImpl->mainFrameImpl()->frameView(), 308 m_webViewImpl->mainFrameImpl()->frameView(),
298 static_cast<const WebMouseWheelEvent&>(inputEvent)); 309 static_cast<const WebMouseWheelEvent&>(inputEvent));
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 !node->isElementNode() || !node->ownerDocument()->isActive() || 879 !node->isElementNode() || !node->ownerDocument()->isActive() ||
869 !m_cssAgent || !m_domAgent) 880 !m_cssAgent || !m_domAgent)
870 return; 881 return;
871 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgent, 882 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgent,
872 &overlayMainFrame()->script()); 883 &overlayMainFrame()->script());
873 toChromeClientImpl(m_webViewImpl->page()->chromeClient()) 884 toChromeClientImpl(m_webViewImpl->page()->chromeClient())
874 .setCursorOverridden(true); 885 .setCursorOverridden(true);
875 } 886 }
876 887
877 } // namespace blink 888 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698