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

Side by Side Diff: third_party/WebKit/Source/web/DevToolsEmulator.cpp

Issue 2536723007: Removed android scrolling fake mouse moves and device_supports_mouse (Closed)
Patch Set: rebase 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"
11 #include "core/input/EventHandler.h"
11 #include "core/page/Page.h" 12 #include "core/page/Page.h"
12 #include "core/style/ComputedStyle.h" 13 #include "core/style/ComputedStyle.h"
13 #include "platform/RuntimeEnabledFeatures.h" 14 #include "platform/RuntimeEnabledFeatures.h"
14 #include "platform/geometry/FloatRect.h" 15 #include "platform/geometry/FloatRect.h"
15 #include "platform/geometry/FloatSize.h" 16 #include "platform/geometry/FloatSize.h"
16 #include "platform/geometry/IntRect.h" 17 #include "platform/geometry/IntRect.h"
17 #include "platform/geometry/IntSize.h" 18 #include "platform/geometry/IntSize.h"
18 #include "public/platform/WebLayerTreeView.h" 19 #include "public/platform/WebLayerTreeView.h"
19 #include "web/WebInputEventConversion.h" 20 #include "web/WebInputEventConversion.h"
20 #include "web/WebLocalFrameImpl.h" 21 #include "web/WebLocalFrameImpl.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 webViewImpl->page()->settings().availableHoverTypes()), 84 webViewImpl->page()->settings().availableHoverTypes()),
84 m_embedderPrimaryHoverType( 85 m_embedderPrimaryHoverType(
85 webViewImpl->page()->settings().primaryHoverType()), 86 webViewImpl->page()->settings().primaryHoverType()),
86 m_embedderMainFrameResizesAreOrientationChanges( 87 m_embedderMainFrameResizesAreOrientationChanges(
87 webViewImpl->page() 88 webViewImpl->page()
88 ->settings() 89 ->settings()
89 .mainFrameResizesAreOrientationChanges()), 90 .mainFrameResizesAreOrientationChanges()),
90 m_touchEventEmulationEnabled(false), 91 m_touchEventEmulationEnabled(false),
91 m_doubleTapToZoomEnabled(false), 92 m_doubleTapToZoomEnabled(false),
92 m_originalTouchEventFeatureDetectionEnabled(false), 93 m_originalTouchEventFeatureDetectionEnabled(false),
93 m_originalDeviceSupportsMouse(false),
94 m_originalDeviceSupportsTouch(false), 94 m_originalDeviceSupportsTouch(false),
95 m_originalMaxTouchPoints(0), 95 m_originalMaxTouchPoints(0),
96 m_embedderScriptEnabled(webViewImpl->page()->settings().scriptEnabled()), 96 m_embedderScriptEnabled(webViewImpl->page()->settings().scriptEnabled()),
97 m_scriptExecutionDisabled(false) {} 97 m_scriptExecutionDisabled(false) {}
98 98
99 DevToolsEmulator::~DevToolsEmulator() {} 99 DevToolsEmulator::~DevToolsEmulator() {}
100 100
101 DevToolsEmulator* DevToolsEmulator::create(WebViewImpl* webViewImpl) { 101 DevToolsEmulator* DevToolsEmulator::create(WebViewImpl* webViewImpl) {
102 return new DevToolsEmulator(webViewImpl); 102 return new DevToolsEmulator(webViewImpl);
103 } 103 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_originalTouchEventFeatureDetectionEnabled = 449 m_originalTouchEventFeatureDetectionEnabled =
450 RuntimeEnabledFeatures::touchEventFeatureDetectionEnabled(); 450 RuntimeEnabledFeatures::touchEventFeatureDetectionEnabled();
451 m_originalDeviceSupportsMouse =
452 m_webViewImpl->page()->settings().deviceSupportsMouse();
453 m_originalDeviceSupportsTouch = 451 m_originalDeviceSupportsTouch =
454 m_webViewImpl->page()->settings().deviceSupportsTouch(); 452 m_webViewImpl->page()->settings().deviceSupportsTouch();
455 m_originalMaxTouchPoints = 453 m_originalMaxTouchPoints =
456 m_webViewImpl->page()->settings().maxTouchPoints(); 454 m_webViewImpl->page()->settings().maxTouchPoints();
457 } 455 }
458 RuntimeEnabledFeatures::setTouchEventFeatureDetectionEnabled( 456 RuntimeEnabledFeatures::setTouchEventFeatureDetectionEnabled(
459 enabled ? true : m_originalTouchEventFeatureDetectionEnabled); 457 enabled ? true : m_originalTouchEventFeatureDetectionEnabled);
460 if (!m_originalDeviceSupportsTouch) { 458 if (!m_originalDeviceSupportsTouch) {
461 m_webViewImpl->page()->settings().setDeviceSupportsMouse( 459 if (enabled && m_webViewImpl->mainFrameImpl()) {
462 enabled ? false : m_originalDeviceSupportsMouse); 460 m_webViewImpl->mainFrameImpl()
461 ->frame()
462 ->eventHandler()
463 .clearMouseEventManager();
464 }
463 m_webViewImpl->page()->settings().setDeviceSupportsTouch( 465 m_webViewImpl->page()->settings().setDeviceSupportsTouch(
464 enabled ? true : m_originalDeviceSupportsTouch); 466 enabled ? true : m_originalDeviceSupportsTouch);
465 // Currently emulation does not provide multiple touch points. 467 // Currently emulation does not provide multiple touch points.
466 m_webViewImpl->page()->settings().setMaxTouchPoints( 468 m_webViewImpl->page()->settings().setMaxTouchPoints(
467 enabled ? 1 : m_originalMaxTouchPoints); 469 enabled ? 1 : m_originalMaxTouchPoints);
468 } 470 }
469 m_touchEventEmulationEnabled = enabled; 471 m_touchEventEmulationEnabled = enabled;
470 // TODO(dgozman): mainFrameImpl() check in this class should be unnecessary. 472 // TODO(dgozman): mainFrameImpl() check in this class should be unnecessary.
471 // It is only needed when we reattach and restore InspectorEmulationAgent, 473 // It is only needed when we reattach and restore InspectorEmulationAgent,
472 // which happens before everything has been setup correctly, and therefore 474 // which happens before everything has been setup correctly, and therefore
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 m_lastPinchAnchorCss.reset(); 521 m_lastPinchAnchorCss.reset();
520 m_lastPinchAnchorDip.reset(); 522 m_lastPinchAnchorDip.reset();
521 } 523 }
522 return true; 524 return true;
523 } 525 }
524 526
525 return false; 527 return false;
526 } 528 }
527 529
528 } // namespace blink 530 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/DevToolsEmulator.h ('k') | third_party/WebKit/Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698