| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 controlSize:(NSControlSize)scrollbar.controlSize() | 280 controlSize:(NSControlSize)scrollbar.controlSize() |
| 281 horizontal:isHorizontal | 281 horizontal:isHorizontal |
| 282 replacingScrollerImp:nil] retain]); | 282 replacingScrollerImp:nil] retain]); |
| 283 RetainPtr<BlinkScrollbarObserver> observer( | 283 RetainPtr<BlinkScrollbarObserver> observer( |
| 284 AdoptNS, | 284 AdoptNS, |
| 285 [[BlinkScrollbarObserver alloc] initWithScrollbar:&scrollbar | 285 [[BlinkScrollbarObserver alloc] initWithScrollbar:&scrollbar |
| 286 painter:scrollbarPainter]); | 286 painter:scrollbarPainter]); |
| 287 | 287 |
| 288 scrollbarPainterMap().add(&scrollbar, observer); | 288 scrollbarPainterMap().add(&scrollbar, observer); |
| 289 updateEnabledState(scrollbar); | 289 updateEnabledState(scrollbar); |
| 290 updateScrollbarOverlayStyle(scrollbar); | 290 updateScrollbarOverlayColorTheme(scrollbar); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void ScrollbarThemeMac::unregisterScrollbar(ScrollbarThemeClient& scrollbar) { | 293 void ScrollbarThemeMac::unregisterScrollbar(ScrollbarThemeClient& scrollbar) { |
| 294 scrollbarPainterMap().remove(&scrollbar); | 294 scrollbarPainterMap().remove(&scrollbar); |
| 295 scrollbarSet().remove(&scrollbar); | 295 scrollbarSet().remove(&scrollbar); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void ScrollbarThemeMac::setNewPainterForScrollbar( | 298 void ScrollbarThemeMac::setNewPainterForScrollbar( |
| 299 ScrollbarThemeClient& scrollbar, | 299 ScrollbarThemeClient& scrollbar, |
| 300 ScrollbarPainter newPainter) { | 300 ScrollbarPainter newPainter) { |
| 301 RetainPtr<ScrollbarPainter> scrollbarPainter(AdoptNS, [newPainter retain]); | 301 RetainPtr<ScrollbarPainter> scrollbarPainter(AdoptNS, [newPainter retain]); |
| 302 RetainPtr<BlinkScrollbarObserver> observer( | 302 RetainPtr<BlinkScrollbarObserver> observer( |
| 303 AdoptNS, | 303 AdoptNS, |
| 304 [[BlinkScrollbarObserver alloc] initWithScrollbar:&scrollbar | 304 [[BlinkScrollbarObserver alloc] initWithScrollbar:&scrollbar |
| 305 painter:scrollbarPainter]); | 305 painter:scrollbarPainter]); |
| 306 scrollbarPainterMap().set(&scrollbar, observer); | 306 scrollbarPainterMap().set(&scrollbar, observer); |
| 307 updateEnabledState(scrollbar); | 307 updateEnabledState(scrollbar); |
| 308 updateScrollbarOverlayStyle(scrollbar); | 308 updateScrollbarOverlayColorTheme(scrollbar); |
| 309 } | 309 } |
| 310 | 310 |
| 311 ScrollbarPainter ScrollbarThemeMac::painterForScrollbar( | 311 ScrollbarPainter ScrollbarThemeMac::painterForScrollbar( |
| 312 const ScrollbarThemeClient& scrollbar) const { | 312 const ScrollbarThemeClient& scrollbar) const { |
| 313 return [scrollbarPainterMap() | 313 return [scrollbarPainterMap() |
| 314 .get(const_cast<ScrollbarThemeClient*>(&scrollbar)) | 314 .get(const_cast<ScrollbarThemeClient*>(&scrollbar)) |
| 315 .get() painter]; | 315 .get() painter]; |
| 316 } | 316 } |
| 317 | 317 |
| 318 void ScrollbarThemeMac::paintTrackBackground(GraphicsContext& context, | 318 void ScrollbarThemeMac::paintTrackBackground(GraphicsContext& context, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 int thickness = [scrollbarPainter trackBoxWidth]; | 393 int thickness = [scrollbarPainter trackBoxWidth]; |
| 394 if (supportsExpandedScrollbars()) | 394 if (supportsExpandedScrollbars()) |
| 395 [scrollbarPainter setExpanded:wasExpanded]; | 395 [scrollbarPainter setExpanded:wasExpanded]; |
| 396 return thickness; | 396 return thickness; |
| 397 } | 397 } |
| 398 | 398 |
| 399 bool ScrollbarThemeMac::usesOverlayScrollbars() const { | 399 bool ScrollbarThemeMac::usesOverlayScrollbars() const { |
| 400 return recommendedScrollerStyle() == NSScrollerStyleOverlay; | 400 return recommendedScrollerStyle() == NSScrollerStyleOverlay; |
| 401 } | 401 } |
| 402 | 402 |
| 403 void ScrollbarThemeMac::updateScrollbarOverlayStyle( | 403 void ScrollbarThemeMac::updateScrollbarOverlayColorTheme( |
| 404 const ScrollbarThemeClient& scrollbar) { | 404 const ScrollbarThemeClient& scrollbar) { |
| 405 ScrollbarPainter painter = painterForScrollbar(scrollbar); | 405 ScrollbarPainter painter = painterForScrollbar(scrollbar); |
| 406 switch (scrollbar.getScrollbarOverlayStyle()) { | 406 switch (scrollbar.getScrollbarOverlayColorTheme()) { |
| 407 case ScrollbarOverlayStyleDefault: | 407 case ScrollbarOverlayColorThemeDefault: |
| 408 [painter setKnobStyle:NSScrollerKnobStyleDefault]; | 408 [painter setKnobStyle:NSScrollerKnobStyleDefault]; |
| 409 break; | 409 break; |
| 410 case ScrollbarOverlayStyleDark: | 410 case ScrollbarOverlayColorThemeDark: |
| 411 [painter setKnobStyle:NSScrollerKnobStyleDark]; | 411 [painter setKnobStyle:NSScrollerKnobStyleDark]; |
| 412 break; | 412 break; |
| 413 case ScrollbarOverlayStyleLight: | 413 case ScrollbarOverlayColorThemeLight: |
| 414 [painter setKnobStyle:NSScrollerKnobStyleLight]; | 414 [painter setKnobStyle:NSScrollerKnobStyleLight]; |
| 415 break; | 415 break; |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 | 418 |
| 419 WebScrollbarButtonsPlacement ScrollbarThemeMac::buttonsPlacement() const { | 419 WebScrollbarButtonsPlacement ScrollbarThemeMac::buttonsPlacement() const { |
| 420 return WebScrollbarButtonsPlacementNone; | 420 return WebScrollbarButtonsPlacementNone; |
| 421 } | 421 } |
| 422 | 422 |
| 423 bool ScrollbarThemeMac::hasThumb(const ScrollbarThemeClient& scrollbar) { | 423 bool ScrollbarThemeMac::hasThumb(const ScrollbarThemeClient& scrollbar) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 } | 470 } |
| 471 | 471 |
| 472 // static | 472 // static |
| 473 NSScrollerStyle ScrollbarThemeMac::recommendedScrollerStyle() { | 473 NSScrollerStyle ScrollbarThemeMac::recommendedScrollerStyle() { |
| 474 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) | 474 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) |
| 475 return NSScrollerStyleOverlay; | 475 return NSScrollerStyleOverlay; |
| 476 return gPreferredScrollerStyle; | 476 return gPreferredScrollerStyle; |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace blink | 479 } // namespace blink |
| OLD | NEW |