Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose "MiddleButtonAutoscroll" runtime feature to brave://flags #21874

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,19 @@
#define BRAVE_TABS_FEATURE_ENTRIES
#endif

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
#define BRAVE_MIDDLE_CLICK_AUTOSCROLL_FEATURE_ENTRY \
EXPAND_FEATURE_ENTRIES({ \
"middle-button-autoscroll", \
"Middle button autoscroll", \
"Enables autoscrolling when the middle mouse button is clicked", \
kOsMac | kOsLinux, \
FEATURE_VALUE_TYPE(blink::features::kMiddleButtonClickAutoscroll), \
})
#else
#define BRAVE_MIDDLE_CLICK_AUTOSCROLL_FEATURE_ENTRY
#endif

#if BUILDFLAG(ENABLE_AI_CHAT)
#define BRAVE_AI_CHAT \
EXPAND_FEATURE_ENTRIES({ \
Expand Down Expand Up @@ -969,6 +982,7 @@
BRAVE_AI_CHAT_HISTORY \
BRAVE_OMNIBOX_FEATURES \
BRAVE_PLAYER_FEATURE_ENTRIES \
BRAVE_MIDDLE_CLICK_AUTOSCROLL_FEATURE_ENTRY \
LAST_BRAVE_FEATURE_ENTRIES_ITEM // Keep it as the last item.
namespace flags_ui {
namespace {
Expand Down
6 changes: 6 additions & 0 deletions chromium_src/third_party/blink/common/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ BASE_FEATURE(kRestrictEventSourcePool,
#endif
);

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
BASE_FEATURE(kMiddleButtonClickAutoscroll,
"MiddelButtonClickAutoscroll",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)

bool IsPrerender2Enabled() {
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions chromium_src/third_party/blink/public/common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBraveGlobalPrivacyControl);
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBraveRoundTimeStamps);
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kRestrictEventSourcePool);

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kMiddleButtonClickAutoscroll);
#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)

// Chromium used this function to control Prerender2 feature, but then the
// feature was permanently enabled and the function was removed. We still want
// to keep the Prerender2 functionality disabled, so putting back the function
Expand Down
8 changes: 8 additions & 0 deletions renderer/brave_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ void BraveContentRendererClient::
blink::WebRuntimeFeatures::EnableFeatureFromString("Serial", false);
}
blink::WebRuntimeFeatures::EnableFeatureFromString("AdTagging", false);

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
if (base::FeatureList::IsEnabled(
blink::features::kMiddleButtonClickAutoscroll)) {
blink::WebRuntimeFeatures::EnableFeatureFromString("MiddleClickAutoscroll",
true);
}
#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
}

BraveContentRendererClient::~BraveContentRendererClient() = default;
Expand Down
Loading