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

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

Issue 2547373002: Rename TouchEventAPI to TouchEventFeatureDetection (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into rename 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"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 m_embedderAvailableHoverTypes( 82 m_embedderAvailableHoverTypes(
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_originalTouchEventFeatureDetectionEnabled(false),
93 m_originalDeviceSupportsMouse(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);
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_originalTouchEventAPIEnabled = 449 m_originalTouchEventFeatureDetectionEnabled =
450 RuntimeEnabledFeatures::touchEventAPIEnabled(); 450 RuntimeEnabledFeatures::touchEventFeatureDetectionEnabled();
451 m_originalDeviceSupportsMouse = 451 m_originalDeviceSupportsMouse =
452 m_webViewImpl->page()->settings().deviceSupportsMouse(); 452 m_webViewImpl->page()->settings().deviceSupportsMouse();
453 m_originalDeviceSupportsTouch = 453 m_originalDeviceSupportsTouch =
454 m_webViewImpl->page()->settings().deviceSupportsTouch(); 454 m_webViewImpl->page()->settings().deviceSupportsTouch();
455 m_originalMaxTouchPoints = 455 m_originalMaxTouchPoints =
456 m_webViewImpl->page()->settings().maxTouchPoints(); 456 m_webViewImpl->page()->settings().maxTouchPoints();
457 } 457 }
458 RuntimeEnabledFeatures::setTouchEventAPIEnabled( 458 RuntimeEnabledFeatures::setTouchEventFeatureDetectionEnabled(
459 enabled ? true : m_originalTouchEventAPIEnabled); 459 enabled ? true : m_originalTouchEventFeatureDetectionEnabled);
460 if (!m_originalDeviceSupportsTouch) { 460 if (!m_originalDeviceSupportsTouch) {
461 m_webViewImpl->page()->settings().setDeviceSupportsMouse( 461 m_webViewImpl->page()->settings().setDeviceSupportsMouse(
462 enabled ? false : m_originalDeviceSupportsMouse); 462 enabled ? false : m_originalDeviceSupportsMouse);
463 m_webViewImpl->page()->settings().setDeviceSupportsTouch( 463 m_webViewImpl->page()->settings().setDeviceSupportsTouch(
464 enabled ? true : m_originalDeviceSupportsTouch); 464 enabled ? true : m_originalDeviceSupportsTouch);
465 // Currently emulation does not provide multiple touch points. 465 // Currently emulation does not provide multiple touch points.
466 m_webViewImpl->page()->settings().setMaxTouchPoints( 466 m_webViewImpl->page()->settings().setMaxTouchPoints(
467 enabled ? 1 : m_originalMaxTouchPoints); 467 enabled ? 1 : m_originalMaxTouchPoints);
468 } 468 }
469 m_touchEventEmulationEnabled = enabled; 469 m_touchEventEmulationEnabled = enabled;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 m_lastPinchAnchorCss.reset(); 518 m_lastPinchAnchorCss.reset();
519 m_lastPinchAnchorDip.reset(); 519 m_lastPinchAnchorDip.reset();
520 } 520 }
521 return true; 521 return true;
522 } 522 }
523 523
524 return false; 524 return false;
525 } 525 }
526 526
527 } // namespace blink 527 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/DevToolsEmulator.h ('k') | third_party/WebKit/Source/web/WebRuntimeFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698