Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp

Issue 2591863003: Use nine-patch resource for drawing Aura overlay scrollbar thumb. (Closed)
Patch Set: Finish Plumbing Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (Platform::current()->themeEngine()) { 230 if (Platform::current()->themeEngine()) {
231 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style); 231 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style);
232 } 232 }
233 theme = new ScrollbarThemeOverlay( 233 theme = new ScrollbarThemeOverlay(
234 style.thumbThickness, style.scrollbarMargin, 234 style.thumbThickness, style.scrollbarMargin,
235 ScrollbarThemeOverlay::DisallowHitTest, Color(style.color)); 235 ScrollbarThemeOverlay::DisallowHitTest, Color(style.color));
236 } 236 }
237 return *theme; 237 return *theme;
238 } 238 }
239 239
240 bool ScrollbarThemeOverlay::usesNinePatchThumbResource() const {
241 WebThemeEngine* engine = Platform::current()->themeEngine();
242 if (!engine)
243 return false;
244
245 // Thumb orientation doesn't matter here.
246 return engine->supportsNinePatch(WebThemeEngine::PartScrollbarVerticalThumb);
247 }
248
249 IntSize ScrollbarThemeOverlay::ninePatchThumbCanvasSize(
250 const ScrollbarThemeClient& scrollbar) const {
251 DCHECK(usesNinePatchThumbResource());
252
253 WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb;
254 if (scrollbar.orientation() == VerticalScrollbar)
255 part = WebThemeEngine::PartScrollbarVerticalThumb;
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
240 } // namespace blink 273 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698