Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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); | |
| 243 // mainFrameImpl() could be null during cleanup or remote <-> local swap. | 242 // mainFrameImpl() could be null during cleanup or remote <-> local swap. |
| 244 if (m_webViewImpl->mainFrameImpl()) { | 243 if (m_webViewImpl->mainFrameImpl()) { |
| 245 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt()) | 244 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt()) |
| 246 document->mediaQueryAffectingValueChanged(); | 245 document->mediaQueryAffectingValueChanged(); |
| 247 } | 246 } |
| 248 } | 247 } |
| 249 | 248 |
| 250 bool DevToolsEmulator::resizeIsDeviceSizeChange() | 249 bool DevToolsEmulator::resizeIsDeviceSizeChange() |
| 251 { | 250 { |
| 252 return m_deviceMetricsEnabled && m_emulateMobileEnabled; | 251 return m_deviceMetricsEnabled && m_emulateMobileEnabled; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 m_webViewImpl->page()->settings().setAvailablePointerTypes(m_embedderAvailab lePointerTypes); | 306 m_webViewImpl->page()->settings().setAvailablePointerTypes(m_embedderAvailab lePointerTypes); |
| 308 m_webViewImpl->page()->settings().setPrimaryPointerType(m_embedderPrimaryPoi nterType); | 307 m_webViewImpl->page()->settings().setPrimaryPointerType(m_embedderPrimaryPoi nterType); |
| 309 m_webViewImpl->page()->settings().setAvailableHoverTypes(m_embedderAvailable HoverTypes); | 308 m_webViewImpl->page()->settings().setAvailableHoverTypes(m_embedderAvailable HoverTypes); |
| 310 m_webViewImpl->page()->settings().setPrimaryHoverType(m_embedderPrimaryHover Type); | 309 m_webViewImpl->page()->settings().setPrimaryHoverType(m_embedderPrimaryHover Type); |
| 311 m_webViewImpl->page()->settings().setResizeIsDeviceSizeChange(false); | 310 m_webViewImpl->page()->settings().setResizeIsDeviceSizeChange(false); |
| 312 m_webViewImpl->setZoomFactorOverride(0); | 311 m_webViewImpl->setZoomFactorOverride(0); |
| 313 m_emulateMobileEnabled = false; | 312 m_emulateMobileEnabled = false; |
| 314 m_webViewImpl->setDefaultPageScaleLimits( | 313 m_webViewImpl->setDefaultPageScaleLimits( |
| 315 m_originalDefaultMinimumPageScaleFactor, | 314 m_originalDefaultMinimumPageScaleFactor, |
| 316 m_originalDefaultMaximumPageScaleFactor); | 315 m_originalDefaultMaximumPageScaleFactor); |
| 316 m_webViewImpl->page()->frameHost().visualViewport().setScale(1.f); | |
|
bokan
2016/07/04 22:44:09
I think this does actually belong in disableDevice
Eric Seckler
2016/07/05 16:46:51
Done.
| |
| 317 // mainFrameImpl() could be null during cleanup or remote <-> local swap. | 317 // mainFrameImpl() could be null during cleanup or remote <-> local swap. |
| 318 if (m_webViewImpl->mainFrameImpl()) | 318 if (m_webViewImpl->mainFrameImpl()) |
| 319 m_webViewImpl->mainFrameImpl()->frameView()->layout(); | 319 m_webViewImpl->mainFrameImpl()->frameView()->layout(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled) | 322 void DevToolsEmulator::setTouchEventEmulationEnabled(bool enabled) |
| 323 { | 323 { |
| 324 if (m_touchEventEmulationEnabled == enabled) | 324 if (m_touchEventEmulationEnabled == enabled) |
| 325 return; | 325 return; |
| 326 if (!m_touchEventEmulationEnabled) { | 326 if (!m_touchEventEmulationEnabled) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 m_lastPinchAnchorCss.reset(); | 382 m_lastPinchAnchorCss.reset(); |
| 383 m_lastPinchAnchorDip.reset(); | 383 m_lastPinchAnchorDip.reset(); |
| 384 } | 384 } |
| 385 return true; | 385 return true; |
| 386 } | 386 } |
| 387 | 387 |
| 388 return false; | 388 return false; |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace blink | 391 } // namespace blink |
| OLD | NEW |