Chromium Code Reviews| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 viewportSize.scale(1. / m_viewportOverride->scale); | 439 viewportSize.scale(1. / m_viewportOverride->scale); |
| 440 return enclosingIntRect( | 440 return enclosingIntRect( |
| 441 FloatRect(m_viewportOverride->position.x, m_viewportOverride->position.y, | 441 FloatRect(m_viewportOverride->position.x, m_viewportOverride->position.y, |
| 442 viewportSize.width(), viewportSize.height())); | 442 viewportSize.width(), viewportSize.height())); |
| 443 } | 443 } |
| 444 | 444 |
| 445 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled) { | 445 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled) { |
| 446 if (m_touchEventEmulationEnabled == enabled) | 446 if (m_touchEventEmulationEnabled == enabled) |
| 447 return; | 447 return; |
| 448 if (!m_touchEventEmulationEnabled) { | 448 if (!m_touchEventEmulationEnabled) { |
| 449 m_originalTouchEnabled = RuntimeEnabledFeatures::touchEnabled(); | 449 m_originalTouchEnabled = RuntimeEnabledFeatures::touchEventAPIEnabled(); |
|
mustaq
2016/11/16 14:54:16
Please rename DevToolsEmulator::m_originalTouchEna
sunyunjia
2016/11/16 16:39:58
Done.
| |
| 450 m_originalDeviceSupportsMouse = | 450 m_originalDeviceSupportsMouse = |
| 451 m_webViewImpl->page()->settings().deviceSupportsMouse(); | 451 m_webViewImpl->page()->settings().deviceSupportsMouse(); |
| 452 m_originalDeviceSupportsTouch = | 452 m_originalDeviceSupportsTouch = |
| 453 m_webViewImpl->page()->settings().deviceSupportsTouch(); | 453 m_webViewImpl->page()->settings().deviceSupportsTouch(); |
| 454 m_originalMaxTouchPoints = | 454 m_originalMaxTouchPoints = |
| 455 m_webViewImpl->page()->settings().maxTouchPoints(); | 455 m_webViewImpl->page()->settings().maxTouchPoints(); |
| 456 } | 456 } |
| 457 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true | 457 RuntimeEnabledFeatures::setTouchEventAPIEnabled( |
| 458 : m_originalTouchEnabled); | 458 enabled ? true : m_originalTouchEnabled); |
| 459 if (!m_originalDeviceSupportsTouch) { | 459 if (!m_originalDeviceSupportsTouch) { |
| 460 m_webViewImpl->page()->settings().setDeviceSupportsMouse( | 460 m_webViewImpl->page()->settings().setDeviceSupportsMouse( |
| 461 enabled ? false : m_originalDeviceSupportsMouse); | 461 enabled ? false : m_originalDeviceSupportsMouse); |
| 462 m_webViewImpl->page()->settings().setDeviceSupportsTouch( | 462 m_webViewImpl->page()->settings().setDeviceSupportsTouch( |
| 463 enabled ? true : m_originalDeviceSupportsTouch); | 463 enabled ? true : m_originalDeviceSupportsTouch); |
| 464 // Currently emulation does not provide multiple touch points. | 464 // Currently emulation does not provide multiple touch points. |
| 465 m_webViewImpl->page()->settings().setMaxTouchPoints( | 465 m_webViewImpl->page()->settings().setMaxTouchPoints( |
| 466 enabled ? 1 : m_originalMaxTouchPoints); | 466 enabled ? 1 : m_originalMaxTouchPoints); |
| 467 } | 467 } |
| 468 m_touchEventEmulationEnabled = enabled; | 468 m_touchEventEmulationEnabled = enabled; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 m_lastPinchAnchorCss.reset(); | 517 m_lastPinchAnchorCss.reset(); |
| 518 m_lastPinchAnchorDip.reset(); | 518 m_lastPinchAnchorDip.reset(); |
| 519 } | 519 } |
| 520 return true; | 520 return true; |
| 521 } | 521 } |
| 522 | 522 |
| 523 return false; | 523 return false; |
| 524 } | 524 } |
| 525 | 525 |
| 526 } // namespace blink | 526 } // namespace blink |
| OLD | NEW |