Filtering of scroll events.
Add a InputFilter object in the ScrollPredictor object. Each predicted
scroll event is sent to the filter and if Filtering flag is enabled,
the predicted scroll event position is replaced by the filtered returned
by the filter.
Firsts real events are sent to the filter to faster initialize its state.
Filter is reset with the predictor is reset.
A flag kFilteringScrollPrediction is added to disable/enable the scroll
filtering.
Bug: 984027
Change-Id: I04bc71f18647b7df5dd28bccd118b56bc083c1e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1710757
Reviewed-by: David Bokan <[email protected]>
Reviewed-by: Ella Ge <[email protected]>
Commit-Queue: Axel Antoine <[email protected]>
Cr-Commit-Position: refs/heads/master@{#680900}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 8763ce2..3cad0146 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -143,6 +143,7 @@
#include "ui/display/display_features.h"
#include "ui/display/display_switches.h"
#include "ui/events/blink/blink_features.h"
+#include "ui/events/blink/prediction/filter_factory.h"
#include "ui/events/blink/prediction/predictor_factory.h"
#include "ui/events/event_switches.h"
#include "ui/gfx/switches.h"
@@ -1062,6 +1063,14 @@
kResamplingInputEventsLinearSecondEnabled,
base::size(kResamplingInputEventsLinearSecondEnabled), nullptr}};
+const FeatureEntry::FeatureParam kFilteringPredictionEmptyFilterEnabled[] = {
+ {"filter", ui::input_prediction::kFilterNameEmpty}};
+
+const FeatureEntry::FeatureVariation kFilteringPredictionFeatureVariations[] = {
+ {ui::input_prediction::kFilterNameEmpty,
+ kFilteringPredictionEmptyFilterEnabled,
+ base::size(kFilteringPredictionEmptyFilterEnabled), nullptr}};
+
#if defined(OS_ANDROID)
const FeatureEntry::FeatureParam kBottomOfflineIndicatorEnabled[] = {
{"bottom_offline_indicator", "true"}};
@@ -3414,6 +3423,13 @@
kResamplingInputEventsFeatureVariations,
"ResamplingScrollEvents")},
+ {"enable-filtering-scroll-events",
+ flag_descriptions::kFilteringScrollPredictionName,
+ flag_descriptions::kFilteringScrollPredictionDescription, kOsAll,
+ FEATURE_WITH_PARAMS_VALUE_TYPE(features::kFilteringScrollPrediction,
+ kFilteringPredictionFeatureVariations,
+ "FilteringScrollPrediction")},
+
{"compositor-threaded-scrollbar-scrolling",
flag_descriptions::kCompositorThreadedScrollbarScrollingName,
flag_descriptions::kCompositorThreadedScrollbarScrollingDescription,