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/layer_tree_host_impl.h" | 5 #include "cc/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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 // When we try to scroll a non-scrollable child layer, the scroll delta | 1514 // When we try to scroll a non-scrollable child layer, the scroll delta |
1515 // should be applied to one of its ancestors if possible. | 1515 // should be applied to one of its ancestors if possible. |
1516 gfx::Size surfaceSize(10, 10); | 1516 gfx::Size surfaceSize(10, 10); |
1517 gfx::Size contentSize(20, 20); | 1517 gfx::Size contentSize(20, 20); |
1518 scoped_ptr<LayerImpl> root = createScrollableLayer(1, contentSize); | 1518 scoped_ptr<LayerImpl> root = createScrollableLayer(1, contentSize); |
1519 scoped_ptr<LayerImpl> child = createScrollableLayer(2, contentSize); | 1519 scoped_ptr<LayerImpl> child = createScrollableLayer(2, contentSize); |
1520 | 1520 |
1521 child->setScrollable(false); | 1521 child->setScrollable(false); |
1522 root->addChild(child.Pass()); | 1522 root->addChild(child.Pass()); |
1523 | 1523 |
| 1524 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
1524 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 1525 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
1525 m_hostImpl->activeTree()->DidBecomeActive(); | 1526 m_hostImpl->activeTree()->DidBecomeActive(); |
1526 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); | |
1527 initializeRendererAndDrawFrame(); | 1527 initializeRendererAndDrawFrame(); |
1528 { | 1528 { |
1529 gfx::Vector2d scrollDelta(0, 4); | 1529 gfx::Vector2d scrollDelta(0, 4); |
1530 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::
Wheel), InputHandlerClient::ScrollStarted); | 1530 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::
Wheel), InputHandlerClient::ScrollStarted); |
1531 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1531 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
1532 m_hostImpl->scrollEnd(); | 1532 m_hostImpl->scrollEnd(); |
1533 | 1533 |
1534 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDelt
as(); | 1534 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDelt
as(); |
1535 | 1535 |
1536 // Only the root should have scrolled. | 1536 // Only the root should have scrolled. |
(...skipping 3139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4676 m_hostImpl->didDrawAllLayers(frame); | 4676 m_hostImpl->didDrawAllLayers(frame); |
4677 } | 4677 } |
4678 } | 4678 } |
4679 | 4679 |
4680 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4680 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4681 LayerTreeHostImplTest, | 4681 LayerTreeHostImplTest, |
4682 ::testing::Values(false, true)); | 4682 ::testing::Values(false, true)); |
4683 | 4683 |
4684 } // namespace | 4684 } // namespace |
4685 } // namespace cc | 4685 } // namespace cc |
OLD | NEW |