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

Unified Diff: webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc

Issue 18341009: Refactor cc scrollbar layers to separate solid-color vs desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address James R's comments. Created 7 years, 5 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
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc
diff --git a/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc b/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc
index a8080212beb7ba55e548044a884ba70ec6fa86ad..db0487f67b50ce9bd4100d4d0438d366c6b497e2 100644
--- a/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc
+++ b/webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.cc
@@ -5,11 +5,31 @@
#include "webkit/renderer/compositor_bindings/web_scrollbar_layer_impl.h"
#include "cc/layers/scrollbar_layer.h"
+#include "cc/layers/scrollbar_layer_base.h"
+#include "cc/layers/solid_color_scrollbar_layer.h"
#include "third_party/WebKit/public/platform/WebScrollbar.h"
#include "webkit/renderer/compositor_bindings/scrollbar_impl.h"
#include "webkit/renderer/compositor_bindings/web_layer_impl.h"
using cc::ScrollbarLayer;
+using cc::SolidColorScrollbarLayer;
+
+#if defined(OS_ANDROID)
+namespace {
+
+cc::ScrollbarOrientation convertOrientation(
tfarina 2013/07/04 17:34:45 CamelCase
wjmaclean 2013/07/04 17:50:11 Done.
+ WebKit::WebScrollbar::Orientation orientation) {
+ if (orientation == WebKit::WebScrollbar::Horizontal)
tfarina 2013/07/04 17:34:45 I know if/else is clear, but I'd just use the tern
wjmaclean 2013/07/04 17:50:11 Done.
+ return cc::HORIZONTAL;
+ else
+ return cc::VERTICAL;
+}
+
+const int solid_color_scrollbar_thumb_thickness = 3;
tfarina 2013/07/04 17:34:45 kFoo
wjmaclean 2013/07/04 17:50:11 Done.
+const SkColor solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
tfarina 2013/07/04 17:34:45 kFoo
wjmaclean 2013/07/04 17:50:11 Done.
+
+} // namespace
+#endif
namespace webkit {
@@ -17,11 +37,19 @@ WebScrollbarLayerImpl::WebScrollbarLayerImpl(
WebKit::WebScrollbar* scrollbar,
WebKit::WebScrollbarThemePainter painter,
WebKit::WebScrollbarThemeGeometry* geometry)
+#if defined(OS_ANDROID)
+ : layer_(new WebLayerImpl(SolidColorScrollbarLayer::Create(
+ convertOrientation(scrollbar->orientation()),
+ solid_color_scrollbar_thumb_thickness,
+ solid_color_scrollbar_color,
+ 0))) {}
+#else
: layer_(new WebLayerImpl(ScrollbarLayer::Create(
scoped_ptr<cc::Scrollbar>(new ScrollbarImpl(
make_scoped_ptr(scrollbar),
painter,
make_scoped_ptr(geometry))).Pass(), 0))) {}
+#endif
WebScrollbarLayerImpl::~WebScrollbarLayerImpl() {}
@@ -29,7 +57,7 @@ WebKit::WebLayer* WebScrollbarLayerImpl::layer() { return layer_.get(); }
void WebScrollbarLayerImpl::setScrollLayer(WebKit::WebLayer* layer) {
int id = layer ? static_cast<WebLayerImpl*>(layer)->layer()->id() : 0;
- static_cast<ScrollbarLayer*>(layer_->layer())->SetScrollLayerId(id);
+ layer_->layer()->ToScrollbarLayerBase()->SetScrollLayerId(id);
}
} // namespace webkit
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698