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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerTreeHostCommon.h" | 7 #include "CCLayerTreeHostCommon.h" |
8 | 8 |
9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
10 #include "CCGeometryTestUtils.h" | 10 #include "CCGeometryTestUtils.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 | 53 |
54 void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) | 54 void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer) |
55 { | 55 { |
56 WebTransformationMatrix identityMatrix; | 56 WebTransformationMatrix identityMatrix; |
57 Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; | 57 Vector<RefPtr<LayerChromium> > dummyRenderSurfaceLayerList; |
58 int dummyMaxTextureSize = 512; | 58 int dummyMaxTextureSize = 512; |
59 | 59 |
60 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 60 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
61 ASSERT(!rootLayer->bounds().isEmpty()); | 61 ASSERT(!rootLayer->bounds().isEmpty()); |
62 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(
), 1, dummyMaxTextureSize, dummyRenderSurfaceLayerList); | 62 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(
), 1, 1, dummyMaxTextureSize, dummyRenderSurfaceLayerList); |
63 CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList); | 63 CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList); |
64 } | 64 } |
65 | 65 |
66 void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer) | 66 void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer) |
67 { | 67 { |
68 // Note: this version skips layer sorting. | 68 // Note: this version skips layer sorting. |
69 | 69 |
70 WebTransformationMatrix identityMatrix; | 70 WebTransformationMatrix identityMatrix; |
71 Vector<CCLayerImpl*> dummyRenderSurfaceLayerList; | 71 Vector<CCLayerImpl*> dummyRenderSurfaceLayerList; |
72 int dummyMaxTextureSize = 512; | 72 int dummyMaxTextureSize = 512; |
73 | 73 |
74 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 74 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
75 ASSERT(!rootLayer->bounds().isEmpty()); | 75 ASSERT(!rootLayer->bounds().isEmpty()); |
76 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(
), 1, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); | 76 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, rootLayer->bounds(
), 1, 1, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); |
77 CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList); | 77 CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList); |
78 } | 78 } |
79 | 79 |
80 WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix&
mat) | 80 WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix&
mat) |
81 { | 81 { |
82 WebTransformationMatrix ret = mat; | 82 WebTransformationMatrix ret = mat; |
83 ret.setM13(0); | 83 ret.setM13(0); |
84 ret.setM23(0); | 84 ret.setM23(0); |
85 ret.setM31(0); | 85 ret.setM31(0); |
86 ret.setM32(0); | 86 ret.setM32(0); |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); | 631 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); |
632 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); | 632 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); |
633 | 633 |
634 parent->addChild(renderSurface1); | 634 parent->addChild(renderSurface1); |
635 parent->setMasksToBounds(true); | 635 parent->setMasksToBounds(true); |
636 renderSurface1->addChild(child); | 636 renderSurface1->addChild(child); |
637 renderSurface1->setForceRenderSurface(true); | 637 renderSurface1->setForceRenderSurface(true); |
638 | 638 |
639 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 639 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
640 int dummyMaxTextureSize = 512; | 640 int dummyMaxTextureSize = 512; |
641 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 641 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
642 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 642 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
643 | 643 |
644 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate | 644 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate |
645 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible | 645 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible |
646 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). | 646 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). |
647 ASSERT_TRUE(parent->renderSurface()); | 647 ASSERT_TRUE(parent->renderSurface()); |
648 ASSERT_FALSE(renderSurface1->renderSurface()); | 648 ASSERT_FALSE(renderSurface1->renderSurface()); |
649 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 649 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
650 } | 650 } |
651 | 651 |
652 TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) | 652 TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) |
653 { | 653 { |
654 RefPtr<LayerChromium> parent = LayerChromium::create(); | 654 RefPtr<LayerChromium> parent = LayerChromium::create(); |
655 RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); | 655 RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); |
656 RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromi
umWithForcedDrawsContent()); | 656 RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromi
umWithForcedDrawsContent()); |
657 | 657 |
658 const WebTransformationMatrix identityMatrix; | 658 const WebTransformationMatrix identityMatrix; |
659 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); | 659 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); |
660 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); | 660 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); |
661 | 661 |
662 parent->addChild(renderSurface1); | 662 parent->addChild(renderSurface1); |
663 renderSurface1->addChild(child); | 663 renderSurface1->addChild(child); |
664 renderSurface1->setForceRenderSurface(true); | 664 renderSurface1->setForceRenderSurface(true); |
665 renderSurface1->setOpacity(0); | 665 renderSurface1->setOpacity(0); |
666 | 666 |
667 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 667 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
668 int dummyMaxTextureSize = 512; | 668 int dummyMaxTextureSize = 512; |
669 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 669 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
670 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 670 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
671 | 671 |
672 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. | 672 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. |
673 // Also, the drawable content rect should not have been extended by the chil
dren. | 673 // Also, the drawable content rect should not have been extended by the chil
dren. |
674 ASSERT_TRUE(parent->renderSurface()); | 674 ASSERT_TRUE(parent->renderSurface()); |
675 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); | 675 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); |
676 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 676 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
677 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 677 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
678 EXPECT_EQ(IntRect(), parent->drawableContentRect()); | 678 EXPECT_EQ(IntRect(), parent->drawableContentRect()); |
679 } | 679 } |
(...skipping 12 matching lines...) Expand all Loading... |
692 | 692 |
693 parent->addChild(renderSurface1); | 693 parent->addChild(renderSurface1); |
694 renderSurface1->addChild(child); | 694 renderSurface1->addChild(child); |
695 | 695 |
696 // Sanity check before the actual test | 696 // Sanity check before the actual test |
697 EXPECT_FALSE(parent->renderSurface()); | 697 EXPECT_FALSE(parent->renderSurface()); |
698 EXPECT_FALSE(renderSurface1->renderSurface()); | 698 EXPECT_FALSE(renderSurface1->renderSurface()); |
699 | 699 |
700 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 700 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
701 int dummyMaxTextureSize = 512; | 701 int dummyMaxTextureSize = 512; |
702 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 702 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
703 | 703 |
704 // The root layer always creates a renderSurface | 704 // The root layer always creates a renderSurface |
705 EXPECT_TRUE(parent->renderSurface()); | 705 EXPECT_TRUE(parent->renderSurface()); |
706 EXPECT_TRUE(renderSurface1->renderSurface()); | 706 EXPECT_TRUE(renderSurface1->renderSurface()); |
707 EXPECT_EQ(2U, renderSurfaceLayerList.size()); | 707 EXPECT_EQ(2U, renderSurfaceLayerList.size()); |
708 | 708 |
709 renderSurfaceLayerList.clear(); | 709 renderSurfaceLayerList.clear(); |
710 renderSurface1->setForceRenderSurface(false); | 710 renderSurface1->setForceRenderSurface(false); |
711 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 711 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
712 EXPECT_TRUE(parent->renderSurface()); | 712 EXPECT_TRUE(parent->renderSurface()); |
713 EXPECT_FALSE(renderSurface1->renderSurface()); | 713 EXPECT_FALSE(renderSurface1->renderSurface()); |
714 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 714 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
715 } | 715 } |
716 | 716 |
717 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDirectContainer) | 717 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDirectContainer) |
718 { | 718 { |
719 // This test checks for correct scroll compensation when the fixed-position
container | 719 // This test checks for correct scroll compensation when the fixed-position
container |
720 // is the direct parent of the fixed-position layer. | 720 // is the direct parent of the fixed-position layer. |
721 | 721 |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix
, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); | 1315 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix
, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); |
1316 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); | 1316 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); |
1317 | 1317 |
1318 child->setMasksToBounds(true); | 1318 child->setMasksToBounds(true); |
1319 child->setOpacity(0.4f); | 1319 child->setOpacity(0.4f); |
1320 grandChild->setOpacity(0.5); | 1320 grandChild->setOpacity(0.5); |
1321 greatGrandChild->setOpacity(0.4f); | 1321 greatGrandChild->setOpacity(0.4f); |
1322 | 1322 |
1323 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 1323 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
1324 int dummyMaxTextureSize = 512; | 1324 int dummyMaxTextureSize = 512; |
1325 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1325 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
1326 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 1326 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
1327 | 1327 |
1328 | 1328 |
1329 ASSERT_EQ(2U, renderSurfaceLayerList.size()); | 1329 ASSERT_EQ(2U, renderSurfaceLayerList.size()); |
1330 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1330 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
1331 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); | 1331 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); |
1332 } | 1332 } |
1333 | 1333 |
1334 TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) | 1334 TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) |
1335 { | 1335 { |
(...skipping 26 matching lines...) Expand all Loading... |
1362 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); | 1362 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); |
1363 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, FloatPoint(0, 0), FloatPoint(200, 200), IntSize(10, 10), false); | 1363 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, FloatPoint(0, 0), FloatPoint(200, 200), IntSize(10, 10), false); |
1364 setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix,
FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); | 1364 setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix,
FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false); |
1365 | 1365 |
1366 parent->setMasksToBounds(true); | 1366 parent->setMasksToBounds(true); |
1367 child->setOpacity(0.4f); | 1367 child->setOpacity(0.4f); |
1368 grandChild->setOpacity(0.4f); | 1368 grandChild->setOpacity(0.4f); |
1369 | 1369 |
1370 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 1370 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
1371 int dummyMaxTextureSize = 512; | 1371 int dummyMaxTextureSize = 512; |
1372 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1372 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
1373 | 1373 |
1374 // Without an animation, we should cull child and grandChild from the render
SurfaceLayerList. | 1374 // Without an animation, we should cull child and grandChild from the render
SurfaceLayerList. |
1375 ASSERT_EQ(1U, renderSurfaceLayerList.size()); | 1375 ASSERT_EQ(1U, renderSurfaceLayerList.size()); |
1376 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1376 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
1377 | 1377 |
1378 // Now put an animating transform on child. | 1378 // Now put an animating transform on child. |
1379 addAnimatedTransformToController(*child->layerAnimationController(), 10, 30,
0); | 1379 addAnimatedTransformToController(*child->layerAnimationController(), 10, 30,
0); |
1380 | 1380 |
1381 parent->clearRenderSurface(); | 1381 parent->clearRenderSurface(); |
1382 child->clearRenderSurface(); | 1382 child->clearRenderSurface(); |
1383 grandChild->clearRenderSurface(); | 1383 grandChild->clearRenderSurface(); |
1384 renderSurfaceLayerList.clear(); | 1384 renderSurfaceLayerList.clear(); |
1385 | 1385 |
1386 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1386 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
1387 | 1387 |
1388 // With an animating transform, we should keep child and grandChild in the r
enderSurfaceLayerList. | 1388 // With an animating transform, we should keep child and grandChild in the r
enderSurfaceLayerList. |
1389 ASSERT_EQ(3U, renderSurfaceLayerList.size()); | 1389 ASSERT_EQ(3U, renderSurfaceLayerList.size()); |
1390 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1390 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
1391 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); | 1391 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); |
1392 EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); | 1392 EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); |
1393 } | 1393 } |
1394 | 1394 |
1395 TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) | 1395 TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) |
1396 { | 1396 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 | 1428 |
1429 // Force everyone to be a render surface. | 1429 // Force everyone to be a render surface. |
1430 child->setOpacity(0.4f); | 1430 child->setOpacity(0.4f); |
1431 grandChild1->setOpacity(0.5); | 1431 grandChild1->setOpacity(0.5); |
1432 grandChild2->setOpacity(0.5); | 1432 grandChild2->setOpacity(0.5); |
1433 grandChild3->setOpacity(0.5); | 1433 grandChild3->setOpacity(0.5); |
1434 grandChild4->setOpacity(0.5); | 1434 grandChild4->setOpacity(0.5); |
1435 | 1435 |
1436 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 1436 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
1437 int dummyMaxTextureSize = 512; | 1437 int dummyMaxTextureSize = 512; |
1438 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1438 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
1439 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 1439 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
1440 | 1440 |
1441 EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawab
leContentRect()); | 1441 EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawab
leContentRect()); |
1442 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); | 1442 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); |
1443 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); | 1443 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); |
1444 EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); | 1444 EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); |
1445 } | 1445 } |
1446 | 1446 |
1447 TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) | 1447 TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) |
1448 { | 1448 { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 | 1494 |
1495 // Force everyone to be a render surface. | 1495 // Force everyone to be a render surface. |
1496 child->setOpacity(0.4f); | 1496 child->setOpacity(0.4f); |
1497 grandChild1->setOpacity(0.5); | 1497 grandChild1->setOpacity(0.5); |
1498 grandChild2->setOpacity(0.5); | 1498 grandChild2->setOpacity(0.5); |
1499 grandChild3->setOpacity(0.5); | 1499 grandChild3->setOpacity(0.5); |
1500 grandChild4->setOpacity(0.5); | 1500 grandChild4->setOpacity(0.5); |
1501 | 1501 |
1502 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 1502 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
1503 int dummyMaxTextureSize = 512; | 1503 int dummyMaxTextureSize = 512; |
1504 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1504 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
1505 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 1505 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
1506 | 1506 |
1507 ASSERT_TRUE(grandChild1->renderSurface()); | 1507 ASSERT_TRUE(grandChild1->renderSurface()); |
1508 ASSERT_TRUE(grandChild2->renderSurface()); | 1508 ASSERT_TRUE(grandChild2->renderSurface()); |
1509 ASSERT_TRUE(grandChild3->renderSurface()); | 1509 ASSERT_TRUE(grandChild3->renderSurface()); |
1510 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. | 1510 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. |
1511 | 1511 |
1512 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. | 1512 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. |
1513 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->render
Surface()->clipRect()); | 1513 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->render
Surface()->clipRect()); |
1514 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->render
Surface()->clipRect()); | 1514 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->render
Surface()->clipRect()); |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2272 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2273 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2273 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2274 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2274 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2275 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 10
0), false); | 2275 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 10
0), false); |
2276 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); | 2276 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); |
2277 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); | 2277 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); |
2278 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100)
, false); | 2278 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100)
, false); |
2279 | 2279 |
2280 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 2280 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
2281 int dummyMaxTextureSize = 512; | 2281 int dummyMaxTextureSize = 512; |
2282 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2282 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
2283 | 2283 |
2284 // Verify which renderSurfaces were created. | 2284 // Verify which renderSurfaces were created. |
2285 EXPECT_FALSE(frontFacingChild->renderSurface()); | 2285 EXPECT_FALSE(frontFacingChild->renderSurface()); |
2286 EXPECT_FALSE(backFacingChild->renderSurface()); | 2286 EXPECT_FALSE(backFacingChild->renderSurface()); |
2287 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2287 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
2288 EXPECT_TRUE(backFacingSurface->renderSurface()); | 2288 EXPECT_TRUE(backFacingSurface->renderSurface()); |
2289 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); | 2289 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); |
2290 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); | 2290 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); |
2291 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); | 2291 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); |
2292 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); | 2292 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2371 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2372 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surf
ace transform style is preserve-3d. | 2372 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surf
ace transform style is preserve-3d. |
2373 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surfa
ce transform style is preserve-3d. | 2373 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surfa
ce transform style is preserve-3d. |
2374 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 10
0), false); | 2374 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 10
0), false); |
2375 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); | 2375 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); |
2376 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); | 2376 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100
), false); |
2377 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100)
, false); | 2377 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100)
, false); |
2378 | 2378 |
2379 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 2379 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
2380 int dummyMaxTextureSize = 512; | 2380 int dummyMaxTextureSize = 512; |
2381 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2381 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
2382 | 2382 |
2383 // Verify which renderSurfaces were created. | 2383 // Verify which renderSurfaces were created. |
2384 EXPECT_FALSE(frontFacingChild->renderSurface()); | 2384 EXPECT_FALSE(frontFacingChild->renderSurface()); |
2385 EXPECT_FALSE(backFacingChild->renderSurface()); | 2385 EXPECT_FALSE(backFacingChild->renderSurface()); |
2386 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2386 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
2387 EXPECT_FALSE(backFacingSurface->renderSurface()); | 2387 EXPECT_FALSE(backFacingSurface->renderSurface()); |
2388 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); | 2388 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); |
2389 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); | 2389 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); |
2390 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); | 2390 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); |
2391 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); | 2391 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2451 | 2451 |
2452 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2452 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2453 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2453 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2454 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2454 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2455 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2455 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2456 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2456 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2457 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2457 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2458 | 2458 |
2459 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 2459 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
2460 int dummyMaxTextureSize = 512; | 2460 int dummyMaxTextureSize = 512; |
2461 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2461 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
2462 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2462 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2463 | 2463 |
2464 EXPECT_FALSE(child->renderSurface()); | 2464 EXPECT_FALSE(child->renderSurface()); |
2465 EXPECT_TRUE(animatingSurface->renderSurface()); | 2465 EXPECT_TRUE(animatingSurface->renderSurface()); |
2466 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); | 2466 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); |
2467 EXPECT_FALSE(animatingChild->renderSurface()); | 2467 EXPECT_FALSE(animatingChild->renderSurface()); |
2468 EXPECT_FALSE(child2->renderSurface()); | 2468 EXPECT_FALSE(child2->renderSurface()); |
2469 | 2469 |
2470 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. | 2470 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. |
2471 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 2471 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 backfaceMatrix.translate(-50, -50); | 2518 backfaceMatrix.translate(-50, -50); |
2519 | 2519 |
2520 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // parent transform
style is preserve3d. | 2520 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // parent transform
style is preserve3d. |
2521 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // sur
face transform style is flat. | 2521 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // sur
face transform style is flat. |
2522 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // sur
face transform style is flat. | 2522 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, ident
ityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // sur
face transform style is flat. |
2523 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2523 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2524 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2524 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
2525 | 2525 |
2526 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 2526 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
2527 int dummyMaxTextureSize = 512; | 2527 int dummyMaxTextureSize = 512; |
2528 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2528 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
2529 | 2529 |
2530 // Verify which renderSurfaces were created. | 2530 // Verify which renderSurfaces were created. |
2531 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2531 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
2532 EXPECT_FALSE(backFacingSurface->renderSurface()); // because it should be cu
lled | 2532 EXPECT_FALSE(backFacingSurface->renderSurface()); // because it should be cu
lled |
2533 EXPECT_FALSE(child1->renderSurface()); | 2533 EXPECT_FALSE(child1->renderSurface()); |
2534 EXPECT_FALSE(child2->renderSurface()); | 2534 EXPECT_FALSE(child2->renderSurface()); |
2535 | 2535 |
2536 // Verify the renderSurfaceLayerList. The back-facing surface should be cull
ed. | 2536 // Verify the renderSurfaceLayerList. The back-facing surface should be cull
ed. |
2537 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 2537 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
2538 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 2538 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 | 2572 |
2573 WebTransformationMatrix identityMatrix; | 2573 WebTransformationMatrix identityMatrix; |
2574 FloatPoint anchor(0, 0); | 2574 FloatPoint anchor(0, 0); |
2575 FloatPoint position(0, 0); | 2575 FloatPoint position(0, 0); |
2576 IntSize bounds(100, 100); | 2576 IntSize bounds(100, 100); |
2577 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2577 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
2578 root->setDrawsContent(true); | 2578 root->setDrawsContent(true); |
2579 | 2579 |
2580 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2580 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2581 int dummyMaxTextureSize = 512; | 2581 int dummyMaxTextureSize = 512; |
2582 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2582 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2583 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2583 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2584 | 2584 |
2585 // Sanity check the scenario we just created. | 2585 // Sanity check the scenario we just created. |
2586 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2586 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2587 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2587 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2588 | 2588 |
2589 // Hit testing for a point outside the layer should return a null pointer. | 2589 // Hit testing for a point outside the layer should return a null pointer. |
2590 IntPoint testPoint(101, 101); | 2590 IntPoint testPoint(101, 101); |
2591 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2591 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
2592 EXPECT_FALSE(resultLayer); | 2592 EXPECT_FALSE(resultLayer); |
(...skipping 29 matching lines...) Expand all Loading... |
2622 | 2622 |
2623 WebTransformationMatrix identityMatrix; | 2623 WebTransformationMatrix identityMatrix; |
2624 FloatPoint anchor(0, 0); | 2624 FloatPoint anchor(0, 0); |
2625 FloatPoint position(0, 0); | 2625 FloatPoint position(0, 0); |
2626 IntSize bounds(100, 100); | 2626 IntSize bounds(100, 100); |
2627 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 2627 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
2628 root->setDrawsContent(true); | 2628 root->setDrawsContent(true); |
2629 | 2629 |
2630 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2630 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2631 int dummyMaxTextureSize = 512; | 2631 int dummyMaxTextureSize = 512; |
2632 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2632 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2633 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2633 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2634 | 2634 |
2635 // Sanity check the scenario we just created. | 2635 // Sanity check the scenario we just created. |
2636 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2636 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2637 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2637 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2638 ASSERT_FALSE(root->screenSpaceTransform().isInvertible()); | 2638 ASSERT_FALSE(root->screenSpaceTransform().isInvertible()); |
2639 | 2639 |
2640 // Hit testing any point should not hit the layer. If the invertible matrix
is | 2640 // Hit testing any point should not hit the layer. If the invertible matrix
is |
2641 // accidentally ignored and treated like an identity, then the hit testing w
ill | 2641 // accidentally ignored and treated like an identity, then the hit testing w
ill |
2642 // incorrectly hit the layer when it shouldn't. | 2642 // incorrectly hit the layer when it shouldn't. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 | 2677 |
2678 WebTransformationMatrix identityMatrix; | 2678 WebTransformationMatrix identityMatrix; |
2679 FloatPoint anchor(0, 0); | 2679 FloatPoint anchor(0, 0); |
2680 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh
ould correctly know where the layer is located. | 2680 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh
ould correctly know where the layer is located. |
2681 IntSize bounds(100, 100); | 2681 IntSize bounds(100, 100); |
2682 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2682 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
2683 root->setDrawsContent(true); | 2683 root->setDrawsContent(true); |
2684 | 2684 |
2685 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2685 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2686 int dummyMaxTextureSize = 512; | 2686 int dummyMaxTextureSize = 512; |
2687 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2687 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2688 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2688 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2689 | 2689 |
2690 // Sanity check the scenario we just created. | 2690 // Sanity check the scenario we just created. |
2691 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2691 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2692 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2692 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2693 | 2693 |
2694 // Hit testing for a point outside the layer should return a null pointer. | 2694 // Hit testing for a point outside the layer should return a null pointer. |
2695 IntPoint testPoint(49, 49); | 2695 IntPoint testPoint(49, 49); |
2696 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2696 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
2697 EXPECT_FALSE(resultLayer); | 2697 EXPECT_FALSE(resultLayer); |
(...skipping 27 matching lines...) Expand all Loading... |
2725 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); | 2725 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); |
2726 rotation45DegreesAboutCenter.translate(-50, -50); | 2726 rotation45DegreesAboutCenter.translate(-50, -50); |
2727 FloatPoint anchor(0, 0); | 2727 FloatPoint anchor(0, 0); |
2728 FloatPoint position(0, 0); | 2728 FloatPoint position(0, 0); |
2729 IntSize bounds(100, 100); | 2729 IntSize bounds(100, 100); |
2730 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); | 2730 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); |
2731 root->setDrawsContent(true); | 2731 root->setDrawsContent(true); |
2732 | 2732 |
2733 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2733 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2734 int dummyMaxTextureSize = 512; | 2734 int dummyMaxTextureSize = 512; |
2735 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2735 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2736 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2736 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2737 | 2737 |
2738 // Sanity check the scenario we just created. | 2738 // Sanity check the scenario we just created. |
2739 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2739 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2740 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2740 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2741 | 2741 |
2742 // Hit testing for points outside the layer. | 2742 // Hit testing for points outside the layer. |
2743 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 2743 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
2744 IntPoint testPoint(99, 99); | 2744 IntPoint testPoint(99, 99); |
2745 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2745 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2782 translationByZ.translate3d(0, 0, -1); | 2782 translationByZ.translate3d(0, 0, -1); |
2783 | 2783 |
2784 FloatPoint anchor(0, 0); | 2784 FloatPoint anchor(0, 0); |
2785 FloatPoint position(0, 0); | 2785 FloatPoint position(0, 0); |
2786 IntSize bounds(100, 100); | 2786 IntSize bounds(100, 100); |
2787 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); | 2787 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); |
2788 root->setDrawsContent(true); | 2788 root->setDrawsContent(true); |
2789 | 2789 |
2790 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2790 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2791 int dummyMaxTextureSize = 512; | 2791 int dummyMaxTextureSize = 512; |
2792 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2792 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2793 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2793 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2794 | 2794 |
2795 // Sanity check the scenario we just created. | 2795 // Sanity check the scenario we just created. |
2796 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2796 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2797 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2797 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2798 | 2798 |
2799 // Hit testing for points outside the layer. | 2799 // Hit testing for points outside the layer. |
2800 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 2800 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
2801 IntPoint testPoint(24, 24); | 2801 IntPoint testPoint(24, 24); |
2802 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2802 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2847 | 2847 |
2848 // override contentBounds | 2848 // override contentBounds |
2849 testLayer->setContentBounds(IntSize(100, 100)); | 2849 testLayer->setContentBounds(IntSize(100, 100)); |
2850 | 2850 |
2851 testLayer->setDrawsContent(true); | 2851 testLayer->setDrawsContent(true); |
2852 root->addChild(testLayer.release()); | 2852 root->addChild(testLayer.release()); |
2853 } | 2853 } |
2854 | 2854 |
2855 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2855 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2856 int dummyMaxTextureSize = 512; | 2856 int dummyMaxTextureSize = 512; |
2857 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2857 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2858 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2858 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2859 | 2859 |
2860 // Sanity check the scenario we just created. | 2860 // Sanity check the scenario we just created. |
2861 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 2861 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
2862 CCLayerImpl* testLayer = root->children()[0].get(); | 2862 CCLayerImpl* testLayer = root->children()[0].get(); |
2863 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi
bleContentRect()); | 2863 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi
bleContentRect()); |
2864 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2864 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2865 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2865 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2866 | 2866 |
2867 // Hit testing for a point outside the layer should return a null pointer (t
he root layer does not draw content, so it will not be hit tested either). | 2867 // Hit testing for a point outside the layer should return a null pointer (t
he root layer does not draw content, so it will not be hit tested either). |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2912 position = FloatPoint(-50, -50); | 2912 position = FloatPoint(-50, -50); |
2913 bounds = IntSize(300, 300); | 2913 bounds = IntSize(300, 300); |
2914 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 2914 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
2915 child->setDrawsContent(true); | 2915 child->setDrawsContent(true); |
2916 clippingLayer->addChild(child.release()); | 2916 clippingLayer->addChild(child.release()); |
2917 root->addChild(clippingLayer.release()); | 2917 root->addChild(clippingLayer.release()); |
2918 } | 2918 } |
2919 | 2919 |
2920 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2920 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2921 int dummyMaxTextureSize = 512; | 2921 int dummyMaxTextureSize = 512; |
2922 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2922 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2923 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2923 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2924 | 2924 |
2925 // Sanity check the scenario we just created. | 2925 // Sanity check the scenario we just created. |
2926 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2926 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2927 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2927 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2928 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 2928 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
2929 | 2929 |
2930 // Hit testing for a point outside the layer should return a null pointer. | 2930 // Hit testing for a point outside the layer should return a null pointer. |
2931 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 2931 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
2932 IntPoint testPoint(24, 24); | 2932 IntPoint testPoint(24, 24); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); | 3003 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); |
3004 rotatedLeaf->setDrawsContent(true); | 3004 rotatedLeaf->setDrawsContent(true); |
3005 | 3005 |
3006 grandChild->addChild(rotatedLeaf.release()); | 3006 grandChild->addChild(rotatedLeaf.release()); |
3007 child->addChild(grandChild.release()); | 3007 child->addChild(grandChild.release()); |
3008 root->addChild(child.release()); | 3008 root->addChild(child.release()); |
3009 } | 3009 } |
3010 | 3010 |
3011 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3011 Vector<CCLayerImpl*> renderSurfaceLayerList; |
3012 int dummyMaxTextureSize = 512; | 3012 int dummyMaxTextureSize = 512; |
3013 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3013 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
3014 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 3014 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
3015 | 3015 |
3016 // Sanity check the scenario we just created. | 3016 // Sanity check the scenario we just created. |
3017 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. | 3017 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. |
3018 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 3018 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
3019 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); | 3019 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); |
3020 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. | 3020 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. |
3021 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); | 3021 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); |
3022 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); | 3022 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); |
3023 | 3023 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3086 position = FloatPoint(60, 60); // 70, 70 in screen space | 3086 position = FloatPoint(60, 60); // 70, 70 in screen space |
3087 bounds = IntSize(20, 20); | 3087 bounds = IntSize(20, 20); |
3088 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3088 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
3089 child->setDrawsContent(true); | 3089 child->setDrawsContent(true); |
3090 intermediateLayer->addChild(child.release()); | 3090 intermediateLayer->addChild(child.release()); |
3091 root->addChild(intermediateLayer.release()); | 3091 root->addChild(intermediateLayer.release()); |
3092 } | 3092 } |
3093 | 3093 |
3094 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3094 Vector<CCLayerImpl*> renderSurfaceLayerList; |
3095 int dummyMaxTextureSize = 512; | 3095 int dummyMaxTextureSize = 512; |
3096 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3096 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
3097 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 3097 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
3098 | 3098 |
3099 // Sanity check the scenario we just created. | 3099 // Sanity check the scenario we just created. |
3100 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3100 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3101 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3101 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3102 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3102 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
3103 | 3103 |
3104 // Hit testing for a point outside the layer should return a null pointer. | 3104 // Hit testing for a point outside the layer should return a null pointer. |
3105 IntPoint testPoint(69, 69); | 3105 IntPoint testPoint(69, 69); |
3106 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 3106 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3167 root->addChild(child1.release()); | 3167 root->addChild(child1.release()); |
3168 root->addChild(child2.release()); | 3168 root->addChild(child2.release()); |
3169 } | 3169 } |
3170 | 3170 |
3171 CCLayerImpl* child1 = root->children()[0].get(); | 3171 CCLayerImpl* child1 = root->children()[0].get(); |
3172 CCLayerImpl* child2 = root->children()[1].get(); | 3172 CCLayerImpl* child2 = root->children()[1].get(); |
3173 CCLayerImpl* grandChild1 = child1->children()[0].get(); | 3173 CCLayerImpl* grandChild1 = child1->children()[0].get(); |
3174 | 3174 |
3175 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3175 Vector<CCLayerImpl*> renderSurfaceLayerList; |
3176 int dummyMaxTextureSize = 512; | 3176 int dummyMaxTextureSize = 512; |
3177 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3177 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
3178 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 3178 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
3179 | 3179 |
3180 // Sanity check the scenario we just created. | 3180 // Sanity check the scenario we just created. |
3181 ASSERT_TRUE(child1); | 3181 ASSERT_TRUE(child1); |
3182 ASSERT_TRUE(child2); | 3182 ASSERT_TRUE(child2); |
3183 ASSERT_TRUE(grandChild1); | 3183 ASSERT_TRUE(grandChild1); |
3184 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3184 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3185 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); | 3185 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); |
3186 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer | 3186 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer |
3187 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 | 3187 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3276 root->addChild(child1.release()); | 3276 root->addChild(child1.release()); |
3277 root->addChild(child2.release()); | 3277 root->addChild(child2.release()); |
3278 } | 3278 } |
3279 | 3279 |
3280 CCLayerImpl* child1 = root->children()[0].get(); | 3280 CCLayerImpl* child1 = root->children()[0].get(); |
3281 CCLayerImpl* child2 = root->children()[1].get(); | 3281 CCLayerImpl* child2 = root->children()[1].get(); |
3282 CCLayerImpl* grandChild1 = child1->children()[0].get(); | 3282 CCLayerImpl* grandChild1 = child1->children()[0].get(); |
3283 | 3283 |
3284 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3284 Vector<CCLayerImpl*> renderSurfaceLayerList; |
3285 int dummyMaxTextureSize = 512; | 3285 int dummyMaxTextureSize = 512; |
3286 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3286 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
3287 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 3287 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
3288 | 3288 |
3289 // Sanity check the scenario we just created. | 3289 // Sanity check the scenario we just created. |
3290 ASSERT_TRUE(child1); | 3290 ASSERT_TRUE(child1); |
3291 ASSERT_TRUE(child2); | 3291 ASSERT_TRUE(child2); |
3292 ASSERT_TRUE(grandChild1); | 3292 ASSERT_TRUE(grandChild1); |
3293 ASSERT_TRUE(child1->renderSurface()); | 3293 ASSERT_TRUE(child1->renderSurface()); |
3294 ASSERT_TRUE(child2->renderSurface()); | 3294 ASSERT_TRUE(child2->renderSurface()); |
3295 ASSERT_TRUE(grandChild1->renderSurface()); | 3295 ASSERT_TRUE(grandChild1->renderSurface()); |
3296 ASSERT_EQ(4u, renderSurfaceLayerList.size()); | 3296 ASSERT_EQ(4u, renderSurfaceLayerList.size()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3347 virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque
) OVERRIDE { } | 3347 virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque
) OVERRIDE { } |
3348 }; | 3348 }; |
3349 | 3349 |
3350 PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayer
ChromiumClient* delegate) | 3350 PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayer
ChromiumClient* delegate) |
3351 { | 3351 { |
3352 RefPtr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegat
e); | 3352 RefPtr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegat
e); |
3353 toReturn->setIsDrawable(true); | 3353 toReturn->setIsDrawable(true); |
3354 return toReturn.release(); | 3354 return toReturn.release(); |
3355 } | 3355 } |
3356 | 3356 |
| 3357 class NoScaleContentLayerChromium : public ContentLayerChromium |
| 3358 { |
| 3359 public: |
| 3360 static PassRefPtr<NoScaleContentLayerChromium> create(ContentLayerChromiumCl
ient* client) { return adoptRef(new NoScaleContentLayerChromium(client)); } |
| 3361 virtual ~NoScaleContentLayerChromium() { } |
| 3362 |
| 3363 virtual bool needsContentsScale() const OVERRIDE { return false; } |
| 3364 |
| 3365 protected: |
| 3366 explicit NoScaleContentLayerChromium(ContentLayerChromiumClient* client) : C
ontentLayerChromium(client) { } |
| 3367 }; |
| 3368 |
| 3369 PassRefPtr<NoScaleContentLayerChromium> createNoScaleDrawableContentLayerChromiu
m(ContentLayerChromiumClient* delegate) |
| 3370 { |
| 3371 RefPtr<NoScaleContentLayerChromium> toReturn = NoScaleContentLayerChromium::
create(delegate); |
| 3372 toReturn->setIsDrawable(true); |
| 3373 return toReturn.release(); |
| 3374 } |
| 3375 |
3357 TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) | 3376 TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI) |
3358 { | 3377 { |
3359 // Verify draw and screen space transforms of layers not in a surface. | 3378 // Verify draw and screen space transforms of layers not in a surface. |
3360 MockContentLayerChromiumClient delegate; | 3379 MockContentLayerChromiumClient delegate; |
3361 WebTransformationMatrix identityMatrix; | 3380 WebTransformationMatrix identityMatrix; |
3362 | 3381 |
3363 RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&de
legate); | 3382 RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&de
legate); |
3364 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); | 3383 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); |
3365 | 3384 |
3366 RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&del
egate); | 3385 RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&del
egate); |
3367 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); | 3386 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); |
3368 | 3387 |
3369 RefPtr<ContentLayerChromium> childNoScale = createDrawableContentLayerChromi
um(&delegate); | 3388 RefPtr<NoScaleContentLayerChromium> childNoScale = createNoScaleDrawableCont
entLayerChromium(&delegate); |
3370 setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMat
rix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); | 3389 setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMat
rix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); |
3371 | 3390 |
3372 parent->addChild(child); | 3391 parent->addChild(child); |
3373 parent->addChild(childNoScale); | 3392 parent->addChild(childNoScale); |
3374 | 3393 |
3375 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 3394 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
3376 int dummyMaxTextureSize = 512; | 3395 int dummyMaxTextureSize = 512; |
3377 | 3396 |
3378 const double deviceScaleFactor = 2.5; | 3397 const double deviceScaleFactor = 2.5; |
3379 parent->setContentsScale(deviceScaleFactor); | 3398 const double pageScaleFactor = 1; |
3380 child->setContentsScale(deviceScaleFactor); | |
3381 EXPECT_EQ(childNoScale->contentsScale(), 1); | |
3382 | 3399 |
3383 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); | 3400 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerLi
st); |
| 3401 |
| 3402 EXPECT_EQ(deviceScaleFactor * pageScaleFactor, parent->contentsScale()); |
| 3403 EXPECT_EQ(deviceScaleFactor * pageScaleFactor, child->contentsScale()); |
| 3404 EXPECT_EQ(1, childNoScale->contentsScale()); |
3384 | 3405 |
3385 EXPECT_EQ(1u, renderSurfaceLayerList.size()); | 3406 EXPECT_EQ(1u, renderSurfaceLayerList.size()); |
3386 | 3407 |
3387 // Verify parent transforms | 3408 // Verify parent transforms |
3388 WebTransformationMatrix expectedParentTransform; | 3409 WebTransformationMatrix expectedParentTransform; |
3389 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); | 3410 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); |
3390 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); | 3411 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); |
3391 | 3412 |
3392 // Verify results of transformed parent rects | 3413 // Verify results of transformed parent rects |
3393 FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds(
))); | 3414 FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds(
))); |
(...skipping 26 matching lines...) Expand all Loading... |
3420 | 3441 |
3421 // Verify childNoScale transforms | 3442 // Verify childNoScale transforms |
3422 WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform
(); | 3443 WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform
(); |
3423 // All transforms operate on content rects. The child's content rect | 3444 // All transforms operate on content rects. The child's content rect |
3424 // incorporates device scale, but the childNoScale does not; add it here. | 3445 // incorporates device scale, but the childNoScale does not; add it here. |
3425 expectedChildNoScaleTransform.scale(deviceScaleFactor); | 3446 expectedChildNoScaleTransform.scale(deviceScaleFactor); |
3426 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>drawTransform()); | 3447 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>drawTransform()); |
3427 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>screenSpaceTransform()); | 3448 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale-
>screenSpaceTransform()); |
3428 } | 3449 } |
3429 | 3450 |
| 3451 TEST(CCLayerTreeHostCommonTest, verifyContentsScale) |
| 3452 { |
| 3453 MockContentLayerChromiumClient delegate; |
| 3454 WebTransformationMatrix identityMatrix; |
| 3455 |
| 3456 RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&de
legate); |
| 3457 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); |
| 3458 |
| 3459 RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&del
egate); |
| 3460 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); |
| 3461 |
| 3462 RefPtr<NoScaleContentLayerChromium> childNoScale = createNoScaleDrawableCont
entLayerChromium(&delegate); |
| 3463 setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMat
rix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); |
| 3464 |
| 3465 // Page scale should not apply to the parent. |
| 3466 parent->setBoundsContainPageScale(true); |
| 3467 |
| 3468 parent->addChild(child); |
| 3469 parent->addChild(childNoScale); |
| 3470 |
| 3471 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
| 3472 int dummyMaxTextureSize = 512; |
| 3473 |
| 3474 const double deviceScaleFactor = 2.5; |
| 3475 const double pageScaleFactor = 1.5; |
| 3476 |
| 3477 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerLi
st); |
| 3478 |
| 3479 EXPECT_EQ(deviceScaleFactor, parent->contentsScale()); |
| 3480 EXPECT_EQ(deviceScaleFactor * pageScaleFactor, child->contentsScale()); |
| 3481 EXPECT_EQ(1, childNoScale->contentsScale()); |
| 3482 } |
| 3483 |
3430 TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) | 3484 TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) |
3431 { | 3485 { |
3432 MockContentLayerChromiumClient delegate; | 3486 MockContentLayerChromiumClient delegate; |
3433 WebTransformationMatrix identityMatrix; | 3487 WebTransformationMatrix identityMatrix; |
3434 | 3488 |
3435 RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&de
legate); | 3489 RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&de
legate); |
3436 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true); | 3490 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true); |
3437 | 3491 |
3438 RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&del
egate); | 3492 RefPtr<ContentLayerChromium> child = createDrawableContentLayerChromium(&del
egate); |
3439 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); | 3493 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true); |
(...skipping 14 matching lines...) Expand all Loading... |
3454 | 3508 |
3455 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 3509 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
3456 int dummyMaxTextureSize = 512; | 3510 int dummyMaxTextureSize = 512; |
3457 | 3511 |
3458 const double deviceScaleFactor = 1.5; | 3512 const double deviceScaleFactor = 1.5; |
3459 parent->setContentsScale(deviceScaleFactor); | 3513 parent->setContentsScale(deviceScaleFactor); |
3460 child->setContentsScale(deviceScaleFactor); | 3514 child->setContentsScale(deviceScaleFactor); |
3461 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); | 3515 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); |
3462 replica->setContentsScale(deviceScaleFactor); | 3516 replica->setContentsScale(deviceScaleFactor); |
3463 | 3517 |
3464 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), deviceScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList); | 3518 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
3465 | 3519 |
3466 // We should have two render surfaces. The root's render surface and child's | 3520 // We should have two render surfaces. The root's render surface and child's |
3467 // render surface (it needs one because it has a replica layer). | 3521 // render surface (it needs one because it has a replica layer). |
3468 EXPECT_EQ(2u, renderSurfaceLayerList.size()); | 3522 EXPECT_EQ(2u, renderSurfaceLayerList.size()); |
3469 | 3523 |
3470 WebTransformationMatrix expectedParentTransform; | 3524 WebTransformationMatrix expectedParentTransform; |
3471 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); | 3525 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); |
3472 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); | 3526 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); |
3473 | 3527 |
3474 WebTransformationMatrix expectedDrawTransform; | 3528 WebTransformationMatrix expectedDrawTransform; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3525 int nonexistentId = -1; | 3579 int nonexistentId = -1; |
3526 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); | 3580 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); |
3527 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); | 3581 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); |
3528 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); | 3582 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); |
3529 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); | 3583 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); |
3530 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); | 3584 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); |
3531 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); | 3585 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); |
3532 } | 3586 } |
3533 | 3587 |
3534 } // namespace | 3588 } // namespace |
OLD | NEW |