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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 did_request_redraw_(false), | 72 did_request_redraw_(false), |
73 did_upload_visible_tile_(false), | 73 did_upload_visible_tile_(false), |
74 reduce_memory_result_(true) { | 74 reduce_memory_result_(true) { |
75 media::InitializeMediaLibraryForTesting(); | 75 media::InitializeMediaLibraryForTesting(); |
76 } | 76 } |
77 | 77 |
78 virtual void SetUp() OVERRIDE { | 78 virtual void SetUp() OVERRIDE { |
79 LayerTreeSettings settings; | 79 LayerTreeSettings settings; |
80 settings.minimum_occlusion_tracking_size = gfx::Size(); | 80 settings.minimum_occlusion_tracking_size = gfx::Size(); |
81 settings.impl_side_painting = true; | 81 settings.impl_side_painting = true; |
82 settings.solid_color_scrollbars = true; | 82 settings.force_solid_color_scrollbars = true; |
83 | 83 |
84 host_impl_ = LayerTreeHostImpl::Create(settings, | 84 host_impl_ = LayerTreeHostImpl::Create(settings, |
85 this, | 85 this, |
86 &proxy_, | 86 &proxy_, |
87 &stats_instrumentation_); | 87 &stats_instrumentation_); |
88 host_impl_->InitializeRenderer(CreateOutputSurface()); | 88 host_impl_->InitializeRenderer(CreateOutputSurface()); |
89 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 89 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
90 } | 90 } |
91 | 91 |
92 virtual void TearDown() OVERRIDE {} | 92 virtual void TearDown() OVERRIDE {} |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 // Trying to scroll without a vertical scrollbar will fail. | 683 // Trying to scroll without a vertical scrollbar will fail. |
684 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( | 684 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( |
685 gfx::Point(), SCROLL_FORWARD)); | 685 gfx::Point(), SCROLL_FORWARD)); |
686 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( | 686 EXPECT_FALSE(host_impl_->ScrollVerticallyByPage( |
687 gfx::Point(), SCROLL_BACKWARD)); | 687 gfx::Point(), SCROLL_BACKWARD)); |
688 | 688 |
689 scoped_ptr<cc::ScrollbarLayerImpl> vertical_scrollbar( | 689 scoped_ptr<cc::ScrollbarLayerImpl> vertical_scrollbar( |
690 cc::ScrollbarLayerImpl::Create( | 690 cc::ScrollbarLayerImpl::Create( |
691 host_impl_->active_tree(), | 691 host_impl_->active_tree(), |
692 20, | 692 20, |
693 VERTICAL)); | 693 VERTICAL, |
| 694 false)); |
694 vertical_scrollbar->SetBounds(gfx::Size(15, 1000)); | 695 vertical_scrollbar->SetBounds(gfx::Size(15, 1000)); |
695 host_impl_->RootScrollLayer()->SetVerticalScrollbarLayer( | 696 host_impl_->RootScrollLayer()->SetVerticalScrollbarLayer( |
696 vertical_scrollbar.get()); | 697 vertical_scrollbar.get()); |
697 | 698 |
698 // Trying to scroll with a vertical scrollbar will succeed. | 699 // Trying to scroll with a vertical scrollbar will succeed. |
699 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( | 700 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( |
700 gfx::Point(), SCROLL_FORWARD)); | 701 gfx::Point(), SCROLL_FORWARD)); |
701 EXPECT_FLOAT_EQ(875.f, host_impl_->RootScrollLayer()->ScrollDelta().y()); | 702 EXPECT_FLOAT_EQ(875.f, host_impl_->RootScrollLayer()->ScrollDelta().y()); |
702 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( | 703 EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( |
703 gfx::Point(), SCROLL_BACKWARD)); | 704 gfx::Point(), SCROLL_BACKWARD)); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 | 1047 |
1047 scoped_ptr<LayerImpl> contents = | 1048 scoped_ptr<LayerImpl> contents = |
1048 LayerImpl::Create(host_impl_->active_tree(), 3); | 1049 LayerImpl::Create(host_impl_->active_tree(), 3); |
1049 contents->SetDrawsContent(true); | 1050 contents->SetDrawsContent(true); |
1050 contents->SetBounds(content_size); | 1051 contents->SetBounds(content_size); |
1051 contents->SetContentBounds(content_size); | 1052 contents->SetContentBounds(content_size); |
1052 | 1053 |
1053 scoped_ptr<ScrollbarLayerImpl> scrollbar = ScrollbarLayerImpl::Create( | 1054 scoped_ptr<ScrollbarLayerImpl> scrollbar = ScrollbarLayerImpl::Create( |
1054 host_impl_->active_tree(), | 1055 host_impl_->active_tree(), |
1055 4, | 1056 4, |
1056 VERTICAL); | 1057 VERTICAL, |
| 1058 false); |
1057 scroll->SetVerticalScrollbarLayer(scrollbar.get()); | 1059 scroll->SetVerticalScrollbarLayer(scrollbar.get()); |
1058 | 1060 |
1059 scroll->AddChild(contents.Pass()); | 1061 scroll->AddChild(contents.Pass()); |
1060 root->AddChild(scroll.Pass()); | 1062 root->AddChild(scroll.Pass()); |
1061 root->AddChild(scrollbar.PassAs<LayerImpl>()); | 1063 root->AddChild(scrollbar.PassAs<LayerImpl>()); |
1062 | 1064 |
1063 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1065 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
1064 host_impl_->active_tree()->DidBecomeActive(); | 1066 host_impl_->active_tree()->DidBecomeActive(); |
1065 InitializeRendererAndDrawFrame(); | 1067 InitializeRendererAndDrawFrame(); |
1066 | 1068 |
(...skipping 4955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6022 scoped_ptr<WebKit::WebGraphicsContext3D>( | 6024 scoped_ptr<WebKit::WebGraphicsContext3D>( |
6023 TestWebGraphicsContext3D::Create()))); | 6025 TestWebGraphicsContext3D::Create()))); |
6024 EXPECT_TRUE(did_try_initialize_renderer_); | 6026 EXPECT_TRUE(did_try_initialize_renderer_); |
6025 | 6027 |
6026 // Defer intialized GL draw. | 6028 // Defer intialized GL draw. |
6027 DrawFrame(); | 6029 DrawFrame(); |
6028 } | 6030 } |
6029 | 6031 |
6030 } // namespace | 6032 } // namespace |
6031 } // namespace cc | 6033 } // namespace cc |
OLD | NEW |