Commit 0f324c12 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Fix input spinner double-increment.

BUG=990863

Change-Id: Iafa06776aac05a379eb1bb16753edba2c85b8481
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1769337
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690751}
parent a0d618f6
......@@ -52,14 +52,27 @@ void FillScrollbarThemeParams(
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults synchronize];
// NSScrollerButtonDelay and NSScrollerButtonPeriod are no longer initialized
// in +[NSApplication _initializeRegisteredDefaults] as of 10.15. Their values
// still seem to affect behavior, but their use is logged as an "unusual app
// config", so it's not clear how much longer they'll be implemented.
params->has_initial_button_delay =
[defaults objectForKey:@"NSScrollerButtonDelay"] != nil;
params->initial_button_delay =
[defaults floatForKey:@"NSScrollerButtonDelay"];
params->has_autoscroll_button_delay =
[defaults objectForKey:@"NSScrollerButtonPeriod"] != nil;
params->autoscroll_button_delay =
[defaults floatForKey:@"NSScrollerButtonPeriod"];
params->jump_on_track_click =
[defaults boolForKey:@"AppleScrollerPagingBehavior"];
params->preferred_scroller_style =
ThemeHelperMac::GetPreferredScrollerStyle();
// One one hand, this constant isn't registered anywhere. On the other hand,
// this constant is still (as of 10.15) being used by AppKit to draw controls.
// On the other other hand, this value sent over the wire is actually ignored.
// TODO(https://crbug.com/997934): Figure out why it's being ignored.
params->button_placement = GetButtonPlacement();
id rubber_band_value = [defaults objectForKey:@"NSScrollViewRubberbanding"];
......
......@@ -148,12 +148,21 @@ struct CreateFrameParams {
};
struct UpdateScrollbarThemeParams {
// TODO(avi): Update these to optional values when optional numeric types are
// allowed. (https://crbug.com/657632)
bool has_initial_button_delay;
float initial_button_delay;
bool has_autoscroll_button_delay;
float autoscroll_button_delay;
bool jump_on_track_click;
ScrollerStyle preferred_scroller_style;
bool redraw;
// TODO(https://crbug.com/997934): This value is ignored on the receiving end.
// Either remove it, or make it not be ignored.
ScrollbarButtonsPlacement button_placement;
bool scroll_view_rubber_banding;
};
......
......@@ -2138,7 +2138,12 @@ void RenderThreadImpl::UpdateScrollbarTheme(
mojom::UpdateScrollbarThemeParamsPtr params) {
#if defined(OS_MACOSX)
blink::WebScrollbarTheme::UpdateScrollbarsWithNSDefaults(
params->initial_button_delay, params->autoscroll_button_delay,
params->has_initial_button_delay
? base::make_optional(params->initial_button_delay)
: base::nullopt,
params->has_autoscroll_button_delay
? base::make_optional(params->autoscroll_button_delay)
: base::nullopt,
params->preferred_scroller_style, params->redraw,
params->jump_on_track_click);
......
......@@ -31,6 +31,7 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MAC_WEB_SCROLLBAR_THEME_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MAC_WEB_SCROLLBAR_THEME_H_
#include "base/optional.h"
#include "third_party/blink/public/platform/web_common.h"
namespace blink {
......@@ -50,8 +51,8 @@ class WebScrollbarTheme {
// |redraw| is true if the update requires a redraw to include the change.
// |jump_on_track_click| is the current value of AppleScrollerPagingBehavior.
BLINK_EXPORT static void UpdateScrollbarsWithNSDefaults(
float initial_button_delay,
float autoscroll_button_delay,
base::Optional<float> initial_button_delay,
base::Optional<float> autoscroll_button_delay,
ScrollerStyle preferred_scroller_style,
bool redraw,
bool jump_on_track_click);
......
......@@ -95,8 +95,8 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme {
// See WebScrollbarTheme for parameters description.
static void UpdateScrollbarsWithNSDefaults(
float initial_button_delay,
float autoscroll_button_delay,
base::Optional<float> initial_button_delay,
base::Optional<float> autoscroll_button_delay,
NSScrollerStyle preferred_scroller_style,
bool redraw,
bool jump_on_track_click);
......
......@@ -415,13 +415,15 @@ float ScrollbarThemeMac::ThumbOpacity(const Scrollbar& scrollbar) const {
// static
void ScrollbarThemeMac::UpdateScrollbarsWithNSDefaults(
float initial_button_delay,
float autoscroll_button_delay,
base::Optional<float> initial_button_delay,
base::Optional<float> autoscroll_button_delay,
NSScrollerStyle preferred_scroller_style,
bool redraw,
bool jump_on_track_click) {
s_initial_button_delay = initial_button_delay;
s_autoscroll_button_delay = autoscroll_button_delay;
s_initial_button_delay =
initial_button_delay.value_or(s_initial_button_delay);
s_autoscroll_button_delay =
autoscroll_button_delay.value_or(s_autoscroll_button_delay);
s_preferred_scroller_style = preferred_scroller_style;
s_jump_on_track_click = jump_on_track_click;
if (redraw) {
......
......@@ -45,8 +45,8 @@ static_assert(static_cast<NSScrollerStyle>(kScrollerStyleOverlay) ==
"ScrollerStyleOverlay must match NSScrollerStyleOverlay");
void WebScrollbarTheme::UpdateScrollbarsWithNSDefaults(
float initial_button_delay,
float autoscroll_button_delay,
base::Optional<float> initial_button_delay,
base::Optional<float> autoscroll_button_delay,
ScrollerStyle preferred_scroller_style,
bool redraw,
bool jump_on_track_click) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment