| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer, float
deviceScaleFactor = 1) | 54 void executeCalculateDrawTransformsAndVisibility(LayerChromium* rootLayer, float
deviceScaleFactor = 1) |
| 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 IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceSca
leFactor, rootLayer->bounds().height() * deviceScaleFactor); | 59 IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceSca
leFactor, rootLayer->bounds().height() * deviceScaleFactor); |
| 60 | 60 |
| 61 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 61 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
| 62 ASSERT(!rootLayer->bounds().isEmpty()); | 62 ASSERT(!rootLayer->bounds().isEmpty()); |
| 63 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize
, deviceScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayerList); | 63 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize
, deviceScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayerList); |
| 64 CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList); | |
| 65 } | 64 } |
| 66 | 65 |
| 67 void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer, float d
eviceScaleFactor = 1) | 66 void executeCalculateDrawTransformsAndVisibility(CCLayerImpl* rootLayer, float d
eviceScaleFactor = 1) |
| 68 { | 67 { |
| 69 // Note: this version skips layer sorting. | 68 // Note: this version skips layer sorting. |
| 70 | 69 |
| 71 WebTransformationMatrix identityMatrix; | 70 WebTransformationMatrix identityMatrix; |
| 72 Vector<CCLayerImpl*> dummyRenderSurfaceLayerList; | 71 Vector<CCLayerImpl*> dummyRenderSurfaceLayerList; |
| 73 int dummyMaxTextureSize = 512; | 72 int dummyMaxTextureSize = 512; |
| 74 IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceSca
leFactor, rootLayer->bounds().height() * deviceScaleFactor); | 73 IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceSca
leFactor, rootLayer->bounds().height() * deviceScaleFactor); |
| 75 | 74 |
| 76 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 75 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
| 77 ASSERT(!rootLayer->bounds().isEmpty()); | 76 ASSERT(!rootLayer->bounds().isEmpty()); |
| 78 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize
, deviceScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); | 77 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize
, deviceScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList); |
| 79 CCLayerTreeHostCommon::calculateVisibleRects(dummyRenderSurfaceLayerList); | |
| 80 } | 78 } |
| 81 | 79 |
| 82 WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix&
mat) | 80 WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix&
mat) |
| 83 { | 81 { |
| 84 WebTransformationMatrix ret = mat; | 82 WebTransformationMatrix ret = mat; |
| 85 ret.setM13(0); | 83 ret.setM13(0); |
| 86 ret.setM23(0); | 84 ret.setM23(0); |
| 87 ret.setM31(0); | 85 ret.setM31(0); |
| 88 ret.setM32(0); | 86 ret.setM32(0); |
| 89 ret.setM33(1); | 87 ret.setM33(1); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); | 646 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false); |
| 649 | 647 |
| 650 parent->addChild(renderSurface1); | 648 parent->addChild(renderSurface1); |
| 651 parent->setMasksToBounds(true); | 649 parent->setMasksToBounds(true); |
| 652 renderSurface1->addChild(child); | 650 renderSurface1->addChild(child); |
| 653 renderSurface1->setForceRenderSurface(true); | 651 renderSurface1->setForceRenderSurface(true); |
| 654 | 652 |
| 655 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 653 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
| 656 int dummyMaxTextureSize = 512; | 654 int dummyMaxTextureSize = 512; |
| 657 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 655 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 658 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 659 | 656 |
| 660 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate | 657 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate |
| 661 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible | 658 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible |
| 662 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). | 659 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). |
| 663 ASSERT_TRUE(parent->renderSurface()); | 660 ASSERT_TRUE(parent->renderSurface()); |
| 664 ASSERT_FALSE(renderSurface1->renderSurface()); | 661 ASSERT_FALSE(renderSurface1->renderSurface()); |
| 665 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 662 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
| 666 } | 663 } |
| 667 | 664 |
| 668 TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) | 665 TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) |
| 669 { | 666 { |
| 670 RefPtr<LayerChromium> parent = LayerChromium::create(); | 667 RefPtr<LayerChromium> parent = LayerChromium::create(); |
| 671 RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); | 668 RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(); |
| 672 RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromi
umWithForcedDrawsContent()); | 669 RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromi
umWithForcedDrawsContent()); |
| 673 | 670 |
| 674 const WebTransformationMatrix identityMatrix; | 671 const WebTransformationMatrix identityMatrix; |
| 675 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); | 672 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); |
| 676 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); | 673 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false); |
| 677 | 674 |
| 678 parent->addChild(renderSurface1); | 675 parent->addChild(renderSurface1); |
| 679 renderSurface1->addChild(child); | 676 renderSurface1->addChild(child); |
| 680 renderSurface1->setForceRenderSurface(true); | 677 renderSurface1->setForceRenderSurface(true); |
| 681 renderSurface1->setOpacity(0); | 678 renderSurface1->setOpacity(0); |
| 682 | 679 |
| 683 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 680 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
| 684 int dummyMaxTextureSize = 512; | 681 int dummyMaxTextureSize = 512; |
| 685 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 682 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 686 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 687 | 683 |
| 688 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. | 684 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. |
| 689 // Also, the drawable content rect should not have been extended by the chil
dren. | 685 // Also, the drawable content rect should not have been extended by the chil
dren. |
| 690 ASSERT_TRUE(parent->renderSurface()); | 686 ASSERT_TRUE(parent->renderSurface()); |
| 691 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); | 687 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); |
| 692 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 688 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
| 693 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 689 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| 694 EXPECT_EQ(IntRect(), parent->drawableContentRect()); | 690 EXPECT_EQ(IntRect(), parent->drawableContentRect()); |
| 695 } | 691 } |
| 696 | 692 |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); | 1328 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false); |
| 1333 | 1329 |
| 1334 child->setMasksToBounds(true); | 1330 child->setMasksToBounds(true); |
| 1335 child->setOpacity(0.4f); | 1331 child->setOpacity(0.4f); |
| 1336 grandChild->setOpacity(0.5); | 1332 grandChild->setOpacity(0.5); |
| 1337 greatGrandChild->setOpacity(0.4f); | 1333 greatGrandChild->setOpacity(0.4f); |
| 1338 | 1334 |
| 1339 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 1335 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
| 1340 int dummyMaxTextureSize = 512; | 1336 int dummyMaxTextureSize = 512; |
| 1341 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1337 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1342 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 1343 | |
| 1344 | 1338 |
| 1345 ASSERT_EQ(2U, renderSurfaceLayerList.size()); | 1339 ASSERT_EQ(2U, renderSurfaceLayerList.size()); |
| 1346 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1340 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| 1347 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); | 1341 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); |
| 1348 } | 1342 } |
| 1349 | 1343 |
| 1350 TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) | 1344 TEST(CCLayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) |
| 1351 { | 1345 { |
| 1352 // When a renderSurface has a clipRect, it is used to clip the contentRect | 1346 // When a renderSurface has a clipRect, it is used to clip the contentRect |
| 1353 // of the surface. When the renderSurface is animating its transforms, then | 1347 // of the surface. When the renderSurface is animating its transforms, then |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 // Force everyone to be a render surface. | 1439 // Force everyone to be a render surface. |
| 1446 child->setOpacity(0.4f); | 1440 child->setOpacity(0.4f); |
| 1447 grandChild1->setOpacity(0.5); | 1441 grandChild1->setOpacity(0.5); |
| 1448 grandChild2->setOpacity(0.5); | 1442 grandChild2->setOpacity(0.5); |
| 1449 grandChild3->setOpacity(0.5); | 1443 grandChild3->setOpacity(0.5); |
| 1450 grandChild4->setOpacity(0.5); | 1444 grandChild4->setOpacity(0.5); |
| 1451 | 1445 |
| 1452 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 1446 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
| 1453 int dummyMaxTextureSize = 512; | 1447 int dummyMaxTextureSize = 512; |
| 1454 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1448 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1455 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 1456 | 1449 |
| 1457 EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawab
leContentRect()); | 1450 EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawab
leContentRect()); |
| 1458 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); | 1451 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); |
| 1459 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); | 1452 EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawab
leContentRect()); |
| 1460 EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); | 1453 EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); |
| 1461 } | 1454 } |
| 1462 | 1455 |
| 1463 TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) | 1456 TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) |
| 1464 { | 1457 { |
| 1465 // Verify that renderSurfaces (and their layers) get the appropriate clipRec
ts when their parent masksToBounds is true. | 1458 // Verify that renderSurfaces (and their layers) get the appropriate clipRec
ts when their parent masksToBounds is true. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 // Force everyone to be a render surface. | 1504 // Force everyone to be a render surface. |
| 1512 child->setOpacity(0.4f); | 1505 child->setOpacity(0.4f); |
| 1513 grandChild1->setOpacity(0.5); | 1506 grandChild1->setOpacity(0.5); |
| 1514 grandChild2->setOpacity(0.5); | 1507 grandChild2->setOpacity(0.5); |
| 1515 grandChild3->setOpacity(0.5); | 1508 grandChild3->setOpacity(0.5); |
| 1516 grandChild4->setOpacity(0.5); | 1509 grandChild4->setOpacity(0.5); |
| 1517 | 1510 |
| 1518 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 1511 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
| 1519 int dummyMaxTextureSize = 512; | 1512 int dummyMaxTextureSize = 512; |
| 1520 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1513 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 1521 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 1522 | 1514 |
| 1523 ASSERT_TRUE(grandChild1->renderSurface()); | 1515 ASSERT_TRUE(grandChild1->renderSurface()); |
| 1524 ASSERT_TRUE(grandChild2->renderSurface()); | 1516 ASSERT_TRUE(grandChild2->renderSurface()); |
| 1525 ASSERT_TRUE(grandChild3->renderSurface()); | 1517 ASSERT_TRUE(grandChild3->renderSurface()); |
| 1526 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. | 1518 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. |
| 1527 | 1519 |
| 1528 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. | 1520 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. |
| 1529 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->render
Surface()->clipRect()); | 1521 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->render
Surface()->clipRect()); |
| 1530 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->render
Surface()->clipRect()); | 1522 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->render
Surface()->clipRect()); |
| 1531 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->render
Surface()->clipRect()); | 1523 EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->render
Surface()->clipRect()); |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2533 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2525 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 2534 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2526 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 2535 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2527 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 2536 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2528 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 2537 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2529 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 2538 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2530 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 2539 | 2531 |
| 2540 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; | 2532 Vector<RefPtr<LayerChromium> > renderSurfaceLayerList; |
| 2541 int dummyMaxTextureSize = 512; | 2533 int dummyMaxTextureSize = 512; |
| 2542 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2534 CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(
), 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2543 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 2544 | 2535 |
| 2545 EXPECT_FALSE(child->renderSurface()); | 2536 EXPECT_FALSE(child->renderSurface()); |
| 2546 EXPECT_TRUE(animatingSurface->renderSurface()); | 2537 EXPECT_TRUE(animatingSurface->renderSurface()); |
| 2547 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); | 2538 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); |
| 2548 EXPECT_FALSE(animatingChild->renderSurface()); | 2539 EXPECT_FALSE(animatingChild->renderSurface()); |
| 2549 EXPECT_FALSE(child2->renderSurface()); | 2540 EXPECT_FALSE(child2->renderSurface()); |
| 2550 | 2541 |
| 2551 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. | 2542 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. |
| 2552 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 2543 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
| 2553 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 2544 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2654 WebTransformationMatrix identityMatrix; | 2645 WebTransformationMatrix identityMatrix; |
| 2655 FloatPoint anchor(0, 0); | 2646 FloatPoint anchor(0, 0); |
| 2656 FloatPoint position(0, 0); | 2647 FloatPoint position(0, 0); |
| 2657 IntSize bounds(100, 100); | 2648 IntSize bounds(100, 100); |
| 2658 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2649 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 2659 root->setDrawsContent(true); | 2650 root->setDrawsContent(true); |
| 2660 | 2651 |
| 2661 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2652 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 2662 int dummyMaxTextureSize = 512; | 2653 int dummyMaxTextureSize = 512; |
| 2663 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2654 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2664 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 2665 | 2655 |
| 2666 // Sanity check the scenario we just created. | 2656 // Sanity check the scenario we just created. |
| 2667 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2657 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2668 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2658 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2669 | 2659 |
| 2670 // Hit testing for a point outside the layer should return a null pointer. | 2660 // Hit testing for a point outside the layer should return a null pointer. |
| 2671 IntPoint testPoint(101, 101); | 2661 IntPoint testPoint(101, 101); |
| 2672 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2662 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
| 2673 EXPECT_FALSE(resultLayer); | 2663 EXPECT_FALSE(resultLayer); |
| 2674 | 2664 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2704 WebTransformationMatrix identityMatrix; | 2694 WebTransformationMatrix identityMatrix; |
| 2705 FloatPoint anchor(0, 0); | 2695 FloatPoint anchor(0, 0); |
| 2706 FloatPoint position(0, 0); | 2696 FloatPoint position(0, 0); |
| 2707 IntSize bounds(100, 100); | 2697 IntSize bounds(100, 100); |
| 2708 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 2698 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
| 2709 root->setDrawsContent(true); | 2699 root->setDrawsContent(true); |
| 2710 | 2700 |
| 2711 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2701 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 2712 int dummyMaxTextureSize = 512; | 2702 int dummyMaxTextureSize = 512; |
| 2713 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2703 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2714 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 2715 | 2704 |
| 2716 // Sanity check the scenario we just created. | 2705 // Sanity check the scenario we just created. |
| 2717 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2706 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2718 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2707 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2719 ASSERT_FALSE(root->screenSpaceTransform().isInvertible()); | 2708 ASSERT_FALSE(root->screenSpaceTransform().isInvertible()); |
| 2720 | 2709 |
| 2721 // Hit testing any point should not hit the layer. If the invertible matrix
is | 2710 // Hit testing any point should not hit the layer. If the invertible matrix
is |
| 2722 // accidentally ignored and treated like an identity, then the hit testing w
ill | 2711 // accidentally ignored and treated like an identity, then the hit testing w
ill |
| 2723 // incorrectly hit the layer when it shouldn't. | 2712 // incorrectly hit the layer when it shouldn't. |
| 2724 IntPoint testPoint(1, 1); | 2713 IntPoint testPoint(1, 1); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2759 WebTransformationMatrix identityMatrix; | 2748 WebTransformationMatrix identityMatrix; |
| 2760 FloatPoint anchor(0, 0); | 2749 FloatPoint anchor(0, 0); |
| 2761 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh
ould correctly know where the layer is located. | 2750 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh
ould correctly know where the layer is located. |
| 2762 IntSize bounds(100, 100); | 2751 IntSize bounds(100, 100); |
| 2763 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2752 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 2764 root->setDrawsContent(true); | 2753 root->setDrawsContent(true); |
| 2765 | 2754 |
| 2766 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2755 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 2767 int dummyMaxTextureSize = 512; | 2756 int dummyMaxTextureSize = 512; |
| 2768 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2757 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2769 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 2770 | 2758 |
| 2771 // Sanity check the scenario we just created. | 2759 // Sanity check the scenario we just created. |
| 2772 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2760 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2773 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2761 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2774 | 2762 |
| 2775 // Hit testing for a point outside the layer should return a null pointer. | 2763 // Hit testing for a point outside the layer should return a null pointer. |
| 2776 IntPoint testPoint(49, 49); | 2764 IntPoint testPoint(49, 49); |
| 2777 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2765 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
| 2778 EXPECT_FALSE(resultLayer); | 2766 EXPECT_FALSE(resultLayer); |
| 2779 | 2767 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2807 rotation45DegreesAboutCenter.translate(-50, -50); | 2795 rotation45DegreesAboutCenter.translate(-50, -50); |
| 2808 FloatPoint anchor(0, 0); | 2796 FloatPoint anchor(0, 0); |
| 2809 FloatPoint position(0, 0); | 2797 FloatPoint position(0, 0); |
| 2810 IntSize bounds(100, 100); | 2798 IntSize bounds(100, 100); |
| 2811 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); | 2799 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); |
| 2812 root->setDrawsContent(true); | 2800 root->setDrawsContent(true); |
| 2813 | 2801 |
| 2814 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2802 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 2815 int dummyMaxTextureSize = 512; | 2803 int dummyMaxTextureSize = 512; |
| 2816 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2804 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2817 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 2818 | 2805 |
| 2819 // Sanity check the scenario we just created. | 2806 // Sanity check the scenario we just created. |
| 2820 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2807 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2821 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2808 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2822 | 2809 |
| 2823 // Hit testing for points outside the layer. | 2810 // Hit testing for points outside the layer. |
| 2824 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 2811 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
| 2825 IntPoint testPoint(99, 99); | 2812 IntPoint testPoint(99, 99); |
| 2826 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2813 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
| 2827 EXPECT_FALSE(resultLayer); | 2814 EXPECT_FALSE(resultLayer); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2864 | 2851 |
| 2865 FloatPoint anchor(0, 0); | 2852 FloatPoint anchor(0, 0); |
| 2866 FloatPoint position(0, 0); | 2853 FloatPoint position(0, 0); |
| 2867 IntSize bounds(100, 100); | 2854 IntSize bounds(100, 100); |
| 2868 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); | 2855 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); |
| 2869 root->setDrawsContent(true); | 2856 root->setDrawsContent(true); |
| 2870 | 2857 |
| 2871 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2858 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 2872 int dummyMaxTextureSize = 512; | 2859 int dummyMaxTextureSize = 512; |
| 2873 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2860 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2874 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 2875 | 2861 |
| 2876 // Sanity check the scenario we just created. | 2862 // Sanity check the scenario we just created. |
| 2877 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2863 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2878 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2864 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2879 | 2865 |
| 2880 // Hit testing for points outside the layer. | 2866 // Hit testing for points outside the layer. |
| 2881 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 2867 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
| 2882 IntPoint testPoint(24, 24); | 2868 IntPoint testPoint(24, 24); |
| 2883 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2869 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
| 2884 EXPECT_FALSE(resultLayer); | 2870 EXPECT_FALSE(resultLayer); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2929 // override contentBounds | 2915 // override contentBounds |
| 2930 testLayer->setContentBounds(IntSize(100, 100)); | 2916 testLayer->setContentBounds(IntSize(100, 100)); |
| 2931 | 2917 |
| 2932 testLayer->setDrawsContent(true); | 2918 testLayer->setDrawsContent(true); |
| 2933 root->addChild(testLayer.release()); | 2919 root->addChild(testLayer.release()); |
| 2934 } | 2920 } |
| 2935 | 2921 |
| 2936 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2922 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 2937 int dummyMaxTextureSize = 512; | 2923 int dummyMaxTextureSize = 512; |
| 2938 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2924 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 2939 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 2940 | 2925 |
| 2941 // Sanity check the scenario we just created. | 2926 // Sanity check the scenario we just created. |
| 2942 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 2927 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
| 2943 CCLayerImpl* testLayer = root->children()[0]; | 2928 CCLayerImpl* testLayer = root->children()[0]; |
| 2944 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi
bleContentRect()); | 2929 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi
bleContentRect()); |
| 2945 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2930 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 2946 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2931 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 2947 | 2932 |
| 2948 // 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). | 2933 // 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). |
| 2949 IntPoint testPoint(101, 101); | 2934 IntPoint testPoint(101, 101); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2994 bounds = IntSize(300, 300); | 2979 bounds = IntSize(300, 300); |
| 2995 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 2980 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 2996 child->setDrawsContent(true); | 2981 child->setDrawsContent(true); |
| 2997 clippingLayer->addChild(child.release()); | 2982 clippingLayer->addChild(child.release()); |
| 2998 root->addChild(clippingLayer.release()); | 2983 root->addChild(clippingLayer.release()); |
| 2999 } | 2984 } |
| 3000 | 2985 |
| 3001 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2986 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 3002 int dummyMaxTextureSize = 512; | 2987 int dummyMaxTextureSize = 512; |
| 3003 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2988 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3004 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 3005 | 2989 |
| 3006 // Sanity check the scenario we just created. | 2990 // Sanity check the scenario we just created. |
| 3007 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2991 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3008 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2992 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3009 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 2993 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 3010 | 2994 |
| 3011 // Hit testing for a point outside the layer should return a null pointer. | 2995 // Hit testing for a point outside the layer should return a null pointer. |
| 3012 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 2996 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
| 3013 IntPoint testPoint(24, 24); | 2997 IntPoint testPoint(24, 24); |
| 3014 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2998 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3085 rotatedLeaf->setDrawsContent(true); | 3069 rotatedLeaf->setDrawsContent(true); |
| 3086 | 3070 |
| 3087 grandChild->addChild(rotatedLeaf.release()); | 3071 grandChild->addChild(rotatedLeaf.release()); |
| 3088 child->addChild(grandChild.release()); | 3072 child->addChild(grandChild.release()); |
| 3089 root->addChild(child.release()); | 3073 root->addChild(child.release()); |
| 3090 } | 3074 } |
| 3091 | 3075 |
| 3092 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3076 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 3093 int dummyMaxTextureSize = 512; | 3077 int dummyMaxTextureSize = 512; |
| 3094 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3078 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3095 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 3096 | 3079 |
| 3097 // Sanity check the scenario we just created. | 3080 // Sanity check the scenario we just created. |
| 3098 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. | 3081 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. |
| 3099 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 3082 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
| 3100 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); | 3083 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); |
| 3101 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. | 3084 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. |
| 3102 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); | 3085 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); |
| 3103 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); | 3086 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); |
| 3104 | 3087 |
| 3105 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. | 3088 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 bounds = IntSize(20, 20); | 3151 bounds = IntSize(20, 20); |
| 3169 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3152 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
| 3170 child->setDrawsContent(true); | 3153 child->setDrawsContent(true); |
| 3171 intermediateLayer->addChild(child.release()); | 3154 intermediateLayer->addChild(child.release()); |
| 3172 root->addChild(intermediateLayer.release()); | 3155 root->addChild(intermediateLayer.release()); |
| 3173 } | 3156 } |
| 3174 | 3157 |
| 3175 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3158 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 3176 int dummyMaxTextureSize = 512; | 3159 int dummyMaxTextureSize = 512; |
| 3177 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3160 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3178 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 3179 | 3161 |
| 3180 // Sanity check the scenario we just created. | 3162 // Sanity check the scenario we just created. |
| 3181 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3163 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3182 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3164 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
| 3183 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3165 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
| 3184 | 3166 |
| 3185 // Hit testing for a point outside the layer should return a null pointer. | 3167 // Hit testing for a point outside the layer should return a null pointer. |
| 3186 IntPoint testPoint(69, 69); | 3168 IntPoint testPoint(69, 69); |
| 3187 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 3169 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
| 3188 EXPECT_FALSE(resultLayer); | 3170 EXPECT_FALSE(resultLayer); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3249 root->addChild(child2.release()); | 3231 root->addChild(child2.release()); |
| 3250 } | 3232 } |
| 3251 | 3233 |
| 3252 CCLayerImpl* child1 = root->children()[0]; | 3234 CCLayerImpl* child1 = root->children()[0]; |
| 3253 CCLayerImpl* child2 = root->children()[1]; | 3235 CCLayerImpl* child2 = root->children()[1]; |
| 3254 CCLayerImpl* grandChild1 = child1->children()[0]; | 3236 CCLayerImpl* grandChild1 = child1->children()[0]; |
| 3255 | 3237 |
| 3256 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3238 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 3257 int dummyMaxTextureSize = 512; | 3239 int dummyMaxTextureSize = 512; |
| 3258 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3240 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3259 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 3260 | 3241 |
| 3261 // Sanity check the scenario we just created. | 3242 // Sanity check the scenario we just created. |
| 3262 ASSERT_TRUE(child1); | 3243 ASSERT_TRUE(child1); |
| 3263 ASSERT_TRUE(child2); | 3244 ASSERT_TRUE(child2); |
| 3264 ASSERT_TRUE(grandChild1); | 3245 ASSERT_TRUE(grandChild1); |
| 3265 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3246 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
| 3266 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); | 3247 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); |
| 3267 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer | 3248 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer |
| 3268 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 | 3249 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 |
| 3269 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 | 3250 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 root->addChild(child2.release()); | 3339 root->addChild(child2.release()); |
| 3359 } | 3340 } |
| 3360 | 3341 |
| 3361 CCLayerImpl* child1 = root->children()[0]; | 3342 CCLayerImpl* child1 = root->children()[0]; |
| 3362 CCLayerImpl* child2 = root->children()[1]; | 3343 CCLayerImpl* child2 = root->children()[1]; |
| 3363 CCLayerImpl* grandChild1 = child1->children()[0]; | 3344 CCLayerImpl* grandChild1 = child1->children()[0]; |
| 3364 | 3345 |
| 3365 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3346 Vector<CCLayerImpl*> renderSurfaceLayerList; |
| 3366 int dummyMaxTextureSize = 512; | 3347 int dummyMaxTextureSize = 512; |
| 3367 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3348 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
| 3368 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | |
| 3369 | 3349 |
| 3370 // Sanity check the scenario we just created. | 3350 // Sanity check the scenario we just created. |
| 3371 ASSERT_TRUE(child1); | 3351 ASSERT_TRUE(child1); |
| 3372 ASSERT_TRUE(child2); | 3352 ASSERT_TRUE(child2); |
| 3373 ASSERT_TRUE(grandChild1); | 3353 ASSERT_TRUE(grandChild1); |
| 3374 ASSERT_TRUE(child1->renderSurface()); | 3354 ASSERT_TRUE(child1->renderSurface()); |
| 3375 ASSERT_TRUE(child2->renderSurface()); | 3355 ASSERT_TRUE(child2->renderSurface()); |
| 3376 ASSERT_TRUE(grandChild1->renderSurface()); | 3356 ASSERT_TRUE(grandChild1->renderSurface()); |
| 3377 ASSERT_EQ(4u, renderSurfaceLayerList.size()); | 3357 ASSERT_EQ(4u, renderSurfaceLayerList.size()); |
| 3378 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. | 3358 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3592 int nonexistentId = -1; | 3572 int nonexistentId = -1; |
| 3593 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); | 3573 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); |
| 3594 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); | 3574 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); |
| 3595 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); | 3575 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); |
| 3596 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); | 3576 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); |
| 3597 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); | 3577 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); |
| 3598 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); | 3578 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); |
| 3599 } | 3579 } |
| 3600 | 3580 |
| 3601 } // namespace | 3581 } // namespace |
| OLD | NEW |