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

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

Issue 1914023002: [DevTools] Apply emulation root layer transform to innerViewportContainerLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comment Created 4 years, 8 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/page/Page.h" 10 #include "core/page/Page.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 && m_emulationParams.scale == params.scale) { 200 && m_emulationParams.scale == params.scale) {
201 return; 201 return;
202 } 202 }
203 203
204 m_emulationParams = params; 204 m_emulationParams = params;
205 205
206 if (!m_deviceMetricsEnabled) { 206 if (!m_deviceMetricsEnabled) {
207 m_deviceMetricsEnabled = true; 207 m_deviceMetricsEnabled = true;
208 if (params.viewSize.width || params.viewSize.height) 208 if (params.viewSize.width || params.viewSize.height)
209 m_webViewImpl->setBackgroundColorOverride(Color::darkGray); 209 m_webViewImpl->setBackgroundColorOverride(Color::darkGray);
210 m_webViewImpl->updateShowFPSCounter();
211 } 210 }
212 211
213 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(calculateDeviceSc aleAdjustment(params.viewSize.width, params.viewSize.height, params.deviceScaleF actor)); 212 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(calculateDeviceSc aleAdjustment(params.viewSize.width, params.viewSize.height, params.deviceScaleF actor));
214 213
215 if (params.screenPosition == WebDeviceEmulationParams::Mobile) 214 if (params.screenPosition == WebDeviceEmulationParams::Mobile)
216 enableMobileEmulation(); 215 enableMobileEmulation();
217 else 216 else
218 disableMobileEmulation(); 217 disableMobileEmulation();
219 218
220 m_webViewImpl->setCompositorDeviceScaleFactorOverride(params.deviceScaleFact or); 219 m_webViewImpl->setCompositorDeviceScaleFactorOverride(params.deviceScaleFact or);
221 m_webViewImpl->setRootLayerTransform(WebSize(params.offset.x, params.offset. y), params.scale); 220 m_webViewImpl->setRootLayerTransform(WebSize(params.offset.x, params.offset. y), params.scale);
222 // TODO(dgozman): mainFrameImpl() is null when it's remote. Figure out how 221 // TODO(dgozman): mainFrameImpl() is null when it's remote. Figure out how
223 // we end up with enabling emulation in this case. 222 // we end up with enabling emulation in this case.
224 if (m_webViewImpl->mainFrameImpl()) { 223 if (m_webViewImpl->mainFrameImpl()) {
225 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt()) 224 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt())
226 document->mediaQueryAffectingValueChanged(); 225 document->mediaQueryAffectingValueChanged();
227 } 226 }
228 } 227 }
229 228
230 void DevToolsEmulator::disableDeviceEmulation() 229 void DevToolsEmulator::disableDeviceEmulation()
231 { 230 {
232 if (!m_deviceMetricsEnabled) 231 if (!m_deviceMetricsEnabled)
233 return; 232 return;
234 233
235 m_deviceMetricsEnabled = false; 234 m_deviceMetricsEnabled = false;
236 m_webViewImpl->setBackgroundColorOverride(Color::transparent); 235 m_webViewImpl->setBackgroundColorOverride(Color::transparent);
237 m_webViewImpl->updateShowFPSCounter();
238 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(m_embedderDeviceS caleAdjustment); 236 m_webViewImpl->page()->settings().setDeviceScaleAdjustment(m_embedderDeviceS caleAdjustment);
239 disableMobileEmulation(); 237 disableMobileEmulation();
240 m_webViewImpl->setCompositorDeviceScaleFactorOverride(0.f); 238 m_webViewImpl->setCompositorDeviceScaleFactorOverride(0.f);
241 m_webViewImpl->setRootLayerTransform(WebSize(0.f, 0.f), 1.f); 239 m_webViewImpl->setRootLayerTransform(WebSize(0.f, 0.f), 1.f);
242 m_webViewImpl->setPageScaleFactor(1.f); 240 m_webViewImpl->setPageScaleFactor(1.f);
243 // mainFrameImpl() could be null during cleanup or remote <-> local swap. 241 // mainFrameImpl() could be null during cleanup or remote <-> local swap.
244 if (m_webViewImpl->mainFrameImpl()) { 242 if (m_webViewImpl->mainFrameImpl()) {
245 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt()) 243 if (Document* document = m_webViewImpl->mainFrameImpl()->frame()->docume nt())
246 document->mediaQueryAffectingValueChanged(); 244 document->mediaQueryAffectingValueChanged();
247 } 245 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 m_lastPinchAnchorCss.clear(); 380 m_lastPinchAnchorCss.clear();
383 m_lastPinchAnchorDip.clear(); 381 m_lastPinchAnchorDip.clear();
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
« no previous file with comments | « third_party/WebKit/Source/web/DevToolsEmulator.h ('k') | third_party/WebKit/Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698