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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 using namespace blink; | 50 using namespace blink; |
51 | 51 |
52 @interface NSColor (WebNSColorDetails) | 52 @interface NSColor (WebNSColorDetails) |
53 + (NSImage*)_linenPatternImage; | 53 + (NSImage*)_linenPatternImage; |
54 @end | 54 @end |
55 | 55 |
56 @interface BlinkScrollbarObserver : NSObject { | 56 @interface BlinkScrollbarObserver : NSObject { |
57 blink::ScrollbarThemeClient* _scrollbar; | 57 blink::ScrollbarThemeClient* _scrollbar; |
58 RetainPtr<ScrollbarPainter> _scrollbarPainter; | 58 RetainPtr<ScrollbarPainter> _scrollbarPainter; |
59 BOOL _visible; | |
60 } | 59 } |
61 - (id)initWithScrollbar:(blink::ScrollbarThemeClient*)scrollbar | 60 - (id)initWithScrollbar:(blink::ScrollbarThemeClient*)scrollbar |
62 painter:(const RetainPtr<ScrollbarPainter>&)painter; | 61 painter:(const RetainPtr<ScrollbarPainter>&)painter; |
63 @end | 62 @end |
64 | 63 |
65 @implementation BlinkScrollbarObserver | 64 @implementation BlinkScrollbarObserver |
66 | 65 |
67 - (id)initWithScrollbar:(blink::ScrollbarThemeClient*)scrollbar | 66 - (id)initWithScrollbar:(blink::ScrollbarThemeClient*)scrollbar |
68 painter:(const RetainPtr<ScrollbarPainter>&)painter { | 67 painter:(const RetainPtr<ScrollbarPainter>&)painter { |
69 if (!(self = [super init])) | 68 if (!(self = [super init])) |
(...skipping 15 matching lines...) Expand all Loading... |
85 [_scrollbarPainter.get() removeObserver:self forKeyPath:@"knobAlpha"]; | 84 [_scrollbarPainter.get() removeObserver:self forKeyPath:@"knobAlpha"]; |
86 [super dealloc]; | 85 [super dealloc]; |
87 } | 86 } |
88 | 87 |
89 - (void)observeValueForKeyPath:(NSString*)keyPath | 88 - (void)observeValueForKeyPath:(NSString*)keyPath |
90 ofObject:(id)object | 89 ofObject:(id)object |
91 change:(NSDictionary*)change | 90 change:(NSDictionary*)change |
92 context:(void*)context { | 91 context:(void*)context { |
93 if ([keyPath isEqualToString:@"knobAlpha"]) { | 92 if ([keyPath isEqualToString:@"knobAlpha"]) { |
94 BOOL visible = [_scrollbarPainter.get() knobAlpha] > 0; | 93 BOOL visible = [_scrollbarPainter.get() knobAlpha] > 0; |
95 if (_visible != visible) { | 94 _scrollbar->setScrollbarsHidden(!visible); |
96 _visible = visible; | |
97 _scrollbar->visibilityChanged(); | |
98 } | |
99 } | 95 } |
100 } | 96 } |
101 | 97 |
102 @end | 98 @end |
103 | 99 |
104 namespace blink { | 100 namespace blink { |
105 | 101 |
106 typedef HashSet<ScrollbarThemeClient*> ScrollbarSet; | 102 typedef HashSet<ScrollbarThemeClient*> ScrollbarSet; |
107 | 103 |
108 static ScrollbarSet& scrollbarSet() { | 104 static ScrollbarSet& scrollbarSet() { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 463 } |
468 | 464 |
469 // static | 465 // static |
470 NSScrollerStyle ScrollbarThemeMac::recommendedScrollerStyle() { | 466 NSScrollerStyle ScrollbarThemeMac::recommendedScrollerStyle() { |
471 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) | 467 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) |
472 return NSScrollerStyleOverlay; | 468 return NSScrollerStyleOverlay; |
473 return gPreferredScrollerStyle; | 469 return gPreferredScrollerStyle; |
474 } | 470 } |
475 | 471 |
476 } // namespace blink | 472 } // namespace blink |
OLD | NEW |