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

Side by Side Diff: third_party/WebKit/Source/core/inspector/DevToolsHost.cpp

Issue 1737733002: [DevTools] Handle emulated device scale factor and original device scale factor properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 m_client = 0; 157 m_client = 0;
158 if (m_menuProvider) { 158 if (m_menuProvider) {
159 m_menuProvider->disconnect(); 159 m_menuProvider->disconnect();
160 m_menuProvider = nullptr; 160 m_menuProvider = nullptr;
161 } 161 }
162 m_frontendFrame = nullptr; 162 m_frontendFrame = nullptr;
163 } 163 }
164 164
165 float DevToolsHost::zoomFactor() 165 float DevToolsHost::zoomFactor()
166 { 166 {
167 return m_frontendFrame ? m_frontendFrame->pageZoomFactor() : 1; 167 float zoomFactor = m_frontendFrame->pageZoomFactor();
168 // Cancel the device scale factor applied to the zoom factor in
169 // use-zoom-for-dsf mode.
170 return convertLengthForEmbedder(1000.f * zoomFactor) / 1000.f;
168 } 171 }
169 172
170 float DevToolsHost::convertLengthForEmbedder(float length) 173 float DevToolsHost::convertLengthForEmbedder(float length)
171 { 174 {
172 if (!m_frontendFrame) 175 if (!m_frontendFrame)
173 return length; 176 return length;
174 const HostWindow* hostWindow = m_frontendFrame->view()->hostWindow(); 177 const HostWindow* hostWindow = m_frontendFrame->view()->hostWindow();
175 IntRect screen = hostWindow->viewportToScreen(IntRect(0, 0, length, 0)); 178 IntRect screen = hostWindow->viewportToScreen(IntRect(0, 0, length, 0));
176 return screen.width(); 179 return screen.width();
177 } 180 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 { 245 {
243 return m_client && m_client->isUnderTest(); 246 return m_client && m_client->isUnderTest();
244 } 247 }
245 248
246 bool DevToolsHost::isHostedMode() 249 bool DevToolsHost::isHostedMode()
247 { 250 {
248 return false; 251 return false;
249 } 252 }
250 253
251 } // namespace blink 254 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698