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

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

Issue 2096633002: Adds scroll position/scale emulation to DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync, patch in 2169483002 (+ regression test), add DevTools tests. Created 4 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 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 { 232 {
233 if (!m_deviceMetricsEnabled) 233 if (!m_deviceMetricsEnabled)
234 return; 234 return;
235 235
236 m_deviceMetricsEnabled = false; 236 m_deviceMetricsEnabled = false;
237 m_webViewImpl->setBackgroundColorOverride(Color::transparent); 237 m_webViewImpl->setBackgroundColorOverride(Color::transparent);
238 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(m_embedderDeviceS caleAdjustment); 238 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(m_embedderDeviceS caleAdjustment);
239 disableMobileEmulation(); 239 disableMobileEmulation();
240 m_webViewImpl->setCompositorDeviceScaleFactorOverride(0.f); 240 m_webViewImpl->setCompositorDeviceScaleFactorOverride(0.f);
241 m_webViewImpl->setRootLayerTransform(WebSize(0.f, 0.f), 1.f); 241 m_webViewImpl->setRootLayerTransform(WebSize(0.f, 0.f), 1.f);
242 m_webViewImpl->setPageScaleFactor(1.f); 242 m_webViewImpl->resetScaleStateImmediately();
243 // mainFrameImpl() could be null during cleanup or remote <-> local swap. 243 // mainFrameImpl() could be null during cleanup or remote <-> local swap.
244 if (m_webViewImpl->mainFrameImpl()) { 244 if (m_webViewImpl->mainFrameImpl()) {
245 m_webViewImpl->mainFrameImpl()->frameView()->layout();
245 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt()) 246 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt())
246 document->mediaQueryAffectingValueChanged(); 247 document->mediaQueryAffectingValueChanged();
247 } 248 }
248 } 249 }
249 250
250 bool DevToolsEmulator::resizeIsDeviceSizeChange() 251 bool DevToolsEmulator::resizeIsDeviceSizeChange()
251 { 252 {
252 return m_deviceMetricsEnabled && m_emulateMobileEnabled; 253 return m_deviceMetricsEnabled && m_emulateMobileEnabled;
253 } 254 }
254 255
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 m_webViewImpl->page()->settings().setAvailablePointerTypes(m_embedderAvailab lePointerTypes); 308 m_webViewImpl->page()->settings().setAvailablePointerTypes(m_embedderAvailab lePointerTypes);
308 m_webViewImpl->page()->settings().setPrimaryPointerType(m_embedderPrimaryPoi nterType); 309 m_webViewImpl->page()->settings().setPrimaryPointerType(m_embedderPrimaryPoi nterType);
309 m_webViewImpl->page()->settings().setAvailableHoverTypes(m_embedderAvailable HoverTypes); 310 m_webViewImpl->page()->settings().setAvailableHoverTypes(m_embedderAvailable HoverTypes);
310 m_webViewImpl->page()->settings().setPrimaryHoverType(m_embedderPrimaryHover Type); 311 m_webViewImpl->page()->settings().setPrimaryHoverType(m_embedderPrimaryHover Type);
311 m_webViewImpl->page()->settings().setResizeIsDeviceSizeChange(false); 312 m_webViewImpl->page()->settings().setResizeIsDeviceSizeChange(false);
312 m_webViewImpl->setZoomFactorOverride(0); 313 m_webViewImpl->setZoomFactorOverride(0);
313 m_emulateMobileEnabled = false; 314 m_emulateMobileEnabled = false;
314 m_webViewImpl->setDefaultPageScaleLimits( 315 m_webViewImpl->setDefaultPageScaleLimits(
315 m_originalDefaultMinimumPageScaleFactor, 316 m_originalDefaultMinimumPageScaleFactor,
316 m_originalDefaultMaximumPageScaleFactor); 317 m_originalDefaultMaximumPageScaleFactor);
317 // mainFrameImpl() could be null during cleanup or remote <-> local swap.
318 if (m_webViewImpl->mainFrameImpl())
319 m_webViewImpl->mainFrameImpl()->frameView()->layout();
dgozman 2016/07/21 20:54:08 This is still needed when we toggle between mobile
Eric Seckler 2016/07/22 14:44:48 Right, thanks. I think it still makes sense to res
320 } 318 }
321 319
322 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled) 320 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled)
323 { 321 {
324 if (m_touchEventEmulationEnabled == enabled) 322 if (m_touchEventEmulationEnabled == enabled)
325 return; 323 return;
326 if (!m_touchEventEmulationEnabled) { 324 if (!m_touchEventEmulationEnabled) {
327 m_originalTouchEnabled = RuntimeEnabledFeatures::touchEnabled(); 325 m_originalTouchEnabled = RuntimeEnabledFeatures::touchEnabled();
328 m_originalDeviceSupportsMouse = m_webViewImpl->page()->settings().device SupportsMouse(); 326 m_originalDeviceSupportsMouse = m_webViewImpl->page()->settings().device SupportsMouse();
329 m_originalDeviceSupportsTouch = m_webViewImpl->page()->settings().device SupportsTouch(); 327 m_originalDeviceSupportsTouch = m_webViewImpl->page()->settings().device SupportsTouch();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 m_lastPinchAnchorCss.reset(); 380 m_lastPinchAnchorCss.reset();
383 m_lastPinchAnchorDip.reset(); 381 m_lastPinchAnchorDip.reset();
384 } 382 }
385 return true; 383 return true;
386 } 384 }
387 385
388 return false; 386 return false;
389 } 387 }
390 388
391 } // namespace blink 389 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698