summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/DEPS3
-rw-r--r--cc/caching_bitmap_content_layer_updater.cc13
-rw-r--r--cc/cc_tests.gyp4
-rw-r--r--cc/content_layer.cc2
-rw-r--r--cc/content_layer.h2
-rw-r--r--cc/layer_painter.h6
-rw-r--r--cc/layer_unittest.cc2
-rw-r--r--cc/scrollbar_layer.cc95
-rw-r--r--cc/scrollbar_layer.h20
-rw-r--r--cc/scrollbar_layer_unittest.cc40
-rw-r--r--cc/scrollbar_theme_painter.h36
-rw-r--r--cc/test/fake_scrollbar_theme_painter.cc69
-rw-r--r--cc/test/fake_scrollbar_theme_painter.h59
-rw-r--r--cc/test/fake_web_scrollbar.cc69
-rw-r--r--cc/test/fake_web_scrollbar.h40
-rw-r--r--cc/tiled_layer_unittest.cc2
-rw-r--r--webkit/compositor_bindings/compositor_bindings.gyp2
-rw-r--r--webkit/compositor_bindings/web_scrollbar_layer_impl.cc10
-rw-r--r--webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.cc65
-rw-r--r--webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.h55
20 files changed, 494 insertions, 100 deletions
diff --git a/cc/DEPS b/cc/DEPS
index ccc99ea..6e68172 100644
--- a/cc/DEPS
+++ b/cc/DEPS
@@ -11,4 +11,7 @@ include_rules = [
"+third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h",
"+third_party/WebKit/Source/Platform/chromium/public/WebGraphicsMemoryAllocation.h",
"+third_party/WebKit/Source/Platform/chromium/public/WebImage.h",
+ "+third_party/WebKit/Source/Platform/chromium/public/WebRect.h",
+ "+third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h",
+ "+third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemeGeometry.h",
]
diff --git a/cc/caching_bitmap_content_layer_updater.cc b/cc/caching_bitmap_content_layer_updater.cc
index ddeef24..937b57d 100644
--- a/cc/caching_bitmap_content_layer_updater.cc
+++ b/cc/caching_bitmap_content_layer_updater.cc
@@ -34,12 +34,13 @@ void CachingBitmapContentLayerUpdater::prepareToUpdate(
float contents_height_scale,
gfx::Rect& resulting_opaque_rect,
RenderingStats& stats) {
- BitmapContentLayerUpdater::prepareToUpdate(content_rect,
- tile_size,
- contents_width_scale,
- contents_height_scale,
- resulting_opaque_rect,
- stats);
+ BitmapContentLayerUpdater::prepareToUpdate(
+ content_rect,
+ tile_size,
+ contents_width_scale,
+ contents_height_scale,
+ resulting_opaque_rect,
+ stats);
const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false);
SkAutoLockPixels lock(new_bitmap);
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 79dfda4..9bc7abb 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -79,6 +79,8 @@
'test/fake_picture_layer_tiling_client.h',
'test/fake_proxy.cc',
'test/fake_proxy.h',
+ 'test/fake_scrollbar_theme_painter.h',
+ 'test/fake_scrollbar_theme_painter.cc',
'test/fake_tile_manager_client.h',
'test/fake_output_surface.cc',
'test/fake_output_surface.h',
@@ -86,6 +88,8 @@
'test/fake_software_output_device.h',
'test/fake_web_graphics_context_3d.cc',
'test/fake_web_graphics_context_3d.h',
+ 'test/fake_web_scrollbar.cc',
+ 'test/fake_web_scrollbar.h',
'test/fake_web_scrollbar_theme_geometry.cc',
'test/fake_web_scrollbar_theme_geometry.h',
'test/geometry_test_utils.cc',
diff --git a/cc/content_layer.cc b/cc/content_layer.cc
index 3b97dcd..20c9556 100644
--- a/cc/content_layer.cc
+++ b/cc/content_layer.cc
@@ -25,7 +25,7 @@ scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient*
return make_scoped_ptr(new ContentLayerPainter(client));
}
-void ContentLayerPainter::paint(SkCanvas* canvas, const gfx::Rect& contentRect, gfx::RectF& opaque)
+void ContentLayerPainter::paint(SkCanvas* canvas, gfx::Rect contentRect, gfx::RectF& opaque)
{
base::TimeTicks paintStart = base::TimeTicks::HighResNow();
m_client->paintContents(canvas, contentRect, opaque);
diff --git a/cc/content_layer.h b/cc/content_layer.h
index 125ea88..cad68d1 100644
--- a/cc/content_layer.h
+++ b/cc/content_layer.h
@@ -21,7 +21,7 @@ class CC_EXPORT ContentLayerPainter : public LayerPainter {
public:
static scoped_ptr<ContentLayerPainter> create(ContentLayerClient*);
- virtual void paint(SkCanvas*, const gfx::Rect& contentRect, gfx::RectF& opaque) OVERRIDE;
+ virtual void paint(SkCanvas*, gfx::Rect contentRect, gfx::RectF& opaque) OVERRIDE;
private:
explicit ContentLayerPainter(ContentLayerClient*);
diff --git a/cc/layer_painter.h b/cc/layer_painter.h
index b9dce8d..dcf69da 100644
--- a/cc/layer_painter.h
+++ b/cc/layer_painter.h
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
#ifndef CC_LAYER_PAINTER_H_
#define CC_LAYER_PAINTER_H_
@@ -20,8 +19,9 @@ namespace cc {
class CC_EXPORT LayerPainter {
public:
virtual ~LayerPainter() { }
- virtual void paint(SkCanvas*, const gfx::Rect& contentRect, gfx::RectF& opaque) = 0;
+ virtual void paint(SkCanvas*, gfx::Rect contentRect, gfx::RectF& opaque) = 0;
};
-} // namespace cc
+} // namespace cc
+
#endif // CC_LAYER_PAINTER_H_
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc
index 2a4af24..df2e7a0 100644
--- a/cc/layer_unittest.cc
+++ b/cc/layer_unittest.cc
@@ -58,7 +58,7 @@ private:
class MockLayerPainter : public LayerPainter {
public:
- virtual void paint(SkCanvas*, const gfx::Rect&, gfx::RectF&) OVERRIDE { }
+ virtual void paint(SkCanvas*, gfx::Rect, gfx::RectF&) OVERRIDE { }
};
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index 9fb96ff..817ead8 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -10,10 +10,8 @@
#include "cc/layer_tree_host.h"
#include "cc/resource_update_queue.h"
#include "cc/scrollbar_layer_impl.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
#include "ui/gfx/rect_conversions.h"
-#include <public/WebRect.h>
-
-using WebKit::WebRect;
namespace cc {
@@ -22,14 +20,22 @@ scoped_ptr<LayerImpl> ScrollbarLayer::createLayerImpl(LayerTreeImpl* treeImpl)
return ScrollbarLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>();
}
-scoped_refptr<ScrollbarLayer> ScrollbarLayer::create(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId)
+scoped_refptr<ScrollbarLayer> ScrollbarLayer::create(
+ scoped_ptr<WebKit::WebScrollbar> scrollbar,
+ scoped_ptr<ScrollbarThemePainter> painter,
+ scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry,
+ int scrollLayerId)
{
- return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), painter, geometry.Pass(), scrollLayerId));
+ return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), painter.Pass(), geometry.Pass(), scrollLayerId));
}
-ScrollbarLayer::ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar> scrollbar, WebKit::WebScrollbarThemePainter painter, scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, int scrollLayerId)
+ScrollbarLayer::ScrollbarLayer(
+ scoped_ptr<WebKit::WebScrollbar> scrollbar,
+ scoped_ptr<ScrollbarThemePainter> painter,
+ scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry,
+ int scrollLayerId)
: m_scrollbar(scrollbar.Pass())
- , m_painter(painter)
+ , m_painter(painter.Pass())
, m_geometry(geometry.Pass())
, m_scrollLayerId(scrollLayerId)
, m_textureFormat(GL_INVALID_ENUM)
@@ -117,46 +123,45 @@ ScrollbarLayer* ScrollbarLayer::toScrollbarLayer()
class ScrollbarBackgroundPainter : public LayerPainter {
public:
- static scoped_ptr<ScrollbarBackgroundPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart)
+ static scoped_ptr<ScrollbarBackgroundPainter> create(WebKit::WebScrollbar* scrollbar, ScrollbarThemePainter *painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart)
{
return make_scoped_ptr(new ScrollbarBackgroundPainter(scrollbar, painter, geometry, trackPart));
}
- virtual void paint(SkCanvas* skCanvas, const gfx::Rect& contentRect, gfx::RectF&) OVERRIDE
+ virtual void paint(SkCanvas* canvas, gfx::Rect contentRect, gfx::RectF&) OVERRIDE
{
- WebKit::WebCanvas* canvas = skCanvas;
// The following is a simplification of ScrollbarThemeComposite::paint.
- m_painter.paintScrollbarBackground(canvas, contentRect);
+ m_painter->PaintScrollbarBackground(canvas, contentRect);
if (m_geometry->hasButtons(m_scrollbar)) {
- WebRect backButtonStartPaintRect = m_geometry->backButtonStartRect(m_scrollbar);
- m_painter.paintBackButtonStart(canvas, backButtonStartPaintRect);
+ gfx::Rect backButtonStartPaintRect = m_geometry->backButtonStartRect(m_scrollbar);
+ m_painter->PaintBackButtonStart(canvas, backButtonStartPaintRect);
- WebRect backButtonEndPaintRect = m_geometry->backButtonEndRect(m_scrollbar);
- m_painter.paintBackButtonEnd(canvas, backButtonEndPaintRect);
+ gfx::Rect backButtonEndPaintRect = m_geometry->backButtonEndRect(m_scrollbar);
+ m_painter->PaintBackButtonEnd(canvas, backButtonEndPaintRect);
- WebRect forwardButtonStartPaintRect = m_geometry->forwardButtonStartRect(m_scrollbar);
- m_painter.paintForwardButtonStart(canvas, forwardButtonStartPaintRect);
+ gfx::Rect forwardButtonStartPaintRect = m_geometry->forwardButtonStartRect(m_scrollbar);
+ m_painter->PaintForwardButtonStart(canvas, forwardButtonStartPaintRect);
- WebRect forwardButtonEndPaintRect = m_geometry->forwardButtonEndRect(m_scrollbar);
- m_painter.paintForwardButtonEnd(canvas, forwardButtonEndPaintRect);
+ gfx::Rect forwardButtonEndPaintRect = m_geometry->forwardButtonEndRect(m_scrollbar);
+ m_painter->PaintForwardButtonEnd(canvas, forwardButtonEndPaintRect);
}
- WebRect trackPaintRect = m_geometry->trackRect(m_scrollbar);
- m_painter.paintTrackBackground(canvas, trackPaintRect);
+ gfx::Rect trackPaintRect = m_geometry->trackRect(m_scrollbar);
+ m_painter->PaintTrackBackground(canvas, trackPaintRect);
bool thumbPresent = m_geometry->hasThumb(m_scrollbar);
if (thumbPresent) {
if (m_trackPart == WebKit::WebScrollbar::ForwardTrackPart)
- m_painter.paintForwardTrackPart(canvas, trackPaintRect);
+ m_painter->PaintForwardTrackPart(canvas, trackPaintRect);
else
- m_painter.paintBackTrackPart(canvas, trackPaintRect);
+ m_painter->PaintBackTrackPart(canvas, trackPaintRect);
}
- m_painter.paintTickmarks(canvas, trackPaintRect);
+ m_painter->PaintTickmarks(canvas, trackPaintRect);
}
private:
- ScrollbarBackgroundPainter(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart)
+ ScrollbarBackgroundPainter(WebKit::WebScrollbar* scrollbar, ScrollbarThemePainter *painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart)
: m_scrollbar(scrollbar)
, m_painter(painter)
, m_geometry(geometry)
@@ -165,7 +170,7 @@ private:
}
WebKit::WebScrollbar* m_scrollbar;
- WebKit::WebScrollbarThemePainter m_painter;
+ ScrollbarThemePainter* m_painter;
WebKit::WebScrollbarThemeGeometry* m_geometry;
WebKit::WebScrollbar::ScrollbarPart m_trackPart;
@@ -174,24 +179,20 @@ private:
class ScrollbarThumbPainter : public LayerPainter {
public:
- static scoped_ptr<ScrollbarThumbPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry)
+ static scoped_ptr<ScrollbarThumbPainter> create(WebKit::WebScrollbar* scrollbar, ScrollbarThemePainter* painter, WebKit::WebScrollbarThemeGeometry* geometry)
{
return make_scoped_ptr(new ScrollbarThumbPainter(scrollbar, painter, geometry));
}
- virtual void paint(SkCanvas* skCanvas, const gfx::Rect& contentRect, gfx::RectF& opaque) OVERRIDE
+ virtual void paint(SkCanvas* canvas, gfx::Rect contentRect, gfx::RectF& opaque) OVERRIDE
{
- WebKit::WebCanvas* canvas = skCanvas;
-
// Consider the thumb to be at the origin when painting.
- WebRect thumbRect = m_geometry->thumbRect(m_scrollbar);
- thumbRect.x = 0;
- thumbRect.y = 0;
- m_painter.paintThumb(canvas, thumbRect);
+ gfx::Rect thumbRect = m_geometry->thumbRect(m_scrollbar);
+ m_painter->PaintThumb(canvas, gfx::Rect(thumbRect.size()));
}
private:
- ScrollbarThumbPainter(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry)
+ ScrollbarThumbPainter(WebKit::WebScrollbar* scrollbar, ScrollbarThemePainter* painter, WebKit::WebScrollbarThemeGeometry* geometry)
: m_scrollbar(scrollbar)
, m_painter(painter)
, m_geometry(geometry)
@@ -199,7 +200,7 @@ private:
}
WebKit::WebScrollbar* m_scrollbar;
- WebKit::WebScrollbarThemePainter m_painter;
+ ScrollbarThemePainter* m_painter;
WebKit::WebScrollbarThemeGeometry* m_geometry;
DISALLOW_COPY_AND_ASSIGN(ScrollbarThumbPainter);
@@ -222,48 +223,48 @@ void ScrollbarLayer::createUpdaterIfNeeded()
m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat;
if (!m_backTrackUpdater)
- m_backTrackUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>());
+ m_backTrackUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter.get(), m_geometry.get(), WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>());
if (!m_backTrack)
m_backTrack = m_backTrackUpdater->createResource(layerTreeHost()->contentsTextureManager());
// Only create two-part track if we think the two parts could be different in appearance.
if (m_scrollbar->isCustomScrollbar()) {
if (!m_foreTrackUpdater)
- m_foreTrackUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>());
+ m_foreTrackUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter.get(), m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>());
if (!m_foreTrack)
m_foreTrack = m_foreTrackUpdater->createResource(layerTreeHost()->contentsTextureManager());
}
if (!m_thumbUpdater)
- m_thumbUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get()).PassAs<LayerPainter>());
+ m_thumbUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter.get(), m_geometry.get()).PassAs<LayerPainter>());
if (!m_thumb)
m_thumb = m_thumbUpdater->createResource(layerTreeHost()->contentsTextureManager());
}
-void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* texture, const gfx::Rect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
+void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* resource, const gfx::Rect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
{
// Skip painting and uploading if there are no invalidations and
// we already have valid texture data.
- if (texture->texture()->haveBackingTexture()
- && texture->texture()->size() == rect.size()
- && m_updateRect.IsEmpty())
+ if (resource->texture()->haveBackingTexture() &&
+ resource->texture()->size() == rect.size() &&
+ m_updateRect.IsEmpty())
return;
// We should always have enough memory for UI.
- DCHECK(texture->texture()->canAcquireBackingTexture());
- if (!texture->texture()->canAcquireBackingTexture())
+ DCHECK(resource->texture()->canAcquireBackingTexture());
+ if (!resource->texture()->canAcquireBackingTexture())
return;
// Paint and upload the entire part.
gfx::Rect paintedOpaqueRect;
painter->prepareToUpdate(rect, rect.size(), contentsScaleX(), contentsScaleY(), paintedOpaqueRect, stats);
- if (!painter->pixelsDidChange() && texture->texture()->haveBackingTexture()) {
+ if (!painter->pixelsDidChange() && resource->texture()->haveBackingTexture()) {
TRACE_EVENT_INSTANT0("cc","ScrollbarLayer::updatePart no texture upload needed");
return;
}
gfx::Vector2d destOffset(0, 0);
- texture->update(queue, rect, destOffset, false, stats);
+ resource->update(queue, rect, destOffset, false, stats);
}
gfx::Rect ScrollbarLayer::scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const
diff --git a/cc/scrollbar_layer.h b/cc/scrollbar_layer.h
index 47de62e..2ddbad7 100644
--- a/cc/scrollbar_layer.h
+++ b/cc/scrollbar_layer.h
@@ -9,9 +9,9 @@
#include "cc/caching_bitmap_content_layer_updater.h"
#include "cc/cc_export.h"
#include "cc/contents_scaling_layer.h"
-#include <public/WebScrollbar.h>
-#include <public/WebScrollbarThemeGeometry.h>
-#include <public/WebScrollbarThemePainter.h>
+#include "cc/scrollbar_theme_painter.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemeGeometry.h"
namespace cc {
@@ -23,7 +23,11 @@ class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer {
public:
virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERRIDE;
- static scoped_refptr<ScrollbarLayer> create(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
+ static scoped_refptr<ScrollbarLayer> create(
+ scoped_ptr<WebKit::WebScrollbar>,
+ scoped_ptr<ScrollbarThemePainter>,
+ scoped_ptr<WebKit::WebScrollbarThemeGeometry>,
+ int scrollLayerId);
int scrollLayerId() const { return m_scrollLayerId; }
void setScrollLayerId(int id);
@@ -42,7 +46,11 @@ public:
virtual ScrollbarLayer* toScrollbarLayer() OVERRIDE;
protected:
- ScrollbarLayer(scoped_ptr<WebKit::WebScrollbar>, WebKit::WebScrollbarThemePainter, scoped_ptr<WebKit::WebScrollbarThemeGeometry>, int scrollLayerId);
+ ScrollbarLayer(
+ scoped_ptr<WebKit::WebScrollbar>,
+ scoped_ptr<ScrollbarThemePainter>,
+ scoped_ptr<WebKit::WebScrollbarThemeGeometry>,
+ int scrollLayerId);
virtual ~ScrollbarLayer();
private:
@@ -54,7 +62,7 @@ private:
float clampScaleToMaxTextureSize(float scale);
scoped_ptr<WebKit::WebScrollbar> m_scrollbar;
- WebKit::WebScrollbarThemePainter m_painter;
+ scoped_ptr<ScrollbarThemePainter> m_painter;
scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry;
int m_scrollLayerId;
diff --git a/cc/scrollbar_layer_unittest.cc b/cc/scrollbar_layer_unittest.cc
index 818d1cd..e32f5e7 100644
--- a/cc/scrollbar_layer_unittest.cc
+++ b/cc/scrollbar_layer_unittest.cc
@@ -9,51 +9,27 @@
#include "cc/single_thread_proxy.h"
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
+#include "cc/test/fake_scrollbar_theme_painter.h"
+#include "cc/test/fake_web_scrollbar.h"
#include "cc/test/fake_web_scrollbar_theme_geometry.h"
#include "cc/test/layer_tree_test_common.h"
#include "cc/tree_synchronizer.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include <public/WebScrollbar.h>
-#include <public/WebScrollbarThemeGeometry.h>
-#include <public/WebScrollbarThemePainter.h>
+#include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemeGeometry.h"
namespace cc {
namespace {
-class FakeWebScrollbar : public WebKit::WebScrollbar {
-public:
- static scoped_ptr<FakeWebScrollbar> create() { return make_scoped_ptr(new FakeWebScrollbar()); }
-
- // WebScrollbar implementation
- virtual bool isOverlay() const OVERRIDE { return false; }
- virtual int value() const OVERRIDE { return 0; }
- virtual WebKit::WebPoint location() const OVERRIDE { return WebKit::WebPoint(); }
- virtual WebKit::WebSize size() const OVERRIDE { return WebKit::WebSize(); }
- virtual bool enabled() const OVERRIDE { return true; }
- virtual int maximum() const OVERRIDE { return 0; }
- virtual int totalSize() const OVERRIDE { return 0; }
- virtual bool isScrollViewScrollbar() const OVERRIDE { return false; }
- virtual bool isScrollableAreaActive() const OVERRIDE { return true; }
- virtual void getTickmarks(WebKit::WebVector<WebKit::WebRect>&) const OVERRIDE { }
- virtual ScrollbarControlSize controlSize() const OVERRIDE { return WebScrollbar::RegularScrollbar; }
- virtual ScrollbarPart pressedPart() const OVERRIDE { return WebScrollbar::NoPart; }
- virtual ScrollbarPart hoveredPart() const OVERRIDE { return WebScrollbar::NoPart; }
- virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE { return WebScrollbar::ScrollbarOverlayStyleDefault; }
- virtual bool isCustomScrollbar() const OVERRIDE { return false; }
- virtual Orientation orientation() const OVERRIDE { return WebScrollbar::Horizontal; }
-};
-
TEST(ScrollbarLayerTest, resolveScrollLayerPointer)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- WebKit::WebScrollbarThemePainter painter;
{
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
scoped_refptr<Layer> layerTreeRoot = Layer::create();
scoped_refptr<Layer> child1 = Layer::create();
- scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), painter, FakeWebScrollbarThemeGeometry::create(), child1->id());
+ scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(), child1->id());
layerTreeRoot->addChild(child1);
layerTreeRoot->addChild(child2);
@@ -70,7 +46,7 @@ TEST(ScrollbarLayerTest, resolveScrollLayerPointer)
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
scoped_refptr<Layer> layerTreeRoot = Layer::create();
scoped_refptr<Layer> child2 = Layer::create();
- scoped_refptr<Layer> child1 = ScrollbarLayer::create(scrollbar.Pass(), painter, FakeWebScrollbarThemeGeometry::create(), child2->id());
+ scoped_refptr<Layer> child1 = ScrollbarLayer::create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(), child2->id());
layerTreeRoot->addChild(child1);
layerTreeRoot->addChild(child2);
@@ -88,12 +64,11 @@ TEST(ScrollbarLayerTest, scrollOffsetSynchronization)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- WebKit::WebScrollbarThemePainter painter;
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
scoped_refptr<Layer> layerTreeRoot = Layer::create();
scoped_refptr<Layer> contentLayer = Layer::create();
- scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), painter, FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id());
+ scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id());
layerTreeRoot->addChild(contentLayer);
layerTreeRoot->addChild(scrollbarLayer);
@@ -141,7 +116,7 @@ public:
m_layerTreeHost->initializeRendererIfNeeded();
scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
- m_scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), m_painter, FakeWebScrollbarThemeGeometry::create(), 1);
+ m_scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(), 1);
m_scrollbarLayer->setLayerTreeHost(m_layerTreeHost.get());
m_scrollbarLayer->setBounds(m_bounds);
m_layerTreeHost->rootLayer()->addChild(m_scrollbarLayer);
@@ -173,7 +148,6 @@ public:
private:
scoped_refptr<ScrollbarLayer> m_scrollbarLayer;
scoped_refptr<Layer> m_scrollLayer;
- WebKit::WebScrollbarThemePainter m_painter;
gfx::Size m_bounds;
};
diff --git a/cc/scrollbar_theme_painter.h b/cc/scrollbar_theme_painter.h
new file mode 100644
index 0000000..4053eb7
--- /dev/null
+++ b/cc/scrollbar_theme_painter.h
@@ -0,0 +1,36 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_SCROLLBAR_THEME_PAINTER_H_
+#define CC_SCROLLBAR_THEME_PAINTER_H_
+
+#include "cc/cc_export.h"
+
+class SkCanvas;
+
+namespace gfx {
+class Rect;
+}
+
+namespace cc {
+
+class CC_EXPORT ScrollbarThemePainter {
+ public:
+ virtual ~ScrollbarThemePainter() {}
+
+ virtual void PaintScrollbarBackground(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintTrackBackground(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintBackTrackPart(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintForwardTrackPart(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintBackButtonStart(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintBackButtonEnd(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintForwardButtonStart(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintForwardButtonEnd(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintTickmarks(SkCanvas*, const gfx::Rect&) = 0;
+ virtual void PaintThumb(SkCanvas*, const gfx::Rect&) = 0;
+};
+
+} // namespace cc
+
+#endif // CC_SCROLLBAR_THEME_PAINTER_H_
diff --git a/cc/test/fake_scrollbar_theme_painter.cc b/cc/test/fake_scrollbar_theme_painter.cc
new file mode 100644
index 0000000..19f97f8
--- /dev/null
+++ b/cc/test/fake_scrollbar_theme_painter.cc
@@ -0,0 +1,69 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/test/fake_scrollbar_theme_painter.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/gfx/rect.h"
+
+namespace cc {
+
+void FakeScrollbarThemePainter::PaintScrollbarBackground(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintTrackBackground(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintBackTrackPart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintForwardTrackPart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintBackButtonStart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintBackButtonEnd(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintForwardButtonStart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintForwardButtonEnd(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintTickmarks(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::PaintThumb(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ Paint(canvas, rect);
+}
+
+void FakeScrollbarThemePainter::Paint(SkCanvas* canvas, gfx::Rect rect) {
+ if (!paint_)
+ return;
+ // Fill the scrollbar with a different color each time.
+ ++fill_color_;
+ canvas->clear(SK_ColorBLACK | fill_color_);
+}
+
+} // namespace cc
diff --git a/cc/test/fake_scrollbar_theme_painter.h b/cc/test/fake_scrollbar_theme_painter.h
new file mode 100644
index 0000000..61c8dd3
--- /dev/null
+++ b/cc/test/fake_scrollbar_theme_painter.h
@@ -0,0 +1,59 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TEST_FAKE_SCROLLBAR_THEME_PAINTER_H_
+#define CC_TEST_FAKE_SCROLLBAR_THEME_PAINTER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "cc/scrollbar_theme_painter.h"
+#include "third_party/skia/include/core/SkColor.h"
+
+namespace cc {
+
+class FakeScrollbarThemePainter : public ScrollbarThemePainter {
+ public:
+ static scoped_ptr<FakeScrollbarThemePainter> Create(bool paint) {
+ return make_scoped_ptr(new FakeScrollbarThemePainter(paint));
+ }
+ virtual ~FakeScrollbarThemePainter() {}
+
+ virtual void PaintScrollbarBackground(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintTrackBackground(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintBackTrackPart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintForwardTrackPart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintBackButtonStart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintBackButtonEnd(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintForwardButtonStart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintForwardButtonEnd(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintTickmarks(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintThumb(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+
+ void set_paint(bool paint) { paint_ = paint; }
+
+ private:
+ explicit FakeScrollbarThemePainter(bool paint)
+ : paint_(paint),
+ fill_color_(0) {}
+
+ void Paint(SkCanvas* canvas, gfx::Rect rect);
+
+ bool paint_;
+ SkColor fill_color_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeScrollbarThemePainter);
+};
+
+} // namespace cc
+
+#endif // CC_TEST_FAKE_SCROLLBAR_BACKGROUND_PAINTER_H_
diff --git a/cc/test/fake_web_scrollbar.cc b/cc/test/fake_web_scrollbar.cc
new file mode 100644
index 0000000..eafda67
--- /dev/null
+++ b/cc/test/fake_web_scrollbar.cc
@@ -0,0 +1,69 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/test/fake_web_scrollbar.h"
+
+namespace cc {
+
+bool FakeWebScrollbar::isOverlay() const {
+ return false;
+}
+
+int FakeWebScrollbar::value() const {
+ return 0;
+}
+
+WebKit::WebPoint FakeWebScrollbar::location() const {
+ return WebKit::WebPoint();
+}
+
+WebKit::WebSize FakeWebScrollbar::size() const {
+ return WebKit::WebSize();
+}
+
+bool FakeWebScrollbar::enabled() const {
+ return true;
+}
+
+int FakeWebScrollbar::maximum() const {
+ return 0;
+}
+
+int FakeWebScrollbar::totalSize() const {
+ return 0;
+}
+
+bool FakeWebScrollbar::isScrollViewScrollbar() const {
+ return false;
+}
+
+bool FakeWebScrollbar::isScrollableAreaActive() const {
+ return true;
+}
+
+WebKit::WebScrollbar::ScrollbarControlSize FakeWebScrollbar::controlSize() const {
+ return WebScrollbar::RegularScrollbar;
+}
+
+WebKit::WebScrollbar::ScrollbarPart FakeWebScrollbar::pressedPart() const {
+ return WebScrollbar::NoPart;
+}
+
+WebKit::WebScrollbar::ScrollbarPart FakeWebScrollbar::hoveredPart() const {
+ return WebScrollbar::NoPart;
+}
+
+WebKit::WebScrollbar::ScrollbarOverlayStyle FakeWebScrollbar::scrollbarOverlayStyle() const {
+ return WebScrollbar::ScrollbarOverlayStyleDefault;
+}
+
+bool FakeWebScrollbar::isCustomScrollbar() const {
+ return false;
+}
+
+WebKit::WebScrollbar::Orientation FakeWebScrollbar::orientation() const {
+ return WebScrollbar::Horizontal;
+}
+
+} // namespace cc
diff --git a/cc/test/fake_web_scrollbar.h b/cc/test/fake_web_scrollbar.h
new file mode 100644
index 0000000..4d8504a
--- /dev/null
+++ b/cc/test/fake_web_scrollbar.h
@@ -0,0 +1,40 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TEST_FAKE_WEB_SCROLLBAR_H_
+#define CC_TEST_FAKE_WEB_SCROLLBAR_H_
+
+#include "base/memory/scoped_ptr.h"
+#include <public/WebScrollbar.h>
+
+namespace cc {
+
+class FakeWebScrollbar : public WebKit::WebScrollbar {
+ public:
+ static scoped_ptr<FakeWebScrollbar> create() {
+ return make_scoped_ptr(new FakeWebScrollbar());
+ }
+
+ // WebScrollbar implementation
+ virtual bool isOverlay() const OVERRIDE;
+ virtual int value() const OVERRIDE;
+ virtual WebKit::WebPoint location() const OVERRIDE;
+ virtual WebKit::WebSize size() const OVERRIDE;
+ virtual bool enabled() const OVERRIDE;
+ virtual int maximum() const OVERRIDE;
+ virtual int totalSize() const OVERRIDE;
+ virtual bool isScrollViewScrollbar() const OVERRIDE;
+ virtual bool isScrollableAreaActive() const OVERRIDE;
+ virtual void getTickmarks(WebKit::WebVector<WebKit::WebRect>&) const OVERRIDE {}
+ virtual ScrollbarControlSize controlSize() const OVERRIDE;
+ virtual ScrollbarPart pressedPart() const OVERRIDE;
+ virtual ScrollbarPart hoveredPart() const OVERRIDE;
+ virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE;
+ virtual bool isCustomScrollbar() const OVERRIDE;
+ virtual Orientation orientation() const OVERRIDE;
+};
+
+} // namespace cc
+
+#endif // CC_TEST_FAKE_WEB_SCROLLBAR_H_
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index f6404e7..7fb252f 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -1571,7 +1571,7 @@ class TrackingLayerPainter : public LayerPainter {
public:
static scoped_ptr<TrackingLayerPainter> create() { return make_scoped_ptr(new TrackingLayerPainter()); }
- virtual void paint(SkCanvas*, const gfx::Rect& contentRect, gfx::RectF&) OVERRIDE
+ virtual void paint(SkCanvas*, gfx::Rect contentRect, gfx::RectF&) OVERRIDE
{
m_paintedRect = contentRect;
}
diff --git a/webkit/compositor_bindings/compositor_bindings.gyp b/webkit/compositor_bindings/compositor_bindings.gyp
index e4df060..67c3f03 100644
--- a/webkit/compositor_bindings/compositor_bindings.gyp
+++ b/webkit/compositor_bindings/compositor_bindings.gyp
@@ -33,6 +33,8 @@
'web_nine_patch_layer_impl.h',
'web_to_ccinput_handler_adapter.cc',
'web_to_ccinput_handler_adapter.h',
+ 'web_to_ccscrollbar_theme_painter_adapter.cc',
+ 'web_to_ccscrollbar_theme_painter_adapter.h',
'web_layer_tree_view_impl.cc',
'web_layer_tree_view_impl.h',
'web_scrollbar_layer_impl.cc',
diff --git a/webkit/compositor_bindings/web_scrollbar_layer_impl.cc b/webkit/compositor_bindings/web_scrollbar_layer_impl.cc
index dbadb31..d2153bc 100644
--- a/webkit/compositor_bindings/web_scrollbar_layer_impl.cc
+++ b/webkit/compositor_bindings/web_scrollbar_layer_impl.cc
@@ -6,8 +6,10 @@
#include "cc/scrollbar_layer.h"
#include "web_layer_impl.h"
+#include "web_to_ccscrollbar_theme_painter_adapter.h"
using cc::ScrollbarLayer;
+using cc::ScrollbarThemePainter;
namespace WebKit {
@@ -18,7 +20,13 @@ WebScrollbarLayer* WebScrollbarLayer::create(WebScrollbar* scrollbar, WebScrollb
WebScrollbarLayerImpl::WebScrollbarLayerImpl(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry)
- : m_layer(new WebLayerImpl(ScrollbarLayer::create(make_scoped_ptr(scrollbar), painter, make_scoped_ptr(geometry), 0)))
+ : m_layer(new WebLayerImpl(ScrollbarLayer::create(
+ make_scoped_ptr(scrollbar),
+ WebToCCScrollbarThemePainterAdapter::Create(
+ make_scoped_ptr(new WebScrollbarThemePainter(painter)))
+ .PassAs<ScrollbarThemePainter>(),
+ make_scoped_ptr(geometry),
+ 0)))
{
}
diff --git a/webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.cc b/webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.cc
new file mode 100644
index 0000000..2c3361d
--- /dev/null
+++ b/webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.cc
@@ -0,0 +1,65 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "web_to_ccscrollbar_theme_painter_adapter.h"
+
+#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbarThemePainter.h"
+
+namespace WebKit {
+
+WebToCCScrollbarThemePainterAdapter::~WebToCCScrollbarThemePainterAdapter() {
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintScrollbarBackground(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintScrollbarBackground(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintTrackBackground(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintTrackBackground(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintBackTrackPart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintBackTrackPart(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintForwardTrackPart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintForwardTrackPart(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintBackButtonStart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintBackButtonStart(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintBackButtonEnd(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintBackButtonEnd(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintForwardButtonStart(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintForwardButtonStart(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintForwardButtonEnd(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintForwardButtonEnd(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintTickmarks(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintTickmarks(canvas, rect);
+}
+
+void WebToCCScrollbarThemePainterAdapter::PaintThumb(
+ SkCanvas* canvas, const gfx::Rect& rect) {
+ painter_->paintThumb(canvas, rect);
+}
+
+} // namespace WebKit
diff --git a/webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.h b/webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.h
new file mode 100644
index 0000000..7ad80bc
--- /dev/null
+++ b/webkit/compositor_bindings/web_to_ccscrollbar_theme_painter_adapter.h
@@ -0,0 +1,55 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_COMPOSITOR_BINDINGS_WEB_TO_CCSCROLLBAR_THEME_PAINTER_ADAPTER_H_
+#define WEBKIT_COMPOSITOR_BINDINGS_WEB_TO_CCSCROLLBAR_THEME_PAINTER_ADAPTER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "cc/scrollbar_theme_painter.h"
+
+namespace WebKit {
+
+class WebScrollbarThemePainter;
+
+class WebToCCScrollbarThemePainterAdapter : public cc::ScrollbarThemePainter {
+ public:
+ static scoped_ptr<WebToCCScrollbarThemePainterAdapter> Create(
+ scoped_ptr<WebScrollbarThemePainter> webPainter) {
+ return make_scoped_ptr(new WebToCCScrollbarThemePainterAdapter(
+ webPainter.Pass()));
+ }
+ virtual ~WebToCCScrollbarThemePainterAdapter();
+
+ virtual void PaintScrollbarBackground(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintTrackBackground(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintBackTrackPart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintForwardTrackPart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintBackButtonStart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintBackButtonEnd(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintForwardButtonStart(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintForwardButtonEnd(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintTickmarks(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+ virtual void PaintThumb(SkCanvas* canvas, const gfx::Rect& rect)
+ OVERRIDE;
+
+ private:
+ WebToCCScrollbarThemePainterAdapter(
+ scoped_ptr<WebScrollbarThemePainter> webPainter)
+ : painter_(webPainter.Pass()) {}
+
+ scoped_ptr<WebScrollbarThemePainter> painter_;
+};
+
+} // namespace WebKit
+
+#endif // WEBKIT_COMPOSITOR_BINDINGS_WEB_TO_CCSCROLLBAR_THEME_PAINTER_ADAPTER_H_