Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2008, 2011 Apple 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 Color background_color) { | 429 Color background_color) { |
| 430 ScrollbarOverlayColorTheme old_overlay_theme = | 430 ScrollbarOverlayColorTheme old_overlay_theme = |
| 431 GetScrollbarOverlayColorTheme(); | 431 GetScrollbarOverlayColorTheme(); |
| 432 ScrollbarOverlayColorTheme overlay_theme = kScrollbarOverlayColorThemeDark; | 432 ScrollbarOverlayColorTheme overlay_theme = kScrollbarOverlayColorThemeDark; |
| 433 | 433 |
| 434 // Reduce the background color from RGB to a lightness value | 434 // Reduce the background color from RGB to a lightness value |
| 435 // and determine which scrollbar style to use based on a lightness | 435 // and determine which scrollbar style to use based on a lightness |
| 436 // heuristic. | 436 // heuristic. |
| 437 double hue, saturation, lightness; | 437 double hue, saturation, lightness; |
| 438 background_color.GetHSL(hue, saturation, lightness); | 438 background_color.GetHSL(hue, saturation, lightness); |
| 439 if (lightness <= .5) | 439 if (lightness <= .5 && background_color.Alpha()) |
|
jbroman
2017/04/26 18:10:20
Possibly the ideal threshold is a little higher th
bokan
2017/04/26 18:11:58
Yeah, I thought about that but the scrollbar theme
| |
| 440 overlay_theme = kScrollbarOverlayColorThemeLight; | 440 overlay_theme = kScrollbarOverlayColorThemeLight; |
| 441 | 441 |
| 442 if (old_overlay_theme != overlay_theme) | 442 if (old_overlay_theme != overlay_theme) |
| 443 SetScrollbarOverlayColorTheme(overlay_theme); | 443 SetScrollbarOverlayColorTheme(overlay_theme); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void ScrollableArea::SetScrollbarNeedsPaintInvalidation( | 446 void ScrollableArea::SetScrollbarNeedsPaintInvalidation( |
| 447 ScrollbarOrientation orientation) { | 447 ScrollbarOrientation orientation) { |
| 448 if (orientation == kHorizontalScrollbar) { | 448 if (orientation == kHorizontalScrollbar) { |
| 449 if (GraphicsLayer* graphics_layer = LayerForHorizontalScrollbar()) { | 449 if (GraphicsLayer* graphics_layer = LayerForHorizontalScrollbar()) { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 671 offset.y() - ScrollOrigin().Y()); | 671 offset.y() - ScrollOrigin().Y()); |
| 672 SetScrollOffset(new_offset, kCompositorScroll); | 672 SetScrollOffset(new_offset, kCompositorScroll); |
| 673 } | 673 } |
| 674 | 674 |
| 675 DEFINE_TRACE(ScrollableArea) { | 675 DEFINE_TRACE(ScrollableArea) { |
| 676 visitor->Trace(scroll_animator_); | 676 visitor->Trace(scroll_animator_); |
| 677 visitor->Trace(programmatic_scroll_animator_); | 677 visitor->Trace(programmatic_scroll_animator_); |
| 678 } | 678 } |
| 679 | 679 |
| 680 } // namespace blink | 680 } // namespace blink |
| OLD | NEW |