OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 30 matching lines...) Expand all Loading... | |
41 Class scrollerImpPairClass = NSClassFromString(@"NSScrollerImpPair"); | 41 Class scrollerImpPairClass = NSClassFromString(@"NSScrollerImpPair"); |
42 apiAvailable = [scrollerImpClass respondsToSelector:@selector(scrollerIm pWithStyle:controlSize:horizontal:replacingScrollerImp:)] | 42 apiAvailable = [scrollerImpClass respondsToSelector:@selector(scrollerIm pWithStyle:controlSize:horizontal:replacingScrollerImp:)] |
43 && [scrollerImpPairClass instancesRespondToSelector:@sele ctor(scrollerStyle)]; | 43 && [scrollerImpPairClass instancesRespondToSelector:@sele ctor(scrollerStyle)]; |
44 } | 44 } |
45 return apiAvailable; | 45 return apiAvailable; |
46 } | 46 } |
47 | 47 |
48 NSScrollerStyle recommendedScrollerStyle() { | 48 NSScrollerStyle recommendedScrollerStyle() { |
49 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) | 49 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) |
50 return NSScrollerStyleOverlay; | 50 return NSScrollerStyleOverlay; |
51 if ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)]) | 51 bool respondsToSelectorPreferredScrollerStyle; |
Nico
2013/10/11 19:48:48
If this is called from a single thread, just
sta
| |
52 bool shouldInitialize = true; | |
Nico
2013/10/11 19:48:48
…wait, how does this version work? Isn't this stil
| |
53 if (shouldInitialize) { | |
54 shouldInitialize = false; | |
55 respondsToSelectorPreferredScrollerStyle = [NSScroller respondsToSelecto r:@selector(preferredScrollerStyle)]; | |
56 } | |
57 if (respondsToSelectorPreferredScrollerStyle) | |
52 return [NSScroller preferredScrollerStyle]; | 58 return [NSScroller preferredScrollerStyle]; |
53 return NSScrollerStyleLegacy; | 59 return NSScrollerStyleLegacy; |
54 } | 60 } |
55 | 61 |
56 } | 62 } |
OLD | NEW |