Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: Source/core/platform/ScrollbarThemeMacCommon.mm

Issue 57463002: Have Blink be told of scrollbar changes rather than paying attention itself (Blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: good version Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/platform/ScrollbarThemeMacCommon.h ('k') | Source/web/mac/WebScrollbarTheme.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 @implementation WebScrollbarPrefsObserver 83 @implementation WebScrollbarPrefsObserver
84 84
85 + (void)appearancePrefsChanged:(NSNotification*)unusedNotification 85 + (void)appearancePrefsChanged:(NSNotification*)unusedNotification
86 { 86 {
87 UNUSED_PARAM(unusedNotification); 87 UNUSED_PARAM(unusedNotification);
88 88
89 ScrollbarTheme* theme = ScrollbarTheme::theme(); 89 ScrollbarTheme* theme = ScrollbarTheme::theme();
90 if (theme->isMockTheme()) 90 if (theme->isMockTheme())
91 return; 91 return;
92 92
93 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged(); 93 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
94 if (scrollbarSet().isEmpty()) 94 [defaults synchronize];
95 return; 95 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged(
96 ScrollbarSet::iterator end = scrollbarSet().end(); 96 [defaults floatForKey:@"NSScrollerButtonDelay"], [defaults floatForKey:@ "NSScrollerButtonPeriod"],
97 for (ScrollbarSet::iterator it = scrollbarSet().begin(); it != end; ++it) { 97 [defaults boolForKey:@"AppleScrollerPagingBehavior"], true);
98 (*it)->styleChanged();
99 (*it)->invalidate();
100 }
101 } 98 }
102 99
103 + (void)behaviorPrefsChanged:(NSNotification*)unusedNotification 100 + (void)behaviorPrefsChanged:(NSNotification*)unusedNotification
104 { 101 {
105 UNUSED_PARAM(unusedNotification); 102 UNUSED_PARAM(unusedNotification);
106 103
107 ScrollbarTheme* theme = ScrollbarTheme::theme(); 104 ScrollbarTheme* theme = ScrollbarTheme::theme();
108 if (theme->isMockTheme()) 105 if (theme->isMockTheme())
109 return; 106 return;
110 107
111 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged(); 108 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
109 [defaults synchronize];
110 static_cast<ScrollbarThemeMacCommon*>(ScrollbarTheme::theme())->preferencesC hanged(
111 [defaults floatForKey:@"NSScrollerButtonDelay"], [defaults floatForKey:@ "NSScrollerButtonPeriod"],
112 [defaults boolForKey:@"AppleScrollerPagingBehavior"], false);
112 } 113 }
113 114
114 + (void)registerAsObserver 115 + (void)registerAsObserver
115 { 116 {
116 [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@ selector(appearancePrefsChanged:) name:@"AppleAquaScrollBarVariantChanged" objec t:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; 117 [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@ selector(appearancePrefsChanged:) name:@"AppleAquaScrollBarVariantChanged" objec t:nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
117 [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@ selector(behaviorPrefsChanged:) name:@"AppleNoRedisplayAppearancePreferenceChang ed" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce]; 118 [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@ selector(behaviorPrefsChanged:) name:@"AppleNoRedisplayAppearancePreferenceChang ed" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];
118 } 119 }
119 120
120 @end 121 @end
121 122
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2); 334 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2);
334 paintGivenTickmarks(context, scrollbar, tickmarkTrackRect, tickmarks); 335 paintGivenTickmarks(context, scrollbar, tickmarkTrackRect, tickmarks);
335 } 336 }
336 337
337 ScrollbarThemeMacCommon::ScrollbarThemeMacCommon() 338 ScrollbarThemeMacCommon::ScrollbarThemeMacCommon()
338 { 339 {
339 static bool initialized; 340 static bool initialized;
340 if (!initialized) { 341 if (!initialized) {
341 initialized = true; 342 initialized = true;
342 [WebScrollbarPrefsObserver registerAsObserver]; 343 [WebScrollbarPrefsObserver registerAsObserver];
343 preferencesChanged(); 344 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
345 [defaults synchronize];
346 preferencesChanged(
347 [defaults floatForKey:@"NSScrollerButtonDelay"], [defaults floatForK ey:@"NSScrollerButtonPeriod"],
348 [defaults boolForKey:@"AppleScrollerPagingBehavior"], false);
344 } 349 }
345 } 350 }
346 351
347 ScrollbarThemeMacCommon::~ScrollbarThemeMacCommon() 352 ScrollbarThemeMacCommon::~ScrollbarThemeMacCommon()
348 { 353 {
349 } 354 }
350 355
351 void ScrollbarThemeMacCommon::preferencesChanged() 356 void ScrollbarThemeMacCommon::preferencesChanged(float initialButtonDelay, float autoscrollButtonDelay, bool jumpOnTrackClick, bool redraw)
352 { 357 {
353 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
354 [defaults synchronize];
355 updateButtonPlacement(); 358 updateButtonPlacement();
356 gInitialButtonDelay = [defaults floatForKey:@"NSScrollerButtonDelay"]; 359 gInitialButtonDelay = initialButtonDelay;
357 gAutoscrollButtonDelay = [defaults floatForKey:@"NSScrollerButtonPeriod"]; 360 gAutoscrollButtonDelay = autoscrollButtonDelay;
358 gJumpOnTrackClick = [defaults boolForKey:@"AppleScrollerPagingBehavior"]; 361 gJumpOnTrackClick = jumpOnTrackClick;
362 if (redraw && !scrollbarSet().isEmpty()) {
363 ScrollbarSet::iterator end = scrollbarSet().end();
364 for (ScrollbarSet::iterator it = scrollbarSet().begin(); it != end; ++it ) {
365 (*it)->styleChanged();
366 (*it)->invalidate();
367 }
368 }
359 } 369 }
360 370
361 double ScrollbarThemeMacCommon::initialAutoscrollTimerDelay() 371 double ScrollbarThemeMacCommon::initialAutoscrollTimerDelay()
362 { 372 {
363 return gInitialButtonDelay; 373 return gInitialButtonDelay;
364 } 374 }
365 375
366 double ScrollbarThemeMacCommon::autoscrollTimerDelay() 376 double ScrollbarThemeMacCommon::autoscrollTimerDelay()
367 { 377 {
368 return gAutoscrollButtonDelay; 378 return gAutoscrollButtonDelay;
(...skipping 25 matching lines...) Expand all
394 case ForwardButtonEndPart: 404 case ForwardButtonEndPart:
395 return kThemeBottomOutsideArrowPressed; 405 return kThemeBottomOutsideArrowPressed;
396 case ThumbPart: 406 case ThumbPart:
397 return kThemeThumbPressed; 407 return kThemeThumbPressed;
398 default: 408 default:
399 return 0; 409 return 0;
400 } 410 }
401 } 411 }
402 412
403 } // namespace WebCore 413 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/ScrollbarThemeMacCommon.h ('k') | Source/web/mac/WebScrollbarTheme.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698