OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 static ScrollbarSet& scrollbarSet() | 61 static ScrollbarSet& scrollbarSet() |
62 { | 62 { |
63 DEFINE_STATIC_LOCAL(ScrollbarSet, set, ()); | 63 DEFINE_STATIC_LOCAL(ScrollbarSet, set, ()); |
64 return set; | 64 return set; |
65 } | 65 } |
66 | 66 |
67 static float gInitialButtonDelay = 0.5f; | 67 static float gInitialButtonDelay = 0.5f; |
68 static float gAutoscrollButtonDelay = 0.05f; | 68 static float gAutoscrollButtonDelay = 0.05f; |
69 static NSScrollerStyle gPreferredScrollerStyle = NSScrollerStyleLegacy; | 69 static NSScrollerStyle gPreferredScrollerStyle = NSScrollerStyleLegacy; |
| 70 static bool gScrollAnimationEnabledForSystem = false; |
70 | 71 |
71 ScrollbarTheme* ScrollbarTheme::nativeTheme() | 72 ScrollbarTheme* ScrollbarTheme::nativeTheme() |
72 { | 73 { |
73 static ScrollbarThemeMacCommon* theme = NULL; | 74 static ScrollbarThemeMacCommon* theme = NULL; |
74 if (theme) | 75 if (theme) |
75 return theme; | 76 return theme; |
76 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { | 77 if (ScrollbarThemeMacCommon::isOverlayAPIAvailable()) { |
77 DEFINE_STATIC_LOCAL(ScrollbarThemeMacOverlayAPI, overlayTheme, ()); | 78 DEFINE_STATIC_LOCAL(ScrollbarThemeMacOverlayAPI, overlayTheme, ()); |
78 theme = &overlayTheme; | 79 theme = &overlayTheme; |
79 } else { | 80 } else { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 IntRect tickmarkTrackRect = rect; | 156 IntRect tickmarkTrackRect = rect; |
156 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 1); | 157 tickmarkTrackRect.setX(tickmarkTrackRect.x() + 1); |
157 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2); | 158 tickmarkTrackRect.setWidth(tickmarkTrackRect.width() - 2); |
158 paintGivenTickmarks(context->canvas(), scrollbar, tickmarkTrackRect, tickmar
ks); | 159 paintGivenTickmarks(context->canvas(), scrollbar, tickmarkTrackRect, tickmar
ks); |
159 } | 160 } |
160 | 161 |
161 ScrollbarThemeMacCommon::~ScrollbarThemeMacCommon() | 162 ScrollbarThemeMacCommon::~ScrollbarThemeMacCommon() |
162 { | 163 { |
163 } | 164 } |
164 | 165 |
165 void ScrollbarThemeMacCommon::preferencesChanged(float initialButtonDelay, float
autoscrollButtonDelay, NSScrollerStyle preferredScrollerStyle, bool redraw) | 166 void ScrollbarThemeMacCommon::preferencesChanged(float initialButtonDelay, float
autoscrollButtonDelay, NSScrollerStyle preferredScrollerStyle, bool redraw, boo
l scrollAnimationEnabled, const std::string& buttonPlacement) |
166 { | 167 { |
167 updateButtonPlacement(); | 168 updateButtonPlacement(buttonPlacement); |
168 gInitialButtonDelay = initialButtonDelay; | 169 gInitialButtonDelay = initialButtonDelay; |
169 gAutoscrollButtonDelay = autoscrollButtonDelay; | 170 gAutoscrollButtonDelay = autoscrollButtonDelay; |
| 171 gScrollAnimationEnabledForSystem = scrollAnimationEnabled; |
170 bool sendScrollerStyleNotification = gPreferredScrollerStyle != preferredScr
ollerStyle; | 172 bool sendScrollerStyleNotification = gPreferredScrollerStyle != preferredScr
ollerStyle; |
171 gPreferredScrollerStyle = preferredScrollerStyle; | 173 gPreferredScrollerStyle = preferredScrollerStyle; |
172 if (redraw && !scrollbarSet().isEmpty()) { | 174 if (redraw && !scrollbarSet().isEmpty()) { |
173 ScrollbarSet::iterator end = scrollbarSet().end(); | 175 ScrollbarSet::iterator end = scrollbarSet().end(); |
174 for (ScrollbarSet::iterator it = scrollbarSet().begin(); it != end; ++it
) { | 176 for (ScrollbarSet::iterator it = scrollbarSet().begin(); it != end; ++it
) { |
175 (*it)->styleChanged(); | 177 (*it)->styleChanged(); |
176 (*it)->invalidate(); | 178 (*it)->invalidate(); |
177 } | 179 } |
178 } | 180 } |
179 if (sendScrollerStyleNotification) { | 181 if (sendScrollerStyleNotification) { |
180 [[NSNotificationCenter defaultCenter] | 182 [[NSNotificationCenter defaultCenter] |
181 postNotificationName:@"NSPreferredScrollerStyleDidChangeNotification
" | 183 postNotificationName:@"NSPreferredScrollerStyleDidChangeNotification
" |
182 object:nil | 184 object:nil |
183 userInfo:@{ @"NSScrollerStyle" : @(gPreferredScrollerSty
le) }]; | 185 userInfo:@{ @"NSScrollerStyle" : @(gPreferredScrollerSty
le) }]; |
184 } | 186 } |
185 } | 187 } |
186 | 188 |
| 189 bool ScrollbarThemeMacCommon::scrollAnimationEnabledForSystem() |
| 190 { |
| 191 return gScrollAnimationEnabledForSystem; |
| 192 } |
| 193 |
187 double ScrollbarThemeMacCommon::initialAutoscrollTimerDelay() | 194 double ScrollbarThemeMacCommon::initialAutoscrollTimerDelay() |
188 { | 195 { |
189 return gInitialButtonDelay; | 196 return gInitialButtonDelay; |
190 } | 197 } |
191 | 198 |
192 double ScrollbarThemeMacCommon::autoscrollTimerDelay() | 199 double ScrollbarThemeMacCommon::autoscrollTimerDelay() |
193 { | 200 { |
194 return gAutoscrollButtonDelay; | 201 return gAutoscrollButtonDelay; |
195 } | 202 } |
196 | 203 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // static | 235 // static |
229 bool ScrollbarThemeMacCommon::isOverlayAPIAvailable() | 236 bool ScrollbarThemeMacCommon::isOverlayAPIAvailable() |
230 { | 237 { |
231 static bool apiAvailable = | 238 static bool apiAvailable = |
232 [NSClassFromString(@"NSScrollerImp") respondsToSelector:@selector(scroll
erImpWithStyle:controlSize:horizontal:replacingScrollerImp:)] | 239 [NSClassFromString(@"NSScrollerImp") respondsToSelector:@selector(scroll
erImpWithStyle:controlSize:horizontal:replacingScrollerImp:)] |
233 && [NSClassFromString(@"NSScrollerImpPair") instancesRespondToSelector:@
selector(scrollerStyle)]; | 240 && [NSClassFromString(@"NSScrollerImpPair") instancesRespondToSelector:@
selector(scrollerStyle)]; |
234 return apiAvailable; | 241 return apiAvailable; |
235 } | 242 } |
236 | 243 |
237 } // namespace blink | 244 } // namespace blink |
OLD | NEW |