OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (Platform::current()->themeEngine()) { | 229 if (Platform::current()->themeEngine()) { |
230 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style); | 230 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style); |
231 } | 231 } |
232 theme = new ScrollbarThemeOverlay( | 232 theme = new ScrollbarThemeOverlay( |
233 style.thumbThickness, style.scrollbarMargin, | 233 style.thumbThickness, style.scrollbarMargin, |
234 ScrollbarThemeOverlay::DisallowHitTest, Color(style.color)); | 234 ScrollbarThemeOverlay::DisallowHitTest, Color(style.color)); |
235 } | 235 } |
236 return *theme; | 236 return *theme; |
237 } | 237 } |
238 | 238 |
| 239 bool ScrollbarThemeOverlay::usesNinePatchThumbResource() const { |
| 240 WebThemeEngine* engine = Platform::current()->themeEngine(); |
| 241 if (!engine) |
| 242 return false; |
| 243 |
| 244 // Thumb orientation doesn't matter here. |
| 245 return engine->supportsNinePatch(WebThemeEngine::PartScrollbarVerticalThumb); |
| 246 } |
| 247 |
| 248 IntSize ScrollbarThemeOverlay::ninePatchThumbCanvasSize( |
| 249 const ScrollbarThemeClient& scrollbar) const { |
| 250 DCHECK(usesNinePatchThumbResource()); |
| 251 |
| 252 WebThemeEngine::Part part = |
| 253 scrollbar.orientation() == VerticalScrollbar |
| 254 ? WebThemeEngine::PartScrollbarVerticalThumb |
| 255 : WebThemeEngine::PartScrollbarHorizontalThumb; |
| 256 |
| 257 DCHECK(Platform::current()->themeEngine()); |
| 258 return Platform::current()->themeEngine()->ninePatchCanvasSize(part); |
| 259 } |
| 260 |
| 261 IntRect ScrollbarThemeOverlay::ninePatchThumbAperture( |
| 262 const ScrollbarThemeClient& scrollbar) const { |
| 263 DCHECK(usesNinePatchThumbResource()); |
| 264 |
| 265 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb; |
| 266 if (scrollbar.orientation() == VerticalScrollbar) |
| 267 part = WebThemeEngine::PartScrollbarVerticalThumb; |
| 268 |
| 269 DCHECK(Platform::current()->themeEngine()); |
| 270 return Platform::current()->themeEngine()->ninePatchAperture(part); |
| 271 } |
| 272 |
239 } // namespace blink | 273 } // namespace blink |
OLD | NEW |