Changeset 152214 in webkit
- Timestamp:
- Jun 29, 2013, 1:27:08 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152213 r152214 1 2013-06-29 Simon Fraser <simon.fraser@apple.com> 2 3 Avoid calling into Objective-C every time we get the scrollbar width 4 https://bugs.webkit.org/show_bug.cgi?id=118216 5 6 Reviewed by Geoffrey Garen. 7 8 Profiling shows that calling Scrollbar::isOverlayScrollbar() is somewhat 9 expensive, because it calls down into Objective-C. Fix by caching in 10 ScrollbarThemeMac whether we're using overlay scrollbars. We update this 11 cache on creation, and when preferences change; ScrollAnimatorMac::updateScrollerStyle() 12 is the function that gets called when the user changes the setting in System Preferences. 13 14 * platform/ScrollbarTheme.h: 15 (WebCore::ScrollbarTheme::usesOverlayScrollbarsChanged): 16 * platform/mac/ScrollAnimatorMac.mm: 17 (WebCore::ScrollAnimatorMac::updateScrollerStyle): 18 * platform/mac/ScrollbarThemeMac.h: 19 * platform/mac/ScrollbarThemeMac.mm: 20 (WebCore::ScrollbarThemeMac::preferencesChanged): 21 (WebCore::ScrollbarThemeMac::usesOverlayScrollbars): 22 (WebCore::ScrollbarThemeMac::usesOverlayScrollbarsChanged): 23 1 24 2013-06-29 Simon Fraser <simon.fraser@apple.com> 2 25 -
trunk/Source/WebCore/platform/ScrollbarTheme.h
r144397 r152214 58 58 virtual bool supportsControlTints() const { return false; } 59 59 virtual bool usesOverlayScrollbars() const { return false; } 60 virtual void usesOverlayScrollbarsChanged() { } 60 61 virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*) { } 61 62 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r150399 r152214 1213 1213 return; 1214 1214 } 1215 1216 macTheme->usesOverlayScrollbarsChanged(); 1215 1217 1216 1218 NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle]; -
trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h
r147860 r152214 48 48 virtual bool supportsControlTints() const { return true; } 49 49 virtual bool usesOverlayScrollbars() const; 50 virtual void usesOverlayScrollbarsChanged() OVERRIDE; 50 51 virtual void updateScrollbarOverlayStyle(ScrollbarThemeClient*); 51 52 -
trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
r149980 r152214 134 134 static float gAutoscrollButtonDelay = 0.05f; 135 135 static bool gJumpOnTrackClick = false; 136 static bool gUsesOverlayScrollbars = false; 136 137 137 138 static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd; … … 227 228 gAutoscrollButtonDelay = [defaults floatForKey:@"NSScrollerButtonPeriod"]; 228 229 gJumpOnTrackClick = [defaults boolForKey:@"AppleScrollerPagingBehavior"]; 230 usesOverlayScrollbarsChanged(); 229 231 } 230 232 … … 242 244 bool ScrollbarThemeMac::usesOverlayScrollbars() const 243 245 { 246 return gUsesOverlayScrollbars; 247 } 248 249 void ScrollbarThemeMac::usesOverlayScrollbarsChanged() 250 { 244 251 if (isScrollbarOverlayAPIAvailable()) 245 returnrecommendedScrollerStyle() == NSScrollerStyleOverlay;252 gUsesOverlayScrollbars = recommendedScrollerStyle() == NSScrollerStyleOverlay; 246 253 else 247 returnfalse;254 gUsesOverlayScrollbars = false; 248 255 } 249 256
Note:
See TracChangeset
for help on using the changeset viewer.