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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 webViewImpl->page()->settings().availableHoverTypes()), | 83 webViewImpl->page()->settings().availableHoverTypes()), |
84 m_embedderPrimaryHoverType( | 84 m_embedderPrimaryHoverType( |
85 webViewImpl->page()->settings().primaryHoverType()), | 85 webViewImpl->page()->settings().primaryHoverType()), |
86 m_embedderMainFrameResizesAreOrientationChanges( | 86 m_embedderMainFrameResizesAreOrientationChanges( |
87 webViewImpl->page() | 87 webViewImpl->page() |
88 ->settings() | 88 ->settings() |
89 .mainFrameResizesAreOrientationChanges()), | 89 .mainFrameResizesAreOrientationChanges()), |
90 m_touchEventEmulationEnabled(false), | 90 m_touchEventEmulationEnabled(false), |
91 m_doubleTapToZoomEnabled(false), | 91 m_doubleTapToZoomEnabled(false), |
92 m_originalTouchEventAPIEnabled(false), | 92 m_originalTouchEventAPIEnabled(false), |
93 m_originalDeviceSupportsMouse(false), | |
94 m_originalDeviceSupportsTouch(false), | 93 m_originalDeviceSupportsTouch(false), |
95 m_originalMaxTouchPoints(0), | 94 m_originalMaxTouchPoints(0), |
96 m_embedderScriptEnabled(webViewImpl->page()->settings().scriptEnabled()), | 95 m_embedderScriptEnabled(webViewImpl->page()->settings().scriptEnabled()), |
97 m_scriptExecutionDisabled(false) {} | 96 m_scriptExecutionDisabled(false) {} |
98 | 97 |
99 DevToolsEmulator::~DevToolsEmulator() {} | 98 DevToolsEmulator::~DevToolsEmulator() {} |
100 | 99 |
101 DevToolsEmulator* DevToolsEmulator::create(WebViewImpl* webViewImpl) { | 100 DevToolsEmulator* DevToolsEmulator::create(WebViewImpl* webViewImpl) { |
102 return new DevToolsEmulator(webViewImpl); | 101 return new DevToolsEmulator(webViewImpl); |
103 } | 102 } |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 FloatRect(m_viewportOverride->position.x, m_viewportOverride->position.y, | 440 FloatRect(m_viewportOverride->position.x, m_viewportOverride->position.y, |
442 viewportSize.width(), viewportSize.height())); | 441 viewportSize.width(), viewportSize.height())); |
443 } | 442 } |
444 | 443 |
445 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled) { | 444 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled) { |
446 if (m_touchEventEmulationEnabled == enabled) | 445 if (m_touchEventEmulationEnabled == enabled) |
447 return; | 446 return; |
448 if (!m_touchEventEmulationEnabled) { | 447 if (!m_touchEventEmulationEnabled) { |
449 m_originalTouchEventAPIEnabled = | 448 m_originalTouchEventAPIEnabled = |
450 RuntimeEnabledFeatures::touchEventAPIEnabled(); | 449 RuntimeEnabledFeatures::touchEventAPIEnabled(); |
451 m_originalDeviceSupportsMouse = | |
452 m_webViewImpl->page()->settings().deviceSupportsMouse(); | |
453 m_originalDeviceSupportsTouch = | 450 m_originalDeviceSupportsTouch = |
454 m_webViewImpl->page()->settings().deviceSupportsTouch(); | 451 m_webViewImpl->page()->settings().deviceSupportsTouch(); |
455 m_originalMaxTouchPoints = | 452 m_originalMaxTouchPoints = |
456 m_webViewImpl->page()->settings().maxTouchPoints(); | 453 m_webViewImpl->page()->settings().maxTouchPoints(); |
457 } | 454 } |
458 RuntimeEnabledFeatures::setTouchEventAPIEnabled( | 455 RuntimeEnabledFeatures::setTouchEventAPIEnabled( |
459 enabled ? true : m_originalTouchEventAPIEnabled); | 456 enabled ? true : m_originalTouchEventAPIEnabled); |
460 if (!m_originalDeviceSupportsTouch) { | 457 if (!m_originalDeviceSupportsTouch) { |
461 m_webViewImpl->page()->settings().setDeviceSupportsMouse( | |
bokan
2016/12/02 18:04:05
We should probably clear the last known mouse loca
amaralp
2016/12/02 23:00:36
I checked locally and no fake mouse moves are disp
bokan
2016/12/07 00:09:53
Could you find out why? As far as I can tell, if t
amaralp
2016/12/13 01:09:14
I'm adding a clear just in case, but from what I c
| |
462 enabled ? false : m_originalDeviceSupportsMouse); | |
463 m_webViewImpl->page()->settings().setDeviceSupportsTouch( | 458 m_webViewImpl->page()->settings().setDeviceSupportsTouch( |
464 enabled ? true : m_originalDeviceSupportsTouch); | 459 enabled ? true : m_originalDeviceSupportsTouch); |
465 // Currently emulation does not provide multiple touch points. | 460 // Currently emulation does not provide multiple touch points. |
466 m_webViewImpl->page()->settings().setMaxTouchPoints( | 461 m_webViewImpl->page()->settings().setMaxTouchPoints( |
467 enabled ? 1 : m_originalMaxTouchPoints); | 462 enabled ? 1 : m_originalMaxTouchPoints); |
468 } | 463 } |
469 m_touchEventEmulationEnabled = enabled; | 464 m_touchEventEmulationEnabled = enabled; |
470 // TODO(dgozman): mainFrameImpl() check in this class should be unnecessary. | 465 // TODO(dgozman): mainFrameImpl() check in this class should be unnecessary. |
471 // It is only needed when we reattach and restore InspectorEmulationAgent, | 466 // It is only needed when we reattach and restore InspectorEmulationAgent, |
472 // which happens before everything has been setup correctly, and therefore | 467 // which happens before everything has been setup correctly, and therefore |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 m_lastPinchAnchorCss.reset(); | 513 m_lastPinchAnchorCss.reset(); |
519 m_lastPinchAnchorDip.reset(); | 514 m_lastPinchAnchorDip.reset(); |
520 } | 515 } |
521 return true; | 516 return true; |
522 } | 517 } |
523 | 518 |
524 return false; | 519 return false; |
525 } | 520 } |
526 | 521 |
527 } // namespace blink | 522 } // namespace blink |
OLD | NEW |