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

Side by Side Diff: Source/core/platform/mac/ScrollAnimatorMac.mm

Issue 21296003: Split ScrollbarThemeMac into Overlay and NonOverlay subclasses (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@composited_scrollbar_after_refactor
Patch Set: Incorporate review feedbac Created 7 years, 4 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2010, 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static bool globalSupportsExpansionTransitionProgress = [NSClassFromString(@ "NSScrollerImp") instancesRespondToSelector:@selector(expansionTransitionProgres s)]; 56 static bool globalSupportsExpansionTransitionProgress = [NSClassFromString(@ "NSScrollerImp") instancesRespondToSelector:@selector(expansionTransitionProgres s)];
57 return globalSupportsExpansionTransitionProgress; 57 return globalSupportsExpansionTransitionProgress;
58 } 58 }
59 59
60 static bool supportsContentAreaScrolledInDirection() 60 static bool supportsContentAreaScrolledInDirection()
61 { 61 {
62 static bool globalSupportsContentAreaScrolledInDirection = [NSClassFromStrin g(@"NSScrollerImpPair") instancesRespondToSelector:@selector(contentAreaScrolled InDirection:)]; 62 static bool globalSupportsContentAreaScrolledInDirection = [NSClassFromStrin g(@"NSScrollerImpPair") instancesRespondToSelector:@selector(contentAreaScrolled InDirection:)];
63 return globalSupportsContentAreaScrolledInDirection; 63 return globalSupportsContentAreaScrolledInDirection;
64 } 64 }
65 65
66 static ScrollbarThemeMac* macScrollbarTheme() 66 static ScrollbarThemeMacOverlayAPI* macOverlayScrollbarTheme()
67 { 67 {
68 ASSERT(isScrollbarOverlayAPIAvailable());
enne (OOO) 2013/07/31 20:55:34 On second thought since this is a cast, how about
ccameron 2013/07/31 21:43:50 Done.
68 ScrollbarTheme* scrollbarTheme = ScrollbarTheme::theme(); 69 ScrollbarTheme* scrollbarTheme = ScrollbarTheme::theme();
69 return !scrollbarTheme->isMockTheme() ? static_cast<ScrollbarThemeMac*>(scro llbarTheme) : 0; 70 return !scrollbarTheme->isMockTheme() ? static_cast<ScrollbarThemeMacOverlay API*>(scrollbarTheme) : 0;
70 } 71 }
71 72
72 static ScrollbarPainter scrollbarPainterForScrollbar(Scrollbar* scrollbar) 73 static ScrollbarPainter scrollbarPainterForScrollbar(Scrollbar* scrollbar)
73 { 74 {
74 if (ScrollbarThemeMac* scrollbarTheme = macScrollbarTheme()) 75 if (ScrollbarThemeMacOverlayAPI* scrollbarTheme = macOverlayScrollbarTheme() )
75 return scrollbarTheme->painterForScrollbar(scrollbar); 76 return scrollbarTheme->painterForScrollbar(scrollbar);
76 77
77 return nil; 78 return nil;
78 } 79 }
79 80
80 @interface NSObject (ScrollAnimationHelperDetails) 81 @interface NSObject (ScrollAnimationHelperDetails)
81 - (id)initWithDelegate:(id)delegate; 82 - (id)initWithDelegate:(id)delegate;
82 - (void)_stopRun; 83 - (void)_stopRun;
83 - (BOOL)_isAnimating; 84 - (BOOL)_isAnimating;
84 - (NSPoint)targetOrigin; 85 - (NSPoint)targetOrigin;
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 void ScrollAnimatorMac::updateScrollerStyle() 1183 void ScrollAnimatorMac::updateScrollerStyle()
1183 { 1184 {
1184 if (!isScrollbarOverlayAPIAvailable()) 1185 if (!isScrollbarOverlayAPIAvailable())
1185 return; 1186 return;
1186 1187
1187 if (!scrollableArea()->scrollbarsCanBeActive()) { 1188 if (!scrollableArea()->scrollbarsCanBeActive()) {
1188 m_needsScrollerStyleUpdate = true; 1189 m_needsScrollerStyleUpdate = true;
1189 return; 1190 return;
1190 } 1191 }
1191 1192
1192 ScrollbarThemeMac* macTheme = macScrollbarTheme(); 1193 ScrollbarThemeMacOverlayAPI* macTheme = macOverlayScrollbarTheme();
1193 if (!macTheme) { 1194 if (!macTheme) {
1194 m_needsScrollerStyleUpdate = false; 1195 m_needsScrollerStyleUpdate = false;
1195 return; 1196 return;
1196 } 1197 }
1197 1198
1198 NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle ]; 1199 NSScrollerStyle newStyle = [m_scrollbarPainterController.get() scrollerStyle ];
1199 1200
1200 if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) { 1201 if (Scrollbar* verticalScrollbar = scrollableArea()->verticalScrollbar()) {
1201 verticalScrollbar->invalidate(); 1202 verticalScrollbar->invalidate();
1202 1203
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 return; 1293 return;
1293 1294
1294 m_visibleScrollerThumbRect = rectInViewCoordinates; 1295 m_visibleScrollerThumbRect = rectInViewCoordinates;
1295 } 1296 }
1296 1297
1297 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() { 1298 bool ScrollAnimatorMac::canUseCoordinatedScrollbar() {
1298 return isScrollbarOverlayAPIAvailable(); 1299 return isScrollbarOverlayAPIAvailable();
1299 } 1300 }
1300 1301
1301 } // namespace WebCore 1302 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/mac/ScrollbarThemeMac.h » ('j') | Source/core/platform/mac/ScrollbarThemeMac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698