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 "config.h" | 5 #include "config.h" |
6 #include "web/DevToolsEmulator.h" | 6 #include "web/DevToolsEmulator.h" |
7 | 7 |
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/page/Page.h" | 10 #include "core/page/Page.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(calculateDeviceSc
aleAdjustment(params.viewSize.width, params.viewSize.height, params.deviceScaleF
actor)); | 173 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(calculateDeviceSc
aleAdjustment(params.viewSize.width, params.viewSize.height, params.deviceScaleF
actor)); |
174 | 174 |
175 if (params.screenPosition == WebDeviceEmulationParams::Mobile) | 175 if (params.screenPosition == WebDeviceEmulationParams::Mobile) |
176 enableMobileEmulation(); | 176 enableMobileEmulation(); |
177 else | 177 else |
178 disableMobileEmulation(); | 178 disableMobileEmulation(); |
179 | 179 |
180 m_webViewImpl->setCompositorDeviceScaleFactorOverride(params.deviceScaleFact
or); | 180 m_webViewImpl->setCompositorDeviceScaleFactorOverride(params.deviceScaleFact
or); |
181 m_webViewImpl->setRootLayerTransform(WebSize(params.offset.x, params.offset.
y), params.scale); | 181 m_webViewImpl->setRootLayerTransform(WebSize(params.offset.x, params.offset.
y), params.scale); |
182 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->document()
) { | 182 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->document()
) |
183 document->styleResolverChanged(); | |
184 document->mediaQueryAffectingValueChanged(); | 183 document->mediaQueryAffectingValueChanged(); |
185 } | |
186 } | 184 } |
187 | 185 |
188 void DevToolsEmulator::disableDeviceEmulation() | 186 void DevToolsEmulator::disableDeviceEmulation() |
189 { | 187 { |
190 if (!m_deviceMetricsEnabled) | 188 if (!m_deviceMetricsEnabled) |
191 return; | 189 return; |
192 | 190 |
193 m_deviceMetricsEnabled = false; | 191 m_deviceMetricsEnabled = false; |
194 m_webViewImpl->setBackgroundColorOverride(Color::transparent); | 192 m_webViewImpl->setBackgroundColorOverride(Color::transparent); |
195 m_webViewImpl->updateShowFPSCounter(); | 193 m_webViewImpl->updateShowFPSCounter(); |
196 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(m_embedderDeviceS
caleAdjustment); | 194 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(m_embedderDeviceS
caleAdjustment); |
197 disableMobileEmulation(); | 195 disableMobileEmulation(); |
198 m_webViewImpl->setCompositorDeviceScaleFactorOverride(0.f); | 196 m_webViewImpl->setCompositorDeviceScaleFactorOverride(0.f); |
199 m_webViewImpl->setRootLayerTransform(WebSize(0.f, 0.f), 1.f); | 197 m_webViewImpl->setRootLayerTransform(WebSize(0.f, 0.f), 1.f); |
200 m_webViewImpl->setPageScaleFactor(1.f); | 198 m_webViewImpl->setPageScaleFactor(1.f); |
201 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->document()
) { | 199 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->document()
) |
202 document->styleResolverChanged(); | |
203 document->mediaQueryAffectingValueChanged(); | 200 document->mediaQueryAffectingValueChanged(); |
204 } | |
205 } | 201 } |
206 | 202 |
207 void DevToolsEmulator::enableMobileEmulation() | 203 void DevToolsEmulator::enableMobileEmulation() |
208 { | 204 { |
209 if (m_emulateMobileEnabled) | 205 if (m_emulateMobileEnabled) |
210 return; | 206 return; |
211 m_emulateMobileEnabled = true; | 207 m_emulateMobileEnabled = true; |
212 m_isOverlayScrollbarsEnabled = RuntimeEnabledFeatures::overlayScrollbarsEnab
led(); | 208 m_isOverlayScrollbarsEnabled = RuntimeEnabledFeatures::overlayScrollbarsEnab
led(); |
213 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); | 209 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); |
214 m_webViewImpl->enableViewport(); | 210 m_webViewImpl->enableViewport(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 m_lastPinchAnchorCss.clear(); | 302 m_lastPinchAnchorCss.clear(); |
307 m_lastPinchAnchorDip.clear(); | 303 m_lastPinchAnchorDip.clear(); |
308 } | 304 } |
309 return true; | 305 return true; |
310 } | 306 } |
311 | 307 |
312 return false; | 308 return false; |
313 } | 309 } |
314 | 310 |
315 } // namespace blink | 311 } // namespace blink |
OLD | NEW |