OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 reduce_memory_result_(true), | 74 reduce_memory_result_(true), |
75 current_limit_bytes_(0), | 75 current_limit_bytes_(0), |
76 current_priority_cutoff_value_(0) { | 76 current_priority_cutoff_value_(0) { |
77 media::InitializeMediaLibraryForTesting(); | 77 media::InitializeMediaLibraryForTesting(); |
78 } | 78 } |
79 | 79 |
80 virtual void SetUp() OVERRIDE { | 80 virtual void SetUp() OVERRIDE { |
81 LayerTreeSettings settings; | 81 LayerTreeSettings settings; |
82 settings.minimum_occlusion_tracking_size = gfx::Size(); | 82 settings.minimum_occlusion_tracking_size = gfx::Size(); |
83 settings.impl_side_painting = true; | 83 settings.impl_side_painting = true; |
84 settings.solid_color_scrollbars = true; | 84 settings.force_solid_color_scrollbars = true; |
85 | 85 |
86 host_impl_ = LayerTreeHostImpl::Create(settings, | 86 host_impl_ = LayerTreeHostImpl::Create(settings, |
87 this, | 87 this, |
88 &proxy_, | 88 &proxy_, |
89 &stats_instrumentation_); | 89 &stats_instrumentation_); |
90 host_impl_->InitializeRenderer(CreateOutputSurface()); | 90 host_impl_->InitializeRenderer(CreateOutputSurface()); |
91 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 91 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
92 } | 92 } |
93 | 93 |
94 virtual void TearDown() OVERRIDE {} | 94 virtual void TearDown() OVERRIDE {} |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 // Trying to scroll without a vertical scrollbar will fail. | 689 // Trying to scroll without a vertical scrollbar will fail. |
690 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( | 690 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( |
691 gfx::Point(), SCROLL_FORWARD)); | 691 gfx::Point(), SCROLL_FORWARD)); |
692 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( | 692 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( |
693 gfx::Point(), SCROLL_BACKWARD)); | 693 gfx::Point(), SCROLL_BACKWARD)); |
694 | 694 |
695 scoped_ptr<cc::ScrollbarLayerImpl> vertical_scrollbar( | 695 scoped_ptr<cc::ScrollbarLayerImpl> vertical_scrollbar( |
696 cc::ScrollbarLayerImpl::Create( | 696 cc::ScrollbarLayerImpl::Create( |
697 host_impl_->active_tree(), | 697 host_impl_->active_tree(), |
698 20, | 698 20, |
699 VERTICAL)); | 699 VERTICAL, |
| 700 false)); |
700 vertical_scrollbar->SetBounds(gfx::Size(15, 1000)); | 701 vertical_scrollbar->SetBounds(gfx::Size(15, 1000)); |
701 host_impl_->RootScrollLayer()->SetVerticalScrollbarLayer( | 702 host_impl_->RootScrollLayer()->SetVerticalScrollbarLayer( |
702 vertical_scrollbar.get()); | 703 vertical_scrollbar.get()); |
703 | 704 |
704 // Trying to scroll with a vertical scrollbar will succeed. | 705 // Trying to scroll with a vertical scrollbar will succeed. |
705 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( | 706 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( |
706 gfx::Point(), SCROLL_FORWARD)); | 707 gfx::Point(), SCROLL_FORWARD)); |
707 EXPECT_FLOAT_EQ(875.f, host_impl_->RootScrollLayer()->ScrollDelta().y()); | 708 EXPECT_FLOAT_EQ(875.f, host_impl_->RootScrollLayer()->ScrollDelta().y()); |
708 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( | 709 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( |
709 gfx::Point(), SCROLL_BACKWARD)); | 710 gfx::Point(), SCROLL_BACKWARD)); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 | 1053 |
1053 scoped_ptr<LayerImpl> contents = | 1054 scoped_ptr<LayerImpl> contents = |
1054 LayerImpl::Create(host_impl_->active_tree(), 3); | 1055 LayerImpl::Create(host_impl_->active_tree(), 3); |
1055 contents->SetDrawsContent(true); | 1056 contents->SetDrawsContent(true); |
1056 contents->SetBounds(content_size); | 1057 contents->SetBounds(content_size); |
1057 contents->SetContentBounds(content_size); | 1058 contents->SetContentBounds(content_size); |
1058 | 1059 |
1059 scoped_ptr<ScrollbarLayerImpl> scrollbar = ScrollbarLayerImpl::Create( | 1060 scoped_ptr<ScrollbarLayerImpl> scrollbar = ScrollbarLayerImpl::Create( |
1060 host_impl_->active_tree(), | 1061 host_impl_->active_tree(), |
1061 4, | 1062 4, |
1062 VERTICAL); | 1063 VERTICAL, |
| 1064 false); |
1063 scroll->SetVerticalScrollbarLayer(scrollbar.get()); | 1065 scroll->SetVerticalScrollbarLayer(scrollbar.get()); |
1064 | 1066 |
1065 scroll->AddChild(contents.Pass()); | 1067 scroll->AddChild(contents.Pass()); |
1066 root->AddChild(scroll.Pass()); | 1068 root->AddChild(scroll.Pass()); |
1067 root->AddChild(scrollbar.PassAs<LayerImpl>()); | 1069 root->AddChild(scrollbar.PassAs<LayerImpl>()); |
1068 | 1070 |
1069 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1071 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1070 host_impl_->active_tree()->DidBecomeActive(); | 1072 host_impl_->active_tree()->DidBecomeActive(); |
1071 InitializeRendererAndDrawFrame(); | 1073 InitializeRendererAndDrawFrame(); |
1072 | 1074 |
(...skipping 5012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6085 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); | 6087 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); |
6086 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); | 6088 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); |
6087 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); | 6089 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); |
6088 host_impl_->SetVisible(false); | 6090 host_impl_->SetVisible(false); |
6089 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); | 6091 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); |
6090 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); | 6092 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); |
6091 } | 6093 } |
6092 | 6094 |
6093 } // namespace | 6095 } // namespace |
6094 } // namespace cc | 6096 } // namespace cc |
OLD | NEW |