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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2122023002: Cross-process frames should be notified of device scale factor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 5 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: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 23a03d9b75fac5e2fd7bb91fa7001bfe8296fbcc..474a99470289d48e4695af5dbc99722eb09bd1d7 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -970,6 +970,26 @@ void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme,
UpdateZoom(level);
}
+void WebContentsImpl::UpdateDeviceScaleFactor(double device_scale_factor) {
+ SendPageMessage(
+ new PageMsg_SetDeviceScaleFactor(MSG_ROUTING_NONE, device_scale_factor));
oshima 2016/07/07 22:45:43 Doesn't a oop frame receive ScreenInfo? When dsf c
wjmaclean 2016/07/08 17:38:33 The OOP frame is informed, but in a sort of round-
+}
+
+double WebContentsImpl::DefaultDeviceScaleFactor() {
+ // TODO(wjmaclean): is it simpler to just remember the value from the last
+ // call to UpdateDeviceScaleFactor()? It's perhaps not the sort of state we
+ // expect WebContents to be hanging on to.
+ RenderWidgetHostViewBase* rwhv =
+ static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
+ if (rwhv) {
+ blink::WebScreenInfo screen_info;
+ rwhv->GetScreenInfo(&screen_info);
+ return screen_info.deviceScaleFactor;
+ }
+
+ return RenderWidgetHostDelegate::DefaultDeviceScaleFactor();
oshima 2016/07/07 22:45:43 web content's view should also knows about the cur
wjmaclean 2016/07/08 17:38:33 You mean WebContentsView? I looked there but didn'
+}
+
WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url,
const std::string& frame_name) {
DCHECK(!frame_name.empty());

Powered by Google App Engine
This is Rietveld 408576698