| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 LayerImpl::Create(host_impl_->active_tree(), 8); | 2006 LayerImpl::Create(host_impl_->active_tree(), 8); |
| 2007 std::unique_ptr<LayerImpl> scroll_child = | 2007 std::unique_ptr<LayerImpl> scroll_child = |
| 2008 CreateScrollableLayer(9, gfx::Size(10, 10), scroll_child_clip.get()); | 2008 CreateScrollableLayer(9, gfx::Size(10, 10), scroll_child_clip.get()); |
| 2009 child = scroll_child.get(); | 2009 child = scroll_child.get(); |
| 2010 scroll_child->SetPosition(gfx::PointF(20.f, 20.f)); | 2010 scroll_child->SetPosition(gfx::PointF(20.f, 20.f)); |
| 2011 scroll_child_clip->AddChild(std::move(scroll_child)); | 2011 scroll_child_clip->AddChild(std::move(scroll_child)); |
| 2012 | 2012 |
| 2013 child_clip = scroll_child_clip.get(); | 2013 child_clip = scroll_child_clip.get(); |
| 2014 viewport_scroll->AddChild(std::move(scroll_child_clip)); | 2014 viewport_scroll->AddChild(std::move(scroll_child_clip)); |
| 2015 | 2015 |
| 2016 child_clip->SetScrollParent(parent); | 2016 child_clip->test_properties()->scroll_parent = parent; |
| 2017 std::unique_ptr<std::set<LayerImpl*>> scroll_children( | 2017 std::unique_ptr<std::set<LayerImpl*>> scroll_children( |
| 2018 new std::set<LayerImpl*>); | 2018 new std::set<LayerImpl*>); |
| 2019 scroll_children->insert(child_clip); | 2019 scroll_children->insert(child_clip); |
| 2020 parent->SetScrollChildren(scroll_children.release()); | 2020 parent->test_properties()->scroll_children.reset(scroll_children.release()); |
| 2021 | 2021 |
| 2022 SetNeedsRebuildPropertyTrees(); | 2022 SetNeedsRebuildPropertyTrees(); |
| 2023 DrawFrame(); | 2023 DrawFrame(); |
| 2024 | 2024 |
| 2025 { | 2025 { |
| 2026 host_impl_->ScrollBegin(BeginState(gfx::Point(21, 21)).get(), | 2026 host_impl_->ScrollBegin(BeginState(gfx::Point(21, 21)).get(), |
| 2027 InputHandler::TOUCHSCREEN); | 2027 InputHandler::TOUCHSCREEN); |
| 2028 host_impl_->ScrollBy( | 2028 host_impl_->ScrollBy( |
| 2029 UpdateState(gfx::Point(21, 21), gfx::Vector2d(5, 5)).get()); | 2029 UpdateState(gfx::Point(21, 21), gfx::Vector2d(5, 5)).get()); |
| 2030 host_impl_->ScrollBy( | 2030 host_impl_->ScrollBy( |
| (...skipping 6140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8171 CreateScrollableLayer(invisible_scroll_layer_id, content_size, root); | 8171 CreateScrollableLayer(invisible_scroll_layer_id, content_size, root); |
| 8172 invisible_scroll->SetDrawsContent(false); | 8172 invisible_scroll->SetDrawsContent(false); |
| 8173 | 8173 |
| 8174 int container_id = 8; | 8174 int container_id = 8; |
| 8175 std::unique_ptr<LayerImpl> container = | 8175 std::unique_ptr<LayerImpl> container = |
| 8176 LayerImpl::Create(host_impl_->active_tree(), container_id); | 8176 LayerImpl::Create(host_impl_->active_tree(), container_id); |
| 8177 | 8177 |
| 8178 std::unique_ptr<std::set<LayerImpl*>> scroll_children( | 8178 std::unique_ptr<std::set<LayerImpl*>> scroll_children( |
| 8179 new std::set<LayerImpl*>); | 8179 new std::set<LayerImpl*>); |
| 8180 scroll_children->insert(scroll_child.get()); | 8180 scroll_children->insert(scroll_child.get()); |
| 8181 invisible_scroll->SetScrollChildren(scroll_children.release()); | 8181 invisible_scroll->test_properties()->scroll_children.reset( |
| 8182 scroll_children.release()); |
| 8182 | 8183 |
| 8183 scroll_child->SetScrollParent(invisible_scroll.get()); | 8184 scroll_child->test_properties()->scroll_parent = invisible_scroll.get(); |
| 8184 | 8185 |
| 8185 container->AddChild(std::move(invisible_scroll)); | 8186 container->AddChild(std::move(invisible_scroll)); |
| 8186 container->AddChild(std::move(scroll_child)); | 8187 container->AddChild(std::move(scroll_child)); |
| 8187 | 8188 |
| 8188 scroll_layer->AddChild(std::move(container)); | 8189 scroll_layer->AddChild(std::move(container)); |
| 8189 | 8190 |
| 8190 SetNeedsRebuildPropertyTrees(); | 8191 SetNeedsRebuildPropertyTrees(); |
| 8191 DrawFrame(); | 8192 DrawFrame(); |
| 8192 | 8193 |
| 8193 // We should have scrolled |child_scroll| even though it is invisible. | 8194 // We should have scrolled |child_scroll| even though it is invisible. |
| (...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10679 // There should not be any jitter measured till we hit the fixed point hits | 10680 // There should not be any jitter measured till we hit the fixed point hits |
| 10680 // threshold. | 10681 // threshold. |
| 10681 float expected_jitter = | 10682 float expected_jitter = |
| 10682 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10683 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
| 10683 EXPECT_EQ(jitter, expected_jitter); | 10684 EXPECT_EQ(jitter, expected_jitter); |
| 10684 } | 10685 } |
| 10685 } | 10686 } |
| 10686 | 10687 |
| 10687 } // namespace | 10688 } // namespace |
| 10688 } // namespace cc | 10689 } // namespace cc |
| OLD | NEW |