OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/layer_tree_host_common.h" | 5 #include "cc/layer_tree_host_common.h" |
6 | 6 |
7 #include "cc/content_layer.h" | 7 #include "cc/content_layer.h" |
8 #include "cc/content_layer_client.h" | 8 #include "cc/content_layer_client.h" |
9 #include "cc/layer.h" | 9 #include "cc/layer.h" |
10 #include "cc/layer_animation_controller.h" | 10 #include "cc/layer_animation_controller.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 setLayerPropertiesForTestingInternal<Layer>(layer, transform, sublayerTransf
orm, anchor, position, bounds, preserves3D); | 44 setLayerPropertiesForTestingInternal<Layer>(layer, transform, sublayerTransf
orm, anchor, position, bounds, preserves3D); |
45 layer->setAutomaticallyComputeRasterScale(true); | 45 layer->setAutomaticallyComputeRasterScale(true); |
46 } | 46 } |
47 | 47 |
48 void setLayerPropertiesForTesting(LayerImpl* layer, const gfx::Transform& transf
orm, const gfx::Transform& sublayerTransform, const gfx::PointF& anchor, const g
fx::PointF& position, const gfx::Size& bounds, bool preserves3D) | 48 void setLayerPropertiesForTesting(LayerImpl* layer, const gfx::Transform& transf
orm, const gfx::Transform& sublayerTransform, const gfx::PointF& anchor, const g
fx::PointF& position, const gfx::Size& bounds, bool preserves3D) |
49 { | 49 { |
50 setLayerPropertiesForTestingInternal<LayerImpl>(layer, transform, sublayerTr
ansform, anchor, position, bounds, preserves3D); | 50 setLayerPropertiesForTestingInternal<LayerImpl>(layer, transform, sublayerTr
ansform, anchor, position, bounds, preserves3D); |
51 layer->setContentBounds(bounds); | 51 layer->setContentBounds(bounds); |
52 } | 52 } |
53 | 53 |
54 void executeCalculateDrawProperties(Layer* rootLayer, float deviceScaleFactor =
1, float pageScaleFactor = 1) | 54 void executeCalculateDrawProperties(Layer* rootLayer, float deviceScaleFactor =
1, float pageScaleFactor = 1, bool canUseLCDText = false) |
55 { | 55 { |
56 gfx::Transform identityMatrix; | 56 gfx::Transform identityMatrix; |
57 std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList; | 57 std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList; |
58 int dummyMaxTextureSize = 512; | 58 int dummyMaxTextureSize = 512; |
59 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); | 59 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, 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 DCHECK(!rootLayer->bounds().IsEmpty()); | 62 DCHECK(!rootLayer->bounds().IsEmpty()); |
63 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayer
List); | 63 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, canUseLCDText, dummyRen
derSurfaceLayerList); |
64 } | 64 } |
65 | 65 |
66 void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto
r = 1, float pageScaleFactor = 1) | 66 void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto
r = 1, float pageScaleFactor = 1, bool canUseLCDText = false) |
67 { | 67 { |
68 gfx::Transform identityMatrix; | 68 gfx::Transform identityMatrix; |
69 std::vector<LayerImpl*> dummyRenderSurfaceLayerList; | 69 std::vector<LayerImpl*> dummyRenderSurfaceLayerList; |
70 int dummyMaxTextureSize = 512; | 70 int dummyMaxTextureSize = 512; |
71 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); | 71 gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * devic
eScaleFactor, rootLayer->bounds().height() * deviceScaleFactor); |
72 | 72 |
73 // We are probably not testing what is intended if the rootLayer bounds are
empty. | 73 // We are probably not testing what is intended if the rootLayer bounds are
empty. |
74 DCHECK(!rootLayer->bounds().IsEmpty()); | 74 DCHECK(!rootLayer->bounds().IsEmpty()); |
75 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayer
List); | 75 LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize,
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, canUseLCDText, dummyRen
derSurfaceLayerList); |
76 } | 76 } |
77 | 77 |
78 scoped_ptr<LayerImpl> createTreeForFixedPositionTests(LayerTreeHostImpl* hostImp
l) | 78 scoped_ptr<LayerImpl> createTreeForFixedPositionTests(LayerTreeHostImpl* hostImp
l) |
79 { | 79 { |
80 scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl->activeTree(), 1); | 80 scoped_ptr<LayerImpl> root = LayerImpl::create(hostImpl->activeTree(), 1); |
81 scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl->activeTree(), 2); | 81 scoped_ptr<LayerImpl> child = LayerImpl::create(hostImpl->activeTree(), 2); |
82 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(hostImpl->activeTree(),
3); | 82 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(hostImpl->activeTree(),
3); |
83 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(hostImpl->activeTr
ee(), 4); | 83 scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(hostImpl->activeTr
ee(), 4); |
84 | 84 |
85 gfx::Transform IdentityMatrix; | 85 gfx::Transform IdentityMatrix; |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 692 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
693 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(30, 30), gfx::Size(10, 10), false); | 693 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(30, 30), gfx::Size(10, 10), false); |
694 | 694 |
695 parent->addChild(renderSurface1); | 695 parent->addChild(renderSurface1); |
696 parent->setMasksToBounds(true); | 696 parent->setMasksToBounds(true); |
697 renderSurface1->addChild(child); | 697 renderSurface1->addChild(child); |
698 renderSurface1->setForceRenderSurface(true); | 698 renderSurface1->setForceRenderSurface(true); |
699 | 699 |
700 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 700 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
701 int dummyMaxTextureSize = 512; | 701 int dummyMaxTextureSize = 512; |
702 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 702 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
703 | 703 |
704 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate | 704 // The child layer's content is entirely outside the parent's clip rect, so
the intermediate |
705 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible | 705 // render surface should not be listed here, even if it was forced to be cre
ated. Render surfaces without children or visible |
706 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). | 706 // content are unexpected at draw time (e.g. we might try to create a conten
t texture of size 0). |
707 ASSERT_TRUE(parent->renderSurface()); | 707 ASSERT_TRUE(parent->renderSurface()); |
708 ASSERT_FALSE(renderSurface1->renderSurface()); | 708 ASSERT_FALSE(renderSurface1->renderSurface()); |
709 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 709 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
710 } | 710 } |
711 | 711 |
712 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) | 712 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild) |
713 { | 713 { |
714 scoped_refptr<Layer> parent = Layer::create(); | 714 scoped_refptr<Layer> parent = Layer::create(); |
715 scoped_refptr<Layer> renderSurface1 = Layer::create(); | 715 scoped_refptr<Layer> renderSurface1 = Layer::create(); |
716 scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new La
yerWithForcedDrawsContent()); | 716 scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new La
yerWithForcedDrawsContent()); |
717 | 717 |
718 const gfx::Transform identityMatrix; | 718 const gfx::Transform identityMatrix; |
719 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 719 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
720 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 10), false); | 720 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gf
x::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
721 | 721 |
722 parent->addChild(renderSurface1); | 722 parent->addChild(renderSurface1); |
723 renderSurface1->addChild(child); | 723 renderSurface1->addChild(child); |
724 renderSurface1->setForceRenderSurface(true); | 724 renderSurface1->setForceRenderSurface(true); |
725 renderSurface1->setOpacity(0); | 725 renderSurface1->setOpacity(0); |
726 | 726 |
727 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 727 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
728 int dummyMaxTextureSize = 512; | 728 int dummyMaxTextureSize = 512; |
729 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 729 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
730 | 730 |
731 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. | 731 // Since the layer is transparent, renderSurface1->renderSurface() should no
t have gotten added anywhere. |
732 // Also, the drawable content rect should not have been extended by the chil
dren. | 732 // Also, the drawable content rect should not have been extended by the chil
dren. |
733 ASSERT_TRUE(parent->renderSurface()); | 733 ASSERT_TRUE(parent->renderSurface()); |
734 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); | 734 EXPECT_EQ(0U, parent->renderSurface()->layerList().size()); |
735 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 735 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
736 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 736 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
737 EXPECT_EQ(gfx::Rect(), parent->drawableContentRect()); | 737 EXPECT_EQ(gfx::Rect(), parent->drawableContentRect()); |
738 } | 738 } |
739 | 739 |
(...skipping 11 matching lines...) Expand all Loading... |
751 | 751 |
752 parent->addChild(renderSurface1); | 752 parent->addChild(renderSurface1); |
753 renderSurface1->addChild(child); | 753 renderSurface1->addChild(child); |
754 | 754 |
755 // Sanity check before the actual test | 755 // Sanity check before the actual test |
756 EXPECT_FALSE(parent->renderSurface()); | 756 EXPECT_FALSE(parent->renderSurface()); |
757 EXPECT_FALSE(renderSurface1->renderSurface()); | 757 EXPECT_FALSE(renderSurface1->renderSurface()); |
758 | 758 |
759 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 759 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
760 int dummyMaxTextureSize = 512; | 760 int dummyMaxTextureSize = 512; |
761 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 761 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
762 | 762 |
763 // The root layer always creates a renderSurface | 763 // The root layer always creates a renderSurface |
764 EXPECT_TRUE(parent->renderSurface()); | 764 EXPECT_TRUE(parent->renderSurface()); |
765 EXPECT_TRUE(renderSurface1->renderSurface()); | 765 EXPECT_TRUE(renderSurface1->renderSurface()); |
766 EXPECT_EQ(2U, renderSurfaceLayerList.size()); | 766 EXPECT_EQ(2U, renderSurfaceLayerList.size()); |
767 | 767 |
768 renderSurfaceLayerList.clear(); | 768 renderSurfaceLayerList.clear(); |
769 renderSurface1->setForceRenderSurface(false); | 769 renderSurface1->setForceRenderSurface(false); |
770 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 770 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
771 EXPECT_TRUE(parent->renderSurface()); | 771 EXPECT_TRUE(parent->renderSurface()); |
772 EXPECT_FALSE(renderSurface1->renderSurface()); | 772 EXPECT_FALSE(renderSurface1->renderSurface()); |
773 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 773 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
774 } | 774 } |
775 | 775 |
776 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) | 776 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) |
777 { | 777 { |
778 // This test checks for correct scroll compensation when the fixed-position
container | 778 // This test checks for correct scroll compensation when the fixed-position
container |
779 // is the direct parent of the fixed-position layer. | 779 // is the direct parent of the fixed-position layer. |
780 FakeImplProxy proxy; | 780 FakeImplProxy proxy; |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false); | 1375 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false); |
1376 | 1376 |
1377 child->setMasksToBounds(true); | 1377 child->setMasksToBounds(true); |
1378 child->setOpacity(0.4f); | 1378 child->setOpacity(0.4f); |
1379 child->setForceRenderSurface(true); | 1379 child->setForceRenderSurface(true); |
1380 grandChild->setOpacity(0.5); | 1380 grandChild->setOpacity(0.5); |
1381 greatGrandChild->setOpacity(0.4f); | 1381 greatGrandChild->setOpacity(0.4f); |
1382 | 1382 |
1383 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1383 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
1384 int dummyMaxTextureSize = 512; | 1384 int dummyMaxTextureSize = 512; |
1385 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1385 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1386 | 1386 |
1387 ASSERT_EQ(2U, renderSurfaceLayerList.size()); | 1387 ASSERT_EQ(2U, renderSurfaceLayerList.size()); |
1388 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1388 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
1389 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); | 1389 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); |
1390 } | 1390 } |
1391 | 1391 |
1392 TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) | 1392 TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) |
1393 { | 1393 { |
1394 // When a renderSurface has a clipRect, it is used to clip the contentRect | 1394 // When a renderSurface has a clipRect, it is used to clip the contentRect |
1395 // of the surface. When the renderSurface is animating its transforms, then | 1395 // of the surface. When the renderSurface is animating its transforms, then |
(...skipping 26 matching lines...) Expand all Loading... |
1422 setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix,
gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); | 1422 setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix,
gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false); |
1423 | 1423 |
1424 parent->setMasksToBounds(true); | 1424 parent->setMasksToBounds(true); |
1425 child->setOpacity(0.4f); | 1425 child->setOpacity(0.4f); |
1426 child->setForceRenderSurface(true); | 1426 child->setForceRenderSurface(true); |
1427 grandChild->setOpacity(0.4f); | 1427 grandChild->setOpacity(0.4f); |
1428 grandChild->setForceRenderSurface(true); | 1428 grandChild->setForceRenderSurface(true); |
1429 | 1429 |
1430 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1430 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
1431 int dummyMaxTextureSize = 512; | 1431 int dummyMaxTextureSize = 512; |
1432 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1432 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1433 | 1433 |
1434 // Without an animation, we should cull child and grandChild from the render
SurfaceLayerList. | 1434 // Without an animation, we should cull child and grandChild from the render
SurfaceLayerList. |
1435 ASSERT_EQ(1U, renderSurfaceLayerList.size()); | 1435 ASSERT_EQ(1U, renderSurfaceLayerList.size()); |
1436 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1436 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
1437 | 1437 |
1438 // Now put an animating transform on child. | 1438 // Now put an animating transform on child. |
1439 addAnimatedTransformToController(*child->layerAnimationController(), 10, 30,
0); | 1439 addAnimatedTransformToController(*child->layerAnimationController(), 10, 30,
0); |
1440 | 1440 |
1441 parent->clearRenderSurface(); | 1441 parent->clearRenderSurface(); |
1442 child->clearRenderSurface(); | 1442 child->clearRenderSurface(); |
1443 grandChild->clearRenderSurface(); | 1443 grandChild->clearRenderSurface(); |
1444 renderSurfaceLayerList.clear(); | 1444 renderSurfaceLayerList.clear(); |
1445 | 1445 |
1446 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1446 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1447 | 1447 |
1448 // With an animating transform, we should keep child and grandChild in the r
enderSurfaceLayerList. | 1448 // With an animating transform, we should keep child and grandChild in the r
enderSurfaceLayerList. |
1449 ASSERT_EQ(3U, renderSurfaceLayerList.size()); | 1449 ASSERT_EQ(3U, renderSurfaceLayerList.size()); |
1450 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 1450 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
1451 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); | 1451 EXPECT_EQ(child->id(), renderSurfaceLayerList[1]->id()); |
1452 EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); | 1452 EXPECT_EQ(grandChild->id(), renderSurfaceLayerList[2]->id()); |
1453 } | 1453 } |
1454 | 1454 |
1455 TEST(LayerTreeHostCommonTest, verifyIsClippedIsSetCorrectly) | 1455 TEST(LayerTreeHostCommonTest, verifyIsClippedIsSetCorrectly) |
1456 { | 1456 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1488 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
1489 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1489 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
1490 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1490 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
1491 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1491 setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
1492 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1492 setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
1493 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1493 setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix
, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
1494 | 1494 |
1495 // Case 1: nothing is clipped except the root renderSurface. | 1495 // Case 1: nothing is clipped except the root renderSurface. |
1496 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1496 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
1497 int dummyMaxTextureSize = 512; | 1497 int dummyMaxTextureSize = 512; |
1498 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1498 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1499 | 1499 |
1500 ASSERT_TRUE(root->renderSurface()); | 1500 ASSERT_TRUE(root->renderSurface()); |
1501 ASSERT_TRUE(child2->renderSurface()); | 1501 ASSERT_TRUE(child2->renderSurface()); |
1502 | 1502 |
1503 EXPECT_FALSE(root->isClipped()); | 1503 EXPECT_FALSE(root->isClipped()); |
1504 EXPECT_TRUE(root->renderSurface()->isClipped()); | 1504 EXPECT_TRUE(root->renderSurface()->isClipped()); |
1505 EXPECT_FALSE(parent->isClipped()); | 1505 EXPECT_FALSE(parent->isClipped()); |
1506 EXPECT_FALSE(child1->isClipped()); | 1506 EXPECT_FALSE(child1->isClipped()); |
1507 EXPECT_FALSE(child2->isClipped()); | 1507 EXPECT_FALSE(child2->isClipped()); |
1508 EXPECT_FALSE(child2->renderSurface()->isClipped()); | 1508 EXPECT_FALSE(child2->renderSurface()->isClipped()); |
1509 EXPECT_FALSE(grandChild->isClipped()); | 1509 EXPECT_FALSE(grandChild->isClipped()); |
1510 EXPECT_FALSE(leafNode1->isClipped()); | 1510 EXPECT_FALSE(leafNode1->isClipped()); |
1511 EXPECT_FALSE(leafNode2->isClipped()); | 1511 EXPECT_FALSE(leafNode2->isClipped()); |
1512 | 1512 |
1513 // Case 2: parent masksToBounds, so the parent, child1, and child2's | 1513 // Case 2: parent masksToBounds, so the parent, child1, and child2's |
1514 // surface are clipped. But layers that contribute to child2's surface are | 1514 // surface are clipped. But layers that contribute to child2's surface are |
1515 // not clipped explicitly because child2's surface already accounts for | 1515 // not clipped explicitly because child2's surface already accounts for |
1516 // that clip. | 1516 // that clip. |
1517 renderSurfaceLayerList.clear(); | 1517 renderSurfaceLayerList.clear(); |
1518 parent->setMasksToBounds(true); | 1518 parent->setMasksToBounds(true); |
1519 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1519 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1520 | 1520 |
1521 ASSERT_TRUE(root->renderSurface()); | 1521 ASSERT_TRUE(root->renderSurface()); |
1522 ASSERT_TRUE(child2->renderSurface()); | 1522 ASSERT_TRUE(child2->renderSurface()); |
1523 | 1523 |
1524 EXPECT_FALSE(root->isClipped()); | 1524 EXPECT_FALSE(root->isClipped()); |
1525 EXPECT_TRUE(root->renderSurface()->isClipped()); | 1525 EXPECT_TRUE(root->renderSurface()->isClipped()); |
1526 EXPECT_TRUE(parent->isClipped()); | 1526 EXPECT_TRUE(parent->isClipped()); |
1527 EXPECT_TRUE(child1->isClipped()); | 1527 EXPECT_TRUE(child1->isClipped()); |
1528 EXPECT_FALSE(child2->isClipped()); | 1528 EXPECT_FALSE(child2->isClipped()); |
1529 EXPECT_TRUE(child2->renderSurface()->isClipped()); | 1529 EXPECT_TRUE(child2->renderSurface()->isClipped()); |
1530 EXPECT_TRUE(grandChild->isClipped()); | 1530 EXPECT_TRUE(grandChild->isClipped()); |
1531 EXPECT_TRUE(leafNode1->isClipped()); | 1531 EXPECT_TRUE(leafNode1->isClipped()); |
1532 EXPECT_FALSE(leafNode2->isClipped()); | 1532 EXPECT_FALSE(leafNode2->isClipped()); |
1533 | 1533 |
1534 // Case 3: child2 masksToBounds. The layer and subtree are clipped, and | 1534 // Case 3: child2 masksToBounds. The layer and subtree are clipped, and |
1535 // child2's renderSurface is not clipped. | 1535 // child2's renderSurface is not clipped. |
1536 renderSurfaceLayerList.clear(); | 1536 renderSurfaceLayerList.clear(); |
1537 parent->setMasksToBounds(false); | 1537 parent->setMasksToBounds(false); |
1538 child2->setMasksToBounds(true); | 1538 child2->setMasksToBounds(true); |
1539 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1539 LayerTreeHostCommon::calculateDrawProperties(root.get(), parent->bounds(), 1
, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1540 | 1540 |
1541 ASSERT_TRUE(root->renderSurface()); | 1541 ASSERT_TRUE(root->renderSurface()); |
1542 ASSERT_TRUE(child2->renderSurface()); | 1542 ASSERT_TRUE(child2->renderSurface()); |
1543 | 1543 |
1544 EXPECT_FALSE(root->isClipped()); | 1544 EXPECT_FALSE(root->isClipped()); |
1545 EXPECT_TRUE(root->renderSurface()->isClipped()); | 1545 EXPECT_TRUE(root->renderSurface()->isClipped()); |
1546 EXPECT_FALSE(parent->isClipped()); | 1546 EXPECT_FALSE(parent->isClipped()); |
1547 EXPECT_FALSE(child1->isClipped()); | 1547 EXPECT_FALSE(child1->isClipped()); |
1548 EXPECT_TRUE(child2->isClipped()); | 1548 EXPECT_TRUE(child2->isClipped()); |
1549 EXPECT_FALSE(child2->renderSurface()->isClipped()); | 1549 EXPECT_FALSE(child2->renderSurface()->isClipped()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 | 1588 |
1589 // Force everyone to be a render surface. | 1589 // Force everyone to be a render surface. |
1590 child->setOpacity(0.4f); | 1590 child->setOpacity(0.4f); |
1591 grandChild1->setOpacity(0.5); | 1591 grandChild1->setOpacity(0.5); |
1592 grandChild2->setOpacity(0.5); | 1592 grandChild2->setOpacity(0.5); |
1593 grandChild3->setOpacity(0.5); | 1593 grandChild3->setOpacity(0.5); |
1594 grandChild4->setOpacity(0.5); | 1594 grandChild4->setOpacity(0.5); |
1595 | 1595 |
1596 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1596 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
1597 int dummyMaxTextureSize = 512; | 1597 int dummyMaxTextureSize = 512; |
1598 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1598 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1599 | 1599 |
1600 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(5, 5), gfx::Size(10, 10)), grandChild1->
drawableContentRect()); | 1600 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(5, 5), gfx::Size(10, 10)), grandChild1->
drawableContentRect()); |
1601 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); | 1601 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); |
1602 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); | 1602 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->
drawableContentRect()); |
1603 EXPECT_TRUE(grandChild4->drawableContentRect().IsEmpty()); | 1603 EXPECT_TRUE(grandChild4->drawableContentRect().IsEmpty()); |
1604 } | 1604 } |
1605 | 1605 |
1606 TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) | 1606 TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) |
1607 { | 1607 { |
1608 // Verify that renderSurfaces (and their layers) get the appropriate clipRec
ts when their parent masksToBounds is true. | 1608 // Verify that renderSurfaces (and their layers) get the appropriate clipRec
ts when their parent masksToBounds is true. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 grandChild1->setForceRenderSurface(true); | 1658 grandChild1->setForceRenderSurface(true); |
1659 grandChild2->setOpacity(0.5); | 1659 grandChild2->setOpacity(0.5); |
1660 grandChild2->setForceRenderSurface(true); | 1660 grandChild2->setForceRenderSurface(true); |
1661 grandChild3->setOpacity(0.5); | 1661 grandChild3->setOpacity(0.5); |
1662 grandChild3->setForceRenderSurface(true); | 1662 grandChild3->setForceRenderSurface(true); |
1663 grandChild4->setOpacity(0.5); | 1663 grandChild4->setOpacity(0.5); |
1664 grandChild4->setForceRenderSurface(true); | 1664 grandChild4->setForceRenderSurface(true); |
1665 | 1665 |
1666 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 1666 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
1667 int dummyMaxTextureSize = 512; | 1667 int dummyMaxTextureSize = 512; |
1668 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 1668 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
1669 | 1669 |
1670 ASSERT_TRUE(grandChild1->renderSurface()); | 1670 ASSERT_TRUE(grandChild1->renderSurface()); |
1671 ASSERT_TRUE(grandChild2->renderSurface()); | 1671 ASSERT_TRUE(grandChild2->renderSurface()); |
1672 ASSERT_TRUE(grandChild3->renderSurface()); | 1672 ASSERT_TRUE(grandChild3->renderSurface()); |
1673 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. | 1673 EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entire
ly clipped, it is expected to not have a renderSurface. |
1674 | 1674 |
1675 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. | 1675 // Surfaces are clipped by their parent, but un-affected by the owning layer
's masksToBounds. |
1676 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild1->
renderSurface()->clipRect()); | 1676 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild1->
renderSurface()->clipRect()); |
1677 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild2->
renderSurface()->clipRect()); | 1677 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild2->
renderSurface()->clipRect()); |
1678 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild3->
renderSurface()->clipRect()); | 1678 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild3->
renderSurface()->clipRect()); |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2500 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2501 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2501 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2502 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2502 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2503 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); | 2503 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); |
2504 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2504 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
2505 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2505 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
2506 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2506 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
2507 | 2507 |
2508 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2508 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
2509 int dummyMaxTextureSize = 512; | 2509 int dummyMaxTextureSize = 512; |
2510 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2510 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2511 | 2511 |
2512 // Verify which renderSurfaces were created. | 2512 // Verify which renderSurfaces were created. |
2513 EXPECT_FALSE(frontFacingChild->renderSurface()); | 2513 EXPECT_FALSE(frontFacingChild->renderSurface()); |
2514 EXPECT_FALSE(backFacingChild->renderSurface()); | 2514 EXPECT_FALSE(backFacingChild->renderSurface()); |
2515 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2515 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
2516 EXPECT_TRUE(backFacingSurface->renderSurface()); | 2516 EXPECT_TRUE(backFacingSurface->renderSurface()); |
2517 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); | 2517 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); |
2518 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); | 2518 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); |
2519 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); | 2519 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); |
2520 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); | 2520 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2599 setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identity
Matrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2600 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); //
surface transform style is preserve-3d. | 2600 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); //
surface transform style is preserve-3d. |
2601 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // s
urface transform style is preserve-3d. | 2601 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identi
tyMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // s
urface transform style is preserve-3d. |
2602 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); | 2602 setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), ide
ntityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100
, 100), false); |
2603 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2603 setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), back
faceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
2604 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2604 setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), iden
tityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
2605 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); | 2605 setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backf
aceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100,
100), false); |
2606 | 2606 |
2607 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2607 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
2608 int dummyMaxTextureSize = 512; | 2608 int dummyMaxTextureSize = 512; |
2609 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2609 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2610 | 2610 |
2611 // Verify which renderSurfaces were created. | 2611 // Verify which renderSurfaces were created. |
2612 EXPECT_FALSE(frontFacingChild->renderSurface()); | 2612 EXPECT_FALSE(frontFacingChild->renderSurface()); |
2613 EXPECT_FALSE(backFacingChild->renderSurface()); | 2613 EXPECT_FALSE(backFacingChild->renderSurface()); |
2614 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2614 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
2615 EXPECT_FALSE(backFacingSurface->renderSurface()); | 2615 EXPECT_FALSE(backFacingSurface->renderSurface()); |
2616 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); | 2616 EXPECT_FALSE(frontFacingChildOfFrontFacingSurface->renderSurface()); |
2617 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); | 2617 EXPECT_FALSE(backFacingChildOfFrontFacingSurface->renderSurface()); |
2618 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); | 2618 EXPECT_FALSE(frontFacingChildOfBackFacingSurface->renderSurface()); |
2619 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); | 2619 EXPECT_FALSE(backFacingChildOfBackFacingSurface->renderSurface()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 | 2679 |
2680 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2680 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2681 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2681 setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2682 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2682 setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identit
yMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2683 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false
); | 2683 setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix,
identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false
); |
2684 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2684 setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityM
atrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2685 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2685 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2686 | 2686 |
2687 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2687 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
2688 int dummyMaxTextureSize = 512; | 2688 int dummyMaxTextureSize = 512; |
2689 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2689 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2690 | 2690 |
2691 EXPECT_FALSE(child->renderSurface()); | 2691 EXPECT_FALSE(child->renderSurface()); |
2692 EXPECT_TRUE(animatingSurface->renderSurface()); | 2692 EXPECT_TRUE(animatingSurface->renderSurface()); |
2693 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); | 2693 EXPECT_FALSE(childOfAnimatingSurface->renderSurface()); |
2694 EXPECT_FALSE(animatingChild->renderSurface()); | 2694 EXPECT_FALSE(animatingChild->renderSurface()); |
2695 EXPECT_FALSE(child2->renderSurface()); | 2695 EXPECT_FALSE(child2->renderSurface()); |
2696 | 2696 |
2697 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. | 2697 // Verify that the animatingChild and childOfAnimatingSurface were not culle
d, but that child was. |
2698 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 2698 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
2699 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 2699 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2745 backfaceMatrix.Translate(-50, -50); | 2745 backfaceMatrix.Translate(-50, -50); |
2746 | 2746 |
2747 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // parent trans
form style is preserve3d. | 2747 setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // parent trans
form style is preserve3d. |
2748 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. | 2748 setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. |
2749 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. | 2749 setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, ident
ityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); //
surface transform style is flat. |
2750 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2750 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2751 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2751 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, g
fx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2752 | 2752 |
2753 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 2753 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
2754 int dummyMaxTextureSize = 512; | 2754 int dummyMaxTextureSize = 512; |
2755 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 2755 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2756 | 2756 |
2757 // Verify which renderSurfaces were created. | 2757 // Verify which renderSurfaces were created. |
2758 EXPECT_TRUE(frontFacingSurface->renderSurface()); | 2758 EXPECT_TRUE(frontFacingSurface->renderSurface()); |
2759 EXPECT_FALSE(backFacingSurface->renderSurface()); // because it should be cu
lled | 2759 EXPECT_FALSE(backFacingSurface->renderSurface()); // because it should be cu
lled |
2760 EXPECT_FALSE(child1->renderSurface()); | 2760 EXPECT_FALSE(child1->renderSurface()); |
2761 EXPECT_FALSE(child2->renderSurface()); | 2761 EXPECT_FALSE(child2->renderSurface()); |
2762 | 2762 |
2763 // Verify the renderSurfaceLayerList. The back-facing surface should be cull
ed. | 2763 // Verify the renderSurfaceLayerList. The back-facing surface should be cull
ed. |
2764 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 2764 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
2765 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); | 2765 EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2797 | 2797 |
2798 gfx::Transform identityMatrix; | 2798 gfx::Transform identityMatrix; |
2799 gfx::PointF anchor(0, 0); | 2799 gfx::PointF anchor(0, 0); |
2800 gfx::PointF position(0, 0); | 2800 gfx::PointF position(0, 0); |
2801 gfx::Size bounds(100, 100); | 2801 gfx::Size bounds(100, 100); |
2802 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2802 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
2803 root->setDrawsContent(true); | 2803 root->setDrawsContent(true); |
2804 | 2804 |
2805 std::vector<LayerImpl*> renderSurfaceLayerList; | 2805 std::vector<LayerImpl*> renderSurfaceLayerList; |
2806 int dummyMaxTextureSize = 512; | 2806 int dummyMaxTextureSize = 512; |
2807 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 2807 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2808 | 2808 |
2809 // Sanity check the scenario we just created. | 2809 // Sanity check the scenario we just created. |
2810 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2810 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2811 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2811 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2812 | 2812 |
2813 // Hit testing for a point outside the layer should return a null pointer. | 2813 // Hit testing for a point outside the layer should return a null pointer. |
2814 gfx::Point testPoint(101, 101); | 2814 gfx::Point testPoint(101, 101); |
2815 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2815 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
2816 EXPECT_FALSE(resultLayer); | 2816 EXPECT_FALSE(resultLayer); |
2817 | 2817 |
(...skipping 28 matching lines...) Expand all Loading... |
2846 | 2846 |
2847 gfx::Transform identityMatrix; | 2847 gfx::Transform identityMatrix; |
2848 gfx::PointF anchor(0, 0); | 2848 gfx::PointF anchor(0, 0); |
2849 gfx::PointF position(0, 0); | 2849 gfx::PointF position(0, 0); |
2850 gfx::Size bounds(100, 100); | 2850 gfx::Size bounds(100, 100); |
2851 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 2851 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
2852 root->setDrawsContent(true); | 2852 root->setDrawsContent(true); |
2853 | 2853 |
2854 std::vector<LayerImpl*> renderSurfaceLayerList; | 2854 std::vector<LayerImpl*> renderSurfaceLayerList; |
2855 int dummyMaxTextureSize = 512; | 2855 int dummyMaxTextureSize = 512; |
2856 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 2856 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2857 | 2857 |
2858 // Sanity check the scenario we just created. | 2858 // Sanity check the scenario we just created. |
2859 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2859 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2860 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2860 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2861 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); | 2861 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); |
2862 | 2862 |
2863 // Hit testing any point should not hit the layer. If the invertible matrix
is | 2863 // Hit testing any point should not hit the layer. If the invertible matrix
is |
2864 // accidentally ignored and treated like an identity, then the hit testing w
ill | 2864 // accidentally ignored and treated like an identity, then the hit testing w
ill |
2865 // incorrectly hit the layer when it shouldn't. | 2865 // incorrectly hit the layer when it shouldn't. |
2866 gfx::Point testPoint(1, 1); | 2866 gfx::Point testPoint(1, 1); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 | 2900 |
2901 gfx::Transform identityMatrix; | 2901 gfx::Transform identityMatrix; |
2902 gfx::PointF anchor(0, 0); | 2902 gfx::PointF anchor(0, 0); |
2903 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. | 2903 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. |
2904 gfx::Size bounds(100, 100); | 2904 gfx::Size bounds(100, 100); |
2905 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2905 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
2906 root->setDrawsContent(true); | 2906 root->setDrawsContent(true); |
2907 | 2907 |
2908 std::vector<LayerImpl*> renderSurfaceLayerList; | 2908 std::vector<LayerImpl*> renderSurfaceLayerList; |
2909 int dummyMaxTextureSize = 512; | 2909 int dummyMaxTextureSize = 512; |
2910 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 2910 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2911 | 2911 |
2912 // Sanity check the scenario we just created. | 2912 // Sanity check the scenario we just created. |
2913 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2913 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2914 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2914 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2915 | 2915 |
2916 // Hit testing for a point outside the layer should return a null pointer. | 2916 // Hit testing for a point outside the layer should return a null pointer. |
2917 gfx::Point testPoint(49, 49); | 2917 gfx::Point testPoint(49, 49); |
2918 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2918 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
2919 EXPECT_FALSE(resultLayer); | 2919 EXPECT_FALSE(resultLayer); |
2920 | 2920 |
(...skipping 26 matching lines...) Expand all Loading... |
2947 MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45); | 2947 MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45); |
2948 rotation45DegreesAboutCenter.Translate(-50, -50); | 2948 rotation45DegreesAboutCenter.Translate(-50, -50); |
2949 gfx::PointF anchor(0, 0); | 2949 gfx::PointF anchor(0, 0); |
2950 gfx::PointF position(0, 0); | 2950 gfx::PointF position(0, 0); |
2951 gfx::Size bounds(100, 100); | 2951 gfx::Size bounds(100, 100); |
2952 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); | 2952 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident
ityMatrix, anchor, position, bounds, false); |
2953 root->setDrawsContent(true); | 2953 root->setDrawsContent(true); |
2954 | 2954 |
2955 std::vector<LayerImpl*> renderSurfaceLayerList; | 2955 std::vector<LayerImpl*> renderSurfaceLayerList; |
2956 int dummyMaxTextureSize = 512; | 2956 int dummyMaxTextureSize = 512; |
2957 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 2957 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
2958 | 2958 |
2959 // Sanity check the scenario we just created. | 2959 // Sanity check the scenario we just created. |
2960 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2960 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2961 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2961 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2962 | 2962 |
2963 // Hit testing for points outside the layer. | 2963 // Hit testing for points outside the layer. |
2964 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 2964 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
2965 gfx::Point testPoint(99, 99); | 2965 gfx::Point testPoint(99, 99); |
2966 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2966 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
2967 EXPECT_FALSE(resultLayer); | 2967 EXPECT_FALSE(resultLayer); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 translationByZ.Translate3d(0, 0, -1); | 3003 translationByZ.Translate3d(0, 0, -1); |
3004 | 3004 |
3005 gfx::PointF anchor(0, 0); | 3005 gfx::PointF anchor(0, 0); |
3006 gfx::PointF position(0, 0); | 3006 gfx::PointF position(0, 0); |
3007 gfx::Size bounds(100, 100); | 3007 gfx::Size bounds(100, 100); |
3008 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); | 3008 setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter *
translationByZ, identityMatrix, anchor, position, bounds, false); |
3009 root->setDrawsContent(true); | 3009 root->setDrawsContent(true); |
3010 | 3010 |
3011 std::vector<LayerImpl*> renderSurfaceLayerList; | 3011 std::vector<LayerImpl*> renderSurfaceLayerList; |
3012 int dummyMaxTextureSize = 512; | 3012 int dummyMaxTextureSize = 512; |
3013 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3013 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3014 | 3014 |
3015 // Sanity check the scenario we just created. | 3015 // Sanity check the scenario we just created. |
3016 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3016 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3017 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3017 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3018 | 3018 |
3019 // Hit testing for points outside the layer. | 3019 // Hit testing for points outside the layer. |
3020 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. | 3020 // These corners would have been inside the un-transformed layer, but they s
hould not hit the correctly transformed layer. |
3021 gfx::Point testPoint(24, 24); | 3021 gfx::Point testPoint(24, 24); |
3022 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3022 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
3023 EXPECT_FALSE(resultLayer); | 3023 EXPECT_FALSE(resultLayer); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3068 // override contentBounds and contentsScale | 3068 // override contentBounds and contentsScale |
3069 testLayer->setContentBounds(gfx::Size(100, 100)); | 3069 testLayer->setContentBounds(gfx::Size(100, 100)); |
3070 testLayer->setContentsScale(2, 2); | 3070 testLayer->setContentsScale(2, 2); |
3071 | 3071 |
3072 testLayer->setDrawsContent(true); | 3072 testLayer->setDrawsContent(true); |
3073 root->addChild(testLayer.Pass()); | 3073 root->addChild(testLayer.Pass()); |
3074 } | 3074 } |
3075 | 3075 |
3076 std::vector<LayerImpl*> renderSurfaceLayerList; | 3076 std::vector<LayerImpl*> renderSurfaceLayerList; |
3077 int dummyMaxTextureSize = 512; | 3077 int dummyMaxTextureSize = 512; |
3078 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3078 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3079 | 3079 |
3080 // Sanity check the scenario we just created. | 3080 // Sanity check the scenario we just created. |
3081 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3081 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
3082 LayerImpl* testLayer = root->children()[0]; | 3082 LayerImpl* testLayer = root->children()[0]; |
3083 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); | 3083 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); |
3084 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3084 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3085 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3085 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3086 | 3086 |
3087 // 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). | 3087 // 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). |
3088 gfx::Point testPoint(101, 101); | 3088 gfx::Point testPoint(101, 101); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3132 position = gfx::PointF(-50, -50); | 3132 position = gfx::PointF(-50, -50); |
3133 bounds = gfx::Size(300, 300); | 3133 bounds = gfx::Size(300, 300); |
3134 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3134 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
3135 child->setDrawsContent(true); | 3135 child->setDrawsContent(true); |
3136 clippingLayer->addChild(child.Pass()); | 3136 clippingLayer->addChild(child.Pass()); |
3137 root->addChild(clippingLayer.Pass()); | 3137 root->addChild(clippingLayer.Pass()); |
3138 } | 3138 } |
3139 | 3139 |
3140 std::vector<LayerImpl*> renderSurfaceLayerList; | 3140 std::vector<LayerImpl*> renderSurfaceLayerList; |
3141 int dummyMaxTextureSize = 512; | 3141 int dummyMaxTextureSize = 512; |
3142 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3142 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3143 | 3143 |
3144 // Sanity check the scenario we just created. | 3144 // Sanity check the scenario we just created. |
3145 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3145 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3146 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3146 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3147 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3147 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
3148 | 3148 |
3149 // Hit testing for a point outside the layer should return a null pointer. | 3149 // Hit testing for a point outside the layer should return a null pointer. |
3150 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 3150 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
3151 gfx::Point testPoint(24, 24); | 3151 gfx::Point testPoint(24, 24); |
3152 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3152 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3222 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); | 3222 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id
entityMatrix, anchor, position, bounds, false); |
3223 rotatedLeaf->setDrawsContent(true); | 3223 rotatedLeaf->setDrawsContent(true); |
3224 | 3224 |
3225 grandChild->addChild(rotatedLeaf.Pass()); | 3225 grandChild->addChild(rotatedLeaf.Pass()); |
3226 child->addChild(grandChild.Pass()); | 3226 child->addChild(grandChild.Pass()); |
3227 root->addChild(child.Pass()); | 3227 root->addChild(child.Pass()); |
3228 } | 3228 } |
3229 | 3229 |
3230 std::vector<LayerImpl*> renderSurfaceLayerList; | 3230 std::vector<LayerImpl*> renderSurfaceLayerList; |
3231 int dummyMaxTextureSize = 512; | 3231 int dummyMaxTextureSize = 512; |
3232 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3232 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3233 | 3233 |
3234 // Sanity check the scenario we just created. | 3234 // Sanity check the scenario we just created. |
3235 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. | 3235 // The grandChild is expected to create a renderSurface because it masksToBo
unds and is not axis aligned. |
3236 ASSERT_EQ(2u, renderSurfaceLayerList.size()); | 3236 ASSERT_EQ(2u, renderSurfaceLayerList.size()); |
3237 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); | 3237 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size()
); |
3238 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. | 3238 ASSERT_EQ(789, renderSurfaceLayerList[0]->renderSurface()->layerList()[0]->i
d()); // grandChild's surface. |
3239 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); | 3239 ASSERT_EQ(1u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); |
3240 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); | 3240 ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->
id()); |
3241 | 3241 |
3242 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. | 3242 // (11, 89) is close to the the bottom left corner within the clip, but it i
s not inside the layer. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3304 position = gfx::PointF(60, 60); // 70, 70 in screen space | 3304 position = gfx::PointF(60, 60); // 70, 70 in screen space |
3305 bounds = gfx::Size(20, 20); | 3305 bounds = gfx::Size(20, 20); |
3306 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3306 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
3307 child->setDrawsContent(true); | 3307 child->setDrawsContent(true); |
3308 intermediateLayer->addChild(child.Pass()); | 3308 intermediateLayer->addChild(child.Pass()); |
3309 root->addChild(intermediateLayer.Pass()); | 3309 root->addChild(intermediateLayer.Pass()); |
3310 } | 3310 } |
3311 | 3311 |
3312 std::vector<LayerImpl*> renderSurfaceLayerList; | 3312 std::vector<LayerImpl*> renderSurfaceLayerList; |
3313 int dummyMaxTextureSize = 512; | 3313 int dummyMaxTextureSize = 512; |
3314 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3314 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3315 | 3315 |
3316 // Sanity check the scenario we just created. | 3316 // Sanity check the scenario we just created. |
3317 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3317 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3318 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3318 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3319 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3319 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
3320 | 3320 |
3321 // Hit testing for a point outside the layer should return a null pointer. | 3321 // Hit testing for a point outside the layer should return a null pointer. |
3322 gfx::Point testPoint(69, 69); | 3322 gfx::Point testPoint(69, 69); |
3323 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 3323 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
3324 EXPECT_FALSE(resultLayer); | 3324 EXPECT_FALSE(resultLayer); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3384 root->addChild(child1.Pass()); | 3384 root->addChild(child1.Pass()); |
3385 root->addChild(child2.Pass()); | 3385 root->addChild(child2.Pass()); |
3386 } | 3386 } |
3387 | 3387 |
3388 LayerImpl* child1 = root->children()[0]; | 3388 LayerImpl* child1 = root->children()[0]; |
3389 LayerImpl* child2 = root->children()[1]; | 3389 LayerImpl* child2 = root->children()[1]; |
3390 LayerImpl* grandChild1 = child1->children()[0]; | 3390 LayerImpl* grandChild1 = child1->children()[0]; |
3391 | 3391 |
3392 std::vector<LayerImpl*> renderSurfaceLayerList; | 3392 std::vector<LayerImpl*> renderSurfaceLayerList; |
3393 int dummyMaxTextureSize = 512; | 3393 int dummyMaxTextureSize = 512; |
3394 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3394 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3395 | 3395 |
3396 // Sanity check the scenario we just created. | 3396 // Sanity check the scenario we just created. |
3397 ASSERT_TRUE(child1); | 3397 ASSERT_TRUE(child1); |
3398 ASSERT_TRUE(child2); | 3398 ASSERT_TRUE(child2); |
3399 ASSERT_TRUE(grandChild1); | 3399 ASSERT_TRUE(grandChild1); |
3400 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3400 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3401 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); | 3401 ASSERT_EQ(4u, root->renderSurface()->layerList().size()); |
3402 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer | 3402 ASSERT_EQ(1, root->renderSurface()->layerList()[0]->id()); // root layer |
3403 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 | 3403 ASSERT_EQ(2, root->renderSurface()->layerList()[1]->id()); // child1 |
3404 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 | 3404 ASSERT_EQ(4, root->renderSurface()->layerList()[2]->id()); // grandChild1 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3492 root->addChild(child1.Pass()); | 3492 root->addChild(child1.Pass()); |
3493 root->addChild(child2.Pass()); | 3493 root->addChild(child2.Pass()); |
3494 } | 3494 } |
3495 | 3495 |
3496 LayerImpl* child1 = root->children()[0]; | 3496 LayerImpl* child1 = root->children()[0]; |
3497 LayerImpl* child2 = root->children()[1]; | 3497 LayerImpl* child2 = root->children()[1]; |
3498 LayerImpl* grandChild1 = child1->children()[0]; | 3498 LayerImpl* grandChild1 = child1->children()[0]; |
3499 | 3499 |
3500 std::vector<LayerImpl*> renderSurfaceLayerList; | 3500 std::vector<LayerImpl*> renderSurfaceLayerList; |
3501 int dummyMaxTextureSize = 512; | 3501 int dummyMaxTextureSize = 512; |
3502 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3502 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3503 | 3503 |
3504 // Sanity check the scenario we just created. | 3504 // Sanity check the scenario we just created. |
3505 ASSERT_TRUE(child1); | 3505 ASSERT_TRUE(child1); |
3506 ASSERT_TRUE(child2); | 3506 ASSERT_TRUE(child2); |
3507 ASSERT_TRUE(grandChild1); | 3507 ASSERT_TRUE(grandChild1); |
3508 ASSERT_TRUE(child1->renderSurface()); | 3508 ASSERT_TRUE(child1->renderSurface()); |
3509 ASSERT_TRUE(child2->renderSurface()); | 3509 ASSERT_TRUE(child2->renderSurface()); |
3510 ASSERT_TRUE(grandChild1->renderSurface()); | 3510 ASSERT_TRUE(grandChild1->renderSurface()); |
3511 ASSERT_EQ(4u, renderSurfaceLayerList.size()); | 3511 ASSERT_EQ(4u, renderSurfaceLayerList.size()); |
3512 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. | 3512 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); // The root surfac
e has the root layer, and child1's and child2's renderSurfaces. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3578 gfx::Transform identityMatrix; | 3578 gfx::Transform identityMatrix; |
3579 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3579 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
3580 gfx::PointF anchor(0, 0); | 3580 gfx::PointF anchor(0, 0); |
3581 gfx::PointF position(0, 0); | 3581 gfx::PointF position(0, 0); |
3582 gfx::Size bounds(100, 100); | 3582 gfx::Size bounds(100, 100); |
3583 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3583 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
3584 root->setDrawsContent(true); | 3584 root->setDrawsContent(true); |
3585 | 3585 |
3586 std::vector<LayerImpl*> renderSurfaceLayerList; | 3586 std::vector<LayerImpl*> renderSurfaceLayerList; |
3587 int dummyMaxTextureSize = 512; | 3587 int dummyMaxTextureSize = 512; |
3588 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3588 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3589 | 3589 |
3590 // Sanity check the scenario we just created. | 3590 // Sanity check the scenario we just created. |
3591 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3591 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3592 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3592 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3593 | 3593 |
3594 // Hit checking for any point should return a null pointer for a layer witho
ut any touch event handler regions. | 3594 // Hit checking for any point should return a null pointer for a layer witho
ut any touch event handler regions. |
3595 gfx::Point testPoint(11, 11); | 3595 gfx::Point testPoint(11, 11); |
3596 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3596 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
3597 EXPECT_FALSE(resultLayer); | 3597 EXPECT_FALSE(resultLayer); |
3598 | 3598 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3644 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3644 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
3645 gfx::PointF anchor(0, 0); | 3645 gfx::PointF anchor(0, 0); |
3646 gfx::PointF position(0, 0); | 3646 gfx::PointF position(0, 0); |
3647 gfx::Size bounds(100, 100); | 3647 gfx::Size bounds(100, 100); |
3648 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); | 3648 setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatr
ix, anchor, position, bounds, false); |
3649 root->setDrawsContent(true); | 3649 root->setDrawsContent(true); |
3650 root->setTouchEventHandlerRegion(touchHandlerRegion); | 3650 root->setTouchEventHandlerRegion(touchHandlerRegion); |
3651 | 3651 |
3652 std::vector<LayerImpl*> renderSurfaceLayerList; | 3652 std::vector<LayerImpl*> renderSurfaceLayerList; |
3653 int dummyMaxTextureSize = 512; | 3653 int dummyMaxTextureSize = 512; |
3654 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3654 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3655 | 3655 |
3656 // Sanity check the scenario we just created. | 3656 // Sanity check the scenario we just created. |
3657 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3657 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3658 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3658 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3659 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); | 3659 ASSERT_FALSE(root->screenSpaceTransform().IsInvertible()); |
3660 | 3660 |
3661 // Hit checking any point should not hit the touch handler region on the lay
er. If the invertible matrix is | 3661 // Hit checking any point should not hit the touch handler region on the lay
er. If the invertible matrix is |
3662 // accidentally ignored and treated like an identity, then the hit testing w
ill | 3662 // accidentally ignored and treated like an identity, then the hit testing w
ill |
3663 // incorrectly hit the layer when it shouldn't. | 3663 // incorrectly hit the layer when it shouldn't. |
3664 gfx::Point testPoint(1, 1); | 3664 gfx::Point testPoint(1, 1); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3700 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); | 3700 Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50)); |
3701 gfx::PointF anchor(0, 0); | 3701 gfx::PointF anchor(0, 0); |
3702 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. | 3702 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. |
3703 gfx::Size bounds(100, 100); | 3703 gfx::Size bounds(100, 100); |
3704 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3704 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
3705 root->setDrawsContent(true); | 3705 root->setDrawsContent(true); |
3706 root->setTouchEventHandlerRegion(touchHandlerRegion); | 3706 root->setTouchEventHandlerRegion(touchHandlerRegion); |
3707 | 3707 |
3708 std::vector<LayerImpl*> renderSurfaceLayerList; | 3708 std::vector<LayerImpl*> renderSurfaceLayerList; |
3709 int dummyMaxTextureSize = 512; | 3709 int dummyMaxTextureSize = 512; |
3710 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3710 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3711 | 3711 |
3712 // Sanity check the scenario we just created. | 3712 // Sanity check the scenario we just created. |
3713 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3713 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3714 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3714 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3715 | 3715 |
3716 // Hit checking for a point outside the layer should return a null pointer. | 3716 // Hit checking for a point outside the layer should return a null pointer. |
3717 gfx::Point testPoint(49, 49); | 3717 gfx::Point testPoint(49, 49); |
3718 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3718 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
3719 EXPECT_FALSE(resultLayer); | 3719 EXPECT_FALSE(resultLayer); |
3720 | 3720 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3772 testLayer->setContentBounds(gfx::Size(100, 100)); | 3772 testLayer->setContentBounds(gfx::Size(100, 100)); |
3773 testLayer->setContentsScale(2, 2); | 3773 testLayer->setContentsScale(2, 2); |
3774 | 3774 |
3775 testLayer->setDrawsContent(true); | 3775 testLayer->setDrawsContent(true); |
3776 testLayer->setTouchEventHandlerRegion(touchHandlerRegion); | 3776 testLayer->setTouchEventHandlerRegion(touchHandlerRegion); |
3777 root->addChild(testLayer.Pass()); | 3777 root->addChild(testLayer.Pass()); |
3778 } | 3778 } |
3779 | 3779 |
3780 std::vector<LayerImpl*> renderSurfaceLayerList; | 3780 std::vector<LayerImpl*> renderSurfaceLayerList; |
3781 int dummyMaxTextureSize = 512; | 3781 int dummyMaxTextureSize = 512; |
3782 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3782 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3783 | 3783 |
3784 // Sanity check the scenario we just created. | 3784 // Sanity check the scenario we just created. |
3785 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3785 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
3786 LayerImpl* testLayer = root->children()[0]; | 3786 LayerImpl* testLayer = root->children()[0]; |
3787 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); | 3787 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visi
bleContentRect()); |
3788 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3788 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3789 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3789 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3790 | 3790 |
3791 // Hit checking for a point outside the layer should return a null pointer (
the root layer does not draw content, so it will not be tested either). | 3791 // Hit checking for a point outside the layer should return a null pointer (
the root layer does not draw content, so it will not be tested either). |
3792 gfx::Point testPoint(76, 76); | 3792 gfx::Point testPoint(76, 76); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3848 } | 3848 } |
3849 | 3849 |
3850 std::vector<LayerImpl*> renderSurfaceLayerList; | 3850 std::vector<LayerImpl*> renderSurfaceLayerList; |
3851 int dummyMaxTextureSize = 512; | 3851 int dummyMaxTextureSize = 512; |
3852 float deviceScaleFactor = 3.0f; | 3852 float deviceScaleFactor = 3.0f; |
3853 float pageScaleFactor = 5.0f; | 3853 float pageScaleFactor = 5.0f; |
3854 gfx::Transform pageScaleTransform; | 3854 gfx::Transform pageScaleTransform; |
3855 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor); | 3855 pageScaleTransform.Scale(pageScaleFactor, pageScaleFactor); |
3856 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor
through implTransform. | 3856 root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor
through implTransform. |
3857 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound
s(), deviceScaleFactor * pageScaleFactor)); | 3857 gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bound
s(), deviceScaleFactor * pageScaleFactor)); |
3858 LayerTreeHostCommon::calculateDrawProperties(root.get(), scaledBoundsForRoot
, deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 3858 LayerTreeHostCommon::calculateDrawProperties(root.get(), scaledBoundsForRoot
, deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3859 | 3859 |
3860 // Sanity check the scenario we just created. | 3860 // Sanity check the scenario we just created. |
3861 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 3861 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
3862 LayerImpl* testLayer = root->children()[0]; | 3862 LayerImpl* testLayer = root->children()[0]; |
3863 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3863 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3864 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3864 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3865 | 3865 |
3866 // Check whether the child layer fits into the root after scaled. | 3866 // Check whether the child layer fits into the root after scaled. |
3867 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont
entRect());; | 3867 EXPECT_RECT_EQ(gfx::Rect(testLayer->contentBounds()), testLayer->visibleCont
entRect());; |
3868 | 3868 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3932 bounds = gfx::Size(300, 300); | 3932 bounds = gfx::Size(300, 300); |
3933 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); | 3933 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix
, anchor, position, bounds, false); |
3934 child->setDrawsContent(true); | 3934 child->setDrawsContent(true); |
3935 child->setTouchEventHandlerRegion(touchHandlerRegion); | 3935 child->setTouchEventHandlerRegion(touchHandlerRegion); |
3936 clippingLayer->addChild(child.Pass()); | 3936 clippingLayer->addChild(child.Pass()); |
3937 root->addChild(clippingLayer.Pass()); | 3937 root->addChild(clippingLayer.Pass()); |
3938 } | 3938 } |
3939 | 3939 |
3940 std::vector<LayerImpl*> renderSurfaceLayerList; | 3940 std::vector<LayerImpl*> renderSurfaceLayerList; |
3941 int dummyMaxTextureSize = 512; | 3941 int dummyMaxTextureSize = 512; |
3942 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, renderSurfaceLayerList); | 3942 LayerTreeHostCommon::calculateDrawProperties(root.get(), root->bounds(), 1,
1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
3943 | 3943 |
3944 // Sanity check the scenario we just created. | 3944 // Sanity check the scenario we just created. |
3945 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 3945 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
3946 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 3946 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
3947 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); | 3947 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); |
3948 | 3948 |
3949 // Hit checking for a point outside the layer should return a null pointer. | 3949 // Hit checking for a point outside the layer should return a null pointer. |
3950 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. | 3950 // Despite the child layer being very large, it should be clipped to the roo
t layer's bounds. |
3951 gfx::Point testPoint(24, 24); | 3951 gfx::Point testPoint(24, 24); |
3952 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); | 3952 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPointInTou
chHandlerRegion(testPoint, renderSurfaceLayerList); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4015 parent->addChild(child); | 4015 parent->addChild(child); |
4016 parent->addChild(childEmpty); | 4016 parent->addChild(childEmpty); |
4017 parent->addChild(childNoScale); | 4017 parent->addChild(childNoScale); |
4018 | 4018 |
4019 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4019 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
4020 int dummyMaxTextureSize = 512; | 4020 int dummyMaxTextureSize = 512; |
4021 | 4021 |
4022 const double deviceScaleFactor = 2.5; | 4022 const double deviceScaleFactor = 2.5; |
4023 const double pageScaleFactor = 1; | 4023 const double pageScaleFactor = 1; |
4024 | 4024 |
4025 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4025 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4026 | 4026 |
4027 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); | 4027 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); |
4028 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); | 4028 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); |
4029 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, childEmpty); | 4029 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, childEmpty); |
4030 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4030 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
4031 | 4031 |
4032 EXPECT_EQ(1u, renderSurfaceLayerList.size()); | 4032 EXPECT_EQ(1u, renderSurfaceLayerList.size()); |
4033 | 4033 |
4034 // Verify parent transforms | 4034 // Verify parent transforms |
4035 gfx::Transform expectedParentTransform; | 4035 gfx::Transform expectedParentTransform; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4097 | 4097 |
4098 parent->addChild(child); | 4098 parent->addChild(child); |
4099 parent->addChild(childNoScale); | 4099 parent->addChild(childNoScale); |
4100 | 4100 |
4101 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4101 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
4102 int dummyMaxTextureSize = 512; | 4102 int dummyMaxTextureSize = 512; |
4103 | 4103 |
4104 const float deviceScaleFactor = 1.7f; | 4104 const float deviceScaleFactor = 1.7f; |
4105 const float pageScaleFactor = 1; | 4105 const float pageScaleFactor = 1; |
4106 | 4106 |
4107 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4107 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4108 | 4108 |
4109 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); | 4109 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, parent); |
4110 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); | 4110 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor, child); |
4111 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4111 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
4112 | 4112 |
4113 EXPECT_EQ(1u, renderSurfaceLayerList.size()); | 4113 EXPECT_EQ(1u, renderSurfaceLayerList.size()); |
4114 | 4114 |
4115 // Verify parent transforms | 4115 // Verify parent transforms |
4116 gfx::Transform expectedParentTransform; | 4116 gfx::Transform expectedParentTransform; |
4117 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); | 4117 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4202 int dummyMaxTextureSize = 512; | 4202 int dummyMaxTextureSize = 512; |
4203 | 4203 |
4204 double deviceScaleFactor = 2.5; | 4204 double deviceScaleFactor = 2.5; |
4205 double pageScaleFactor = 1.5; | 4205 double pageScaleFactor = 1.5; |
4206 | 4206 |
4207 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4207 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
4208 gfx::Transform pageScaleMatrix; | 4208 gfx::Transform pageScaleMatrix; |
4209 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4209 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
4210 parent->setSublayerTransform(pageScaleMatrix); | 4210 parent->setSublayerTransform(pageScaleMatrix); |
4211 | 4211 |
4212 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4212 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4213 | 4213 |
4214 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4214 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
4215 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 4215 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
4216 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); | 4216 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
4217 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4217 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
4218 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); | 4218 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); |
4219 | 4219 |
4220 // The parent is scaled up and shouldn't need to scale during draw. The chil
d that can scale its contents should | 4220 // The parent is scaled up and shouldn't need to scale during draw. The chil
d that can scale its contents should |
4221 // also not need to scale during draw. This shouldn't change if the child ha
s empty bounds. The other children should. | 4221 // also not need to scale during draw. This shouldn't change if the child ha
s empty bounds. The other children should. |
4222 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(0, 0)); | 4222 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(0, 0)); |
4223 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(1, 1)); | 4223 EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(1, 1)); |
4224 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(0, 0)); | 4224 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(0, 0)); |
4225 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(1, 1)); | 4225 EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(1, 1)); |
4226 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(0, 0)); | 4226 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(0, 0)); |
4227 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(1, 1)); | 4227 EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(1, 1)); |
4228 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(0, 0)); | 4228 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(0, 0)); |
4229 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(1, 1)); | 4229 EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * i
nitialChildScale, childNoScale->drawTransform().matrix().getDouble(1, 1)); |
4230 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(0, 0)); | 4230 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(0, 0)); |
4231 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(1, 1)); | 4231 EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, c
hildNoAutoScale->drawTransform().matrix().getDouble(1, 1)); |
4232 | 4232 |
4233 // If the transform changes, we expect the contentsScale to remain unchanged
. | 4233 // If the transform changes, we expect the contentsScale to remain unchanged
. |
4234 childScale->setTransform(identityMatrix); | 4234 childScale->setTransform(identityMatrix); |
4235 childEmpty->setTransform(identityMatrix); | 4235 childEmpty->setTransform(identityMatrix); |
4236 | 4236 |
4237 renderSurfaceLayerList.clear(); | 4237 renderSurfaceLayerList.clear(); |
4238 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4238 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4239 | 4239 |
4240 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4240 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
4241 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 4241 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
4242 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); | 4242 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
4243 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4243 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
4244 | 4244 |
4245 // But if the deviceScaleFactor or pageScaleFactor changes, then it should b
e updated, but using the initial transform. | 4245 // But if the deviceScaleFactor or pageScaleFactor changes, then it should b
e updated, but using the initial transform. |
4246 deviceScaleFactor = 2.25; | 4246 deviceScaleFactor = 2.25; |
4247 pageScaleFactor = 1.25; | 4247 pageScaleFactor = 1.25; |
4248 | 4248 |
4249 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4249 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
4250 pageScaleMatrix = identityMatrix; | 4250 pageScaleMatrix = identityMatrix; |
4251 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4251 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
4252 parent->setSublayerTransform(pageScaleMatrix); | 4252 parent->setSublayerTransform(pageScaleMatrix); |
4253 | 4253 |
4254 renderSurfaceLayerList.clear(); | 4254 renderSurfaceLayerList.clear(); |
4255 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4255 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4256 | 4256 |
4257 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4257 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
4258 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); | 4258 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childScale); |
4259 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); | 4259 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, childEmpty); |
4260 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); | 4260 EXPECT_CONTENTS_SCALE_EQ(1, childNoScale); |
4261 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); | 4261 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, childNoAutoScale); |
4262 } | 4262 } |
4263 | 4263 |
4264 TEST(LayerTreeHostCommonTest, verifySmallContentsScale) | 4264 TEST(LayerTreeHostCommonTest, verifySmallContentsScale) |
4265 { | 4265 { |
(...skipping 24 matching lines...) Expand all Loading... |
4290 int dummyMaxTextureSize = 512; | 4290 int dummyMaxTextureSize = 512; |
4291 | 4291 |
4292 double deviceScaleFactor = 2.5; | 4292 double deviceScaleFactor = 2.5; |
4293 double pageScaleFactor = 0.01; | 4293 double pageScaleFactor = 0.01; |
4294 | 4294 |
4295 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4295 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
4296 gfx::Transform pageScaleMatrix; | 4296 gfx::Transform pageScaleMatrix; |
4297 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4297 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
4298 parent->setSublayerTransform(pageScaleMatrix); | 4298 parent->setSublayerTransform(pageScaleMatrix); |
4299 | 4299 |
4300 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4300 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4301 | 4301 |
4302 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4302 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
4303 // The child's scale is < 1, so we should not save and use that scale factor
. | 4303 // The child's scale is < 1, so we should not save and use that scale factor
. |
4304 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * 1, childScale
); | 4304 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * 1, childScale
); |
4305 | 4305 |
4306 // When chilld's total scale becomes >= 1, we should save and use that scale
factor. | 4306 // When chilld's total scale becomes >= 1, we should save and use that scale
factor. |
4307 childScaleMatrix.MakeIdentity(); | 4307 childScaleMatrix.MakeIdentity(); |
4308 const double finalChildScale = 0.75; | 4308 const double finalChildScale = 0.75; |
4309 childScaleMatrix.Scale(finalChildScale, finalChildScale); | 4309 childScaleMatrix.Scale(finalChildScale, finalChildScale); |
4310 childScale->setTransform(childScaleMatrix); | 4310 childScale->setTransform(childScaleMatrix); |
4311 | 4311 |
4312 renderSurfaceLayerList.clear(); | 4312 renderSurfaceLayerList.clear(); |
4313 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4313 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4314 | 4314 |
4315 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4315 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
4316 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * finalChildScale, childScale); | 4316 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * finalChildScale, childScale); |
4317 } | 4317 } |
4318 | 4318 |
4319 TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces) | 4319 TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces) |
4320 { | 4320 { |
4321 MockContentLayerClient delegate; | 4321 MockContentLayerClient delegate; |
4322 gfx::Transform identityMatrix; | 4322 gfx::Transform identityMatrix; |
4323 | 4323 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4387 int dummyMaxTextureSize = 512; | 4387 int dummyMaxTextureSize = 512; |
4388 | 4388 |
4389 double deviceScaleFactor = 5; | 4389 double deviceScaleFactor = 5; |
4390 double pageScaleFactor = 7; | 4390 double pageScaleFactor = 7; |
4391 | 4391 |
4392 // FIXME: Remove this when pageScaleFactor is applied in the compositor. | 4392 // FIXME: Remove this when pageScaleFactor is applied in the compositor. |
4393 gfx::Transform pageScaleMatrix; | 4393 gfx::Transform pageScaleMatrix; |
4394 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); | 4394 pageScaleMatrix.Scale(pageScaleFactor, pageScaleFactor); |
4395 parent->setSublayerTransform(pageScaleMatrix); | 4395 parent->setSublayerTransform(pageScaleMatrix); |
4396 | 4396 |
4397 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList
); | 4397 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, false, renderSurfaceLa
yerList); |
4398 | 4398 |
4399 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); | 4399 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * initialParentScale, parent); |
4400 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, surfaceScale); | 4400 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale, surfaceScale); |
4401 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScale); | 4401 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScale); |
4402 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, surfaceNoAutoScale); | 4402 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * fixedRasterSc
ale, surfaceNoAutoScale); |
4403 | 4403 |
4404 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceScaleChildScale); | 4404 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceScaleChildScale); |
4405 EXPECT_CONTENTS_SCALE_EQ(1, surfaceScaleChildNoScale); | 4405 EXPECT_CONTENTS_SCALE_EQ(1, surfaceScaleChildNoScale); |
4406 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceNoScaleChildScale); | 4406 EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * initialParent
Scale * initialChildScale * initialChildScale, surfaceNoScaleChildScale); |
4407 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScaleChildNoScale); | 4407 EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoScaleChildNoScale); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4481 setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); | 4481 setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMat
rix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true); |
4482 | 4482 |
4483 parent->addChild(childScale); | 4483 parent->addChild(childScale); |
4484 | 4484 |
4485 // Now put an animating transform on child. | 4485 // Now put an animating transform on child. |
4486 int animationId = addAnimatedTransformToController(*childScale->layerAnimati
onController(), 10, 30, 0); | 4486 int animationId = addAnimatedTransformToController(*childScale->layerAnimati
onController(), 10, 30, 0); |
4487 | 4487 |
4488 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4488 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
4489 int dummyMaxTextureSize = 512; | 4489 int dummyMaxTextureSize = 512; |
4490 | 4490 |
4491 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4491 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
4492 | 4492 |
4493 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); | 4493 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); |
4494 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. | 4494 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. |
4495 EXPECT_CONTENTS_SCALE_EQ(1, childScale); | 4495 EXPECT_CONTENTS_SCALE_EQ(1, childScale); |
4496 | 4496 |
4497 // Remove the animation, now it can save a raster scale. | 4497 // Remove the animation, now it can save a raster scale. |
4498 childScale->layerAnimationController()->removeAnimation(animationId); | 4498 childScale->layerAnimationController()->removeAnimation(animationId); |
4499 | 4499 |
4500 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4500 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
4501 | 4501 |
4502 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); | 4502 EXPECT_CONTENTS_SCALE_EQ(initialParentScale, parent); |
4503 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. | 4503 // The layers with animating transforms should not compute a contentsScale o
ther than 1 until they finish animating. |
4504 EXPECT_CONTENTS_SCALE_EQ(initialParentScale * initialChildScale, childScale)
; | 4504 EXPECT_CONTENTS_SCALE_EQ(initialParentScale * initialChildScale, childScale)
; |
4505 } | 4505 } |
4506 | 4506 |
4507 | 4507 |
4508 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) | 4508 TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) |
4509 { | 4509 { |
4510 MockContentLayerClient delegate; | 4510 MockContentLayerClient delegate; |
(...skipping 21 matching lines...) Expand all Loading... |
4532 | 4532 |
4533 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4533 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
4534 int dummyMaxTextureSize = 512; | 4534 int dummyMaxTextureSize = 512; |
4535 | 4535 |
4536 const double deviceScaleFactor = 1.5; | 4536 const double deviceScaleFactor = 1.5; |
4537 parent->setContentsScale(deviceScaleFactor); | 4537 parent->setContentsScale(deviceScaleFactor); |
4538 child->setContentsScale(deviceScaleFactor); | 4538 child->setContentsScale(deviceScaleFactor); |
4539 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); | 4539 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); |
4540 replica->setContentsScale(deviceScaleFactor); | 4540 replica->setContentsScale(deviceScaleFactor); |
4541 | 4541 |
4542 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4542 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
4543 | 4543 |
4544 // We should have two render surfaces. The root's render surface and child's | 4544 // We should have two render surfaces. The root's render surface and child's |
4545 // render surface (it needs one because it has a replica layer). | 4545 // render surface (it needs one because it has a replica layer). |
4546 EXPECT_EQ(2u, renderSurfaceLayerList.size()); | 4546 EXPECT_EQ(2u, renderSurfaceLayerList.size()); |
4547 | 4547 |
4548 gfx::Transform expectedParentTransform; | 4548 gfx::Transform expectedParentTransform; |
4549 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); | 4549 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpace
Transform()); |
4550 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); | 4550 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransfo
rm()); |
4551 | 4551 |
4552 gfx::Transform expectedDrawTransform; | 4552 gfx::Transform expectedDrawTransform; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4615 | 4615 |
4616 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 4616 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
4617 int dummyMaxTextureSize = 512; | 4617 int dummyMaxTextureSize = 512; |
4618 | 4618 |
4619 const float deviceScaleFactor = 1.7f; | 4619 const float deviceScaleFactor = 1.7f; |
4620 parent->setContentsScale(deviceScaleFactor); | 4620 parent->setContentsScale(deviceScaleFactor); |
4621 child->setContentsScale(deviceScaleFactor); | 4621 child->setContentsScale(deviceScaleFactor); |
4622 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); | 4622 duplicateChildNonOwner->setContentsScale(deviceScaleFactor); |
4623 replica->setContentsScale(deviceScaleFactor); | 4623 replica->setContentsScale(deviceScaleFactor); |
4624 | 4624 |
4625 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 4625 LayerTreeHostCommon::calculateDrawProperties(parent.get(), parent->bounds(),
deviceScaleFactor, 1, dummyMaxTextureSize, false, renderSurfaceLayerList); |
4626 | 4626 |
4627 // We should have two render surfaces. The root's render surface and child's | 4627 // We should have two render surfaces. The root's render surface and child's |
4628 // render surface (it needs one because it has a replica layer). | 4628 // render surface (it needs one because it has a replica layer). |
4629 EXPECT_EQ(2u, renderSurfaceLayerList.size()); | 4629 EXPECT_EQ(2u, renderSurfaceLayerList.size()); |
4630 | 4630 |
4631 gfx::Transform identityTransform; | 4631 gfx::Transform identityTransform; |
4632 | 4632 |
4633 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->screenSpaceTransf
orm()); | 4633 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->screenSpaceTransf
orm()); |
4634 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->drawTransform()); | 4634 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->drawTransform()); |
4635 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, child->drawTransform()); | 4635 EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, child->drawTransform()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4687 | 4687 |
4688 root->addChild(child); | 4688 root->addChild(child); |
4689 child->addChild(grandChild); | 4689 child->addChild(grandChild); |
4690 child->setOpacity(0.5f); | 4690 child->setOpacity(0.5f); |
4691 | 4691 |
4692 executeCalculateDrawProperties(root.get()); | 4692 executeCalculateDrawProperties(root.get()); |
4693 | 4693 |
4694 EXPECT_FALSE(child->renderSurface()); | 4694 EXPECT_FALSE(child->renderSurface()); |
4695 } | 4695 } |
4696 | 4696 |
| 4697 typedef std::tr1::tuple<bool, bool> LCDTextTestParam; |
| 4698 class LCDTextTest : public testing::TestWithParam<LCDTextTestParam> { |
| 4699 protected: |
| 4700 virtual void SetUp() |
| 4701 { |
| 4702 m_canUseLCDText = std::tr1::get<0>(GetParam()); |
| 4703 |
| 4704 m_root = Layer::create(); |
| 4705 m_child = Layer::create(); |
| 4706 m_grandChild = Layer::create(); |
| 4707 m_child->addChild(m_grandChild.get()); |
| 4708 m_root->addChild(m_child.get()); |
| 4709 |
| 4710 gfx::Transform identityMatrix; |
| 4711 setLayerPropertiesForTesting(m_root, identityMatrix, identityMatrix, gfx
::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 1), false); |
| 4712 setLayerPropertiesForTesting(m_child, identityMatrix, identityMatrix, gf
x::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 1), false); |
| 4713 setLayerPropertiesForTesting(m_grandChild, identityMatrix, identityMatri
x, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 1), false); |
| 4714 |
| 4715 m_child->setForceRenderSurface(std::tr1::get<1>(GetParam())); |
| 4716 } |
| 4717 |
| 4718 bool m_canUseLCDText; |
| 4719 scoped_refptr<Layer> m_root; |
| 4720 scoped_refptr<Layer> m_child; |
| 4721 scoped_refptr<Layer> m_grandChild; |
| 4722 }; |
| 4723 |
| 4724 TEST_P(LCDTextTest, verifyCanUseLCDText) |
| 4725 { |
| 4726 // Case 1: Identity transform. |
| 4727 gfx::Transform identityMatrix; |
| 4728 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4729 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4730 EXPECT_EQ(m_canUseLCDText, m_child->canUseLCDText()); |
| 4731 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); |
| 4732 |
| 4733 // Case 2: Integral translation. |
| 4734 gfx::Transform integralTranslation; |
| 4735 integralTranslation.Translate(1, 2); |
| 4736 m_child->setTransform(integralTranslation); |
| 4737 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4738 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4739 EXPECT_EQ(m_canUseLCDText, m_child->canUseLCDText()); |
| 4740 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); |
| 4741 |
| 4742 // Case 3: Non-integral translation. |
| 4743 gfx::Transform nonIntegralTranslation; |
| 4744 nonIntegralTranslation.Translate(1.5, 2.5); |
| 4745 m_child->setTransform(nonIntegralTranslation); |
| 4746 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4747 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4748 EXPECT_FALSE(m_child->canUseLCDText()); |
| 4749 EXPECT_FALSE(m_grandChild->canUseLCDText()); |
| 4750 |
| 4751 // Case 4: Rotation. |
| 4752 gfx::Transform rotation; |
| 4753 rotation.Rotate(10); |
| 4754 m_child->setTransform(rotation); |
| 4755 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4756 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4757 EXPECT_FALSE(m_child->canUseLCDText()); |
| 4758 EXPECT_FALSE(m_grandChild->canUseLCDText()); |
| 4759 |
| 4760 // Case 5: Scale. |
| 4761 gfx::Transform scale; |
| 4762 scale.Scale(2, 2); |
| 4763 m_child->setTransform(scale); |
| 4764 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4765 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4766 EXPECT_FALSE(m_child->canUseLCDText()); |
| 4767 EXPECT_FALSE(m_grandChild->canUseLCDText()); |
| 4768 |
| 4769 // Case 6: Skew. |
| 4770 gfx::Transform skew; |
| 4771 skew.SkewX(10); |
| 4772 m_child->setTransform(skew); |
| 4773 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4774 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4775 EXPECT_FALSE(m_child->canUseLCDText()); |
| 4776 EXPECT_FALSE(m_grandChild->canUseLCDText()); |
| 4777 |
| 4778 // Case 7: Translucent. |
| 4779 m_child->setTransform(identityMatrix); |
| 4780 m_child->setOpacity(0.5); |
| 4781 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4782 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4783 EXPECT_FALSE(m_child->canUseLCDText()); |
| 4784 EXPECT_FALSE(m_grandChild->canUseLCDText()); |
| 4785 |
| 4786 // Case 8: Sanity check: restore transform and opacity. |
| 4787 m_child->setTransform(identityMatrix); |
| 4788 m_child->setOpacity(1); |
| 4789 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4790 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4791 EXPECT_EQ(m_canUseLCDText, m_child->canUseLCDText()); |
| 4792 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); |
| 4793 } |
| 4794 |
| 4795 TEST_P(LCDTextTest, verifyCanUseLCDTextWithAnimation) |
| 4796 { |
| 4797 // Sanity check: Make sure m_canUseLCDText is set on each node. |
| 4798 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4799 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4800 EXPECT_EQ(m_canUseLCDText, m_child->canUseLCDText()); |
| 4801 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); |
| 4802 |
| 4803 // Add opacity animation. |
| 4804 m_child->setOpacity(0.9f); |
| 4805 addOpacityTransitionToController(*(m_child->layerAnimationController()), 10,
0.9f, 0.1f, false); |
| 4806 |
| 4807 executeCalculateDrawProperties(m_root, 1, 1, m_canUseLCDText); |
| 4808 // Text AA should not be adjusted while animation is active. |
| 4809 // Make sure LCD text AA setting remains unchanged. |
| 4810 EXPECT_EQ(m_canUseLCDText, m_root->canUseLCDText()); |
| 4811 EXPECT_EQ(m_canUseLCDText, m_child->canUseLCDText()); |
| 4812 EXPECT_EQ(m_canUseLCDText, m_grandChild->canUseLCDText()); |
| 4813 } |
| 4814 |
| 4815 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
| 4816 LCDTextTest, |
| 4817 testing::Combine(testing::Bool(), |
| 4818 testing::Bool())); |
| 4819 |
4697 } // namespace | 4820 } // namespace |
4698 } // namespace cc | 4821 } // namespace cc |
OLD | NEW |