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

Side by Side Diff: Source/web/WebDevToolsAgentImpl.cpp

Issue 376873004: [DevTools] Allow touch emulation on devices with native touch. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 4 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
« no previous file with comments | « Source/devtools/protocol.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2010-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 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 305
306 bool WebDevToolsAgentImpl::handleInputEvent(blink::Page* page, const WebInputEve nt& inputEvent) 306 bool WebDevToolsAgentImpl::handleInputEvent(blink::Page* page, const WebInputEve nt& inputEvent)
307 { 307 {
308 if (!m_attached && !m_generatingEvent) 308 if (!m_attached && !m_generatingEvent)
309 return false; 309 return false;
310 310
311 // FIXME: This workaround is required for touch emulation on Mac, where 311 // FIXME: This workaround is required for touch emulation on Mac, where
312 // compositor-side pinch handling is not enabled. See http://crbug.com/13800 3. 312 // compositor-side pinch handling is not enabled. See http://crbug.com/13800 3.
313 bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin || inputE vent.type == WebInputEvent::GesturePinchUpdate || inputEvent.type == WebInputEve nt::GesturePinchEnd; 313 bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin || inputE vent.type == WebInputEvent::GesturePinchUpdate || inputEvent.type == WebInputEve nt::GesturePinchEnd;
314 if (isPinch && m_touchEventEmulationEnabled && m_emulateMobileEnabled) { 314 if (isPinch && m_touchEventEmulationEnabled) {
315 FrameView* frameView = page->deprecatedLocalMainFrame()->view(); 315 FrameView* frameView = page->deprecatedLocalMainFrame()->view();
316 PlatformGestureEventBuilder gestureEvent(frameView, static_cast<const We bGestureEvent&>(inputEvent)); 316 PlatformGestureEventBuilder gestureEvent(frameView, static_cast<const We bGestureEvent&>(inputEvent));
317 float pageScaleFactor = page->pageScaleFactor(); 317 float pageScaleFactor = page->pageScaleFactor();
318 if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { 318 if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) {
319 m_lastPinchAnchorCss = adoptPtr(new blink::IntPoint(frameView->scrol lPosition() + gestureEvent.position())); 319 m_lastPinchAnchorCss = adoptPtr(new blink::IntPoint(frameView->scrol lPosition() + gestureEvent.position()));
320 m_lastPinchAnchorDip = adoptPtr(new blink::IntPoint(gestureEvent.pos ition())); 320 m_lastPinchAnchorDip = adoptPtr(new blink::IntPoint(gestureEvent.pos ition()));
321 m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor); 321 m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor);
322 } 322 }
323 if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate && m_lastPi nchAnchorCss) { 323 if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate && m_lastPi nchAnchorCss) {
324 float newPageScaleFactor = pageScaleFactor * gestureEvent.scale(); 324 float newPageScaleFactor = pageScaleFactor * gestureEvent.scale();
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd) 738 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd)
739 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd); 739 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd);
740 } 740 }
741 741
742 void WebDevToolsAgent::processPendingMessages() 742 void WebDevToolsAgent::processPendingMessages()
743 { 743 {
744 PageScriptDebugServer::shared().runPendingTasks(); 744 PageScriptDebugServer::shared().runPendingTasks();
745 } 745 }
746 746
747 } // namespace blink 747 } // namespace blink
OLDNEW
« no previous file with comments | « Source/devtools/protocol.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698