| 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 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 child->AddChild(grand_child.Pass()); | 1887 child->AddChild(grand_child.Pass()); |
| 1888 | 1888 |
| 1889 root->AddChild(child.Pass()); | 1889 root->AddChild(child.Pass()); |
| 1890 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1890 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
| 1891 host_impl_->active_tree()->DidBecomeActive(); | 1891 host_impl_->active_tree()->DidBecomeActive(); |
| 1892 host_impl_->SetViewportSize(surface_size); | 1892 host_impl_->SetViewportSize(surface_size); |
| 1893 InitializeRendererAndDrawFrame(); | 1893 InitializeRendererAndDrawFrame(); |
| 1894 { | 1894 { |
| 1895 gfx::Vector2d scroll_delta(-8, -7); | 1895 gfx::Vector2d scroll_delta(-8, -7); |
| 1896 EXPECT_EQ(InputHandler::ScrollStarted, | 1896 EXPECT_EQ(InputHandler::ScrollStarted, |
| 1897 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1897 host_impl_->ScrollBegin(gfx::Point(), |
| 1898 InputHandler::Wheel)); | 1898 InputHandler::Wheel)); |
| 1899 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1899 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
| 1900 host_impl_->ScrollEnd(); | 1900 host_impl_->ScrollEnd(); |
| 1901 | 1901 |
| 1902 scoped_ptr<ScrollAndScaleSet> scroll_info = | 1902 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 1903 host_impl_->ProcessScrollDeltas(); | 1903 host_impl_->ProcessScrollDeltas(); |
| 1904 | 1904 |
| 1905 // The grand child should have scrolled up to its limit. | 1905 // The grand child should have scrolled up to its limit. |
| 1906 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; | 1906 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; |
| 1907 LayerImpl* grand_child = child->children()[0]; | 1907 LayerImpl* grand_child = child->children()[0]; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1926 child->AddChild(grand_child.Pass()); | 1926 child->AddChild(grand_child.Pass()); |
| 1927 | 1927 |
| 1928 root->AddChild(child.Pass()); | 1928 root->AddChild(child.Pass()); |
| 1929 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 1929 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
| 1930 host_impl_->active_tree()->DidBecomeActive(); | 1930 host_impl_->active_tree()->DidBecomeActive(); |
| 1931 host_impl_->SetViewportSize(surface_size); | 1931 host_impl_->SetViewportSize(surface_size); |
| 1932 InitializeRendererAndDrawFrame(); | 1932 InitializeRendererAndDrawFrame(); |
| 1933 { | 1933 { |
| 1934 gfx::Vector2d scroll_delta(0, -10); | 1934 gfx::Vector2d scroll_delta(0, -10); |
| 1935 EXPECT_EQ(InputHandler::ScrollStarted, | 1935 EXPECT_EQ(InputHandler::ScrollStarted, |
| 1936 host_impl_->ScrollBegin(gfx::Point(5, 5), | 1936 host_impl_->ScrollBegin(gfx::Point(), |
| 1937 InputHandler::NonBubblingGesture)); | 1937 InputHandler::NonBubblingGesture)); |
| 1938 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 1938 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
| 1939 host_impl_->ScrollEnd(); | 1939 host_impl_->ScrollEnd(); |
| 1940 | 1940 |
| 1941 scoped_ptr<ScrollAndScaleSet> scroll_info = | 1941 scoped_ptr<ScrollAndScaleSet> scroll_info = |
| 1942 host_impl_->ProcessScrollDeltas(); | 1942 host_impl_->ProcessScrollDeltas(); |
| 1943 | 1943 |
| 1944 // The grand child should have scrolled up to its limit. | 1944 // The grand child should have scrolled up to its limit. |
| 1945 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; | 1945 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; |
| 1946 LayerImpl* grand_child = child->children()[0]; | 1946 LayerImpl* grand_child = child->children()[0]; |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2355 child->AddChild(grand_child.Pass()); | 2355 child->AddChild(grand_child.Pass()); |
| 2356 | 2356 |
| 2357 root->AddChild(child.Pass()); | 2357 root->AddChild(child.Pass()); |
| 2358 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 2358 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
| 2359 host_impl_->active_tree()->DidBecomeActive(); | 2359 host_impl_->active_tree()->DidBecomeActive(); |
| 2360 host_impl_->SetViewportSize(surface_size); | 2360 host_impl_->SetViewportSize(surface_size); |
| 2361 InitializeRendererAndDrawFrame(); | 2361 InitializeRendererAndDrawFrame(); |
| 2362 { | 2362 { |
| 2363 gfx::Vector2d scroll_delta(0, -10); | 2363 gfx::Vector2d scroll_delta(0, -10); |
| 2364 EXPECT_EQ(InputHandler::ScrollStarted, | 2364 EXPECT_EQ(InputHandler::ScrollStarted, |
| 2365 host_impl_->ScrollBegin(gfx::Point(5, 5), | 2365 host_impl_->ScrollBegin(gfx::Point(), |
| 2366 InputHandler::NonBubblingGesture)); | 2366 InputHandler::NonBubblingGesture)); |
| 2367 host_impl_->ScrollBy(gfx::Point(), scroll_delta); | 2367 host_impl_->ScrollBy(gfx::Point(), scroll_delta); |
| 2368 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll()); | 2368 EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll()); |
| 2369 host_impl_->ScrollEnd(); | 2369 host_impl_->ScrollEnd(); |
| 2370 | 2370 |
| 2371 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; | 2371 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; |
| 2372 LayerImpl* grand_child = child->children()[0]; | 2372 LayerImpl* grand_child = child->children()[0]; |
| 2373 | 2373 |
| 2374 // The next time we scroll we should only scroll the parent, but overscroll | 2374 // The next time we scroll we should only scroll the parent, but overscroll |
| 2375 // should still not reach the root layer. | 2375 // should still not reach the root layer. |
| (...skipping 3709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6085 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); | 6085 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); |
| 6086 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); | 6086 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); |
| 6087 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); | 6087 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); |
| 6088 host_impl_->SetVisible(false); | 6088 host_impl_->SetVisible(false); |
| 6089 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); | 6089 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); |
| 6090 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); | 6090 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); |
| 6091 } | 6091 } |
| 6092 | 6092 |
| 6093 } // namespace | 6093 } // namespace |
| 6094 } // namespace cc | 6094 } // namespace cc |
| OLD | NEW |