summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@chromium.org>2014-09-25 01:11:11 -0400
committerSadrul Habib Chowdhury <sadrul@chromium.org>2014-09-25 05:12:37 +0000
commit67feaac651ac428654a7326db2c2329d52a78de3 (patch)
tree1e47ed1d0ef2b263f3106d6adbea77ed8bcd0cbb
parent0e6cd43eb9a467c81382e37f686f3ebfdda5c1d3 (diff)
downloadchromium_src-67feaac651ac428654a7326db2c2329d52a78de3.zip
chromium_src-67feaac651ac428654a7326db2c2329d52a78de3.tar.gz
chromium_src-67feaac651ac428654a7326db2c2329d52a78de3.tar.bz2
fling: Remove a bunch of code for configuring fling curves.
The fling curve for touchpad and touchscreen used to be configurable for experimenting with, but these parameters have been stable for a long time now. So make the values default, and remove all the code and preferences that were necessary for the configurability. BUG=none R=avi@chromium.org, kenrb@chromium.org, sky@chromium.org, wjmaclean@chromium.org Review URL: https://codereview.chromium.org/586933003 Cr-Commit-Position: refs/heads/master@{#296652}
-rw-r--r--chrome/browser/renderer_preferences_util.cc14
-rw-r--r--chrome/browser/resources/gesture_config.js79
-rw-r--r--chrome/browser/ui/gesture_prefs_observer_factory_aura.cc83
-rw-r--r--chrome/browser/ui/gesture_prefs_observer_factory_aura.h1
-rw-r--r--chrome/browser/ui/webui/chromeos/salsa_ui.cc10
-rw-r--r--chrome/common/pref_names.cc14
-rw-r--r--chrome/common/pref_names.h10
-rw-r--r--content/child/blink_platform_impl.cc16
-rw-r--r--content/child/blink_platform_impl.h4
-rw-r--r--content/child/fling_curve_configuration.cc56
-rw-r--r--content/child/fling_curve_configuration.h58
-rw-r--r--content/child/touch_fling_gesture_curve.cc55
-rw-r--r--content/child/touch_fling_gesture_curve.h5
-rw-r--r--content/child/touch_fling_gesture_curve_unittest.cc3
-rw-r--r--content/common/view_messages.h2
-rw-r--r--content/content_child.gypi2
-rw-r--r--content/public/common/renderer_preferences.cc16
-rw-r--r--content/public/common/renderer_preferences.h6
-rw-r--r--content/renderer/render_thread_impl.cc7
-rw-r--r--content/renderer/render_thread_impl.h3
-rw-r--r--content/renderer/render_view_impl.cc5
-rw-r--r--ui/aura/test/aura_test_base.cc8
-rw-r--r--ui/events/gestures/gesture_configuration.cc11
-rw-r--r--ui/events/gestures/gesture_configuration.h11
24 files changed, 47 insertions, 432 deletions
diff --git a/chrome/browser/renderer_preferences_util.cc b/chrome/browser/renderer_preferences_util.cc
index 8cc171c..519e63b 100644
--- a/chrome/browser/renderer_preferences_util.cc
+++ b/chrome/browser/renderer_preferences_util.cc
@@ -38,7 +38,6 @@ void UpdateFromSystemSettings(
#if defined(USE_DEFAULT_RENDER_THEME)
prefs->focus_ring_color = SkColorSetRGB(0x4D, 0x90, 0xFE);
-
#if defined(OS_CHROMEOS)
// This color is 0x544d90fe modulated with 0xffffff.
prefs->active_selection_bg_color = SkColorSetRGB(0xCB, 0xE4, 0xFA);
@@ -46,19 +45,6 @@ void UpdateFromSystemSettings(
prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA);
prefs->inactive_selection_fg_color = SK_ColorBLACK;
#endif
-
- prefs->touchpad_fling_profile[0] =
- pref_service->GetDouble(prefs::kFlingCurveTouchpadAlpha);
- prefs->touchpad_fling_profile[1] =
- pref_service->GetDouble(prefs::kFlingCurveTouchpadBeta);
- prefs->touchpad_fling_profile[2] =
- pref_service->GetDouble(prefs::kFlingCurveTouchpadGamma);
- prefs->touchscreen_fling_profile[0] =
- pref_service->GetDouble(prefs::kFlingCurveTouchscreenAlpha);
- prefs->touchscreen_fling_profile[1] =
- pref_service->GetDouble(prefs::kFlingCurveTouchscreenBeta);
- prefs->touchscreen_fling_profile[2] =
- pref_service->GetDouble(prefs::kFlingCurveTouchscreenGamma);
#endif
#if defined(TOOLKIT_VIEWS)
diff --git a/chrome/browser/resources/gesture_config.js b/chrome/browser/resources/gesture_config.js
index 2c077e8..099c288 100644
--- a/chrome/browser/resources/gesture_config.js
+++ b/chrome/browser/resources/gesture_config.js
@@ -179,30 +179,6 @@ function GestureConfig() {
units: 'pixels'
},
{
- key: 'fling_acceleration_curve_coefficient_0',
- label: 'Touchscreen Fling Acceleration',
- units: 'x<sup>3</sup>',
- min: '-1'
- },
- {
- key: 'fling_acceleration_curve_coefficient_1',
- label: '+',
- units: 'x<sup>2</sup>',
- min: '-1'
- },
- {
- key: 'fling_acceleration_curve_coefficient_2',
- label: '+',
- units: 'x<sup>1</sup>',
- min: '-1'
- },
- {
- key: 'fling_acceleration_curve_coefficient_3',
- label: '+',
- units: 'x<sup>0</sup>',
- min: '-1'
- },
- {
key: 'tab_scrub_activation_delay_in_ms',
label: 'Tab scrub auto activation delay, (-1 for never)',
units: 'milliseconds'
@@ -265,57 +241,6 @@ function OverscrollConfig() {
}
/**
- * Returns a GeneralConfig for configuring flingcurve.* preferences.
- * @return {object} A GeneralConfig object.
- */
-function FlingConfig() {
- /** @const */ var FLING_TITLE = 'Fling Configuration';
-
- /** @const */ var FLING_PREFIX = 'flingcurve.';
-
- var FLING_FIELDS = [
- {
- key: 'touchscreen_alpha',
- label: 'Touchscreen fling deacceleration coefficients',
- units: 'alpha',
- min: '-inf'
- },
- {
- key: 'touchscreen_beta',
- label: '',
- units: 'beta',
- min: '-inf'
- },
- {
- key: 'touchscreen_gamma',
- label: '',
- units: 'gamma',
- min: '-inf'
- },
- {
- key: 'touchpad_alpha',
- label: 'Touchpad fling deacceleration coefficients',
- units: 'alpha',
- min: '-inf'
- },
- {
- key: 'touchpad_beta',
- label: '',
- units: 'beta',
- min: '-inf'
- },
- {
- key: 'touchpad_gamma',
- label: '',
- units: 'gamma',
- min: '-inf'
- },
- ];
-
- return new GeneralConfig(FLING_TITLE, FLING_PREFIX, FLING_FIELDS);
-}
-
-/**
* WebUI instance for configuring preference values related to gesture input.
*/
window.gesture_config = {
@@ -329,13 +254,9 @@ window.gesture_config = {
var o = OverscrollConfig();
o.buildAll();
- var f = FlingConfig();
- f.buildAll();
-
$('reset-all-button').onclick = function() {
g.onReset();
o.onReset();
- f.onReset();
};
},
diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc
index 3163ef0..b529fea 100644
--- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc
+++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.cc
@@ -91,10 +91,6 @@ class GesturePrefsObserver : public KeyedService {
// Note that this collection of settings should correspond to the settings used
// in ui/events/gestures/gesture_configuration.h
const char* kPrefsToObserve[] = {
- prefs::kFlingAccelerationCurveCoefficient0,
- prefs::kFlingAccelerationCurveCoefficient1,
- prefs::kFlingAccelerationCurveCoefficient2,
- prefs::kFlingAccelerationCurveCoefficient3,
prefs::kFlingMaxCancelToDownTimeInMs,
prefs::kFlingMaxTapGapTimeInMs,
prefs::kTabScrubActivationDelayInMS,
@@ -102,20 +98,26 @@ const char* kPrefsToObserve[] = {
prefs::kSemiLongPressTimeInSeconds,
};
-const char* kFlingTouchpadPrefs[] = {
- prefs::kFlingCurveTouchpadAlpha,
- prefs::kFlingCurveTouchpadBeta,
- prefs::kFlingCurveTouchpadGamma
-};
-
-const char* kFlingTouchscreenPrefs[] = {
- prefs::kFlingCurveTouchscreenAlpha,
- prefs::kFlingCurveTouchscreenBeta,
- prefs::kFlingCurveTouchscreenGamma,
+const char* kPrefsToRemove[] = {
+ "gesture.fling_acceleration_curve_coefficient_0",
+ "gesture.fling_acceleration_curve_coefficient_1",
+ "gesture.fling_acceleration_curve_coefficient_2",
+ "gesture.fling_acceleration_curve_coefficient_3",
+ "flingcurve.touchpad_alpha",
+ "flingcurve.touchpad_beta",
+ "flingcurve.touchpad_gamma",
+ "flingcurve.touchscreen_alpha",
+ "flingcurve.touchscreen_beta",
+ "flingcurve.touchscreen_gamma",
};
GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs)
: prefs_(prefs) {
+ for (size_t i = 0; i < arraysize(kPrefsToRemove); ++i) {
+ if (prefs->FindPreference(kPrefsToRemove[i]))
+ prefs->ClearPref(kPrefsToRemove[i]);
+ }
+
registrar_.Init(prefs);
registrar_.RemoveAll();
base::Closure callback = base::Bind(&GesturePrefsObserver::Update,
@@ -131,11 +133,6 @@ GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs)
for (size_t i = 0; i < overscroll_prefs.size(); ++i)
registrar_.Add(overscroll_prefs[i].pref_name, callback);
- for (size_t i = 0; i < arraysize(kFlingTouchpadPrefs); ++i)
- registrar_.Add(kFlingTouchpadPrefs[i], notify_callback);
- for (size_t i = 0; i < arraysize(kFlingTouchscreenPrefs); ++i)
- registrar_.Add(kFlingTouchscreenPrefs[i], notify_callback);
-
Update();
}
@@ -146,14 +143,6 @@ void GesturePrefsObserver::Shutdown() {
}
void GesturePrefsObserver::Update() {
- GestureConfiguration::set_fling_acceleration_curve_coefficients(0,
- prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient0));
- GestureConfiguration::set_fling_acceleration_curve_coefficients(1,
- prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient1));
- GestureConfiguration::set_fling_acceleration_curve_coefficients(2,
- prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient2));
- GestureConfiguration::set_fling_acceleration_curve_coefficients(3,
- prefs_->GetDouble(prefs::kFlingAccelerationCurveCoefficient3));
GestureConfiguration::set_fling_max_cancel_to_down_time_in_ms(
prefs_->GetInteger(prefs::kFlingMaxCancelToDownTimeInMs));
GestureConfiguration::set_fling_max_tap_gap_time_in_ms(
@@ -161,11 +150,9 @@ void GesturePrefsObserver::Update() {
GestureConfiguration::set_tab_scrub_activation_delay_in_ms(
prefs_->GetInteger(prefs::kTabScrubActivationDelayInMS));
GestureConfiguration::set_semi_long_press_time_in_seconds(
- prefs_->GetDouble(
- prefs::kSemiLongPressTimeInSeconds));
+ prefs_->GetDouble(prefs::kSemiLongPressTimeInSeconds));
GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels(
- prefs_->GetDouble(
- prefs::kMaxSeparationForGestureTouchesInPixels));
+ prefs_->GetDouble(prefs::kMaxSeparationForGestureTouchesInPixels));
UpdateOverscrollPrefs();
}
@@ -219,41 +206,8 @@ void GesturePrefsObserverFactoryAura::RegisterOverscrollPrefs(
}
}
-void GesturePrefsObserverFactoryAura::RegisterFlingCurveParameters(
- user_prefs::PrefRegistrySyncable* registry) {
- content::RendererPreferences def_prefs;
-
- for (size_t i = 0; i < arraysize(kFlingTouchpadPrefs); i++)
- registry->RegisterDoublePref(
- kFlingTouchpadPrefs[i],
- def_prefs.touchpad_fling_profile[i],
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-
- for (size_t i = 0; i < arraysize(kFlingTouchscreenPrefs); i++)
- registry->RegisterDoublePref(
- kFlingTouchscreenPrefs[i],
- def_prefs.touchscreen_fling_profile[i],
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
-}
-
void GesturePrefsObserverFactoryAura::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
- registry->RegisterDoublePref(
- prefs::kFlingAccelerationCurveCoefficient0,
- GestureConfiguration::fling_acceleration_curve_coefficients(0),
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterDoublePref(
- prefs::kFlingAccelerationCurveCoefficient1,
- GestureConfiguration::fling_acceleration_curve_coefficients(1),
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterDoublePref(
- prefs::kFlingAccelerationCurveCoefficient2,
- GestureConfiguration::fling_acceleration_curve_coefficients(2),
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterDoublePref(
- prefs::kFlingAccelerationCurveCoefficient3,
- GestureConfiguration::fling_acceleration_curve_coefficients(3),
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterIntegerPref(
prefs::kFlingMaxCancelToDownTimeInMs,
GestureConfiguration::fling_max_cancel_to_down_time_in_ms(),
@@ -275,7 +229,6 @@ void GesturePrefsObserverFactoryAura::RegisterProfilePrefs(
GestureConfiguration::max_separation_for_gesture_touches_in_pixels(),
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
RegisterOverscrollPrefs(registry);
- RegisterFlingCurveParameters(registry);
}
bool
diff --git a/chrome/browser/ui/gesture_prefs_observer_factory_aura.h b/chrome/browser/ui/gesture_prefs_observer_factory_aura.h
index 7e71250..8621066 100644
--- a/chrome/browser/ui/gesture_prefs_observer_factory_aura.h
+++ b/chrome/browser/ui/gesture_prefs_observer_factory_aura.h
@@ -25,7 +25,6 @@ class GesturePrefsObserverFactoryAura
virtual ~GesturePrefsObserverFactoryAura();
void RegisterOverscrollPrefs(user_prefs::PrefRegistrySyncable* registry);
- void RegisterFlingCurveParameters(user_prefs::PrefRegistrySyncable* registry);
// BrowserContextKeyedServiceFactory:
virtual KeyedService* BuildServiceInstanceFor(
diff --git a/chrome/browser/ui/webui/chromeos/salsa_ui.cc b/chrome/browser/ui/webui/chromeos/salsa_ui.cc
index 34c66ac..9a2afea 100644
--- a/chrome/browser/ui/webui/chromeos/salsa_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/salsa_ui.cc
@@ -26,10 +26,6 @@ namespace {
const char* kWhitelist[] = {
prefs::kMaxSeparationForGestureTouchesInPixels,
- prefs::kFlingAccelerationCurveCoefficient0,
- prefs::kFlingAccelerationCurveCoefficient1,
- prefs::kFlingAccelerationCurveCoefficient2,
- prefs::kFlingAccelerationCurveCoefficient3,
prefs::kTabScrubActivationDelayInMS,
prefs::kOverscrollHorizontalThresholdComplete,
prefs::kOverscrollVerticalThresholdComplete,
@@ -37,12 +33,6 @@ const char* kWhitelist[] = {
prefs::kOverscrollVerticalThresholdStart,
prefs::kOverscrollHorizontalResistThreshold,
prefs::kOverscrollVerticalResistThreshold,
- prefs::kFlingCurveTouchscreenAlpha,
- prefs::kFlingCurveTouchscreenBeta,
- prefs::kFlingCurveTouchscreenGamma,
- prefs::kFlingCurveTouchpadAlpha,
- prefs::kFlingCurveTouchpadBeta,
- prefs::kFlingCurveTouchpadGamma,
};
void RevertPreferences(PrefService* prefs,
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 79da55d..b257b01 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -2201,20 +2201,6 @@ const char kSemiLongPressTimeInSeconds[] =
"gesture.semi_long_press_time_in_seconds";
const char kTabScrubActivationDelayInMS[] =
"gesture.tab_scrub_activation_delay_in_ms";
-const char kFlingAccelerationCurveCoefficient0[] =
- "gesture.fling_acceleration_curve_coefficient_0";
-const char kFlingAccelerationCurveCoefficient1[] =
- "gesture.fling_acceleration_curve_coefficient_1";
-const char kFlingAccelerationCurveCoefficient2[] =
- "gesture.fling_acceleration_curve_coefficient_2";
-const char kFlingAccelerationCurveCoefficient3[] =
- "gesture.fling_acceleration_curve_coefficient_3";
-const char kFlingCurveTouchpadAlpha[] = "flingcurve.touchpad_alpha";
-const char kFlingCurveTouchpadBeta[] = "flingcurve.touchpad_beta";
-const char kFlingCurveTouchpadGamma[] = "flingcurve.touchpad_gamma";
-const char kFlingCurveTouchscreenAlpha[] = "flingcurve.touchscreen_alpha";
-const char kFlingCurveTouchscreenBeta[] = "flingcurve.touchscreen_beta";
-const char kFlingCurveTouchscreenGamma[] = "flingcurve.touchscreen_gamma";
const char kFlingMaxCancelToDownTimeInMs[] =
"gesture.fling_max_cancel_to_down_time_in_ms";
const char kFlingMaxTapGapTimeInMs[] =
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index a474abf..74e47fc 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -760,16 +760,6 @@ extern const char kShowLogoutButtonInTray[];
extern const char kMaxSeparationForGestureTouchesInPixels[];
extern const char kSemiLongPressTimeInSeconds[];
extern const char kTabScrubActivationDelayInMS[];
-extern const char kFlingAccelerationCurveCoefficient0[];
-extern const char kFlingAccelerationCurveCoefficient1[];
-extern const char kFlingAccelerationCurveCoefficient2[];
-extern const char kFlingAccelerationCurveCoefficient3[];
-extern const char kFlingCurveTouchpadAlpha[];
-extern const char kFlingCurveTouchpadBeta[];
-extern const char kFlingCurveTouchpadGamma[];
-extern const char kFlingCurveTouchscreenAlpha[];
-extern const char kFlingCurveTouchscreenBeta[];
-extern const char kFlingCurveTouchscreenGamma[];
extern const char kFlingMaxCancelToDownTimeInMs[];
extern const char kFlingMaxTapGapTimeInMs[];
extern const char kOverscrollHorizontalThresholdComplete[];
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 85a391c..ca2392c 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -32,7 +32,7 @@
#include "content/app/strings/grit/content_strings.h"
#include "content/child/child_thread.h"
#include "content/child/content_child_helpers.h"
-#include "content/child/fling_curve_configuration.h"
+#include "content/child/touch_fling_gesture_curve.h"
#include "content/child/web_discardable_memory_impl.h"
#include "content/child/web_socket_stream_handle_impl.h"
#include "content/child/web_url_loader_impl.h"
@@ -422,7 +422,6 @@ BlinkPlatformImpl::BlinkPlatformImpl()
shared_timer_fire_time_(0.0),
shared_timer_fire_time_was_set_while_suspended_(false),
shared_timer_suspended_(0),
- fling_curve_configuration_(new FlingCurveConfiguration),
current_thread_slot_(&DestroyCurrentThread) {}
BlinkPlatformImpl::~BlinkPlatformImpl() {
@@ -998,12 +997,7 @@ blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve(
cumulative_scroll);
#endif
- if (device_source == blink::WebGestureDeviceTouchscreen)
- return fling_curve_configuration_->CreateForTouchScreen(velocity,
- cumulative_scroll);
-
- return fling_curve_configuration_->CreateForTouchPad(velocity,
- cumulative_scroll);
+ return TouchFlingGestureCurve::Create(velocity, cumulative_scroll);
}
void BlinkPlatformImpl::didStartWorkerRunLoop(
@@ -1184,12 +1178,6 @@ size_t BlinkPlatformImpl::maxDecodedImageBytes() {
#endif
}
-void BlinkPlatformImpl::SetFlingCurveParameters(
- const std::vector<float>& new_touchpad,
- const std::vector<float>& new_touchscreen) {
- fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen);
-}
-
void BlinkPlatformImpl::SuspendSharedTimer() {
++shared_timer_suspended_;
}
diff --git a/content/child/blink_platform_impl.h b/content/child/blink_platform_impl.h
index b39f1f8..65d4239 100644
--- a/content/child/blink_platform_impl.h
+++ b/content/child/blink_platform_impl.h
@@ -154,9 +154,6 @@ class CONTENT_EXPORT BlinkPlatformImpl
const blink::WebWorkerRunLoop& runLoop) OVERRIDE;
virtual blink::WebCrypto* crypto() OVERRIDE;
- void SetFlingCurveParameters(const std::vector<float>& new_touchpad,
- const std::vector<float>& new_touchscreen);
-
void SuspendSharedTimer();
void ResumeSharedTimer();
virtual void OnStartSharedTimer(base::TimeDelta delay) {}
@@ -177,7 +174,6 @@ class CONTENT_EXPORT BlinkPlatformImpl
double shared_timer_fire_time_;
bool shared_timer_fire_time_was_set_while_suspended_;
int shared_timer_suspended_; // counter
- scoped_ptr<FlingCurveConfiguration> fling_curve_configuration_;
base::ThreadLocalStorage::Slot current_thread_slot_;
WebCryptoImpl web_crypto_;
};
diff --git a/content/child/fling_curve_configuration.cc b/content/child/fling_curve_configuration.cc
deleted file mode 100644
index 8beeb36..0000000
--- a/content/child/fling_curve_configuration.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/child/fling_curve_configuration.h"
-
-#include "base/logging.h"
-#include "content/child/touch_fling_gesture_curve.h"
-#include "third_party/WebKit/public/platform/WebGestureCurve.h"
-
-namespace content {
-
-FlingCurveConfiguration::FlingCurveConfiguration() { }
-
-FlingCurveConfiguration::~FlingCurveConfiguration() { }
-
-void FlingCurveConfiguration::SetCurveParameters(
- const std::vector<float>& new_touchpad,
- const std::vector<float>& new_touchscreen) {
- DCHECK(new_touchpad.size() >= 3);
- DCHECK(new_touchscreen.size() >= 3);
- base::AutoLock scoped_lock(lock_);
- touchpad_coefs_ = new_touchpad;
- touchscreen_coefs_ = new_touchscreen;
-}
-
-blink::WebGestureCurve* FlingCurveConfiguration::CreateCore(
- const std::vector<float>& coefs,
- const blink::WebFloatPoint& velocity,
- const blink::WebSize& cumulativeScroll) {
- float p0, p1, p2;
-
- {
- base::AutoLock scoped_lock(lock_);
- p0 = coefs[0];
- p1 = coefs[1];
- p2 = coefs[2];
- }
-
- return TouchFlingGestureCurve::Create(velocity, p0, p1, p2,
- cumulativeScroll);
-}
-
-blink::WebGestureCurve* FlingCurveConfiguration::CreateForTouchPad(
- const blink::WebFloatPoint& velocity,
- const blink::WebSize& cumulativeScroll) {
- return CreateCore(touchpad_coefs_, velocity, cumulativeScroll);
-}
-
-blink::WebGestureCurve* FlingCurveConfiguration::CreateForTouchScreen(
- const blink::WebFloatPoint& velocity,
- const blink::WebSize& cumulativeScroll) {
- return CreateCore(touchscreen_coefs_, velocity, cumulativeScroll);
-}
-
-} // namespace content
diff --git a/content/child/fling_curve_configuration.h b/content/child/fling_curve_configuration.h
deleted file mode 100644
index 1a6573d..0000000
--- a/content/child/fling_curve_configuration.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_CHILD_FLING_CURVE_CONFIGURATION_H_
-#define CONTENT_CHILD_FLING_CURVE_CONFIGURATION_H_
-
-#include <vector>
-
-#include "base/synchronization/lock.h"
-#include "third_party/WebKit/public/platform/WebFloatPoint.h"
-#include "third_party/WebKit/public/platform/WebSize.h"
-
-namespace blink {
-class WebGestureCurve;
-}
-
-namespace content {
-
-// A class to manage dynamically adjustable parameters controlling the
-// shape of the fling deacceleration function.
-class FlingCurveConfiguration {
- public:
- FlingCurveConfiguration();
- virtual ~FlingCurveConfiguration();
-
- // Create a touchpad fling curve using the current parameters.
- blink::WebGestureCurve* CreateForTouchPad(
- const blink::WebFloatPoint& velocity,
- const blink::WebSize& cumulativeScroll);
-
- // Create a touchscreen fling curve using the current parameters.
- blink::WebGestureCurve* CreateForTouchScreen(
- const blink::WebFloatPoint& velocity,
- const blink::WebSize& cumulativeScroll);
-
- // Set the curve parameters.
- void SetCurveParameters(
- const std::vector<float>& new_touchpad,
- const std::vector<float>& new_touchscreen);
-
- private:
- blink::WebGestureCurve* CreateCore(
- const std::vector<float>& coefs,
- const blink::WebFloatPoint& velocity,
- const blink::WebSize& cumulativeScroll);
-
- // Protect access to touchpad_coefs_ and touchscreen_coefs_.
- base::Lock lock_;
- std::vector<float> touchpad_coefs_;
- std::vector<float> touchscreen_coefs_;
-
- DISALLOW_COPY_AND_ASSIGN(FlingCurveConfiguration);
-};
-
-} // namespace content
-
-#endif // CONTENT_CHILD_FLING_CURVE_CONFIGURATION_H_
diff --git a/content/child/touch_fling_gesture_curve.cc b/content/child/touch_fling_gesture_curve.cc
index cc94bd6..c871458 100644
--- a/content/child/touch_fling_gesture_curve.cc
+++ b/content/child/touch_fling_gesture_curve.cc
@@ -24,18 +24,27 @@ namespace {
const char* kCurveName = "TouchFlingGestureCurve";
-inline double position(double t, float* p) {
- return p[0] * exp(-p[2] * t) - p[1] * t - p[0];
+// The touchpad / touchscreen fling profiles are a matched set
+// determined via UX experimentation. Do not modify without
+// first discussing with rjkroege@chromium.org or
+// wjmaclean@chromium.org.
+const float kDefaultAlpha = -5.70762e+03f;
+const float kDefaultBeta = 1.72e+02f;
+const float kDefaultGamma = 3.7e+00f;
+
+inline double position(double t) {
+ return kDefaultAlpha * exp(-kDefaultGamma * t) - kDefaultBeta * t -
+ kDefaultAlpha;
}
-inline double velocity(double t, float* p) {
- return -p[0] * p[2] * exp(-p[2] * t) - p[1];
+inline double velocity(double t) {
+ return -kDefaultAlpha * kDefaultGamma * exp(-kDefaultGamma * t) -
+ kDefaultBeta;
}
-inline double timeAtVelocity(double v, float* p) {
- DCHECK(p[0]);
- DCHECK(p[2]);
- return -log((v + p[1]) / (-p[0] * p[2])) / p[2];
+inline double timeAtVelocity(double v) {
+ return -log((v + kDefaultBeta) / (-kDefaultAlpha * kDefaultGamma)) /
+ kDefaultGamma;
}
} // namespace
@@ -68,30 +77,19 @@ namespace content {
WebGestureCurve* TouchFlingGestureCurve::Create(
const WebFloatPoint& initial_velocity,
- float p0,
- float p1,
- float p2,
const WebSize& cumulative_scroll) {
- return new TouchFlingGestureCurve(initial_velocity, p0, p1, p2,
- cumulative_scroll);
+ return new TouchFlingGestureCurve(initial_velocity, cumulative_scroll);
}
TouchFlingGestureCurve::TouchFlingGestureCurve(
const WebFloatPoint& initial_velocity,
- float alpha,
- float beta,
- float gamma,
const WebSize& cumulative_scroll)
: cumulative_scroll_(WebFloatSize(cumulative_scroll.width,
cumulative_scroll.height)) {
DCHECK(initial_velocity != WebFloatPoint());
- coefficients_[0] = alpha;
- coefficients_[1] = beta;
- coefficients_[2] = gamma;
-
// Curve ends when velocity reaches zero.
- curve_duration_ = timeAtVelocity(0, coefficients_);
+ curve_duration_ = timeAtVelocity(0);
DCHECK(curve_duration_ > 0);
float max_start_velocity = std::max(fabs(initial_velocity.x),
@@ -100,8 +98,8 @@ TouchFlingGestureCurve::TouchFlingGestureCurve(
// Force max_start_velocity to lie in the range v(0) to v(curve_duration),
// and assume that the curve parameters define a monotonically decreasing
// velocity, or else bisection search may fail.
- if (max_start_velocity > velocity(0, coefficients_))
- max_start_velocity = velocity(0, coefficients_);
+ if (max_start_velocity > velocity(0))
+ max_start_velocity = velocity(0);
if (max_start_velocity < 0)
max_start_velocity = 0;
@@ -112,10 +110,10 @@ TouchFlingGestureCurve::TouchFlingGestureCurve(
initial_velocity.y / max_start_velocity);
// Compute time-offset for start velocity.
- time_offset_ = timeAtVelocity(max_start_velocity, coefficients_);
+ time_offset_ = timeAtVelocity(max_start_velocity);
// Compute curve position at offset time
- position_offset_ = position(time_offset_, coefficients_);
+ position_offset_ = position(time_offset_);
TRACE_EVENT_ASYNC_BEGIN1("input", "GestureAnimation", this, "curve",
kCurveName);
}
@@ -133,11 +131,10 @@ bool TouchFlingGestureCurve::apply(double time, WebGestureCurveTarget* target) {
float displacement;
float speed;
if (time + time_offset_ < curve_duration_) {
- displacement =
- position(time + time_offset_, coefficients_) - position_offset_;
- speed = velocity(time + time_offset_, coefficients_);
+ displacement = position(time + time_offset_) - position_offset_;
+ speed = velocity(time + time_offset_);
} else {
- displacement = position(curve_duration_, coefficients_) - position_offset_;
+ displacement = position(curve_duration_) - position_offset_;
speed = 0.f;
}
diff --git a/content/child/touch_fling_gesture_curve.h b/content/child/touch_fling_gesture_curve.h
index 555fc74..d8c4495 100644
--- a/content/child/touch_fling_gesture_curve.h
+++ b/content/child/touch_fling_gesture_curve.h
@@ -26,7 +26,6 @@ class TouchFlingGestureCurve : public blink::WebGestureCurve {
static CONTENT_EXPORT WebGestureCurve* Create(
const blink::WebFloatPoint& initial_velocity,
- float p0, float p1, float p2,
const blink::WebSize& cumulativeScroll);
virtual bool apply(double monotonicTime,
@@ -34,15 +33,11 @@ class TouchFlingGestureCurve : public blink::WebGestureCurve {
private:
TouchFlingGestureCurve(const blink::WebFloatPoint& initial_velocity,
- float p0,
- float p1,
- float p2,
const blink::WebSize& cumulativeScroll);
virtual ~TouchFlingGestureCurve();
blink::WebFloatPoint displacement_ratio_;
blink::WebFloatSize cumulative_scroll_;
- float coefficients_[3];
float time_offset_;
float curve_duration_;
float position_offset_;
diff --git a/content/child/touch_fling_gesture_curve_unittest.cc b/content/child/touch_fling_gesture_curve_unittest.cc
index 9c42e63..971c263 100644
--- a/content/child/touch_fling_gesture_curve_unittest.cc
+++ b/content/child/touch_fling_gesture_curve_unittest.cc
@@ -50,8 +50,7 @@ TEST(TouchFlingGestureCurve, flingCurveTouch)
MockGestureCurveTarget target;
scoped_ptr<WebGestureCurve> curve(content::TouchFlingGestureCurve::Create(
- WebFloatPoint(initialVelocity, 0),
- -5.70762e+03f, 1.72e+02f, 3.7e+00f, WebSize()));
+ WebFloatPoint(initialVelocity, 0), WebSize()));
// Note: the expectations below are dependent on the curve parameters hard
// coded into the create call above.
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 373a3f1..ed50c60 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -208,8 +208,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::RendererPreferences)
IPC_STRUCT_TRAITS_MEMBER(user_agent_override)
IPC_STRUCT_TRAITS_MEMBER(accept_languages)
IPC_STRUCT_TRAITS_MEMBER(report_frame_name_changes)
- IPC_STRUCT_TRAITS_MEMBER(touchpad_fling_profile)
- IPC_STRUCT_TRAITS_MEMBER(touchscreen_fling_profile)
IPC_STRUCT_TRAITS_MEMBER(tap_multiple_targets_strategy)
IPC_STRUCT_TRAITS_MEMBER(disable_client_blocked_error_page)
IPC_STRUCT_TRAITS_MEMBER(plugin_fullscreen_allowed)
diff --git a/content/content_child.gypi b/content/content_child.gypi
index 9a4b411..e4f7b58 100644
--- a/content/content_child.gypi
+++ b/content/content_child.gypi
@@ -70,8 +70,6 @@
'child/fileapi/webfilewriter_impl.h',
'child/fling_animator_impl_android.cc',
'child/fling_animator_impl_android.h',
- 'child/fling_curve_configuration.cc',
- 'child/fling_curve_configuration.h',
'child/ftp_directory_listing_response_delegate.cc',
'child/ftp_directory_listing_response_delegate.h',
'child/image_decoder.cc',
diff --git a/content/public/common/renderer_preferences.cc b/content/public/common/renderer_preferences.cc
index 584b2e8..a43b9439 100644
--- a/content/public/common/renderer_preferences.cc
+++ b/content/public/common/renderer_preferences.cc
@@ -7,16 +7,6 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/font_render_params.h"
-namespace {
-// The touchpad / touchscreen fling profiles are a matched set
-// determined via UX experimentation. Do not modify without
-// first discussing with rjkroege@chromium.org or
-// wjmaclean@chromium.org.
-const float kDefaultAlpha = -5.70762e+03f;
-const float kDefaultBeta = 1.72e+02f;
-const float kDefaultGamma = 3.7e+00f;
-}
-
namespace content {
RendererPreferences::RendererPreferences()
@@ -43,16 +33,10 @@ RendererPreferences::RendererPreferences()
enable_do_not_track(false),
default_zoom_level(0),
report_frame_name_changes(false),
- touchpad_fling_profile(3),
- touchscreen_fling_profile(3),
tap_multiple_targets_strategy(TAP_MULTIPLE_TARGETS_STRATEGY_POPUP),
disable_client_blocked_error_page(false),
plugin_fullscreen_allowed(true),
use_video_overlay_for_embedded_encrypted_video(false) {
- touchpad_fling_profile[0] = kDefaultAlpha;
- touchpad_fling_profile[1] = kDefaultBeta;
- touchpad_fling_profile[2] = kDefaultGamma;
- touchscreen_fling_profile = touchpad_fling_profile;
}
RendererPreferences::~RendererPreferences() { }
diff --git a/content/public/common/renderer_preferences.h b/content/public/common/renderer_preferences.h
index ce02b17..cb13db7 100644
--- a/content/public/common/renderer_preferences.h
+++ b/content/public/common/renderer_preferences.h
@@ -113,12 +113,6 @@ struct CONTENT_EXPORT RendererPreferences {
// information.
bool report_frame_name_changes;
- // Controls deacceleration of touchpad-initiated flings.
- std::vector<float> touchpad_fling_profile;
-
- // Controls deacceleration of touchscreen-initiated flings.
- std::vector<float> touchscreen_fling_profile;
-
// How to handle a tap gesture touching multiple targets
TapMultipleTargetsStrategy tap_multiple_targets_strategy;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index ade02fb..9e2a309 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -1622,13 +1622,6 @@ RenderThreadImpl::GetMediaThreadTaskRunner() {
return media_thread_->message_loop_proxy();
}
-void RenderThreadImpl::SetFlingCurveParameters(
- const std::vector<float>& new_touchpad,
- const std::vector<float>& new_touchscreen) {
- webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
- new_touchscreen);
-}
-
void RenderThreadImpl::SampleGamepads(blink::WebGamepads* data) {
webkit_platform_support_->sampleGamepads(*data);
}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 1b91344..af82acc 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -383,9 +383,6 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
return &histogram_customizer_;
}
- void SetFlingCurveParameters(const std::vector<float>& new_touchpad,
- const std::vector<float>& new_touchscreen);
-
// Retrieve current gamepad data.
void SampleGamepads(blink::WebGamepads* data);
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index adc15a9..200a2a1 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -3092,11 +3092,6 @@ void RenderViewImpl::OnSetRendererPrefs(
}
#endif // defined(USE_DEFAULT_RENDER_THEME)
- if (RenderThreadImpl::current()) // Will be NULL during unit tests.
- RenderThreadImpl::current()->SetFlingCurveParameters(
- renderer_prefs.touchpad_fling_profile,
- renderer_prefs.touchscreen_fling_profile);
-
// If the zoom level for this page matches the old zoom default, and this
// is not a plugin, update the zoom level to match the new default.
if (webview() && webview()->mainFrame()->isWebLocalFrame() &&
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc
index 39064fb..039661d 100644
--- a/ui/aura/test/aura_test_base.cc
+++ b/ui/aura/test/aura_test_base.cc
@@ -51,14 +51,6 @@ void AuraTestBase::SetUp() {
ui::GestureConfiguration::set_min_distance_for_pinch_scroll_in_pixels(20);
ui::GestureConfiguration::set_min_pinch_update_distance_in_pixels(5);
ui::GestureConfiguration::set_default_radius(0);
- ui::GestureConfiguration::set_fling_acceleration_curve_coefficients(
- 0, 0.0166667f);
- ui::GestureConfiguration::set_fling_acceleration_curve_coefficients(
- 1, -0.0238095f);
- ui::GestureConfiguration::set_fling_acceleration_curve_coefficients(
- 2, 0.0452381f);
- ui::GestureConfiguration::set_fling_acceleration_curve_coefficients(
- 3, 0.8f);
ui::GestureConfiguration::set_fling_velocity_cap(15000.0f);
ui::GestureConfiguration::set_min_swipe_speed(10);
diff --git a/ui/events/gestures/gesture_configuration.cc b/ui/events/gestures/gesture_configuration.cc
index dd6188d..1ce13d7 100644
--- a/ui/events/gestures/gesture_configuration.cc
+++ b/ui/events/gestures/gesture_configuration.cc
@@ -40,15 +40,4 @@ int GestureConfiguration::scroll_debounce_interval_in_ms_ = 30;
int GestureConfiguration::scroll_debounce_interval_in_ms_ = 0;
#endif
-// Coefficients for a function that computes fling acceleration.
-// These are empirically determined defaults. Do not adjust without
-// additional empirical validation.
-float GestureConfiguration::fling_acceleration_curve_coefficients_[
- NumAccelParams] = {
- 0.0166667f,
- -0.0238095f,
- 0.0452381f,
- 0.8f
-};
-
} // namespace ui
diff --git a/ui/events/gestures/gesture_configuration.h b/ui/events/gestures/gesture_configuration.h
index 39b3054..1537b8e 100644
--- a/ui/events/gestures/gesture_configuration.h
+++ b/ui/events/gestures/gesture_configuration.h
@@ -16,10 +16,6 @@ namespace ui {
class EVENTS_BASE_EXPORT GestureConfiguration {
public:
- // Number of parameters in the array of parameters for the fling acceleration
- // curve.
- static const int NumAccelParams = 4;
-
// Ordered alphabetically ignoring underscores, to align with the
// associated list of prefs in gesture_prefs_aura.cc.
static int default_radius() {
@@ -134,12 +130,6 @@ class EVENTS_BASE_EXPORT GestureConfiguration {
static int set_scroll_debounce_interval_in_ms(int val) {
return scroll_debounce_interval_in_ms_ = val;
}
- static void set_fling_acceleration_curve_coefficients(int i, float val) {
- fling_acceleration_curve_coefficients_[i] = val;
- }
- static float fling_acceleration_curve_coefficients(int i) {
- return fling_acceleration_curve_coefficients_[i];
- }
static float fling_velocity_cap() {
return fling_velocity_cap_;
}
@@ -192,7 +182,6 @@ class EVENTS_BASE_EXPORT GestureConfiguration {
static int min_scaling_span_in_pixels_;
static int show_press_delay_in_ms_;
static int scroll_debounce_interval_in_ms_;
- static float fling_acceleration_curve_coefficients_[NumAccelParams];
static float fling_velocity_cap_;
// TODO(davemoore): Move into chrome/browser/ui.
static int tab_scrub_activation_delay_in_ms_;