diff options
author | Avi Drissman <avi@chromium.org> | 2019-08-27 16:07:15 +0000 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2020-02-12 14:29:11 +0000 |
commit | bbc3a3082b4a5080f9dc59098878c599e47c7b67 (patch) | |
tree | ec5fbeb998889f60774ccc6b6e164f5cd8f7e66c | |
parent | 5b79320c01316f29510df90f7c6b508b9f72b8a4 (diff) | |
download | qtwebengine-chromium-bbc3a3082b4a5080f9dc59098878c599e47c7b67.tar.gz |
[Backport] Fix input spinner double-increment.
BUG=990863
Fixes: QTBUG-79667
Change-Id: Ic733f8a45f730fd2ad1e4c06520430fad929189a
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690751}
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
7 files changed, 41 insertions, 11 deletions
diff --git a/chromium/content/browser/theme_helper_mac.mm b/chromium/content/browser/theme_helper_mac.mm index 8bb37de35c5..8ccfbb9aeb6 100644 --- a/chromium/content/browser/theme_helper_mac.mm +++ b/chromium/content/browser/theme_helper_mac.mm @@ -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"]; diff --git a/chromium/content/common/renderer.mojom b/chromium/content/common/renderer.mojom index 1e6c4091f53..5abc2c4021d 100644 --- a/chromium/content/common/renderer.mojom +++ b/chromium/content/common/renderer.mojom @@ -151,12 +151,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; }; diff --git a/chromium/content/renderer/render_thread_impl.cc b/chromium/content/renderer/render_thread_impl.cc index f2b481ac7fc..f1e10e4be3b 100644 --- a/chromium/content/renderer/render_thread_impl.cc +++ b/chromium/content/renderer/render_thread_impl.cc @@ -2143,7 +2143,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); diff --git a/chromium/third_party/blink/public/platform/mac/web_scrollbar_theme.h b/chromium/third_party/blink/public/platform/mac/web_scrollbar_theme.h index 9af5197cf74..0cfe437861e 100644 --- a/chromium/third_party/blink/public/platform/mac/web_scrollbar_theme.h +++ b/chromium/third_party/blink/public/platform/mac/web_scrollbar_theme.h @@ -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); diff --git a/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h b/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h index 7ddc6472464..88a5c15ebf1 100644 --- a/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h +++ b/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.h @@ -96,8 +96,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); diff --git a/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm b/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm index d74831d250f..57d793753ac 100644 --- a/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm +++ b/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm @@ -420,13 +420,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) { diff --git a/chromium/third_party/blink/renderer/core/scroll/web_scrollbar_theme.mm b/chromium/third_party/blink/renderer/core/scroll/web_scrollbar_theme.mm index 55530f53f43..bde3fec96f3 100644 --- a/chromium/third_party/blink/renderer/core/scroll/web_scrollbar_theme.mm +++ b/chromium/third_party/blink/renderer/core/scroll/web_scrollbar_theme.mm @@ -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) { |