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

Unified Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 376873004: [DevTools] Allow touch emulation on devices with native touch. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/devtools/front_end/main/OverridesView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorPageAgent.cpp
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 8402fd757d640bdfbd674fda1ebb855b53286562..1bd79c987390c6a2831a4f156d7c8c8cbbd623d3 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -1337,31 +1337,20 @@ void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
m_originalDeviceSupportsTouch = m_page->settings().deviceSupportsTouch();
}
RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnabled);
- m_page->settings().setDeviceSupportsMouse(enabled ? false : m_originalDeviceSupportsMouse);
- m_page->settings().setDeviceSupportsTouch(enabled ? true : m_originalDeviceSupportsTouch);
+ if (!m_originalDeviceSupportsTouch) {
+ m_page->settings().setDeviceSupportsMouse(enabled ? false : m_originalDeviceSupportsMouse);
+ m_page->settings().setDeviceSupportsTouch(enabled ? true : m_originalDeviceSupportsTouch);
+ }
m_touchEmulationEnabled = enabled;
m_client->setTouchEventEmulationEnabled(enabled);
m_page->deprecatedLocalMainFrame()->view()->layout();
}
-void InspectorPageAgent::hasTouchInputs(ErrorString*, bool* result)
-{
- *result = m_touchEmulationEnabled ? m_originalDeviceSupportsTouch : m_page->settings().deviceSupportsTouch();
-}
-
-void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabled)
+void InspectorPageAgent::setTouchEmulationEnabled(ErrorString*, bool enabled)
{
if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabled)
return;
- bool hasTouch = false;
- hasTouchInputs(error, &hasTouch);
- if (enabled && hasTouch) {
- if (error)
- *error = "Device already supports touch input";
- return;
- }
-
m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled);
updateTouchEventEmulationInPage(enabled);
}
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/devtools/front_end/main/OverridesView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698