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

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: Addressed sadrul@'s feedback Created 3 years, 9 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698