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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "cc/animation/scrollbar_animation_controller.h" | 6 #include "cc/animation/scrollbar_animation_controller.h" |
7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
8 #include "cc/layers/painted_scrollbar_layer.h" | 8 #include "cc/layers/painted_scrollbar_layer.h" |
9 #include "cc/layers/painted_scrollbar_layer_impl.h" | 9 #include "cc/layers/painted_scrollbar_layer_impl.h" |
10 #include "cc/layers/scrollbar_layer_interface.h" | 10 #include "cc/layers/scrollbar_layer_interface.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 if (use_solid_color_scrollbar) { | 45 if (use_solid_color_scrollbar) { |
46 const bool kIsLeftSideVerticalScrollbar = false; | 46 const bool kIsLeftSideVerticalScrollbar = false; |
47 child2 = SolidColorScrollbarLayer::Create(scrollbar->Orientation(), | 47 child2 = SolidColorScrollbarLayer::Create(scrollbar->Orientation(), |
48 thumb_thickness, | 48 thumb_thickness, |
49 track_start, | 49 track_start, |
50 kIsLeftSideVerticalScrollbar, | 50 kIsLeftSideVerticalScrollbar, |
51 child1->id()); | 51 child1->id()); |
52 } else { | 52 } else { |
53 child2 = PaintedScrollbarLayer::Create(scrollbar.Pass(), child1->id()); | 53 child2 = PaintedScrollbarLayer::Create(scrollbar.Pass(), child1->id()); |
54 } | 54 } |
| 55 child2->ToScrollbarLayer()->SetClipLayer(layer_tree_root->id()); |
55 layer_tree_root->AddChild(child1); | 56 layer_tree_root->AddChild(child1); |
56 layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1); | 57 layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1); |
57 host->SetRootLayer(layer_tree_root); | 58 host->SetRootLayer(layer_tree_root); |
58 return host->CommitAndCreateLayerImplTree(); | 59 return host->CommitAndCreateLayerImplTree(); |
59 } | 60 } |
60 | 61 |
61 TEST(ScrollbarLayerTest, ResolveScrollLayerPointer) { | 62 TEST(ScrollbarLayerTest, ResolveScrollLayerPointer) { |
62 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 63 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
63 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); | 64 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); |
64 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( | 65 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 884 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
884 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 885 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
885 | 886 |
886 // Horizontal Scrollbars. | 887 // Horizontal Scrollbars. |
887 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 888 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
888 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 889 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
889 } | 890 } |
890 | 891 |
891 } // namespace | 892 } // namespace |
892 } // namespace cc | 893 } // namespace cc |
OLD | NEW |