| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } else { | 119 } else { |
| 120 if (part == scrollbar.pressedPart()) | 120 if (part == scrollbar.pressedPart()) |
| 121 state = WebThemeEngine::StatePressed; | 121 state = WebThemeEngine::StatePressed; |
| 122 else if (part == scrollbar.hoveredPart()) | 122 else if (part == scrollbar.hoveredPart()) |
| 123 state = WebThemeEngine::StateHover; | 123 state = WebThemeEngine::StateHover; |
| 124 } | 124 } |
| 125 | 125 |
| 126 return PartPaintingParams(paintPart, state); | 126 return PartPaintingParams(paintPart, state); |
| 127 } | 127 } |
| 128 | 128 |
| 129 static int getScrollbarThickness() { |
| 130 return Platform::current() |
| 131 ->themeEngine() |
| 132 ->getSize(WebThemeEngine::PartScrollbarVerticalThumb) |
| 133 .width; |
| 134 } |
| 135 |
| 129 } // namespace | 136 } // namespace |
| 130 | 137 |
| 131 ScrollbarTheme& ScrollbarTheme::nativeTheme() { | 138 ScrollbarTheme& ScrollbarTheme::nativeTheme() { |
| 132 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { | 139 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { |
| 133 DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, | 140 DEFINE_STATIC_LOCAL( |
| 134 (10, 0, ScrollbarThemeOverlay::AllowHitTest)); | 141 ScrollbarThemeOverlay, theme, |
| 142 (getScrollbarThickness(), 0, ScrollbarThemeOverlay::AllowHitTest)); |
| 135 return theme; | 143 return theme; |
| 136 } | 144 } |
| 137 | 145 |
| 138 DEFINE_STATIC_LOCAL(ScrollbarThemeAura, theme, ()); | 146 DEFINE_STATIC_LOCAL(ScrollbarThemeAura, theme, ()); |
| 139 return theme; | 147 return theme; |
| 140 } | 148 } |
| 141 | 149 |
| 142 int ScrollbarThemeAura::scrollbarThickness(ScrollbarControlSize controlSize) { | 150 int ScrollbarThemeAura::scrollbarThickness(ScrollbarControlSize controlSize) { |
| 143 // Horiz and Vert scrollbars are the same thickness. | 151 // Horiz and Vert scrollbars are the same thickness. |
| 144 // In unit tests we don't have the mock theme engine (because of layering | 152 // In unit tests we don't have the mock theme engine (because of layering |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 391 } |
| 384 | 392 |
| 385 // HorizontalScrollbar | 393 // HorizontalScrollbar |
| 386 int squareSize = scrollbar.height(); | 394 int squareSize = scrollbar.height(); |
| 387 return IntSize( | 395 return IntSize( |
| 388 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize, | 396 scrollbar.width() < 2 * squareSize ? scrollbar.width() / 2 : squareSize, |
| 389 squareSize); | 397 squareSize); |
| 390 } | 398 } |
| 391 | 399 |
| 392 } // namespace blink | 400 } // namespace blink |
| OLD | NEW |