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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
index 9753dcc192827a0a56e415c39e9afe1f31795f66..30ba2b9554699d95115ee07d6d3ed8f1506b2dd7 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
@@ -236,4 +236,38 @@ ScrollbarThemeOverlay& ScrollbarThemeOverlay::mobileTheme() {
return *theme;
}
+bool ScrollbarThemeOverlay::usesNinePatchThumbResource() const {
+ WebThemeEngine* engine = Platform::current()->themeEngine();
+ if (!engine)
+ return false;
+
+ // Thumb orientation doesn't matter here.
+ return engine->supportsNinePatch(WebThemeEngine::PartScrollbarVerticalThumb);
+}
+
+IntSize ScrollbarThemeOverlay::ninePatchThumbCanvasSize(
+ const ScrollbarThemeClient& scrollbar) const {
+ DCHECK(usesNinePatchThumbResource());
+
+ WebThemeEngine::Part part =
+ scrollbar.orientation() == VerticalScrollbar
+ ? WebThemeEngine::PartScrollbarVerticalThumb
+ : WebThemeEngine::PartScrollbarHorizontalThumb;
+
+ DCHECK(Platform::current()->themeEngine());
+ return Platform::current()->themeEngine()->ninePatchCanvasSize(part);
+}
+
+IntRect ScrollbarThemeOverlay::ninePatchThumbAperture(
+ const ScrollbarThemeClient& scrollbar) const {
+ DCHECK(usesNinePatchThumbResource());
+
+ WebThemeEngine::Part part = WebThemeEngine::PartScrollbarHorizontalThumb;
+ if (scrollbar.orientation() == VerticalScrollbar)
+ part = WebThemeEngine::PartScrollbarVerticalThumb;
+
+ DCHECK(Platform::current()->themeEngine());
+ return Platform::current()->themeEngine()->ninePatchAperture(part);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698