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

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

Issue 2467913002: Touch event flag should control only DOM event firing. (Closed)
Patch Set: Bring the auto back. Created 4 years, 1 month 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 428 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_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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698