diff options
author | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 00:05:39 +0000 |
---|---|---|
committer | scottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 00:05:39 +0000 |
commit | a22ebd8195be28d72b49073cbcaa4d9b750d495d (patch) | |
tree | 74435123982cba6c4615403d9bcbdc8857809f5e | |
parent | 0f1373a184a3a1495b3b3b35387f75f15609f3e1 (diff) | |
download | chromium_src-a22ebd8195be28d72b49073cbcaa4d9b750d495d.zip chromium_src-a22ebd8195be28d72b49073cbcaa4d9b750d495d.tar.gz chromium_src-a22ebd8195be28d72b49073cbcaa4d9b750d495d.tar.bz2 |
Linux/CrOS smooth scrolling support - behind a flag.
Add runtime flag to control smooth scrolling. Add compile time flag handling for a GYP_DEFINE (enable_smooth_scrolling=1).
BUG=575,61140
TEST=compile still works without the flag. Compiling with the flag works once the WebKit change is landed, and then the flag appears in the about:flags page, and actually turns on that WebKit implementation.
Review URL: http://codereview.chromium.org/7034052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90136 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/common.gypi | 3 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 6 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 12 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_delegate_helper.cc | 2 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 5 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | content/common/view_messages.h | 1 | ||||
-rw-r--r-- | webkit/glue/webpreferences.cc | 4 | ||||
-rw-r--r-- | webkit/glue/webpreferences.h | 1 |
10 files changed, 37 insertions, 1 deletions
diff --git a/build/common.gypi b/build/common.gypi index 65e6a65..8d70646 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -251,6 +251,9 @@ 'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)', 'enable_register_protocol_handler%': '<(enable_register_protocol_handler)', + # Smooth scrolling is disabled by default. + 'enable_smooth_scrolling%': 0, + # The release channel that this build targets. This is used to restrict # channel-specific build options, like which installer packages to create. # The default is 'all', which does no channel-specific filtering. diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index f492ffd..64a3168 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4323,6 +4323,12 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_FLAGS_PRELOAD_INSTANT_SEARCH_DESCRIPTION" desc="Description for the flag to preload Instant search"> Preload the default search engine for Instant. </message> + <message name="IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_NAME" desc="Title for the flag to turn on smooth scrolling"> + Smooth Scrolling + </message> + <message name="IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_DESCRIPTION" desc="Description for the flag to turn on smooth scrolling"> + Enable the experimental smooth scrolling implementation. + </message> <message name="IDS_FLAGS_AUTO_LOGIN_NAME" desc="title for the flag to pre- and auto-login the user"> Disable pre- and auto-login </message> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index b5137f2..75f9d66 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -364,6 +364,18 @@ const Experiment kExperiments[] = { kOsAll, SINGLE_VALUE_TYPE(switches::kEnableSyncTypedUrls) }, + { + "enable-smooth-scrolling", // FLAGS:RECORD_UMA + IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_NAME, + IDS_FLAGS_ENABLE_SMOOTH_SCROLLING_DESCRIPTION, + // Can't expose the switch unless the code is compiled in. +#if defined(ENABLE_SMOOTH_SCROLLING) + kOsAll, +#else + 0, +#endif + SINGLE_VALUE_TYPE(switches::kEnableSmoothScrolling) + }, }; const Experiment* experiments = kExperiments; diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 9f6f388..0484959 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -341,6 +341,8 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent); web_prefs.allow_running_insecure_content = prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent); + web_prefs.enable_scroll_animator = + command_line.HasSwitch(switches::kEnableSmoothScrolling); // The user stylesheet watcher may not exist in a testing profile. if (profile->GetUserStyleSheetWatcher()) { diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index ad08b00..5c6cec9 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -4512,6 +4512,11 @@ ['exclude', '^browser/ui/views/file_manager_dialog.h'], ]} ], + ['enable_smooth_scrolling==1', { + 'defines': [ + 'ENABLE_SMOOTH_SCROLLING', + ], + }], ], }, { diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index b1f74dd..b667a0f 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -479,6 +479,9 @@ const char kEnablePreconnect[] = "enable-preconnect"; // parameter to indicate if the provider should be the default. const char kEnableSearchProviderApiV2[] = "enable-search-provider-api-v2"; +// On platforms that support it, enable smooth scroll animation. +const char kEnableSmoothScrolling[] = "enable-smooth-scrolling"; + // Enables TLS cached info extension. const char kEnableSSLCachedInfo[] = "enable-ssl-cached-info"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index c9f0db3..6770bd1 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -139,6 +139,7 @@ extern const char kEnablePreconnect[]; extern const char kEnableRemoting[]; extern const char kEnableResourceContentSettings[]; extern const char kEnableSearchProviderApiV2[]; +extern const char kEnableSmoothScrolling[]; extern const char kEnableSSLCachedInfo[]; extern const char kEnableSync[]; extern const char kEnableSyncAutofill[]; diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 57d7bd2..911cd87 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -327,6 +327,7 @@ IPC_STRUCT_TRAITS_BEGIN(WebPreferences) IPC_STRUCT_TRAITS_MEMBER(fullscreen_enabled) IPC_STRUCT_TRAITS_MEMBER(allow_displaying_insecure_content) IPC_STRUCT_TRAITS_MEMBER(allow_running_insecure_content) + IPC_STRUCT_TRAITS_MEMBER(enable_scroll_animator) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(WebMenuItem) diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc index f55ec5f..362c212 100644 --- a/webkit/glue/webpreferences.cc +++ b/webkit/glue/webpreferences.cc @@ -81,7 +81,8 @@ WebPreferences::WebPreferences() fullscreen_enabled(false), allow_displaying_insecure_content(true), allow_running_insecure_content(false), - should_print_backgrounds(false) { + should_print_backgrounds(false), + enable_scroll_animator(false) { } WebPreferences::~WebPreferences() { @@ -231,4 +232,5 @@ void WebPreferences::Apply(WebView* web_view) const { settings->setAllowDisplayOfInsecureContent(allow_displaying_insecure_content); settings->setAllowRunningOfInsecureContent(allow_running_insecure_content); settings->setShouldPrintBackgrounds(should_print_backgrounds); + settings->setEnableScrollAnimator(enable_scroll_animator); } diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h index 5389cc4..78dc8f1 100644 --- a/webkit/glue/webpreferences.h +++ b/webkit/glue/webpreferences.h @@ -91,6 +91,7 @@ struct WebPreferences { bool allow_displaying_insecure_content; bool allow_running_insecure_content; bool should_print_backgrounds; + bool enable_scroll_animator; // We try to keep the default values the same as the default values in // chrome, except for the cases where it would require lots of extra work for |