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

Unified Diff: chrome/renderer/chrome_content_renderer_client.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: Minimizes render_view_impl changes and introduces a defaultDeviceScaleFactor argument 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
Index: chrome/renderer/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 66a774431ebd630b7ad8febc8c48968c41266a1d..36bbbbe37318d4ca34695e6a02d2b2fa290a3c7b 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
+#include "base/string_number_conversions.h"
#include "base/string_tokenizer.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -76,6 +77,8 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h"
@@ -265,6 +268,26 @@ void ChromeContentRendererClient::RenderViewCreated(
switches::kDomAutomationController)) {
new AutomationRendererHelper(render_view);
}
+
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ render_view->GetWebView()->enableFixedLayoutMode(
+ cmd_line->HasSwitch(switches::kEnableFixedLayout));
+}
+
+void ChromeContentRendererClient::RenderViewResized(
+ content::RenderView* render_view, int new_width, int new_height) {
+ if (!render_view->GetWebView())
+ return;
+
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ int defaultDeviceScaleFactor = 0;
darin (slow to review) 2012/02/15 06:13:23 nit: use google_style_for_variable_names
Fady Samuel 2012/02/15 17:46:05 Done. I always forget when switching between chrom
+ base::StringToInt(cmd_line->GetSwitchValueASCII(
+ switches::kDefaultDeviceScaleFactor),
darin (slow to review) 2012/02/15 06:13:23 nit: indentation
Fady Samuel 2012/02/15 17:46:05 I think I have matched the style guide now.
+ &defaultDeviceScaleFactor);
+ // This setting has no effect if fixed layout is not enabled.
+ if (defaultDeviceScaleFactor)
+ render_view->GetWebView()->settings()->setLayoutFallbackWidth(
darin (slow to review) 2012/02/15 06:13:23 it seems a bit unusual to update WebSettings on re
Fady Samuel 2012/02/15 17:46:05 In my humble opinion, no. The default device scale
+ new_width / defaultDeviceScaleFactor);
}
void ChromeContentRendererClient::SetNumberOfViews(int number_of_views) {

Powered by Google App Engine
This is Rietveld 408576698