summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbokan@chromium.org <bokan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 10:29:00 +0000
committerbokan@chromium.org <bokan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 10:29:00 +0000
commitfe89d82f7d90d1bc084bc4dd49269ce530c50cbf (patch)
tree923030d92fc4f18ce04af5ccdd1b4de7cd4c0ae0
parent6fa615b4eff8602ae539686e28fcbafd7deab1c6 (diff)
downloadchromium_src-fe89d82f7d90d1bc084bc4dd49269ce530c50cbf.zip
chromium_src-fe89d82f7d90d1bc084bc4dd49269ce530c50cbf.tar.gz
chromium_src-fe89d82f7d90d1bc084bc4dd49269ce530c50cbf.tar.bz2
Fix for pinch virtual viewport flag wasn't fully enabled.
Missed a case when enabling the flag on CrOS in r266119. BUG=367099 Review URL: https://codereview.chromium.org/257903002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266504 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/base/switches.cc1
-rw-r--r--cc/base/switches.h1
-rw-r--r--chrome/browser/about_flags.cc6
-rw-r--r--chrome/browser/chromeos/login/chrome_restart_request.cc1
-rw-r--r--content/browser/gpu/compositor_util.cc16
-rw-r--r--content/browser/gpu/compositor_util.h4
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc10
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc8
8 files changed, 34 insertions, 13 deletions
diff --git a/cc/base/switches.cc b/cc/base/switches.cc
index 0731598..4211a35 100644
--- a/cc/base/switches.cc
+++ b/cc/base/switches.cc
@@ -63,6 +63,7 @@ const char kStrictLayerPropertyChangeChecking[] =
// Virtual viewport for fixed-position elements, scrollbars during pinch.
const char kEnablePinchVirtualViewport[] = "enable-pinch-virtual-viewport";
+const char kDisablePinchVirtualViewport[] = "disable-pinch-virtual-viewport";
// Disable partial swap which is needed for some OpenGL drivers / emulators.
const char kUIDisablePartialSwap[] = "ui-disable-partial-swap";
diff --git a/cc/base/switches.h b/cc/base/switches.h
index b8b2243..be4c1ac 100644
--- a/cc/base/switches.h
+++ b/cc/base/switches.h
@@ -31,6 +31,7 @@ CC_EXPORT extern const char kCompositeToMailbox[];
CC_EXPORT extern const char kMaxTilesForInterestArea[];
CC_EXPORT extern const char kMaxUnusedResourceMemoryUsagePercentage[];
CC_EXPORT extern const char kEnablePinchVirtualViewport[];
+CC_EXPORT extern const char kDisablePinchVirtualViewport[];
CC_EXPORT extern const char kStrictLayerPropertyChangeChecking[];
CC_EXPORT extern const char kDisableCompositorTouchHitTesting[];
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 3ba634e..92110c7 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -972,8 +972,10 @@ const Experiment kExperiments[] = {
"enable-pinch-virtual-viewport",
IDS_FLAGS_ENABLE_PINCH_VIRTUAL_VIEWPORT_NAME,
IDS_FLAGS_ENABLE_PINCH_VIRTUAL_VIEWPORT_DESCRIPTION,
- kOsLinux | kOsWin | kOsAndroid,
- SINGLE_VALUE_TYPE(cc::switches::kEnablePinchVirtualViewport),
+ kOsLinux | kOsWin | kOsCrOS | kOsAndroid,
+ ENABLE_DISABLE_VALUE_TYPE(
+ cc::switches::kEnablePinchVirtualViewport,
+ cc::switches::kDisablePinchVirtualViewport),
},
{
"enable-viewport-meta",
diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc
index c280609..94d4f34 100644
--- a/chrome/browser/chromeos/login/chrome_restart_request.cc
+++ b/chrome/browser/chromeos/login/chrome_restart_request.cc
@@ -179,6 +179,7 @@ std::string DeriveCommandLine(const GURL& start_url,
cc::switches::kDisableCompositorTouchHitTesting,
cc::switches::kDisableMainFrameBeforeActivation,
cc::switches::kDisableMainFrameBeforeDraw,
+ cc::switches::kDisablePinchVirtualViewport,
cc::switches::kDisableThreadedAnimation,
cc::switches::kEnableGpuBenchmarking,
cc::switches::kEnablePinchVirtualViewport,
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc
index d5982a4..5c1d962 100644
--- a/content/browser/gpu/compositor_util.cc
+++ b/content/browser/gpu/compositor_util.cc
@@ -136,6 +136,22 @@ const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) {
} // namespace
+bool IsPinchVirtualViewportEnabled() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+
+ // Command line switches take precedence over platform default.
+ if (command_line.HasSwitch(cc::switches::kDisablePinchVirtualViewport))
+ return false;
+ if (command_line.HasSwitch(cc::switches::kEnablePinchVirtualViewport))
+ return true;
+
+#if defined(OS_CHROMEOS)
+ return true;
+#else
+ return false;
+#endif
+}
+
bool IsThreadedCompositingEnabled() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
diff --git a/content/browser/gpu/compositor_util.h b/content/browser/gpu/compositor_util.h
index b3cf204..72a3ac0 100644
--- a/content/browser/gpu/compositor_util.h
+++ b/content/browser/gpu/compositor_util.h
@@ -13,6 +13,10 @@ namespace content {
// Note: When adding a function here, please make sure the logic is not
// duplicated in the renderer.
+// Returns true if the virtual viewport model of pinch-to-zoom is on (via
+// flags, or platform default).
+CONTENT_EXPORT bool IsPinchVirtualViewportEnabled();
+
// Returns true if the threaded compositor is on (via flags or field trial).
CONTENT_EXPORT bool IsThreadedCompositingEnabled();
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index bf77203..5ce5e59 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -939,7 +939,10 @@ StoragePartition* RenderProcessHostImpl::GetStoragePartition() const {
return storage_partition_impl_;
}
-static void AppendGpuCommandLineFlags(CommandLine* command_line) {
+static void AppendCompositorCommandLineFlags(CommandLine* command_line) {
+ if (IsPinchVirtualViewportEnabled())
+ command_line->AppendSwitch(cc::switches::kEnablePinchVirtualViewport);
+
if (IsThreadedCompositingEnabled())
command_line->AppendSwitch(switches::kEnableThreadedCompositing);
@@ -992,7 +995,7 @@ void RenderProcessHostImpl::AppendRendererCommandLine(
if (content::IsPinchToZoomEnabled())
command_line->AppendSwitch(switches::kEnablePinch);
- AppendGpuCommandLineFlags(command_line);
+ AppendCompositorCommandLineFlags(command_line);
}
void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
@@ -1136,7 +1139,6 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
cc::switches::kDisableMainFrameBeforeDraw,
cc::switches::kDisableThreadedAnimation,
cc::switches::kEnableGpuBenchmarking,
- cc::switches::kEnablePinchVirtualViewport,
cc::switches::kEnableMainFrameBeforeActivation,
cc::switches::kEnableTopControlsPositionCalculation,
cc::switches::kMaxTilesForInterestArea,
@@ -1644,7 +1646,7 @@ void RenderProcessHost::SetRunRendererInProcess(bool value) {
// TODO(piman): we should really send configuration through bools rather
// than by parsing strings, i.e. sending an IPC rather than command line
// args. crbug.com/314909
- AppendGpuCommandLineFlags(command_line);
+ AppendCompositorCommandLineFlags(command_line);
}
}
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index cfd1af1..fb77177 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -431,13 +431,7 @@ WebPreferences RenderViewHostImpl::GetWebkitPrefs(const GURL& url) {
prefs.region_based_columns_enabled =
command_line.HasSwitch(switches::kEnableRegionBasedColumns);
-#if defined(OS_CHROMEOS)
- bool enable_pinch_virtual_viewport = true;
-#else
- bool enable_pinch_virtual_viewport =
- command_line.HasSwitch(cc::switches::kEnablePinchVirtualViewport);
-#endif
- if (enable_pinch_virtual_viewport) {
+ if (IsPinchVirtualViewportEnabled()) {
prefs.pinch_virtual_viewport_enabled = true;
prefs.pinch_overlay_scrollbar_thickness = 10;
}