1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
// Copyright 2017 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 "ui/base/ui_base_features.h"
#include "build/chromeos_buildflags.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
#if defined(OS_ANDROID)
#include "base/android/build_info.h"
#endif
namespace features {
#if defined(OS_WIN)
// If enabled, calculate native window occlusion - Windows-only.
const base::Feature kCalculateNativeWinOcclusion{
"CalculateNativeWinOcclusion", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kCalculateNativeWinOcclusionCheckVirtualDesktopUsed{
"CalculateNativeWinOcclusionCheckVirtualDesktopUsed",
base::FEATURE_DISABLED_BY_DEFAULT};
#endif // OW_WIN
// Whether or not to delegate color queries to the color provider.
const base::Feature kColorProviderRedirection = {
"ColorProviderRedirection", base::FEATURE_DISABLED_BY_DEFAULT};
#if defined(OS_CHROMEOS)
// Integrate input method specific settings to Chrome OS settings page.
// https://crbug.com/895886.
const base::Feature kSettingsShowsPerKeyboardSettings = {
"InputMethodIntegratedSettings", base::FEATURE_DISABLED_BY_DEFAULT};
// Experimental shortcut handling and mapping to address i18n issues.
// https://crbug.com/1067269
const base::Feature kNewShortcutMapping = {"NewShortcutMapping",
base::FEATURE_DISABLED_BY_DEFAULT};
bool IsNewShortcutMappingEnabled() {
return base::FeatureList::IsEnabled(kNewShortcutMapping);
}
#endif // defined(OS_CHROMEOS)
// Update of the virtual keyboard settings UI as described in
// https://crbug.com/876901.
const base::Feature kInputMethodSettingsUiUpdate = {
"InputMethodSettingsUiUpdate", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables percent-based scrolling for mousewheel and keyboard initiated
// scrolls.
const base::Feature kPercentBasedScrolling = {
"PercentBasedScrolling", base::FEATURE_DISABLED_BY_DEFAULT};
// Allows requesting unadjusted movement when entering pointerlock.
const base::Feature kPointerLockOptions = {"PointerLockOptions",
base::FEATURE_ENABLED_BY_DEFAULT};
// Allows system caption style for WebVTT Captions.
const base::Feature kSystemCaptionStyle{"SystemCaptionStyle",
base::FEATURE_ENABLED_BY_DEFAULT};
// Allows system keyboard event capture via the keyboard lock API.
const base::Feature kSystemKeyboardLock{"SystemKeyboardLock",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kNotificationIndicator = {
"EnableNotificationIndicator", base::FEATURE_DISABLED_BY_DEFAULT};
bool IsNotificationIndicatorEnabled() {
return base::FeatureList::IsEnabled(kNotificationIndicator);
}
// Enables GPU rasterization for all UI drawing (where not blocklisted).
const base::Feature kUiGpuRasterization = {"UiGpuRasterization",
#if defined(OS_APPLE) || defined(OS_CHROMEOS) || defined(OS_FUCHSIA)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
bool IsUiGpuRasterizationEnabled() {
return base::FeatureList::IsEnabled(kUiGpuRasterization);
}
// Enables scrolling with layers under ui using the ui::Compositor.
const base::Feature kUiCompositorScrollWithLayers = {
"UiCompositorScrollWithLayers",
// TODO(https://crbug.com/615948): Use composited scrolling on all platforms.
#if defined(OS_APPLE)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
// Enables compositor threaded scrollbar scrolling by mapping pointer events to
// gesture events.
const base::Feature kCompositorThreadedScrollbarScrolling = {
"CompositorThreadedScrollbarScrolling", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables the use of a touch fling curve that is based on the behavior of
// native apps on Windows.
const base::Feature kExperimentalFlingAnimation {
"ExperimentalFlingAnimation",
#if defined(OS_WIN) || \
(defined(OS_LINUX) && !defined(OS_CHROMEOS) && !BUILDFLAG(IS_LACROS))
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
#if defined(OS_WIN)
const base::Feature kElasticOverscrollWin = {"ElasticOverscrollWin",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables InputPane API for controlling on screen keyboard.
const base::Feature kInputPaneOnScreenKeyboard = {
"InputPaneOnScreenKeyboard", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables using WM_POINTER instead of WM_TOUCH for touch events.
const base::Feature kPointerEventsForTouch = {"PointerEventsForTouch",
base::FEATURE_ENABLED_BY_DEFAULT};
// Enables using TSF (over IMM32) for IME.
const base::Feature kTSFImeSupport = {"TSFImeSupport",
base::FEATURE_ENABLED_BY_DEFAULT};
bool IsUsingWMPointerForTouch() {
return base::win::GetVersion() >= base::win::Version::WIN8 &&
base::FeatureList::IsEnabled(kPointerEventsForTouch);
}
// Enables Logging for DirectManipulation.
const base::Feature kPrecisionTouchpadLogging{
"PrecisionTouchpadLogging", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // defined(OS_WIN)
#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \
defined(OS_CHROMEOS)
// Enables stylus appearing as touch when in contact with digitizer.
const base::Feature kDirectManipulationStylus = {
"DirectManipulationStylus",
#if defined(OS_WIN)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) ||
// defined(OS_CHROMEOS)
// Enables forced colors mode for web content.
const base::Feature kForcedColors{"ForcedColors",
base::FEATURE_DISABLED_BY_DEFAULT};
bool IsForcedColorsEnabled() {
static const bool forced_colors_enabled =
base::FeatureList::IsEnabled(features::kForcedColors);
return forced_colors_enabled;
}
// Enables the eye-dropper in the refresh color-picker for Windows and Mac.
// This feature will be released for other platforms in later milestones.
const base::Feature kEyeDropper {
"EyeDropper",
#if defined(OS_WIN) || defined(OS_MAC)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
bool IsEyeDropperEnabled() {
return IsFormControlsRefreshEnabled() &&
base::FeatureList::IsEnabled(features::kEyeDropper);
}
// Enable the CSSColorSchemeUARendering feature for Windows, ChromeOS, Linux,
// and Mac. This feature will be released for Android in later milestones. See
// crbug.com/1086530 for the Desktop launch bug.
const base::Feature kCSSColorSchemeUARendering = {
"CSSColorSchemeUARendering", base::FEATURE_DISABLED_BY_DEFAULT};
bool IsCSSColorSchemeUARenderingEnabled() {
static const bool css_color_scheme_ua_rendering_enabled =
base::FeatureList::IsEnabled(features::kCSSColorSchemeUARendering);
return css_color_scheme_ua_rendering_enabled;
}
// Enable the FormControlsRefresh feature for Windows, ChromeOS, Linux, and Mac.
// This feature will be released for Android in later milestones. See
// crbug.com/1012106 for the Windows launch bug, and crbug.com/1012108 for the
// Mac launch bug.
const base::Feature kFormControlsRefresh = {"FormControlsRefresh",
#if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_LINUX) || \
defined(OS_APPLE)
base::FEATURE_ENABLED_BY_DEFAULT
#else
base::FEATURE_DISABLED_BY_DEFAULT
#endif
};
bool IsFormControlsRefreshEnabled() {
static const bool form_controls_refresh_enabled =
base::FeatureList::IsEnabled(features::kFormControlsRefresh);
return form_controls_refresh_enabled;
}
// Enable the common select popup.
const base::Feature kUseCommonSelectPopup = {"UseCommonSelectPopup",
base::FEATURE_DISABLED_BY_DEFAULT};
bool IsUseCommonSelectPopupEnabled() {
return base::FeatureList::IsEnabled(features::kUseCommonSelectPopup);
}
#if defined(OS_CHROMEOS)
const base::Feature kHandwritingGesture = {"HandwritingGesture",
base::FEATURE_ENABLED_BY_DEFAULT};
#endif
const base::Feature kSynchronousPageFlipTesting{
"SynchronousPageFlipTesting", base::FEATURE_DISABLED_BY_DEFAULT};
bool IsSynchronousPageFlipTestingEnabled() {
return base::FeatureList::IsEnabled(kSynchronousPageFlipTesting);
}
#if defined(USE_X11) || defined(USE_OZONE)
const base::Feature kUseOzonePlatform {
"UseOzonePlatform",
#if defined(USE_X11)
base::FEATURE_DISABLED_BY_DEFAULT
};
#else
base::FEATURE_ENABLED_BY_DEFAULT
};
#endif
bool IsUsingOzonePlatform() {
// Only allow enabling and disabling the OzonePlatform on USE_X11 && USE_OZONE
// builds.
static const bool using_ozone_platform =
#if defined(USE_X11) && defined(USE_OZONE) && !BUILDFLAG(IS_LACROS)
base::FeatureList::IsEnabled(kUseOzonePlatform);
#elif defined(USE_X11) && !defined(USE_OZONE)
// This shouldn't be switchable for pure X11 builds.
false;
#else
// All the other platforms must use Ozone by default and can't disable
// that.
true;
#endif
return using_ozone_platform;
}
#endif // defined(USE_X11) || defined(USE_OZONE)
const char kPredictorNameLsq[] = "lsq";
const char kPredictorNameKalman[] = "kalman";
const char kPredictorNameLinearFirst[] = "linear_first";
const char kPredictorNameLinearSecond[] = "linear_second";
const char kPredictorNameLinearResampling[] = "linear_resampling";
const char kPredictorNameEmpty[] = "empty";
const char kFilterNameEmpty[] = "empty_filter";
const char kFilterNameOneEuro[] = "one_euro_filter";
const base::Feature kSwipeToMoveCursor{"SwipeToMoveCursor",
base::FEATURE_DISABLED_BY_DEFAULT};
bool IsSwipeToMoveCursorEnabled() {
static const bool enabled =
base::FeatureList::IsEnabled(kSwipeToMoveCursor)
#if defined(OS_ANDROID)
&& base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_R;
#else
;
#endif
return enabled;
}
} // namespace features
|