OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/scrollbar_layer.h" | 7 #include "cc/scrollbar_layer.h" |
8 | 8 |
9 #include "cc/scrollbar_animation_controller.h" | 9 #include "cc/scrollbar_animation_controller.h" |
10 #include "cc/scrollbar_layer_impl.h" | 10 #include "cc/scrollbar_layer_impl.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 virtual ScrollbarControlSize controlSize() const OVERRIDE { return WebScroll
bar::RegularScrollbar; } | 38 virtual ScrollbarControlSize controlSize() const OVERRIDE { return WebScroll
bar::RegularScrollbar; } |
39 virtual ScrollbarPart pressedPart() const OVERRIDE { return WebScrollbar::No
Part; } | 39 virtual ScrollbarPart pressedPart() const OVERRIDE { return WebScrollbar::No
Part; } |
40 virtual ScrollbarPart hoveredPart() const OVERRIDE { return WebScrollbar::No
Part; } | 40 virtual ScrollbarPart hoveredPart() const OVERRIDE { return WebScrollbar::No
Part; } |
41 virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE { retur
n WebScrollbar::ScrollbarOverlayStyleDefault; } | 41 virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE { retur
n WebScrollbar::ScrollbarOverlayStyleDefault; } |
42 virtual bool isCustomScrollbar() const OVERRIDE { return false; } | 42 virtual bool isCustomScrollbar() const OVERRIDE { return false; } |
43 virtual Orientation orientation() const OVERRIDE { return WebScrollbar::Hori
zontal; } | 43 virtual Orientation orientation() const OVERRIDE { return WebScrollbar::Hori
zontal; } |
44 }; | 44 }; |
45 | 45 |
46 TEST(ScrollbarLayerTest, resolveScrollLayerPointer) | 46 TEST(ScrollbarLayerTest, resolveScrollLayerPointer) |
47 { | 47 { |
| 48 DebugScopedSetImplThread impl; |
| 49 |
48 WebKit::WebScrollbarThemePainter painter; | 50 WebKit::WebScrollbarThemePainter painter; |
49 | 51 |
50 { | 52 { |
51 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); | 53 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); |
52 scoped_refptr<Layer> layerTreeRoot = Layer::create(); | 54 scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
53 scoped_refptr<Layer> child1 = Layer::create(); | 55 scoped_refptr<Layer> child1 = Layer::create(); |
54 scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), p
ainter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id()); | 56 scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), p
ainter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id()); |
55 layerTreeRoot->addChild(child1); | 57 layerTreeRoot->addChild(child1); |
56 layerTreeRoot->addChild(child2); | 58 layerTreeRoot->addChild(child2); |
57 | 59 |
(...skipping 19 matching lines...) Expand all Loading... |
77 ScrollbarLayerImpl* ccChild1 = static_cast<ScrollbarLayerImpl*>(layerImp
lTreeRoot->children()[0]); | 79 ScrollbarLayerImpl* ccChild1 = static_cast<ScrollbarLayerImpl*>(layerImp
lTreeRoot->children()[0]); |
78 LayerImpl* ccChild2 = layerImplTreeRoot->children()[1]; | 80 LayerImpl* ccChild2 = layerImplTreeRoot->children()[1]; |
79 | 81 |
80 EXPECT_TRUE(ccChild2->scrollbarAnimationController()); | 82 EXPECT_TRUE(ccChild2->scrollbarAnimationController()); |
81 EXPECT_EQ(ccChild2->horizontalScrollbarLayer(), ccChild1); | 83 EXPECT_EQ(ccChild2->horizontalScrollbarLayer(), ccChild1); |
82 } | 84 } |
83 } | 85 } |
84 | 86 |
85 TEST(ScrollbarLayerTest, scrollOffsetSynchronization) | 87 TEST(ScrollbarLayerTest, scrollOffsetSynchronization) |
86 { | 88 { |
| 89 DebugScopedSetImplThread impl; |
| 90 |
87 WebKit::WebScrollbarThemePainter painter; | 91 WebKit::WebScrollbarThemePainter painter; |
88 | 92 |
89 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); | 93 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); |
90 scoped_refptr<Layer> layerTreeRoot = Layer::create(); | 94 scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
91 scoped_refptr<Layer> contentLayer = Layer::create(); | 95 scoped_refptr<Layer> contentLayer = Layer::create(); |
92 scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(
), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id()
); | 96 scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(
), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id()
); |
93 layerTreeRoot->addChild(contentLayer); | 97 layerTreeRoot->addChild(contentLayer); |
94 layerTreeRoot->addChild(scrollbarLayer); | 98 layerTreeRoot->addChild(scrollbarLayer); |
95 | 99 |
96 layerTreeRoot->setScrollPosition(IntPoint(10, 20)); | 100 layerTreeRoot->setScrollPosition(IntPoint(10, 20)); |
(...skipping 21 matching lines...) Expand all Loading... |
118 EXPECT_EQ(300, ccScrollbarLayer->maximum()); | 122 EXPECT_EQ(300, ccScrollbarLayer->maximum()); |
119 | 123 |
120 layerImplTreeRoot->scrollBy(FloatSize(12, 34)); | 124 layerImplTreeRoot->scrollBy(FloatSize(12, 34)); |
121 | 125 |
122 EXPECT_EQ(112, ccScrollbarLayer->currentPos()); | 126 EXPECT_EQ(112, ccScrollbarLayer->currentPos()); |
123 EXPECT_EQ(1000, ccScrollbarLayer->totalSize()); | 127 EXPECT_EQ(1000, ccScrollbarLayer->totalSize()); |
124 EXPECT_EQ(300, ccScrollbarLayer->maximum()); | 128 EXPECT_EQ(300, ccScrollbarLayer->maximum()); |
125 } | 129 } |
126 | 130 |
127 } | 131 } |
OLD | NEW |