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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/DevToolsHost.cpp
diff --git a/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp b/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp
index 9854ebcd4eceab5bc6d0963d9c4cf95c16c25015..6593eafab937d5552f7e7063a89b32029db99fba 100644
--- a/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp
+++ b/third_party/WebKit/Source/core/inspector/DevToolsHost.cpp
@@ -164,16 +164,12 @@ void DevToolsHost::disconnectClient()
float DevToolsHost::zoomFactor()
{
- return m_frontendFrame ? m_frontendFrame->pageZoomFactor() : 1;
-}
-
-float DevToolsHost::convertLengthForEmbedder(float length)
-{
- if (!m_frontendFrame)
- return length;
+ float zoomFactor = m_frontendFrame->pageZoomFactor();
+ // Cancel the device scale factor applied to the zoom factor in
+ // use-zoom-for-dsf mode.
const HostWindow* hostWindow = m_frontendFrame->view()->hostWindow();
- IntRect screen = hostWindow->viewportToScreen(IntRect(0, 0, length, 0));
- return screen.width();
+ float windowToViewportRatio = hostWindow->windowToViewportScalar(1.0f);
+ return zoomFactor / windowToViewportRatio;
}
void DevToolsHost::setInjectedScriptForOrigin(const String& origin, const String& script)

Powered by Google App Engine
This is Rietveld 408576698