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