Commit fe89d82f authored by bokan@chromium.org's avatar bokan@chromium.org

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
parent 6fa615b4
......@@ -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";
......
......@@ -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[];
......
......@@ -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",
......
......@@ -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,
......
......@@ -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();
......
......@@ -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();
......
......@@ -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);
}
}
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment