Index: cc/layers/scrollbar_layer_unittest.cc |
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc |
index f8b009b583a30862aea7cc9b9b3cc4a3f054d001..c146c1f771fbe2731fcddbebb7ff12a3bd1a2f1f 100644 |
--- a/cc/layers/scrollbar_layer_unittest.cc |
+++ b/cc/layers/scrollbar_layer_unittest.cc |
@@ -31,12 +31,13 @@ namespace { |
scoped_ptr<LayerImpl> LayerImplForScrollAreaAndScrollbar( |
FakeLayerTreeHostImpl* host_impl, |
scoped_ptr<Scrollbar> scrollbar, |
- bool reverse_order) { |
+ bool reverse_order, |
+ bool is_solid_color) { |
scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
scoped_refptr<Layer> child1 = Layer::Create(); |
scoped_refptr<Layer> child2 = |
ScrollbarLayer::Create(scrollbar.Pass(), |
- child1->id()); |
+ child1->id(), is_solid_color); |
layer_tree_root->AddChild(child1); |
layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1); |
scoped_ptr<LayerImpl> layer_impl = |
@@ -55,7 +56,7 @@ TEST(ScrollbarLayerTest, ResolveScrollLayerPointer) { |
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); |
scoped_ptr<LayerImpl> layer_impl_tree_root = |
LayerImplForScrollAreaAndScrollbar( |
- &host_impl, scrollbar.Pass(), false); |
+ &host_impl, scrollbar.Pass(), false, false); |
LayerImpl* cc_child1 = layer_impl_tree_root->children()[0]; |
ScrollbarLayerImpl* cc_child2 = static_cast<ScrollbarLayerImpl*>( |
@@ -68,7 +69,7 @@ TEST(ScrollbarLayerTest, ResolveScrollLayerPointer) { |
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); |
scoped_ptr<LayerImpl> layer_impl_tree_root = |
LayerImplForScrollAreaAndScrollbar( |
- &host_impl, scrollbar.Pass(), true); |
+ &host_impl, scrollbar.Pass(), true, false); |
ScrollbarLayerImpl* cc_child1 = static_cast<ScrollbarLayerImpl*>( |
layer_impl_tree_root->children()[0]); |
@@ -85,7 +86,8 @@ TEST(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { |
// Create and attach a non-overlay scrollbar. |
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); |
scoped_ptr<LayerImpl> layer_impl_tree_root = |
- LayerImplForScrollAreaAndScrollbar(&host_impl, scrollbar.Pass(), false); |
+ LayerImplForScrollAreaAndScrollbar( |
+ &host_impl, scrollbar.Pass(), false, false); |
ScrollbarLayerImpl* scrollbar_layer_impl = |
static_cast<ScrollbarLayerImpl*>(layer_impl_tree_root->children()[1]); |
@@ -99,8 +101,8 @@ TEST(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { |
// Create and attach an overlay scrollbar. |
scrollbar.reset(new FakeScrollbar(false, false, true)); |
- layer_impl_tree_root = |
- LayerImplForScrollAreaAndScrollbar(&host_impl, scrollbar.Pass(), false); |
+ layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( |
+ &host_impl, scrollbar.Pass(), false, false); |
scrollbar_layer_impl = |
static_cast<ScrollbarLayerImpl*>(layer_impl_tree_root->children()[1]); |
@@ -120,7 +122,7 @@ TEST(ScrollbarLayerTest, ScrollOffsetSynchronization) { |
scoped_refptr<Layer> content_layer = Layer::Create(); |
scoped_refptr<Layer> scrollbar_layer = |
ScrollbarLayer::Create(scrollbar.Pass(), |
- layer_tree_root->id()); |
+ layer_tree_root->id(), false); |
layer_tree_root->AddChild(content_layer); |
layer_tree_root->AddChild(scrollbar_layer); |
@@ -173,14 +175,18 @@ TEST(ScrollbarLayerTest, ScrollOffsetSynchronization) { |
TEST(ScrollbarLayerTest, SolidColorDrawQuads) { |
LayerTreeSettings layer_tree_settings; |
- layer_tree_settings.solid_color_scrollbars = true; |
+ layer_tree_settings.force_solid_color_scrollbars = true; |
layer_tree_settings.solid_color_scrollbar_thickness_dip = 3; |
FakeImplProxy proxy; |
FakeLayerTreeHostImpl host_impl(layer_tree_settings, &proxy); |
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); |
scoped_ptr<LayerImpl> layer_impl_tree_root = |
- LayerImplForScrollAreaAndScrollbar(&host_impl, scrollbar.Pass(), false); |
+ LayerImplForScrollAreaAndScrollbar( |
+ &host_impl, |
+ scrollbar.Pass(), |
+ false, |
+ layer_tree_settings.force_solid_color_scrollbars); |
ScrollbarLayerImpl* scrollbar_layer_impl = |
static_cast<ScrollbarLayerImpl*>(layer_impl_tree_root->children()[1]); |
scrollbar_layer_impl->set_thumb_thickness(3); |
@@ -234,14 +240,18 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) { |
TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { |
LayerTreeSettings layer_tree_settings; |
- layer_tree_settings.solid_color_scrollbars = true; |
+ layer_tree_settings.force_solid_color_scrollbars = true; |
layer_tree_settings.solid_color_scrollbar_thickness_dip = 3; |
FakeImplProxy proxy; |
FakeLayerTreeHostImpl host_impl(layer_tree_settings, &proxy); |
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); |
scoped_ptr<LayerImpl> layer_impl_tree_root = |
- LayerImplForScrollAreaAndScrollbar(&host_impl, scrollbar.Pass(), false); |
+ LayerImplForScrollAreaAndScrollbar( |
+ &host_impl, |
+ scrollbar.Pass(), |
+ false, |
+ layer_tree_settings.force_solid_color_scrollbars); |
ScrollbarLayerImpl* scrollbar_layer_impl = |
static_cast<ScrollbarLayerImpl*>(layer_impl_tree_root->children()[1]); |
@@ -271,13 +281,19 @@ class ScrollbarLayerSolidColorThumbTest : public testing::Test { |
public: |
ScrollbarLayerSolidColorThumbTest() { |
LayerTreeSettings layer_tree_settings; |
- layer_tree_settings.solid_color_scrollbars = true; |
+ layer_tree_settings.force_solid_color_scrollbars = true; |
host_impl_.reset(new FakeLayerTreeHostImpl(layer_tree_settings, &proxy_)); |
horizontal_scrollbar_layer_ = ScrollbarLayerImpl::Create( |
- host_impl_->active_tree(), 1, HORIZONTAL); |
+ host_impl_->active_tree(), |
+ 1, |
+ HORIZONTAL, |
+ layer_tree_settings.force_solid_color_scrollbars); |
vertical_scrollbar_layer_ = ScrollbarLayerImpl::Create( |
- host_impl_->active_tree(), 2, VERTICAL); |
+ host_impl_->active_tree(), |
+ 2, |
+ VERTICAL, |
+ layer_tree_settings.force_solid_color_scrollbars); |
} |
protected: |
@@ -362,7 +378,7 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest { |
virtual void BeginTest() OVERRIDE { |
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); |
- scrollbar_layer_ = ScrollbarLayer::Create(scrollbar.Pass(), 1); |
+ scrollbar_layer_ = ScrollbarLayer::Create(scrollbar.Pass(), 1, false); |
scrollbar_layer_->SetLayerTreeHost(layer_tree_host()); |
scrollbar_layer_->SetBounds(bounds_); |
layer_tree_host()->root_layer()->AddChild(scrollbar_layer_); |
@@ -437,8 +453,10 @@ class ScrollbarLayerTestResourceCreation : public testing::Test { |
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, false)); |
scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
scoped_refptr<Layer> content_layer = Layer::Create(); |
- scoped_refptr<Layer> scrollbar_layer = |
- ScrollbarLayer::Create(scrollbar.Pass(), layer_tree_root->id()); |
+ scoped_refptr<Layer> scrollbar_layer = ScrollbarLayer::Create( |
+ scrollbar.Pass(), |
+ layer_tree_root->id(), |
+ layer_tree_settings_.force_solid_color_scrollbars); |
layer_tree_root->AddChild(content_layer); |
layer_tree_root->AddChild(scrollbar_layer); |
@@ -482,12 +500,12 @@ class ScrollbarLayerTestResourceCreation : public testing::Test { |
}; |
TEST_F(ScrollbarLayerTestResourceCreation, ResourceUpload) { |
- layer_tree_settings_.solid_color_scrollbars = false; |
+ layer_tree_settings_.force_solid_color_scrollbars = false; |
TestResourceUpload(2); |
} |
TEST_F(ScrollbarLayerTestResourceCreation, SolidColorNoResourceUpload) { |
- layer_tree_settings_.solid_color_scrollbars = true; |
+ layer_tree_settings_.force_solid_color_scrollbars = true; |
TestResourceUpload(0); |
} |
@@ -506,9 +524,10 @@ class ScaledScrollbarLayerTestResourceCreation : public testing::Test { |
scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
scoped_refptr<Layer> content_layer = Layer::Create(); |
- scoped_refptr<Layer> scrollbar_layer = |
- ScrollbarLayer::Create(scrollbar.PassAs<cc::Scrollbar>(), |
- layer_tree_root->id()); |
+ scoped_refptr<Layer> scrollbar_layer = ScrollbarLayer::Create( |
+ scrollbar.PassAs<cc::Scrollbar>(), |
+ layer_tree_root->id(), |
+ layer_tree_settings_.force_solid_color_scrollbars); |
layer_tree_root->AddChild(content_layer); |
layer_tree_root->AddChild(scrollbar_layer); |
@@ -575,7 +594,7 @@ class ScaledScrollbarLayerTestResourceCreation : public testing::Test { |
}; |
TEST_F(ScaledScrollbarLayerTestResourceCreation, ScaledResourceUpload) { |
- layer_tree_settings_.solid_color_scrollbars = false; |
+ layer_tree_settings_.force_solid_color_scrollbars = false; |
// Pick a test scale that moves the scrollbar's (non-zero) position to |
// a non-pixel-aligned location. |
TestResourceUpload(2, 1.41f); |