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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 root->setAnchorPoint(gfx::PointF(0, 0)); | 175 root->setAnchorPoint(gfx::PointF(0, 0)); |
176 | 176 |
177 scoped_ptr<LayerImpl> contents = LayerImpl::create(m_hostImpl->activeTre
e(), 2); | 177 scoped_ptr<LayerImpl> contents = LayerImpl::create(m_hostImpl->activeTre
e(), 2); |
178 contents->setDrawsContent(true); | 178 contents->setDrawsContent(true); |
179 contents->setBounds(contentSize); | 179 contents->setBounds(contentSize); |
180 contents->setContentBounds(contentSize); | 180 contents->setContentBounds(contentSize); |
181 contents->setPosition(gfx::PointF(0, 0)); | 181 contents->setPosition(gfx::PointF(0, 0)); |
182 contents->setAnchorPoint(gfx::PointF(0, 0)); | 182 contents->setAnchorPoint(gfx::PointF(0, 0)); |
183 root->addChild(contents.Pass()); | 183 root->addChild(contents.Pass()); |
184 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 184 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
185 m_hostImpl->activeTree()->FindRootScrollLayer(); | 185 m_hostImpl->activeTree()->DidBecomeActive(); |
186 } | 186 } |
187 | 187 |
188 scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size) | 188 scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size) |
189 { | 189 { |
190 scoped_ptr<LayerImpl> layer = LayerImpl::create(m_hostImpl->activeTree()
, id); | 190 scoped_ptr<LayerImpl> layer = LayerImpl::create(m_hostImpl->activeTree()
, id); |
191 layer->setScrollable(true); | 191 layer->setScrollable(true); |
192 layer->setDrawsContent(true); | 192 layer->setDrawsContent(true); |
193 layer->setBounds(size); | 193 layer->setBounds(size); |
194 layer->setContentBounds(size); | 194 layer->setContentBounds(size); |
195 layer->setMaxScrollOffset(gfx::Vector2d(size.width() * 2, size.height()
* 2)); | 195 layer->setMaxScrollOffset(gfx::Vector2d(size.width() * 2, size.height()
* 2)); |
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 // Scrolling fails because the content layer is asking to be scrolled on the
main thread. | 1307 // Scrolling fails because the content layer is asking to be scrolled on the
main thread. |
1308 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollOnMainThread); | 1308 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollOnMainThread); |
1309 } | 1309 } |
1310 | 1310 |
1311 TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) | 1311 TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread) |
1312 { | 1312 { |
1313 gfx::Size surfaceSize(10, 10); | 1313 gfx::Size surfaceSize(10, 10); |
1314 float pageScale = 2; | 1314 float pageScale = 2; |
1315 scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); | 1315 scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); |
1316 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 1316 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
1317 m_hostImpl->activeTree()->FindRootScrollLayer(); | 1317 m_hostImpl->activeTree()->DidBecomeActive(); |
1318 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); | 1318 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
1319 initializeRendererAndDrawFrame(); | 1319 initializeRendererAndDrawFrame(); |
1320 | 1320 |
1321 gfx::Vector2d scrollDelta(0, 10); | 1321 gfx::Vector2d scrollDelta(0, 10); |
1322 gfx::Vector2d expectedScrollDelta(scrollDelta); | 1322 gfx::Vector2d expectedScrollDelta(scrollDelta); |
1323 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset()); | 1323 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset()); |
1324 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 1324 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
1325 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1325 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
1326 m_hostImpl->scrollEnd(); | 1326 m_hostImpl->scrollEnd(); |
1327 | 1327 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 EXPECT_EQ(0.0, m_hostImpl->rootLayer()->implTransform().matrix().getDouble(3
, 2)); | 1360 EXPECT_EQ(0.0, m_hostImpl->rootLayer()->implTransform().matrix().getDouble(3
, 2)); |
1361 EXPECT_EQ(1.0, m_hostImpl->rootLayer()->implTransform().matrix().getDouble(3
, 3)); | 1361 EXPECT_EQ(1.0, m_hostImpl->rootLayer()->implTransform().matrix().getDouble(3
, 3)); |
1362 } | 1362 } |
1363 | 1363 |
1364 TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) | 1364 TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread) |
1365 { | 1365 { |
1366 gfx::Size surfaceSize(10, 10); | 1366 gfx::Size surfaceSize(10, 10); |
1367 float pageScale = 2; | 1367 float pageScale = 2; |
1368 scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); | 1368 scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); |
1369 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 1369 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
1370 m_hostImpl->activeTree()->FindRootScrollLayer(); | 1370 m_hostImpl->activeTree()->DidBecomeActive(); |
1371 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); | 1371 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
1372 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); | 1372 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); |
1373 initializeRendererAndDrawFrame(); | 1373 initializeRendererAndDrawFrame(); |
1374 | 1374 |
1375 gfx::Vector2d scrollDelta(0, 10); | 1375 gfx::Vector2d scrollDelta(0, 10); |
1376 gfx::Vector2d expectedScrollDelta(scrollDelta); | 1376 gfx::Vector2d expectedScrollDelta(scrollDelta); |
1377 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset()); | 1377 gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->maxScrollOffset()); |
1378 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 1378 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
1379 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1379 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
1380 m_hostImpl->scrollEnd(); | 1380 m_hostImpl->scrollEnd(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 { | 1447 { |
1448 gfx::Size surfaceSize(10, 10); | 1448 gfx::Size surfaceSize(10, 10); |
1449 scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); | 1449 scoped_ptr<LayerImpl> root = LayerImpl::create(m_hostImpl->activeTree(), 1); |
1450 root->setBounds(surfaceSize); | 1450 root->setBounds(surfaceSize); |
1451 root->setContentBounds(surfaceSize); | 1451 root->setContentBounds(surfaceSize); |
1452 // Also mark the root scrollable so it becomes the root scroll layer. | 1452 // Also mark the root scrollable so it becomes the root scroll layer. |
1453 root->setScrollable(true); | 1453 root->setScrollable(true); |
1454 int scrollLayerId = 2; | 1454 int scrollLayerId = 2; |
1455 root->addChild(createScrollableLayer(scrollLayerId, surfaceSize)); | 1455 root->addChild(createScrollableLayer(scrollLayerId, surfaceSize)); |
1456 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 1456 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
1457 m_hostImpl->activeTree()->FindRootScrollLayer(); | 1457 m_hostImpl->activeTree()->DidBecomeActive(); |
1458 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); | 1458 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
1459 initializeRendererAndDrawFrame(); | 1459 initializeRendererAndDrawFrame(); |
1460 | 1460 |
1461 LayerImpl* child = m_hostImpl->rootLayer()->children()[0]; | 1461 LayerImpl* child = m_hostImpl->rootLayer()->children()[0]; |
1462 | 1462 |
1463 gfx::Vector2d scrollDelta(0, 10); | 1463 gfx::Vector2d scrollDelta(0, 10); |
1464 gfx::Vector2d expectedScrollDelta(scrollDelta); | 1464 gfx::Vector2d expectedScrollDelta(scrollDelta); |
1465 gfx::Vector2d expectedMaxScroll(child->maxScrollOffset()); | 1465 gfx::Vector2d expectedMaxScroll(child->maxScrollOffset()); |
1466 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 1466 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
1467 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1467 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
(...skipping 29 matching lines...) Expand all Loading... |
1497 | 1497 |
1498 scoped_ptr<LayerImpl> grandChild = createScrollableLayer(3, surfaceSize); | 1498 scoped_ptr<LayerImpl> grandChild = createScrollableLayer(3, surfaceSize); |
1499 grandChild->setScrollOffset(gfx::Vector2d(0, 5)); | 1499 grandChild->setScrollOffset(gfx::Vector2d(0, 5)); |
1500 | 1500 |
1501 scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); | 1501 scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); |
1502 child->setScrollOffset(gfx::Vector2d(3, 0)); | 1502 child->setScrollOffset(gfx::Vector2d(3, 0)); |
1503 child->addChild(grandChild.Pass()); | 1503 child->addChild(grandChild.Pass()); |
1504 | 1504 |
1505 root->addChild(child.Pass()); | 1505 root->addChild(child.Pass()); |
1506 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 1506 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
1507 m_hostImpl->activeTree()->FindRootScrollLayer(); | 1507 m_hostImpl->activeTree()->DidBecomeActive(); |
1508 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); | 1508 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
1509 initializeRendererAndDrawFrame(); | 1509 initializeRendererAndDrawFrame(); |
1510 { | 1510 { |
1511 gfx::Vector2d scrollDelta(-8, -7); | 1511 gfx::Vector2d scrollDelta(-8, -7); |
1512 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::
Wheel), InputHandlerClient::ScrollStarted); | 1512 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::
Wheel), InputHandlerClient::ScrollStarted); |
1513 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1513 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
1514 m_hostImpl->scrollEnd(); | 1514 m_hostImpl->scrollEnd(); |
1515 | 1515 |
1516 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDelt
as(); | 1516 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDelt
as(); |
1517 | 1517 |
1518 // The grand child should have scrolled up to its limit. | 1518 // The grand child should have scrolled up to its limit. |
1519 LayerImpl* child = m_hostImpl->rootLayer()->children()[0]; | 1519 LayerImpl* child = m_hostImpl->rootLayer()->children()[0]; |
1520 LayerImpl* grandChild = child->children()[0]; | 1520 LayerImpl* grandChild = child->children()[0]; |
1521 expectContains(*scrollInfo.get(), grandChild->id(), gfx::Vector2d(0, -5)
); | 1521 expectContains(*scrollInfo.get(), grandChild->id(), gfx::Vector2d(0, -5)
); |
1522 | 1522 |
1523 // The child should have only scrolled on the other axis. | 1523 // The child should have only scrolled on the other axis. |
1524 expectContains(*scrollInfo.get(), child->id(), gfx::Vector2d(-3, 0)); | 1524 expectContains(*scrollInfo.get(), child->id(), gfx::Vector2d(-3, 0)); |
1525 } | 1525 } |
1526 } | 1526 } |
1527 | 1527 |
1528 TEST_P(LayerTreeHostImplTest, scrollEventBubbling) | 1528 TEST_P(LayerTreeHostImplTest, scrollEventBubbling) |
1529 { | 1529 { |
1530 // When we try to scroll a non-scrollable child layer, the scroll delta | 1530 // When we try to scroll a non-scrollable child layer, the scroll delta |
1531 // should be applied to one of its ancestors if possible. | 1531 // should be applied to one of its ancestors if possible. |
1532 gfx::Size surfaceSize(10, 10); | 1532 gfx::Size surfaceSize(10, 10); |
1533 scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize); | 1533 gfx::Size contentSize(20, 20); |
1534 scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize); | 1534 scoped_ptr<LayerImpl> root = createScrollableLayer(1, contentSize); |
| 1535 scoped_ptr<LayerImpl> child = createScrollableLayer(2, contentSize); |
1535 | 1536 |
1536 child->setScrollable(false); | 1537 child->setScrollable(false); |
1537 root->addChild(child.Pass()); | 1538 root->addChild(child.Pass()); |
1538 | 1539 |
1539 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 1540 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
1540 m_hostImpl->activeTree()->FindRootScrollLayer(); | 1541 m_hostImpl->activeTree()->DidBecomeActive(); |
1541 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); | 1542 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
1542 initializeRendererAndDrawFrame(); | 1543 initializeRendererAndDrawFrame(); |
1543 { | 1544 { |
1544 gfx::Vector2d scrollDelta(0, 4); | 1545 gfx::Vector2d scrollDelta(0, 4); |
1545 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::
Wheel), InputHandlerClient::ScrollStarted); | 1546 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::
Wheel), InputHandlerClient::ScrollStarted); |
1546 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); | 1547 m_hostImpl->scrollBy(gfx::Point(), scrollDelta); |
1547 m_hostImpl->scrollEnd(); | 1548 m_hostImpl->scrollEnd(); |
1548 | 1549 |
1549 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDelt
as(); | 1550 scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDelt
as(); |
1550 | 1551 |
1551 // Only the root should have scrolled. | 1552 // Only the root should have scrolled. |
1552 ASSERT_EQ(scrollInfo->scrolls.size(), 1u); | 1553 ASSERT_EQ(scrollInfo->scrolls.size(), 1u); |
1553 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), scrollD
elta); | 1554 expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), scrollD
elta); |
1554 } | 1555 } |
1555 } | 1556 } |
1556 | 1557 |
1557 TEST_P(LayerTreeHostImplTest, scrollBeforeRedraw) | 1558 TEST_P(LayerTreeHostImplTest, scrollBeforeRedraw) |
1558 { | 1559 { |
1559 gfx::Size surfaceSize(10, 10); | 1560 gfx::Size surfaceSize(10, 10); |
1560 m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(1, surfaceSize)
); | 1561 m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(1, surfaceSize)
); |
1561 m_hostImpl->activeTree()->FindRootScrollLayer(); | 1562 m_hostImpl->activeTree()->DidBecomeActive(); |
1562 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); | 1563 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); |
1563 | 1564 |
1564 // Draw one frame and then immediately rebuild the layer tree to mimic a tre
e synchronization. | 1565 // Draw one frame and then immediately rebuild the layer tree to mimic a tre
e synchronization. |
1565 initializeRendererAndDrawFrame(); | 1566 initializeRendererAndDrawFrame(); |
1566 m_hostImpl->activeTree()->DetachLayerTree(); | 1567 m_hostImpl->activeTree()->DetachLayerTree(); |
1567 m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(2, surfaceSize)
); | 1568 m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(2, surfaceSize)
); |
1568 m_hostImpl->activeTree()->FindRootScrollLayer(); | 1569 m_hostImpl->activeTree()->DidBecomeActive(); |
1569 | 1570 |
1570 // Scrolling should still work even though we did not draw yet. | 1571 // Scrolling should still work even though we did not draw yet. |
1571 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); | 1572 EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Whee
l), InputHandlerClient::ScrollStarted); |
1572 } | 1573 } |
1573 | 1574 |
1574 TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) | 1575 TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer) |
1575 { | 1576 { |
1576 setupScrollAndContentsLayers(gfx::Size(100, 100)); | 1577 setupScrollAndContentsLayers(gfx::Size(100, 100)); |
1577 | 1578 |
1578 // Rotate the root layer 90 degrees counter-clockwise about its center. | 1579 // Rotate the root layer 90 degrees counter-clockwise about its center. |
(...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4032 | 4033 |
4033 gfx::Size layoutSurfaceSize(10, 20); | 4034 gfx::Size layoutSurfaceSize(10, 20); |
4034 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), | 4035 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), |
4035 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); | 4036 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); |
4036 float pageScale = 2; | 4037 float pageScale = 2; |
4037 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); | 4038 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); |
4038 // For this test we want to force scrolls to only pan the pinchZoomViewport | 4039 // For this test we want to force scrolls to only pan the pinchZoomViewport |
4039 // and not the document, we can verify commit/redraw are requested. | 4040 // and not the document, we can verify commit/redraw are requested. |
4040 root->setMaxScrollOffset(gfx::Vector2d()); | 4041 root->setMaxScrollOffset(gfx::Vector2d()); |
4041 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 4042 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
4042 m_hostImpl->activeTree()->FindRootScrollLayer(); | 4043 m_hostImpl->activeTree()->DidBecomeActive(); |
4043 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); | 4044 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); |
4044 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); | 4045 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); |
4045 initializeRendererAndDrawFrame(); | 4046 initializeRendererAndDrawFrame(); |
4046 | 4047 |
4047 // Set new page scale on impl thread by pinching. | 4048 // Set new page scale on impl thread by pinching. |
4048 m_hostImpl->pinchGestureBegin(); | 4049 m_hostImpl->pinchGestureBegin(); |
4049 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); | 4050 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); |
4050 m_hostImpl->pinchGestureEnd(); | 4051 m_hostImpl->pinchGestureEnd(); |
4051 drawOneFrame(); | 4052 drawOneFrame(); |
4052 | 4053 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 | 4106 |
4106 gfx::Size layoutSurfaceSize(10, 20); | 4107 gfx::Size layoutSurfaceSize(10, 20); |
4107 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), | 4108 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), |
4108 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); | 4109 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); |
4109 float pageScale = 2; | 4110 float pageScale = 2; |
4110 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); | 4111 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); |
4111 // For this test we want to force scrolls to move the pinchZoomViewport so | 4112 // For this test we want to force scrolls to move the pinchZoomViewport so |
4112 // we can see the scroll component on the implTransform. | 4113 // we can see the scroll component on the implTransform. |
4113 root->setMaxScrollOffset(gfx::Vector2d()); | 4114 root->setMaxScrollOffset(gfx::Vector2d()); |
4114 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 4115 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
4115 m_hostImpl->activeTree()->FindRootScrollLayer(); | 4116 m_hostImpl->activeTree()->DidBecomeActive(); |
4116 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); | 4117 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); |
4117 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); | 4118 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); |
4118 initializeRendererAndDrawFrame(); | 4119 initializeRendererAndDrawFrame(); |
4119 | 4120 |
4120 // Set new page scale on impl thread by pinching. | 4121 // Set new page scale on impl thread by pinching. |
4121 m_hostImpl->pinchGestureBegin(); | 4122 m_hostImpl->pinchGestureBegin(); |
4122 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); | 4123 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); |
4123 m_hostImpl->pinchGestureEnd(); | 4124 m_hostImpl->pinchGestureEnd(); |
4124 drawOneFrame(); | 4125 drawOneFrame(); |
4125 | 4126 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4190 | 4191 |
4191 gfx::Size layoutSurfaceSize(10, 20); | 4192 gfx::Size layoutSurfaceSize(10, 20); |
4192 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), | 4193 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), |
4193 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); | 4194 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); |
4194 float pageScale = 2; | 4195 float pageScale = 2; |
4195 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); | 4196 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); |
4196 // For this test we want to scrolls to move both the document and the | 4197 // For this test we want to scrolls to move both the document and the |
4197 // pinchZoomViewport so we can see some scroll component on the implTransfor
m. | 4198 // pinchZoomViewport so we can see some scroll component on the implTransfor
m. |
4198 root->setMaxScrollOffset(gfx::Vector2d(3, 4)); | 4199 root->setMaxScrollOffset(gfx::Vector2d(3, 4)); |
4199 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 4200 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
4200 m_hostImpl->activeTree()->FindRootScrollLayer(); | 4201 m_hostImpl->activeTree()->DidBecomeActive(); |
4201 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); | 4202 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); |
4202 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); | 4203 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); |
4203 initializeRendererAndDrawFrame(); | 4204 initializeRendererAndDrawFrame(); |
4204 | 4205 |
4205 // Set new page scale on impl thread by pinching. | 4206 // Set new page scale on impl thread by pinching. |
4206 m_hostImpl->pinchGestureBegin(); | 4207 m_hostImpl->pinchGestureBegin(); |
4207 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); | 4208 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); |
4208 m_hostImpl->pinchGestureEnd(); | 4209 m_hostImpl->pinchGestureEnd(); |
4209 drawOneFrame(); | 4210 drawOneFrame(); |
4210 | 4211 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4314 | 4315 |
4315 gfx::Size layoutSurfaceSize(10, 20); | 4316 gfx::Size layoutSurfaceSize(10, 20); |
4316 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), | 4317 gfx::Size deviceSurfaceSize(layoutSurfaceSize.width() * static_cast<int>(dev
iceScaleFactor), |
4317 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); | 4318 layoutSurfaceSize.height() * static_cast<int>(de
viceScaleFactor)); |
4318 float pageScale = 2; | 4319 float pageScale = 2; |
4319 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); | 4320 scoped_ptr<LayerImpl> root = createScrollableLayer(1, layoutSurfaceSize); |
4320 // For this test we want to scrolls to move both the document and the | 4321 // For this test we want to scrolls to move both the document and the |
4321 // pinchZoomViewport so we can see some scroll component on the implTransfor
m. | 4322 // pinchZoomViewport so we can see some scroll component on the implTransfor
m. |
4322 root->setMaxScrollOffset(gfx::Vector2d(3, 4)); | 4323 root->setMaxScrollOffset(gfx::Vector2d(3, 4)); |
4323 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); | 4324 m_hostImpl->activeTree()->SetRootLayer(root.Pass()); |
4324 m_hostImpl->activeTree()->FindRootScrollLayer(); | 4325 m_hostImpl->activeTree()->DidBecomeActive(); |
4325 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); | 4326 m_hostImpl->setViewportSize(layoutSurfaceSize, deviceSurfaceSize); |
4326 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); | 4327 m_hostImpl->setPageScaleFactorAndLimits(1, 1, pageScale); |
4327 initializeRendererAndDrawFrame(); | 4328 initializeRendererAndDrawFrame(); |
4328 | 4329 |
4329 // Set new page scale on impl thread by pinching. | 4330 // Set new page scale on impl thread by pinching. |
4330 m_hostImpl->pinchGestureBegin(); | 4331 m_hostImpl->pinchGestureBegin(); |
4331 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); | 4332 m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point()); |
4332 m_hostImpl->pinchGestureEnd(); | 4333 m_hostImpl->pinchGestureEnd(); |
4333 drawOneFrame(); | 4334 drawOneFrame(); |
4334 | 4335 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4691 m_hostImpl->didDrawAllLayers(frame); | 4692 m_hostImpl->didDrawAllLayers(frame); |
4692 } | 4693 } |
4693 } | 4694 } |
4694 | 4695 |
4695 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, | 4696 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, |
4696 LayerTreeHostImplTest, | 4697 LayerTreeHostImplTest, |
4697 ::testing::Values(false, true)); | 4698 ::testing::Values(false, true)); |
4698 | 4699 |
4699 } // namespace | 4700 } // namespace |
4700 } // namespace cc | 4701 } // namespace cc |
OLD | NEW |