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

Unified Diff: content/renderer/render_view_impl.cc

Issue 23364004: Implementation of device metrics emulation in render view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 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/renderer/render_view_impl.cc
===================================================================
--- content/renderer/render_view_impl.cc (revision 217537)
+++ content/renderer/render_view_impl.cc (working copy)
@@ -2363,6 +2363,8 @@
WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) {
RenderWidget* widget =
RenderWidget::Create(routing_id_, popup_type, screen_info_);
+ if (device_emulation_helper_)
+ device_emulation_helper_->PopupCreated(this, widget);
return widget->webwidget();
}
@@ -2440,6 +2442,26 @@
plugin->initializeFrame(main_render_frame_.get());
}
+void RenderViewImpl::emulateDevice(
+ bool enabled,
+ const WebKit::WebSize& device_size,
+ const WebKit::WebRect& view_rect,
+ float device_scale_factor,
+ bool fit_to_view) {
+ if (enabled && webview()) {
+ webview()->settings()->setViewportEnabled(true);
+ webview()->enableFixedLayoutMode(true);
+ webview()->settings()->setForceCompositingMode(true);
+ }
+ EmulateDevice(enabled, gfx::Size(device_size), gfx::Rect(view_rect),
+ device_scale_factor, fit_to_view);
+ if (!enabled && webview()) {
+ webview()->settings()->setForceCompositingMode(false);
aelias_OOO_until_Jul13 2013/09/05 08:26:49 This one is usually true on desktop as well, this
dgozman 2013/09/10 19:54:02 Nice catch, thanks!
+ webview()->enableFixedLayoutMode(false);
+ webview()->settings()->setViewportEnabled(false);
+ }
+}
+
void RenderViewImpl::didStartLoading() {
if (is_loading_) {
DVLOG(1) << "didStartLoading called while loading";

Powered by Google App Engine
This is Rietveld 408576698