| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |