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

Unified Diff: content/renderer/render_view_impl.cc

Issue 7831028: Compute pageScaleFactor on page so that fixed layout page fits width of window. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed common.gypi to have default value for enable_viewport Created 8 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 737a7c39bf135ad19e74a3757aacde4b90554b48..f8f0cba6f26d4d5ea729e72bfc2df640663f1f45 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -20,6 +20,7 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_piece.h"
+#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
@@ -527,6 +528,15 @@ RenderViewImpl::RenderViewImpl(
if (command_line.HasSwitch(switches::kDomAutomationController))
enabled_bindings_ |= content::BINDINGS_POLICY_DOM_AUTOMATION;
+ bool enable_fixed_layout =
+ command_line.HasSwitch(switches::kEnableFixedLayout);
+ webview()->enableFixedLayoutMode(enable_fixed_layout);
+ if (enable_fixed_layout)
+ webview()->settings()->setFixedElementsLayoutRelativeToFrame(true);
+ base::StringToInt(command_line.GetSwitchValueASCII(
+ switches::kDefaultDeviceScaleFactor),
+ &default_device_scale_factor_);
+
content::GetContentClient()->renderer()->RenderViewCreated(this);
}
@@ -4367,6 +4377,10 @@ void RenderViewImpl::OnResize(const gfx::Size& new_size,
const gfx::Rect& resizer_rect,
bool is_fullscreen) {
if (webview()) {
+ // This setting has no effect if fixed layout is not enabled.
+ if (default_device_scale_factor_)
+ webview()->settings()->setLayoutFallbackWidth(
+ new_size.width() / default_device_scale_factor_);
webview()->hidePopups();
if (send_preferred_size_changes_) {
webview()->mainFrame()->setCanHaveScrollbars(
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698