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

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1412663005: Introduce painted-device-scale-factor and use it when --enable-use-zoom-for-dsf is specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: export switch, remove WebWidgetClient::deviceScaleFactor Created 5 years, 2 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/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index fe889d4f9fb92f8fe078d49f546d9d80a5e741bc..be19f6e366d3b3151c69131c3b1c023cb8457f53 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -412,6 +412,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_zoomLevel(0)
, m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier))
, m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier))
+ , m_zoomFactorForDeviceScaleFactor(1.f)
, m_maximumLegibleScale(1)
, m_doubleTapZoomPageScaleFactor(0)
, m_doubleTapZoomPending(false)
@@ -2958,6 +2959,7 @@ double WebViewImpl::setZoomLevel(double zoomLevel)
LocalFrame* frame = mainFrameImpl()->frame();
if (!WebLocalFrameImpl::pluginContainerFromFrame(frame)) {
float zoomFactor = m_zoomFactorOverride ? m_zoomFactorOverride : static_cast<float>(zoomLevelToZoomFactor(m_zoomLevel));
+ zoomFactor *= m_zoomFactorForDeviceScaleFactor;
frame->setPageZoomFactor(zoomFactor);
}
@@ -3103,6 +3105,14 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor)
updateLayerTreeDeviceScaleFactor();
}
+void WebViewImpl::setZoomFactorForDeviceScaleFactor(float zoomFactorForDeviceScaleFactor)
+{
+ if (!m_layerTreeView || m_zoomFactorForDeviceScaleFactor == zoomFactorForDeviceScaleFactor)
+ return;
+ m_zoomFactorForDeviceScaleFactor = zoomFactorForDeviceScaleFactor;
+ setZoomLevel(m_zoomLevel);
+}
+
void WebViewImpl::setDeviceColorProfile(const WebVector<char>& colorProfile)
{
if (!page())

Powered by Google App Engine
This is Rietveld 408576698