Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1083)

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 12025031: Find root scroll layer at tree activation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 459ab4bb6bc920a7f7d92ad0e05298c5e432ad16..3f2ab3574d4b06c318e06b4da377ff6e32a04518 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -177,7 +177,7 @@ public:
contents->setAnchorPoint(gfx::PointF(0, 0));
root->addChild(contents.Pass());
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
}
scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size)
@@ -1307,7 +1307,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread)
float pageScale = 2;
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
@@ -1360,7 +1360,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread)
float pageScale = 2;
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale);
initializeRendererAndDrawFrame();
@@ -1447,7 +1447,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread)
int scrollLayerId = 2;
root->addChild(createScrollableLayer(scrollLayerId, surfaceSize));
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
@@ -1497,7 +1497,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildBeyondLimit)
root->addChild(child.Pass());
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
{
@@ -1523,14 +1523,15 @@ TEST_P(LayerTreeHostImplTest, scrollEventBubbling)
// When we try to scroll a non-scrollable child layer, the scroll delta
// should be applied to one of its ancestors if possible.
gfx::Size surfaceSize(10, 10);
- scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
- scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize);
+ gfx::Size contentSize(20, 20);
+ scoped_ptr<LayerImpl> root = createScrollableLayer(1, contentSize);
+ scoped_ptr<LayerImpl> child = createScrollableLayer(2, contentSize);
child->setScrollable(false);
root->addChild(child.Pass());
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
{
@@ -1551,14 +1552,14 @@ TEST_P(LayerTreeHostImplTest, scrollBeforeRedraw)
{
gfx::Size surfaceSize(10, 10);
m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(1, surfaceSize));
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
// Draw one frame and then immediately rebuild the layer tree to mimic a tree synchronization.
initializeRendererAndDrawFrame();
m_hostImpl->activeTree()->DetachLayerTree();
m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(2, surfaceSize));
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
// Scrolling should still work even though we did not draw yet.
EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
@@ -4032,7 +4033,7 @@ void LayerTreeHostImplTest::pinchZoomPanViewportForcesCommitRedraw(const float d
// and not the document, we can verify commit/redraw are requested.
root->setMaxScrollOffset(gfx::Vector2d());
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize);
m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale);
initializeRendererAndDrawFrame();
@@ -4105,7 +4106,7 @@ void LayerTreeHostImplTest::pinchZoomPanViewportTest(const float deviceScaleFact
// we can see the scroll component on the implTransform.
root->setMaxScrollOffset(gfx::Vector2d());
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize);
m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale);
initializeRendererAndDrawFrame();
@@ -4190,7 +4191,7 @@ void LayerTreeHostImplTest::pinchZoomPanViewportAndScrollTest(const float device
// pinchZoomViewport so we can see some scroll component on the implTransform.
root->setMaxScrollOffset(gfx::Vector2d(3, 4));
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize);
m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale);
initializeRendererAndDrawFrame();
@@ -4314,7 +4315,7 @@ void LayerTreeHostImplTest::pinchZoomPanViewportAndScrollBoundaryTest(const floa
// pinchZoomViewport so we can see some scroll component on the implTransform.
root->setMaxScrollOffset(gfx::Vector2d(3, 4));
m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->activeTree()->DidBecomeActive();
m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize);
m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale);
initializeRendererAndDrawFrame();

Powered by Google App Engine
This is Rietveld 408576698