| 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/page/Page.h" | 10 #include "core/page/Page.h" |
| 11 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 11 #include "core/style/ComputedStyle.h" | 12 #include "core/style/ComputedStyle.h" |
| 12 #include "platform/RuntimeEnabledFeatures.h" | 13 #include "platform/RuntimeEnabledFeatures.h" |
| 13 #include "public/platform/WebLayerTreeView.h" | 14 #include "public/platform/WebLayerTreeView.h" |
| 14 #include "web/WebInputEventConversion.h" | 15 #include "web/WebInputEventConversion.h" |
| 15 #include "web/WebLocalFrameImpl.h" | 16 #include "web/WebLocalFrameImpl.h" |
| 16 #include "web/WebSettingsImpl.h" | 17 #include "web/WebSettingsImpl.h" |
| 17 #include "web/WebViewImpl.h" | 18 #include "web/WebViewImpl.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 m_originalMaxTouchPoints = m_webViewImpl->page()->settings().maxTouchPoi
nts(); | 329 m_originalMaxTouchPoints = m_webViewImpl->page()->settings().maxTouchPoi
nts(); |
| 329 } | 330 } |
| 330 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnab
led); | 331 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnab
led); |
| 331 if (!m_originalDeviceSupportsTouch) { | 332 if (!m_originalDeviceSupportsTouch) { |
| 332 m_webViewImpl->page()->settings().setDeviceSupportsMouse(enabled ? false
: m_originalDeviceSupportsMouse); | 333 m_webViewImpl->page()->settings().setDeviceSupportsMouse(enabled ? false
: m_originalDeviceSupportsMouse); |
| 333 m_webViewImpl->page()->settings().setDeviceSupportsTouch(enabled ? true
: m_originalDeviceSupportsTouch); | 334 m_webViewImpl->page()->settings().setDeviceSupportsTouch(enabled ? true
: m_originalDeviceSupportsTouch); |
| 334 // Currently emulation does not provide multiple touch points. | 335 // Currently emulation does not provide multiple touch points. |
| 335 m_webViewImpl->page()->settings().setMaxTouchPoints(enabled ? 1 : m_orig
inalMaxTouchPoints); | 336 m_webViewImpl->page()->settings().setMaxTouchPoints(enabled ? 1 : m_orig
inalMaxTouchPoints); |
| 336 } | 337 } |
| 337 m_touchEventEmulationEnabled = enabled; | 338 m_touchEventEmulationEnabled = enabled; |
| 339 if (ScrollingCoordinator* scrollingCoordinator = m_webViewImpl->page()->scro
llingCoordinator()) { |
| 340 // We only have to invalidate touch event target rects below, while usin
g big hammer notifyGeometryChanged. |
| 341 // But touch is not toggled often, and so it's fine to do more work vs i
ntroducing more fine-grained methods. |
| 342 scrollingCoordinator->notifyGeometryChanged(); |
| 343 scrollingCoordinator->updateAfterCompositingChangeIfNeeded(); |
| 344 } |
| 338 // TODO(dgozman): mainFrameImpl() check in this class should be unnecessary. | 345 // TODO(dgozman): mainFrameImpl() check in this class should be unnecessary. |
| 339 // It is only needed when we reattach and restore InspectorEmulationAgent, | 346 // It is only needed when we reattach and restore InspectorEmulationAgent, |
| 340 // which happens before everything has been setup correctly, and therefore | 347 // which happens before everything has been setup correctly, and therefore |
| 341 // fails during remote -> local main frame transition. | 348 // fails during remote -> local main frame transition. |
| 342 // We should instead route emulation from browser through the WebViewImpl | 349 // We should instead route emulation from browser through the WebViewImpl |
| 343 // to the local main frame, and remove InspectorEmulationAgent entirely. | 350 // to the local main frame, and remove InspectorEmulationAgent entirely. |
| 344 if (m_webViewImpl->mainFrameImpl()) | 351 if (m_webViewImpl->mainFrameImpl()) |
| 345 m_webViewImpl->mainFrameImpl()->frameView()->layout(); | 352 m_webViewImpl->mainFrameImpl()->frameView()->layout(); |
| 346 } | 353 } |
| 347 | 354 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 m_lastPinchAnchorCss.reset(); | 387 m_lastPinchAnchorCss.reset(); |
| 381 m_lastPinchAnchorDip.reset(); | 388 m_lastPinchAnchorDip.reset(); |
| 382 } | 389 } |
| 383 return true; | 390 return true; |
| 384 } | 391 } |
| 385 | 392 |
| 386 return false; | 393 return false; |
| 387 } | 394 } |
| 388 | 395 |
| 389 } // namespace blink | 396 } // namespace blink |
| OLD | NEW |