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

Side by Side Diff: third_party/WebKit/Source/web/DevToolsEmulator.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/DevToolsEmulator.h" 5 #include "web/DevToolsEmulator.h"
6 6
7 #include "core/frame/FrameHost.h" 7 #include "core/frame/FrameHost.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/frame/VisualViewport.h" 10 #include "core/frame/VisualViewport.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 m_scriptExecutionDisabled ? false : m_embedderScriptEnabled); 484 m_scriptExecutionDisabled ? false : m_embedderScriptEnabled);
485 } 485 }
486 486
487 bool DevToolsEmulator::handleInputEvent(const WebInputEvent& inputEvent) { 487 bool DevToolsEmulator::handleInputEvent(const WebInputEvent& inputEvent) {
488 Page* page = m_webViewImpl->page(); 488 Page* page = m_webViewImpl->page();
489 if (!page) 489 if (!page)
490 return false; 490 return false;
491 491
492 // FIXME: This workaround is required for touch emulation on Mac, where 492 // FIXME: This workaround is required for touch emulation on Mac, where
493 // compositor-side pinch handling is not enabled. See http://crbug.com/138003. 493 // compositor-side pinch handling is not enabled. See http://crbug.com/138003.
494 bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin || 494 bool isPinch = inputEvent.type() == WebInputEvent::GesturePinchBegin ||
495 inputEvent.type == WebInputEvent::GesturePinchUpdate || 495 inputEvent.type() == WebInputEvent::GesturePinchUpdate ||
496 inputEvent.type == WebInputEvent::GesturePinchEnd; 496 inputEvent.type() == WebInputEvent::GesturePinchEnd;
497 if (isPinch && m_touchEventEmulationEnabled) { 497 if (isPinch && m_touchEventEmulationEnabled) {
498 FrameView* frameView = page->deprecatedLocalMainFrame()->view(); 498 FrameView* frameView = page->deprecatedLocalMainFrame()->view();
499 PlatformGestureEventBuilder gestureEvent( 499 PlatformGestureEventBuilder gestureEvent(
500 frameView, static_cast<const WebGestureEvent&>(inputEvent)); 500 frameView, static_cast<const WebGestureEvent&>(inputEvent));
501 float pageScaleFactor = page->pageScaleFactor(); 501 float pageScaleFactor = page->pageScaleFactor();
502 if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { 502 if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) {
503 m_lastPinchAnchorCss = WTF::wrapUnique(new IntPoint(roundedIntPoint( 503 m_lastPinchAnchorCss = WTF::wrapUnique(new IntPoint(roundedIntPoint(
504 gestureEvent.position() + frameView->getScrollOffset()))); 504 gestureEvent.position() + frameView->getScrollOffset())));
505 m_lastPinchAnchorDip = 505 m_lastPinchAnchorDip =
506 WTF::wrapUnique(new IntPoint(gestureEvent.position())); 506 WTF::wrapUnique(new IntPoint(gestureEvent.position()));
(...skipping 12 matching lines...) Expand all
519 m_lastPinchAnchorCss.reset(); 519 m_lastPinchAnchorCss.reset();
520 m_lastPinchAnchorDip.reset(); 520 m_lastPinchAnchorDip.reset();
521 } 521 }
522 return true; 522 return true;
523 } 523 }
524 524
525 return false; 525 return false;
526 } 526 }
527 527
528 } // namespace blink 528 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698