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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 current_limit_bytes_(0), | 90 current_limit_bytes_(0), |
91 current_priority_cutoff_value_(0) { | 91 current_priority_cutoff_value_(0) { |
92 media::InitializeMediaLibraryForTesting(); | 92 media::InitializeMediaLibraryForTesting(); |
93 } | 93 } |
94 | 94 |
95 LayerTreeSettings DefaultSettings() { | 95 LayerTreeSettings DefaultSettings() { |
96 LayerTreeSettings settings; | 96 LayerTreeSettings settings; |
97 settings.minimum_occlusion_tracking_size = gfx::Size(); | 97 settings.minimum_occlusion_tracking_size = gfx::Size(); |
98 settings.impl_side_painting = true; | 98 settings.impl_side_painting = true; |
99 settings.texture_id_allocation_chunk_size = 1; | 99 settings.texture_id_allocation_chunk_size = 1; |
100 settings.report_overscroll_only_for_scrollable_axes = true; | |
100 return settings; | 101 return settings; |
101 } | 102 } |
102 | 103 |
103 virtual void SetUp() OVERRIDE { | 104 virtual void SetUp() OVERRIDE { |
104 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); | 105 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); |
105 } | 106 } |
106 | 107 |
107 virtual void TearDown() OVERRIDE {} | 108 virtual void TearDown() OVERRIDE {} |
108 | 109 |
109 virtual void UpdateRendererCapabilitiesOnImplThread() OVERRIDE {} | 110 virtual void UpdateRendererCapabilitiesOnImplThread() OVERRIDE {} |
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3164 DrawFrame(); | 3165 DrawFrame(); |
3165 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll()); | 3166 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll()); |
3166 | 3167 |
3167 // Even though the layer can't scroll the overscroll still happens. | 3168 // Even though the layer can't scroll the overscroll still happens. |
3168 EXPECT_EQ(InputHandler::ScrollStarted, | 3169 EXPECT_EQ(InputHandler::ScrollStarted, |
3169 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); | 3170 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); |
3170 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); | 3171 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)); |
3171 EXPECT_EQ(gfx::Vector2dF(0, 10), host_impl_->accumulated_root_overscroll()); | 3172 EXPECT_EQ(gfx::Vector2dF(0, 10), host_impl_->accumulated_root_overscroll()); |
3172 } | 3173 } |
3173 | 3174 |
3175 TEST_F(LayerTreeHostImplTest, NoOverscrollOnLowEndDevice) { | |
aelias_OOO_until_Jul13
2014/04/22 02:09:46
Please rename to "NoOverscrollOnFractionalDeviceSc
| |
3176 gfx::Size surface_size(980, 1439); | |
3177 gfx::Size content_size(980, 1438); | |
3178 float device_scale_factor = 1.5f; | |
3179 scoped_ptr<LayerImpl> root_clip = | |
3180 LayerImpl::Create(host_impl_->active_tree(), 3); | |
3181 scoped_ptr<LayerImpl> root = | |
3182 CreateScrollableLayer(1, content_size, root_clip.get()); | |
3183 root->SetIsContainerForFixedPositionLayers(true); | |
3184 scoped_ptr<LayerImpl> child = | |
3185 CreateScrollableLayer(2, content_size, root_clip.get()); | |
3186 root->scroll_clip_layer()->SetBounds(gfx::Size(320, 469)); | |
3187 host_impl_->active_tree()->SetPageScaleFactorAndLimits( | |
3188 0.326531f, 0.326531f, 5.f); | |
3189 host_impl_->active_tree()->SetPageScaleDelta(1.f); | |
3190 child->SetScrollClipLayer(Layer::INVALID_ID); | |
3191 root->AddChild(child.Pass()); | |
3192 root_clip->AddChild(root.Pass()); | |
3193 | |
3194 host_impl_->SetViewportSize(surface_size); | |
3195 host_impl_->SetDeviceScaleFactor(device_scale_factor); | |
3196 host_impl_->active_tree()->SetRootLayer(root_clip.Pass()); | |
3197 host_impl_->active_tree()->SetViewportLayersFromIds(3, 1, Layer::INVALID_ID); | |
3198 host_impl_->active_tree()->DidBecomeActive(); | |
3199 DrawFrame(); | |
3200 { | |
3201 // Horizontal & Vertical GlowEffect should not be applied when | |
3202 // content size is less then view port size. For Example Horizontal & | |
3203 // vertical GlowEffect should not be applied in about:blank page. | |
3204 EXPECT_EQ(InputHandler::ScrollStarted, | |
3205 host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Wheel)); | |
3206 host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -1)); | |
3207 EXPECT_EQ(gfx::Vector2dF().ToString(), | |
3208 host_impl_->accumulated_root_overscroll().ToString()); | |
3209 | |
3210 host_impl_->ScrollEnd(); | |
3211 } | |
3212 } | |
3213 | |
3174 TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) { | 3214 TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) { |
3175 gfx::Size surface_size(100, 100); | 3215 gfx::Size surface_size(100, 100); |
3176 gfx::Size content_size(200, 200); | 3216 gfx::Size content_size(200, 200); |
3177 scoped_ptr<LayerImpl> root_clip = | 3217 scoped_ptr<LayerImpl> root_clip = |
3178 LayerImpl::Create(host_impl_->active_tree(), 3); | 3218 LayerImpl::Create(host_impl_->active_tree(), 3); |
3179 scoped_ptr<LayerImpl> root = | 3219 scoped_ptr<LayerImpl> root = |
3180 CreateScrollableLayer(1, content_size, root_clip.get()); | 3220 CreateScrollableLayer(1, content_size, root_clip.get()); |
3181 root->SetIsContainerForFixedPositionLayers(true); | 3221 root->SetIsContainerForFixedPositionLayers(true); |
3182 scoped_ptr<LayerImpl> child = | 3222 scoped_ptr<LayerImpl> child = |
3183 CreateScrollableLayer(2, content_size, root_clip.get()); | 3223 CreateScrollableLayer(2, content_size, root_clip.get()); |
(...skipping 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6272 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, | 6312 EXPECT_EQ(host_impl_->global_tile_state().hard_memory_limit_in_bytes, |
6273 300u * 1024u * 1024u); | 6313 300u * 1024u * 1024u); |
6274 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, | 6314 EXPECT_EQ(host_impl_->global_tile_state().soft_memory_limit_in_bytes, |
6275 150u * 1024u * 1024u); | 6315 150u * 1024u * 1024u); |
6276 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, | 6316 EXPECT_EQ(host_impl_->global_tile_state().unused_memory_limit_in_bytes, |
6277 75u * 1024u * 1024u); | 6317 75u * 1024u * 1024u); |
6278 } | 6318 } |
6279 | 6319 |
6280 } // namespace | 6320 } // namespace |
6281 } // namespace cc | 6321 } // namespace cc |
OLD | NEW |