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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_tree_host_impl.h" 7 #include "cc/layer_tree_host_impl.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 settings.minimumOcclusionTrackingSize = IntSize(); 100 settings.minimumOcclusionTrackingSize = IntSize();
101 101
102 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this); 102 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this);
103 103
104 myHostImpl->initializeRenderer(graphicsContext.Pass()); 104 myHostImpl->initializeRenderer(graphicsContext.Pass());
105 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10)); 105 myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
106 106
107 root->setAnchorPoint(FloatPoint(0, 0)); 107 root->setAnchorPoint(FloatPoint(0, 0));
108 root->setPosition(FloatPoint(0, 0)); 108 root->setPosition(FloatPoint(0, 0));
109 root->setBounds(IntSize(10, 10)); 109 root->setBounds(IntSize(10, 10));
110 root->setContentBounds(IntSize(10, 10));
111 root->setVisibleContentRect(IntRect(0, 0, 10, 10)); 110 root->setVisibleContentRect(IntRect(0, 0, 10, 10));
112 root->setDrawsContent(true); 111 root->setDrawsContent(true);
113 myHostImpl->setRootLayer(root.Pass()); 112 myHostImpl->setRootLayer(root.Pass());
114 return myHostImpl.Pass(); 113 return myHostImpl.Pass();
115 } 114 }
116 115
117 static void expectClearedScrollDeltasRecursive(LayerImpl* layer) 116 static void expectClearedScrollDeltasRecursive(LayerImpl* layer)
118 { 117 {
119 ASSERT_EQ(layer->scrollDelta(), IntSize()); 118 ASSERT_EQ(layer->scrollDelta(), IntSize());
120 for (size_t i = 0; i < layer->children().size(); ++i) 119 for (size_t i = 0; i < layer->children().size(); ++i)
(...skipping 15 matching lines...) Expand all
136 ASSERT_EQ(timesEncountered, 1); 135 ASSERT_EQ(timesEncountered, 1);
137 } 136 }
138 137
139 void setupScrollAndContentsLayers(const IntSize& contentSize) 138 void setupScrollAndContentsLayers(const IntSize& contentSize)
140 { 139 {
141 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 140 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
142 root->setScrollable(true); 141 root->setScrollable(true);
143 root->setScrollPosition(IntPoint(0, 0)); 142 root->setScrollPosition(IntPoint(0, 0));
144 root->setMaxScrollPosition(contentSize); 143 root->setMaxScrollPosition(contentSize);
145 root->setBounds(contentSize); 144 root->setBounds(contentSize);
146 root->setContentBounds(contentSize);
147 root->setPosition(FloatPoint(0, 0)); 145 root->setPosition(FloatPoint(0, 0));
148 root->setAnchorPoint(FloatPoint(0, 0)); 146 root->setAnchorPoint(FloatPoint(0, 0));
149 147
150 scoped_ptr<LayerImpl> contents = LayerImpl::create(2); 148 scoped_ptr<LayerImpl> contents = LayerImpl::create(2);
151 contents->setDrawsContent(true); 149 contents->setDrawsContent(true);
152 contents->setBounds(contentSize); 150 contents->setBounds(contentSize);
153 contents->setContentBounds(contentSize);
154 contents->setPosition(FloatPoint(0, 0)); 151 contents->setPosition(FloatPoint(0, 0));
155 contents->setAnchorPoint(FloatPoint(0, 0)); 152 contents->setAnchorPoint(FloatPoint(0, 0));
156 root->addChild(contents.Pass()); 153 root->addChild(contents.Pass());
157 m_hostImpl->setRootLayer(root.Pass()); 154 m_hostImpl->setRootLayer(root.Pass());
158 } 155 }
159 156
160 static scoped_ptr<LayerImpl> createScrollableLayer(int id, const IntSize& si ze) 157 static scoped_ptr<LayerImpl> createScrollableLayer(int id, const IntSize& si ze)
161 { 158 {
162 scoped_ptr<LayerImpl> layer = LayerImpl::create(id); 159 scoped_ptr<LayerImpl> layer = LayerImpl::create(id);
163 layer->setScrollable(true); 160 layer->setScrollable(true);
164 layer->setDrawsContent(true); 161 layer->setDrawsContent(true);
165 layer->setBounds(size); 162 layer->setBounds(size);
166 layer->setContentBounds(size);
167 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2) ); 163 layer->setMaxScrollPosition(IntSize(size.width() * 2, size.height() * 2) );
168 return layer.Pass(); 164 return layer.Pass();
169 } 165 }
170 166
171 void initializeRendererAndDrawFrame() 167 void initializeRendererAndDrawFrame()
172 { 168 {
173 m_hostImpl->initializeRenderer(createContext()); 169 m_hostImpl->initializeRenderer(createContext());
174 LayerTreeHostImpl::FrameData frame; 170 LayerTreeHostImpl::FrameData frame;
175 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 171 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
176 m_hostImpl->drawLayers(frame); 172 m_hostImpl->drawLayers(frame);
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 } 813 }
818 814
819 protected: 815 protected:
820 explicit DidDrawCheckLayer(int id) 816 explicit DidDrawCheckLayer(int id)
821 : TiledLayerImpl(id) 817 : TiledLayerImpl(id)
822 , m_didDrawCalled(false) 818 , m_didDrawCalled(false)
823 , m_willDrawCalled(false) 819 , m_willDrawCalled(false)
824 { 820 {
825 setAnchorPoint(FloatPoint(0, 0)); 821 setAnchorPoint(FloatPoint(0, 0));
826 setBounds(IntSize(10, 10)); 822 setBounds(IntSize(10, 10));
827 setContentBounds(IntSize(10, 10));
828 setDrawsContent(true); 823 setDrawsContent(true);
829 setSkipsDraw(false); 824 setSkipsDraw(false);
830 setVisibleContentRect(IntRect(0, 0, 10, 10)); 825 setVisibleContentRect(IntRect(0, 0, 10, 10));
831 826
832 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(100, 100), LayerTilingData::HasBorderTexels); 827 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(100, 100), LayerTilingData::HasBorderTexels);
833 tiler->setBounds(contentBounds()); 828 tiler->setBounds(contentBounds());
834 setTilingData(*tiler.get()); 829 setTilingData(*tiler.get());
835 } 830 }
836 831
837 private: 832 private:
838 bool m_didDrawCalled; 833 bool m_didDrawCalled;
839 bool m_willDrawCalled; 834 bool m_willDrawCalled;
840 }; 835 };
841 836
842 TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) 837 TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
843 { 838 {
844 // The root layer is always drawn, so run this test on a child layer that 839 // The root layer is always drawn, so run this test on a child layer that
845 // will be masked out by the root layer's bounds. 840 // will be masked out by the root layer's bounds.
846 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); 841 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1));
847 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLa yer()); 842 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLa yer());
848 root->setMasksToBounds(true); 843 root->setMasksToBounds(true);
849 844
850 root->addChild(DidDrawCheckLayer::create(2)); 845 root->addChild(DidDrawCheckLayer::create(2));
851 DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[ 0]); 846 DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[ 0]);
852 // Ensure visibleContentRect for layer is empty 847 // Ensure visibleContentRect for layer is empty
853 layer->setPosition(FloatPoint(100, 100)); 848 layer->setPosition(FloatPoint(100, 100));
854 layer->setBounds(IntSize(10, 10)); 849 layer->setBounds(IntSize(10, 10));
855 layer->setContentBounds(IntSize(10, 10));
856 850
857 LayerTreeHostImpl::FrameData frame; 851 LayerTreeHostImpl::FrameData frame;
858 852
859 EXPECT_FALSE(layer->willDrawCalled()); 853 EXPECT_FALSE(layer->willDrawCalled());
860 EXPECT_FALSE(layer->didDrawCalled()); 854 EXPECT_FALSE(layer->didDrawCalled());
861 855
862 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 856 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
863 m_hostImpl->drawLayers(frame); 857 m_hostImpl->drawLayers(frame);
864 m_hostImpl->didDrawAllLayers(frame); 858 m_hostImpl->didDrawAllLayers(frame);
865 859
(...skipping 26 matching lines...) Expand all
892 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1)); 886 m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1));
893 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLa yer()); 887 DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLa yer());
894 888
895 root->addChild(DidDrawCheckLayer::create(2)); 889 root->addChild(DidDrawCheckLayer::create(2));
896 DidDrawCheckLayer* occludedLayer = static_cast<DidDrawCheckLayer*>(root->chi ldren()[0]); 890 DidDrawCheckLayer* occludedLayer = static_cast<DidDrawCheckLayer*>(root->chi ldren()[0]);
897 891
898 root->addChild(DidDrawCheckLayer::create(3)); 892 root->addChild(DidDrawCheckLayer::create(3));
899 DidDrawCheckLayer* topLayer = static_cast<DidDrawCheckLayer*>(root->children ()[1]); 893 DidDrawCheckLayer* topLayer = static_cast<DidDrawCheckLayer*>(root->children ()[1]);
900 // This layer covers the occludedLayer above. Make this layer large so it ca n occlude. 894 // This layer covers the occludedLayer above. Make this layer large so it ca n occlude.
901 topLayer->setBounds(bigSize); 895 topLayer->setBounds(bigSize);
902 topLayer->setContentBounds(bigSize);
903 topLayer->setContentsOpaque(true); 896 topLayer->setContentsOpaque(true);
904 897
905 LayerTreeHostImpl::FrameData frame; 898 LayerTreeHostImpl::FrameData frame;
906 899
907 EXPECT_FALSE(occludedLayer->willDrawCalled()); 900 EXPECT_FALSE(occludedLayer->willDrawCalled());
908 EXPECT_FALSE(occludedLayer->didDrawCalled()); 901 EXPECT_FALSE(occludedLayer->didDrawCalled());
909 EXPECT_FALSE(topLayer->willDrawCalled()); 902 EXPECT_FALSE(topLayer->willDrawCalled());
910 EXPECT_FALSE(topLayer->didDrawCalled()); 903 EXPECT_FALSE(topLayer->didDrawCalled());
911 904
912 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 905 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 // Test the configuration where a non-composited root layer is embedded in a 1026 // Test the configuration where a non-composited root layer is embedded in a
1034 // scrollable outer layer. 1027 // scrollable outer layer.
1035 IntSize surfaceSize(10, 10); 1028 IntSize surfaceSize(10, 10);
1036 1029
1037 scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(1); 1030 scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(1);
1038 contentLayer->setUseLCDText(true); 1031 contentLayer->setUseLCDText(true);
1039 contentLayer->setDrawsContent(true); 1032 contentLayer->setDrawsContent(true);
1040 contentLayer->setPosition(FloatPoint(0, 0)); 1033 contentLayer->setPosition(FloatPoint(0, 0));
1041 contentLayer->setAnchorPoint(FloatPoint(0, 0)); 1034 contentLayer->setAnchorPoint(FloatPoint(0, 0));
1042 contentLayer->setBounds(surfaceSize); 1035 contentLayer->setBounds(surfaceSize);
1043 contentLayer->setContentBounds(IntSize(surfaceSize.width() * 2, surfaceSize. height() * 2)); 1036 contentLayer->setContentsScale(2, 2);
1044 1037
1045 scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(2); 1038 scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(2);
1046 scrollLayer->setScrollable(true); 1039 scrollLayer->setScrollable(true);
1047 scrollLayer->setMaxScrollPosition(surfaceSize); 1040 scrollLayer->setMaxScrollPosition(surfaceSize);
1048 scrollLayer->setBounds(surfaceSize); 1041 scrollLayer->setBounds(surfaceSize);
1049 scrollLayer->setContentBounds(surfaceSize);
1050 scrollLayer->setPosition(FloatPoint(0, 0)); 1042 scrollLayer->setPosition(FloatPoint(0, 0));
1051 scrollLayer->setAnchorPoint(FloatPoint(0, 0)); 1043 scrollLayer->setAnchorPoint(FloatPoint(0, 0));
1052 scrollLayer->addChild(contentLayer.Pass()); 1044 scrollLayer->addChild(contentLayer.Pass());
1053 1045
1054 m_hostImpl->setRootLayer(scrollLayer.Pass()); 1046 m_hostImpl->setRootLayer(scrollLayer.Pass());
1055 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); 1047 m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
1056 initializeRendererAndDrawFrame(); 1048 initializeRendererAndDrawFrame();
1057 1049
1058 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel) , InputHandlerClient::ScrollStarted); 1050 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel) , InputHandlerClient::ScrollStarted);
1059 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); 1051 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10));
1060 m_hostImpl->scrollEnd(); 1052 m_hostImpl->scrollEnd();
1061 EXPECT_TRUE(m_didRequestRedraw); 1053 EXPECT_TRUE(m_didRequestRedraw);
1062 EXPECT_TRUE(m_didRequestCommit); 1054 EXPECT_TRUE(m_didRequestCommit);
1063 } 1055 }
1064 1056
1065 TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw) 1057 TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw)
1066 { 1058 {
1067 IntSize surfaceSize(10, 10); 1059 IntSize surfaceSize(10, 10);
1068 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 1060 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
1069 root->setBounds(surfaceSize); 1061 root->setBounds(surfaceSize);
1070 root->setContentBounds(surfaceSize);
1071 root->addChild(createScrollableLayer(2, surfaceSize)); 1062 root->addChild(createScrollableLayer(2, surfaceSize));
1072 m_hostImpl->setRootLayer(root.Pass()); 1063 m_hostImpl->setRootLayer(root.Pass());
1073 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); 1064 m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
1074 initializeRendererAndDrawFrame(); 1065 initializeRendererAndDrawFrame();
1075 1066
1076 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel) , InputHandlerClient::ScrollStarted); 1067 EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(5, 5), InputHandlerClient::Wheel) , InputHandlerClient::ScrollStarted);
1077 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10)); 1068 m_hostImpl->scrollBy(IntPoint(), IntSize(0, 10));
1078 m_hostImpl->scrollEnd(); 1069 m_hostImpl->scrollEnd();
1079 EXPECT_TRUE(m_didRequestRedraw); 1070 EXPECT_TRUE(m_didRequestRedraw);
1080 EXPECT_TRUE(m_didRequestCommit); 1071 EXPECT_TRUE(m_didRequestCommit);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 EXPECT_EQ(child->drawTransform().m22(), newPageScale); 1239 EXPECT_EQ(child->drawTransform().m22(), newPageScale);
1249 EXPECT_EQ(grandChild->drawTransform().m11(), newPageScale); 1240 EXPECT_EQ(grandChild->drawTransform().m11(), newPageScale);
1250 EXPECT_EQ(grandChild->drawTransform().m22(), newPageScale); 1241 EXPECT_EQ(grandChild->drawTransform().m22(), newPageScale);
1251 } 1242 }
1252 1243
1253 TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread) 1244 TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread)
1254 { 1245 {
1255 IntSize surfaceSize(10, 10); 1246 IntSize surfaceSize(10, 10);
1256 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 1247 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
1257 root->setBounds(surfaceSize); 1248 root->setBounds(surfaceSize);
1258 root->setContentBounds(surfaceSize);
1259 // Also mark the root scrollable so it becomes the root scroll layer. 1249 // Also mark the root scrollable so it becomes the root scroll layer.
1260 root->setScrollable(true); 1250 root->setScrollable(true);
1261 int scrollLayerId = 2; 1251 int scrollLayerId = 2;
1262 root->addChild(createScrollableLayer(scrollLayerId, surfaceSize)); 1252 root->addChild(createScrollableLayer(scrollLayerId, surfaceSize));
1263 m_hostImpl->setRootLayer(root.Pass()); 1253 m_hostImpl->setRootLayer(root.Pass());
1264 m_hostImpl->setViewportSize(surfaceSize, surfaceSize); 1254 m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
1265 initializeRendererAndDrawFrame(); 1255 initializeRendererAndDrawFrame();
1266 1256
1267 LayerImpl* child = m_hostImpl->rootLayer()->children()[0]; 1257 LayerImpl* child = m_hostImpl->rootLayer()->children()[0];
1268 1258
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 : LayerImpl(id) 1557 : LayerImpl(id)
1568 , m_blend(false) 1558 , m_blend(false)
1569 , m_hasRenderSurface(false) 1559 , m_hasRenderSurface(false)
1570 , m_quadsAppended(false) 1560 , m_quadsAppended(false)
1571 , m_quadRect(5, 5, 5, 5) 1561 , m_quadRect(5, 5, 5, 5)
1572 , m_quadVisibleRect(5, 5, 5, 5) 1562 , m_quadVisibleRect(5, 5, 5, 5)
1573 , m_resourceId(resourceProvider->createResource(Renderer::ContentPool, I ntSize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny)) 1563 , m_resourceId(resourceProvider->createResource(Renderer::ContentPool, I ntSize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny))
1574 { 1564 {
1575 setAnchorPoint(FloatPoint(0, 0)); 1565 setAnchorPoint(FloatPoint(0, 0));
1576 setBounds(IntSize(10, 10)); 1566 setBounds(IntSize(10, 10));
1577 setContentBounds(IntSize(10, 10));
1578 setDrawsContent(true); 1567 setDrawsContent(true);
1579 } 1568 }
1580 1569
1581 bool m_blend; 1570 bool m_blend;
1582 bool m_hasRenderSurface; 1571 bool m_hasRenderSurface;
1583 bool m_quadsAppended; 1572 bool m_quadsAppended;
1584 IntRect m_quadRect; 1573 IntRect m_quadRect;
1585 IntRect m_opaqueContentRect; 1574 IntRect m_opaqueContentRect;
1586 IntRect m_quadVisibleRect; 1575 IntRect m_quadVisibleRect;
1587 ResourceProvider::ResourceId m_resourceId; 1576 ResourceProvider::ResourceId m_resourceId;
1588 }; 1577 };
1589 1578
1590 TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) 1579 TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
1591 { 1580 {
1592 { 1581 {
1593 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 1582 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
1594 root->setAnchorPoint(FloatPoint(0, 0)); 1583 root->setAnchorPoint(FloatPoint(0, 0));
1595 root->setBounds(IntSize(10, 10)); 1584 root->setBounds(IntSize(10, 10));
1596 root->setContentBounds(root->bounds());
1597 root->setDrawsContent(false); 1585 root->setDrawsContent(false);
1598 m_hostImpl->setRootLayer(root.Pass()); 1586 m_hostImpl->setRootLayer(root.Pass());
1599 } 1587 }
1600 LayerImpl* root = m_hostImpl->rootLayer(); 1588 LayerImpl* root = m_hostImpl->rootLayer();
1601 1589
1602 root->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider( ))); 1590 root->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider( )));
1603 BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->chil dren()[0]); 1591 BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->chil dren()[0]);
1604 layer1->setPosition(FloatPoint(2, 2)); 1592 layer1->setPosition(FloatPoint(2, 2));
1605 1593
1606 LayerTreeHostImpl::FrameData frame; 1594 LayerTreeHostImpl::FrameData frame;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc eProvider())); 1778 m_hostImpl->setRootLayer(BlendStateCheckLayer::create(1, m_hostImpl->resourc eProvider()));
1791 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl-> rootLayer()); 1779 BlendStateCheckLayer* root = static_cast<BlendStateCheckLayer*>(m_hostImpl-> rootLayer());
1792 root->setExpectation(false, true); 1780 root->setExpectation(false, true);
1793 root->setContentsOpaque(true); 1781 root->setContentsOpaque(true);
1794 1782
1795 // No gutter rects 1783 // No gutter rects
1796 { 1784 {
1797 IntRect layerRect(0, 0, 1000, 1000); 1785 IntRect layerRect(0, 0, 1000, 1000);
1798 root->setPosition(layerRect.location()); 1786 root->setPosition(layerRect.location());
1799 root->setBounds(layerRect.size()); 1787 root->setBounds(layerRect.size());
1800 root->setContentBounds(layerRect.size());
1801 root->setQuadRect(IntRect(IntPoint(), layerRect.size())); 1788 root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
1802 root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); 1789 root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
1803 1790
1804 LayerTreeHostImpl::FrameData frame; 1791 LayerTreeHostImpl::FrameData frame;
1805 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 1792 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
1806 ASSERT_EQ(1u, frame.renderPasses.size()); 1793 ASSERT_EQ(1u, frame.renderPasses.size());
1807 1794
1808 size_t numGutterQuads = 0; 1795 size_t numGutterQuads = 0;
1809 for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i) 1796 for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
1810 numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0; 1797 numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0;
1811 EXPECT_EQ(0u, numGutterQuads); 1798 EXPECT_EQ(0u, numGutterQuads);
1812 EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size()); 1799 EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
1813 1800
1814 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(- layerRect.location(), viewportSize)); 1801 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(- layerRect.location(), viewportSize));
1815 m_hostImpl->didDrawAllLayers(frame); 1802 m_hostImpl->didDrawAllLayers(frame);
1816 } 1803 }
1817 1804
1818 // Empty visible content area (fullscreen gutter rect) 1805 // Empty visible content area (fullscreen gutter rect)
1819 { 1806 {
1820 IntRect layerRect(0, 0, 0, 0); 1807 IntRect layerRect(0, 0, 0, 0);
1821 root->setPosition(layerRect.location()); 1808 root->setPosition(layerRect.location());
1822 root->setBounds(layerRect.size()); 1809 root->setBounds(layerRect.size());
1823 root->setContentBounds(layerRect.size());
1824 root->setQuadRect(IntRect(IntPoint(), layerRect.size())); 1810 root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
1825 root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); 1811 root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
1826 1812
1827 LayerTreeHostImpl::FrameData frame; 1813 LayerTreeHostImpl::FrameData frame;
1828 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 1814 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
1829 ASSERT_EQ(1u, frame.renderPasses.size()); 1815 ASSERT_EQ(1u, frame.renderPasses.size());
1830 m_hostImpl->didDrawAllLayers(frame); 1816 m_hostImpl->didDrawAllLayers(frame);
1831 1817
1832 size_t numGutterQuads = 0; 1818 size_t numGutterQuads = 0;
1833 for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i) 1819 for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
1834 numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0; 1820 numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0;
1835 EXPECT_EQ(1u, numGutterQuads); 1821 EXPECT_EQ(1u, numGutterQuads);
1836 EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size()); 1822 EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
1837 1823
1838 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(- layerRect.location(), viewportSize)); 1824 verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(- layerRect.location(), viewportSize));
1839 m_hostImpl->didDrawAllLayers(frame); 1825 m_hostImpl->didDrawAllLayers(frame);
1840 } 1826 }
1841 1827
1842 // Content area in middle of clip rect (four surrounding gutter rects) 1828 // Content area in middle of clip rect (four surrounding gutter rects)
1843 { 1829 {
1844 IntRect layerRect(500, 500, 200, 200); 1830 IntRect layerRect(500, 500, 200, 200);
1845 root->setPosition(layerRect.location()); 1831 root->setPosition(layerRect.location());
1846 root->setBounds(layerRect.size()); 1832 root->setBounds(layerRect.size());
1847 root->setContentBounds(layerRect.size());
1848 root->setQuadRect(IntRect(IntPoint(), layerRect.size())); 1833 root->setQuadRect(IntRect(IntPoint(), layerRect.size()));
1849 root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size())); 1834 root->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
1850 1835
1851 LayerTreeHostImpl::FrameData frame; 1836 LayerTreeHostImpl::FrameData frame;
1852 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 1837 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
1853 ASSERT_EQ(1u, frame.renderPasses.size()); 1838 ASSERT_EQ(1u, frame.renderPasses.size());
1854 1839
1855 size_t numGutterQuads = 0; 1840 size_t numGutterQuads = 0;
1856 for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i) 1841 for (size_t i = 0; i < frame.renderPasses[0]->quadList().size(); ++i)
1857 numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0; 1842 numGutterQuads += (frame.renderPasses[0]->quadList()[i]->material() == DrawQuad::SolidColor) ? 1 : 0;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 Settings::setPartialSwapEnabled(true); 1929 Settings::setPartialSwapEnabled(true);
1945 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this); 1930 scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create( settings, this);
1946 layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); 1931 layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
1947 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500)); 1932 layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500));
1948 1933
1949 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); 1934 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
1950 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); 1935 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2);
1951 child->setPosition(FloatPoint(12, 13)); 1936 child->setPosition(FloatPoint(12, 13));
1952 child->setAnchorPoint(FloatPoint(0, 0)); 1937 child->setAnchorPoint(FloatPoint(0, 0));
1953 child->setBounds(IntSize(14, 15)); 1938 child->setBounds(IntSize(14, 15));
1954 child->setContentBounds(IntSize(14, 15));
1955 child->setDrawsContent(true); 1939 child->setDrawsContent(true);
1956 root->setAnchorPoint(FloatPoint(0, 0)); 1940 root->setAnchorPoint(FloatPoint(0, 0));
1957 root->setBounds(IntSize(500, 500)); 1941 root->setBounds(IntSize(500, 500));
1958 root->setContentBounds(IntSize(500, 500));
1959 root->setDrawsContent(true); 1942 root->setDrawsContent(true);
1960 root->addChild(child.Pass()); 1943 root->addChild(child.Pass());
1961 layerTreeHostImpl->setRootLayer(root.Pass()); 1944 layerTreeHostImpl->setRootLayer(root.Pass());
1962 1945
1963 LayerTreeHostImpl::FrameData frame; 1946 LayerTreeHostImpl::FrameData frame;
1964 1947
1965 // First frame, the entire screen should get swapped. 1948 // First frame, the entire screen should get swapped.
1966 EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame)); 1949 EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
1967 layerTreeHostImpl->drawLayers(frame); 1950 layerTreeHostImpl->drawLayers(frame);
1968 layerTreeHostImpl->didDrawAllLayers(frame); 1951 layerTreeHostImpl->didDrawAllLayers(frame);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width()); 1989 EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width());
2007 EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height()); 1990 EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
2008 } 1991 }
2009 1992
2010 TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) 1993 TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface)
2011 { 1994 {
2012 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1); 1995 scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
2013 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2); 1996 scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2);
2014 child->setAnchorPoint(FloatPoint(0, 0)); 1997 child->setAnchorPoint(FloatPoint(0, 0));
2015 child->setBounds(IntSize(10, 10)); 1998 child->setBounds(IntSize(10, 10));
2016 child->setContentBounds(IntSize(10, 10));
2017 child->setDrawsContent(true); 1999 child->setDrawsContent(true);
2018 root->setAnchorPoint(FloatPoint(0, 0)); 2000 root->setAnchorPoint(FloatPoint(0, 0));
2019 root->setBounds(IntSize(10, 10)); 2001 root->setBounds(IntSize(10, 10));
2020 root->setContentBounds(IntSize(10, 10));
2021 root->setDrawsContent(true); 2002 root->setDrawsContent(true);
2022 root->setOpacity(0.7f); 2003 root->setOpacity(0.7f);
2023 root->addChild(child.Pass()); 2004 root->addChild(child.Pass());
2024 2005
2025 m_hostImpl->setRootLayer(root.Pass()); 2006 m_hostImpl->setRootLayer(root.Pass());
2026 2007
2027 LayerTreeHostImpl::FrameData frame; 2008 LayerTreeHostImpl::FrameData frame;
2028 2009
2029 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); 2010 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
2030 EXPECT_EQ(1u, frame.renderSurfaceLayerList->size()); 2011 EXPECT_EQ(1u, frame.renderSurfaceLayerList->size());
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::create(3); 2237 scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::create(3);
2257 2238
2258 IntRect rootRect(0, 0, 100, 100); 2239 IntRect rootRect(0, 0, 100, 100);
2259 IntRect childRect(10, 10, 50, 50); 2240 IntRect childRect(10, 10, 50, 50);
2260 IntRect grandChildRect(5, 5, 150, 150); 2241 IntRect grandChildRect(5, 5, 150, 150);
2261 2242
2262 root->createRenderSurface(); 2243 root->createRenderSurface();
2263 root->setAnchorPoint(FloatPoint(0, 0)); 2244 root->setAnchorPoint(FloatPoint(0, 0));
2264 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); 2245 root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
2265 root->setBounds(IntSize(rootRect.width(), rootRect.height())); 2246 root->setBounds(IntSize(rootRect.width(), rootRect.height()));
2266 root->setContentBounds(root->bounds());
2267 root->setVisibleContentRect(rootRect); 2247 root->setVisibleContentRect(rootRect);
2268 root->setDrawsContent(false); 2248 root->setDrawsContent(false);
2269 root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.w idth(), rootRect.height()))); 2249 root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.w idth(), rootRect.height())));
2270 2250
2271 child->setAnchorPoint(FloatPoint(0, 0)); 2251 child->setAnchorPoint(FloatPoint(0, 0));
2272 child->setPosition(FloatPoint(childRect.x(), childRect.y())); 2252 child->setPosition(FloatPoint(childRect.x(), childRect.y()));
2273 child->setOpacity(0.5f); 2253 child->setOpacity(0.5f);
2274 child->setBounds(IntSize(childRect.width(), childRect.height())); 2254 child->setBounds(IntSize(childRect.width(), childRect.height()));
2275 child->setContentBounds(child->bounds());
2276 child->setVisibleContentRect(childRect); 2255 child->setVisibleContentRect(childRect);
2277 child->setDrawsContent(false); 2256 child->setDrawsContent(false);
2278 2257
2279 grandChild->setAnchorPoint(FloatPoint(0, 0)); 2258 grandChild->setAnchorPoint(FloatPoint(0, 0));
2280 grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); 2259 grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
2281 grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height( ))); 2260 grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height( )));
2282 grandChild->setContentBounds(grandChild->bounds());
2283 grandChild->setVisibleContentRect(grandChildRect); 2261 grandChild->setVisibleContentRect(grandChildRect);
2284 grandChild->setDrawsContent(true); 2262 grandChild->setDrawsContent(true);
2285 2263
2286 child->addChild(grandChild.Pass()); 2264 child->addChild(grandChild.Pass());
2287 root->addChild(child.Pass()); 2265 root->addChild(child.Pass());
2288 2266
2289 myHostImpl->setRootLayer(root.Pass()); 2267 myHostImpl->setRootLayer(root.Pass());
2290 return myHostImpl.Pass(); 2268 return myHostImpl.Pass();
2291 } 2269 }
2292 2270
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 { 2632 {
2655 int layerId = 1; 2633 int layerId = 1;
2656 2634
2657 scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(layerId++)); 2635 scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(layerId++));
2658 rootLayer->setBounds(IntSize(10, 10)); 2636 rootLayer->setBounds(IntSize(10, 10));
2659 rootLayer->setAnchorPoint(FloatPoint(0, 0)); 2637 rootLayer->setAnchorPoint(FloatPoint(0, 0));
2660 2638
2661 scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(layerId++); 2639 scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(layerId++);
2662 tileLayer->setBounds(IntSize(10, 10)); 2640 tileLayer->setBounds(IntSize(10, 10));
2663 tileLayer->setAnchorPoint(FloatPoint(0, 0)); 2641 tileLayer->setAnchorPoint(FloatPoint(0, 0));
2664 tileLayer->setContentBounds(IntSize(10, 10));
2665 tileLayer->setDrawsContent(true); 2642 tileLayer->setDrawsContent(true);
2666 tileLayer->setSkipsDraw(false); 2643 tileLayer->setSkipsDraw(false);
2667 scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 1 0), LayerTilingData::NoBorderTexels)); 2644 scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 1 0), LayerTilingData::NoBorderTexels));
2668 tilingData->setBounds(IntSize(10, 10)); 2645 tilingData->setBounds(IntSize(10, 10));
2669 tileLayer->setTilingData(*tilingData); 2646 tileLayer->setTilingData(*tilingData);
2670 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false); 2647 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false);
2671 rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); 2648 rootLayer->addChild(tileLayer.PassAs<LayerImpl>());
2672 2649
2673 scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(layerId ++); 2650 scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(layerId ++);
2674 textureLayer->setBounds(IntSize(10, 10)); 2651 textureLayer->setBounds(IntSize(10, 10));
2675 textureLayer->setAnchorPoint(FloatPoint(0, 0)); 2652 textureLayer->setAnchorPoint(FloatPoint(0, 0));
2676 textureLayer->setContentBounds(IntSize(10, 10));
2677 textureLayer->setDrawsContent(true); 2653 textureLayer->setDrawsContent(true);
2678 textureLayer->setTextureId(1); 2654 textureLayer->setTextureId(1);
2679 rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); 2655 rootLayer->addChild(textureLayer.PassAs<LayerImpl>());
2680 2656
2681 scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(layerId++); 2657 scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(layerId++);
2682 maskLayer->setBounds(IntSize(10, 10)); 2658 maskLayer->setBounds(IntSize(10, 10));
2683 maskLayer->setAnchorPoint(FloatPoint(0, 0)); 2659 maskLayer->setAnchorPoint(FloatPoint(0, 0));
2684 maskLayer->setContentBounds(IntSize(10, 10));
2685 maskLayer->setDrawsContent(true); 2660 maskLayer->setDrawsContent(true);
2686 maskLayer->setSkipsDraw(false); 2661 maskLayer->setSkipsDraw(false);
2687 maskLayer->setTilingData(*tilingData); 2662 maskLayer->setTilingData(*tilingData);
2688 maskLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false); 2663 maskLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false);
2689 2664
2690 scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create (layerId++); 2665 scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create (layerId++);
2691 textureLayerWithMask->setBounds(IntSize(10, 10)); 2666 textureLayerWithMask->setBounds(IntSize(10, 10));
2692 textureLayerWithMask->setAnchorPoint(FloatPoint(0, 0)); 2667 textureLayerWithMask->setAnchorPoint(FloatPoint(0, 0));
2693 textureLayerWithMask->setContentBounds(IntSize(10, 10));
2694 textureLayerWithMask->setDrawsContent(true); 2668 textureLayerWithMask->setDrawsContent(true);
2695 textureLayerWithMask->setTextureId(1); 2669 textureLayerWithMask->setTextureId(1);
2696 textureLayerWithMask->setMaskLayer(maskLayer.PassAs<LayerImpl>()); 2670 textureLayerWithMask->setMaskLayer(maskLayer.PassAs<LayerImpl>());
2697 rootLayer->addChild(textureLayerWithMask.PassAs<LayerImpl>()); 2671 rootLayer->addChild(textureLayerWithMask.PassAs<LayerImpl>());
2698 2672
2699 FakeVideoFrame videoFrame; 2673 FakeVideoFrame videoFrame;
2700 FakeVideoFrameProvider provider; 2674 FakeVideoFrameProvider provider;
2701 provider.setFrame(&videoFrame); 2675 provider.setFrame(&videoFrame);
2702 scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(layerId++, &p rovider); 2676 scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(layerId++, &p rovider);
2703 videoLayer->setBounds(IntSize(10, 10)); 2677 videoLayer->setBounds(IntSize(10, 10));
2704 videoLayer->setAnchorPoint(FloatPoint(0, 0)); 2678 videoLayer->setAnchorPoint(FloatPoint(0, 0));
2705 videoLayer->setContentBounds(IntSize(10, 10));
2706 videoLayer->setDrawsContent(true); 2679 videoLayer->setDrawsContent(true);
2707 videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2680 videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
2708 rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); 2681 rootLayer->addChild(videoLayer.PassAs<LayerImpl>());
2709 2682
2710 FakeVideoFrame hwVideoFrame; 2683 FakeVideoFrame hwVideoFrame;
2711 FakeVideoFrameProvider hwProvider; 2684 FakeVideoFrameProvider hwProvider;
2712 hwProvider.setFrame(&hwVideoFrame); 2685 hwProvider.setFrame(&hwVideoFrame);
2713 scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(layerId++, &hwProvider); 2686 scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(layerId++, &hwProvider);
2714 hwVideoLayer->setBounds(IntSize(10, 10)); 2687 hwVideoLayer->setBounds(IntSize(10, 10));
2715 hwVideoLayer->setAnchorPoint(FloatPoint(0, 0)); 2688 hwVideoLayer->setAnchorPoint(FloatPoint(0, 0));
2716 hwVideoLayer->setContentBounds(IntSize(10, 10));
2717 hwVideoLayer->setDrawsContent(true); 2689 hwVideoLayer->setDrawsContent(true);
2718 hwVideoLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2690 hwVideoLayer->setLayerTreeHostImpl(m_hostImpl.get());
2719 rootLayer->addChild(hwVideoLayer.PassAs<LayerImpl>()); 2691 rootLayer->addChild(hwVideoLayer.PassAs<LayerImpl>());
2720 2692
2721 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(l ayerId++); 2693 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(l ayerId++);
2722 ioSurfaceLayer->setBounds(IntSize(10, 10)); 2694 ioSurfaceLayer->setBounds(IntSize(10, 10));
2723 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); 2695 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
2724 ioSurfaceLayer->setContentBounds(IntSize(10, 10));
2725 ioSurfaceLayer->setDrawsContent(true); 2696 ioSurfaceLayer->setDrawsContent(true);
2726 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); 2697 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
2727 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2698 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
2728 rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>()); 2699 rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>());
2729 2700
2730 scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::crea te(layerId++); 2701 scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::crea te(layerId++);
2731 hudLayer->setBounds(IntSize(10, 10)); 2702 hudLayer->setBounds(IntSize(10, 10));
2732 hudLayer->setAnchorPoint(FloatPoint(0, 0)); 2703 hudLayer->setAnchorPoint(FloatPoint(0, 0));
2733 hudLayer->setContentBounds(IntSize(10, 10));
2734 hudLayer->setDrawsContent(true); 2704 hudLayer->setDrawsContent(true);
2735 hudLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2705 hudLayer->setLayerTreeHostImpl(m_hostImpl.get());
2736 rootLayer->addChild(hudLayer.PassAs<LayerImpl>()); 2706 rootLayer->addChild(hudLayer.PassAs<LayerImpl>());
2737 2707
2738 scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::cr eate(layerId++)); 2708 scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::cr eate(layerId++));
2739 scrollbarLayer->setBounds(IntSize(10, 10)); 2709 scrollbarLayer->setBounds(IntSize(10, 10));
2740 scrollbarLayer->setContentBounds(IntSize(10, 10));
2741 scrollbarLayer->setDrawsContent(true); 2710 scrollbarLayer->setDrawsContent(true);
2742 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2711 scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get());
2743 scrollbarLayer->createResources(m_hostImpl->resourceProvider()); 2712 scrollbarLayer->createResources(m_hostImpl->resourceProvider());
2744 rootLayer->addChild(scrollbarLayer.PassAs<LayerImpl>()); 2713 rootLayer->addChild(scrollbarLayer.PassAs<LayerImpl>());
2745 2714
2746 scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRende rerLayerImpl::create(layerId++)); 2715 scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRende rerLayerImpl::create(layerId++));
2747 delegatedRendererLayer->setBounds(IntSize(10, 10)); 2716 delegatedRendererLayer->setBounds(IntSize(10, 10));
2748 delegatedRendererLayer->setContentBounds(IntSize(10, 10));
2749 delegatedRendererLayer->setDrawsContent(true); 2717 delegatedRendererLayer->setDrawsContent(true);
2750 delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2718 delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get());
2751 ScopedPtrVector<RenderPass> passList; 2719 ScopedPtrVector<RenderPass> passList;
2752 passList.append(createRenderPassWithResource(m_hostImpl->resourceProvider()) ); 2720 passList.append(createRenderPassWithResource(m_hostImpl->resourceProvider()) );
2753 delegatedRendererLayer->setRenderPasses(passList); 2721 delegatedRendererLayer->setRenderPasses(passList);
2754 EXPECT_TRUE(passList.isEmpty()); 2722 EXPECT_TRUE(passList.isEmpty());
2755 rootLayer->addChild(delegatedRendererLayer.PassAs<LayerImpl>()); 2723 rootLayer->addChild(delegatedRendererLayer.PassAs<LayerImpl>());
2756 2724
2757 // Use a context that supports IOSurfaces 2725 // Use a context that supports IOSurfaces
2758 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).P assAs<GraphicsContext>()); 2726 m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped _ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DWithIOSurface)).P assAs<GraphicsContext>());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 2807
2840 TEST_P(LayerTreeHostImplTest, layersFreeTextures) 2808 TEST_P(LayerTreeHostImplTest, layersFreeTextures)
2841 { 2809 {
2842 scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(1)); 2810 scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(1));
2843 rootLayer->setBounds(IntSize(10, 10)); 2811 rootLayer->setBounds(IntSize(10, 10));
2844 rootLayer->setAnchorPoint(FloatPoint(0, 0)); 2812 rootLayer->setAnchorPoint(FloatPoint(0, 0));
2845 2813
2846 scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(2); 2814 scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(2);
2847 tileLayer->setBounds(IntSize(10, 10)); 2815 tileLayer->setBounds(IntSize(10, 10));
2848 tileLayer->setAnchorPoint(FloatPoint(0, 0)); 2816 tileLayer->setAnchorPoint(FloatPoint(0, 0));
2849 tileLayer->setContentBounds(IntSize(10, 10));
2850 tileLayer->setDrawsContent(true); 2817 tileLayer->setDrawsContent(true);
2851 tileLayer->setSkipsDraw(false); 2818 tileLayer->setSkipsDraw(false);
2852 scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 1 0), LayerTilingData::NoBorderTexels)); 2819 scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 1 0), LayerTilingData::NoBorderTexels));
2853 tilingData->setBounds(IntSize(10, 10)); 2820 tilingData->setBounds(IntSize(10, 10));
2854 tileLayer->setTilingData(*tilingData); 2821 tileLayer->setTilingData(*tilingData);
2855 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false); 2822 tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false);
2856 rootLayer->addChild(tileLayer.PassAs<LayerImpl>()); 2823 rootLayer->addChild(tileLayer.PassAs<LayerImpl>());
2857 2824
2858 scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(3); 2825 scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(3);
2859 textureLayer->setBounds(IntSize(10, 10)); 2826 textureLayer->setBounds(IntSize(10, 10));
2860 textureLayer->setAnchorPoint(FloatPoint(0, 0)); 2827 textureLayer->setAnchorPoint(FloatPoint(0, 0));
2861 textureLayer->setContentBounds(IntSize(10, 10));
2862 textureLayer->setDrawsContent(true); 2828 textureLayer->setDrawsContent(true);
2863 textureLayer->setTextureId(1); 2829 textureLayer->setTextureId(1);
2864 rootLayer->addChild(textureLayer.PassAs<LayerImpl>()); 2830 rootLayer->addChild(textureLayer.PassAs<LayerImpl>());
2865 2831
2866 FakeVideoFrameProvider provider; 2832 FakeVideoFrameProvider provider;
2867 scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(4, &provider) ; 2833 scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(4, &provider) ;
2868 videoLayer->setBounds(IntSize(10, 10)); 2834 videoLayer->setBounds(IntSize(10, 10));
2869 videoLayer->setAnchorPoint(FloatPoint(0, 0)); 2835 videoLayer->setAnchorPoint(FloatPoint(0, 0));
2870 videoLayer->setContentBounds(IntSize(10, 10));
2871 videoLayer->setDrawsContent(true); 2836 videoLayer->setDrawsContent(true);
2872 videoLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2837 videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
2873 rootLayer->addChild(videoLayer.PassAs<LayerImpl>()); 2838 rootLayer->addChild(videoLayer.PassAs<LayerImpl>());
2874 2839
2875 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(5 ); 2840 scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(5 );
2876 ioSurfaceLayer->setBounds(IntSize(10, 10)); 2841 ioSurfaceLayer->setBounds(IntSize(10, 10));
2877 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0)); 2842 ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
2878 ioSurfaceLayer->setContentBounds(IntSize(10, 10));
2879 ioSurfaceLayer->setDrawsContent(true); 2843 ioSurfaceLayer->setDrawsContent(true);
2880 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10)); 2844 ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
2881 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get()); 2845 ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
2882 rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>()); 2846 rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>());
2883 2847
2884 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the LayerTreeHostImpl takes ownership of). 2848 // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the LayerTreeHostImpl takes ownership of).
2885 scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::cr eate(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D)) ); 2849 scoped_ptr<GraphicsContext> outputSurface(FakeWebCompositorOutputSurface::cr eate(scoped_ptr<WebKit::WebGraphicsContext3D>(new TrackingWebGraphicsContext3D)) );
2886 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track ingWebGraphicsContext3D*>(outputSurface->context3D()); 2850 TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<Track ingWebGraphicsContext3D*>(outputSurface->context3D());
2887 m_hostImpl->initializeRenderer(outputSurface.Pass()); 2851 m_hostImpl->initializeRenderer(outputSurface.Pass());
2888 2852
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 Mock::VerifyAndClearExpectations(&mockContext); 2901 Mock::VerifyAndClearExpectations(&mockContext);
2938 } 2902 }
2939 2903
2940 static void addDrawingLayerTo(LayerImpl* parent, int id, const IntRect& layerRec t, LayerImpl** result) 2904 static void addDrawingLayerTo(LayerImpl* parent, int id, const IntRect& layerRec t, LayerImpl** result)
2941 { 2905 {
2942 scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(id); 2906 scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(id);
2943 LayerImpl* layerPtr = layer.get(); 2907 LayerImpl* layerPtr = layer.get();
2944 layerPtr->setAnchorPoint(FloatPoint(0, 0)); 2908 layerPtr->setAnchorPoint(FloatPoint(0, 0));
2945 layerPtr->setPosition(FloatPoint(layerRect.location())); 2909 layerPtr->setPosition(FloatPoint(layerRect.location()));
2946 layerPtr->setBounds(layerRect.size()); 2910 layerPtr->setBounds(layerRect.size());
2947 layerPtr->setContentBounds(layerRect.size());
2948 layerPtr->setDrawsContent(true); // only children draw content 2911 layerPtr->setDrawsContent(true); // only children draw content
2949 layerPtr->setContentsOpaque(true); 2912 layerPtr->setContentsOpaque(true);
2950 parent->addChild(layer.Pass()); 2913 parent->addChild(layer.Pass());
2951 if (result) 2914 if (result)
2952 *result = layerPtr; 2915 *result = layerPtr;
2953 } 2916 }
2954 2917
2955 static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L ayerImpl*& rootPtr, LayerImpl*& intermediateLayerPtr, LayerImpl*& surfaceLayerPt r, LayerImpl*& childPtr, const IntSize& rootSize) 2918 static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L ayerImpl*& rootPtr, LayerImpl*& intermediateLayerPtr, LayerImpl*& surfaceLayerPt r, LayerImpl*& childPtr, const IntSize& rootSize)
2956 { 2919 {
2957 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 2920 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>();
2958 2921
2959 layerTreeHostImpl->initializeRenderer(context.Pass()); 2922 layerTreeHostImpl->initializeRenderer(context.Pass());
2960 layerTreeHostImpl->setViewportSize(rootSize, rootSize); 2923 layerTreeHostImpl->setViewportSize(rootSize, rootSize);
2961 2924
2962 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 2925 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
2963 rootPtr = root.get(); 2926 rootPtr = root.get();
2964 2927
2965 root->setAnchorPoint(FloatPoint(0, 0)); 2928 root->setAnchorPoint(FloatPoint(0, 0));
2966 root->setPosition(FloatPoint(0, 0)); 2929 root->setPosition(FloatPoint(0, 0));
2967 root->setBounds(rootSize); 2930 root->setBounds(rootSize);
2968 root->setContentBounds(rootSize);
2969 root->setDrawsContent(true); 2931 root->setDrawsContent(true);
2970 layerTreeHostImpl->setRootLayer(root.Pass()); 2932 layerTreeHostImpl->setRootLayer(root.Pass());
2971 2933
2972 addDrawingLayerTo(rootPtr, 2, IntRect(10, 10, rootSize.width(), rootSize.hei ght()), &intermediateLayerPtr); 2934 addDrawingLayerTo(rootPtr, 2, IntRect(10, 10, rootSize.width(), rootSize.hei ght()), &intermediateLayerPtr);
2973 intermediateLayerPtr->setDrawsContent(false); // only children draw content 2935 intermediateLayerPtr->setDrawsContent(false); // only children draw content
2974 2936
2975 // Surface layer is the layer that changes its opacity 2937 // Surface layer is the layer that changes its opacity
2976 // It will contain other layers that draw content. 2938 // It will contain other layers that draw content.
2977 addDrawingLayerTo(intermediateLayerPtr, 3, IntRect(10, 10, rootSize.width(), rootSize.height()), &surfaceLayerPtr); 2939 addDrawingLayerTo(intermediateLayerPtr, 3, IntRect(10, 10, rootSize.width(), rootSize.height()), &surfaceLayerPtr);
2978 surfaceLayerPtr->setDrawsContent(false); // only children draw content 2940 surfaceLayerPtr->setDrawsContent(false); // only children draw content
(...skipping 25 matching lines...) Expand all
3004 2966
3005 myHostImpl->initializeRenderer(context.Pass()); 2967 myHostImpl->initializeRenderer(context.Pass());
3006 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height())); 2968 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height()));
3007 2969
3008 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 2970 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3009 rootPtr = root.get(); 2971 rootPtr = root.get();
3010 2972
3011 root->setAnchorPoint(FloatPoint(0, 0)); 2973 root->setAnchorPoint(FloatPoint(0, 0));
3012 root->setPosition(FloatPoint(0, 0)); 2974 root->setPosition(FloatPoint(0, 0));
3013 root->setBounds(rootSize); 2975 root->setBounds(rootSize);
3014 root->setContentBounds(rootSize);
3015 root->setDrawsContent(true); 2976 root->setDrawsContent(true);
3016 root->setMasksToBounds(true); 2977 root->setMasksToBounds(true);
3017 myHostImpl->setRootLayer(root.Pass()); 2978 myHostImpl->setRootLayer(root.Pass());
3018 2979
3019 addDrawingLayerTo(rootPtr, 3, IntRect(0, 0, rootSize.width(), rootSize.heigh t()), &surfaceLayerPtr); 2980 addDrawingLayerTo(rootPtr, 3, IntRect(0, 0, rootSize.width(), rootSize.heigh t()), &surfaceLayerPtr);
3020 surfaceLayerPtr->setDrawsContent(false); 2981 surfaceLayerPtr->setDrawsContent(false);
3021 2982
3022 // Surface layer is the layer that changes its opacity 2983 // Surface layer is the layer that changes its opacity
3023 // It will contain other layers that draw content. 2984 // It will contain other layers that draw content.
3024 surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface 2985 surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 3077
3117 myHostImpl->initializeRenderer(context.Pass()); 3078 myHostImpl->initializeRenderer(context.Pass());
3118 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height())); 3079 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height()));
3119 3080
3120 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3081 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3121 rootPtr = root.get(); 3082 rootPtr = root.get();
3122 3083
3123 root->setAnchorPoint(FloatPoint(0, 0)); 3084 root->setAnchorPoint(FloatPoint(0, 0));
3124 root->setPosition(FloatPoint(0, 0)); 3085 root->setPosition(FloatPoint(0, 0));
3125 root->setBounds(rootSize); 3086 root->setBounds(rootSize);
3126 root->setContentBounds(rootSize);
3127 root->setDrawsContent(true); 3087 root->setDrawsContent(true);
3128 root->setMasksToBounds(true); 3088 root->setMasksToBounds(true);
3129 myHostImpl->setRootLayer(root.Pass()); 3089 myHostImpl->setRootLayer(root.Pass());
3130 3090
3131 addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr); 3091 addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr);
3132 layerS1Ptr->setForceRenderSurface(true); 3092 layerS1Ptr->setForceRenderSurface(true);
3133 3093
3134 addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11 3094 addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11
3135 addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12 3095 addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12
3136 3096
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 3189
3230 myHostImpl->initializeRenderer(context.Pass()); 3190 myHostImpl->initializeRenderer(context.Pass());
3231 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height())); 3191 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height()));
3232 3192
3233 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3193 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3234 rootPtr = root.get(); 3194 rootPtr = root.get();
3235 3195
3236 root->setAnchorPoint(FloatPoint(0, 0)); 3196 root->setAnchorPoint(FloatPoint(0, 0));
3237 root->setPosition(FloatPoint(0, 0)); 3197 root->setPosition(FloatPoint(0, 0));
3238 root->setBounds(rootSize); 3198 root->setBounds(rootSize);
3239 root->setContentBounds(rootSize);
3240 root->setDrawsContent(true); 3199 root->setDrawsContent(true);
3241 root->setMasksToBounds(true); 3200 root->setMasksToBounds(true);
3242 myHostImpl->setRootLayer(root.Pass()); 3201 myHostImpl->setRootLayer(root.Pass());
3243 3202
3244 addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 800, 800), &layerS1Ptr); 3203 addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 800, 800), &layerS1Ptr);
3245 layerS1Ptr->setForceRenderSurface(true); 3204 layerS1Ptr->setForceRenderSurface(true);
3246 layerS1Ptr->setDrawsContent(false); 3205 layerS1Ptr->setDrawsContent(false);
3247 3206
3248 addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11 3207 addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11
3249 addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 500, 300, 300), 0); // L12 3208 addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 500, 300, 300), 0); // L12
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 3302
3344 myHostImpl->initializeRenderer(context.Pass()); 3303 myHostImpl->initializeRenderer(context.Pass());
3345 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height())); 3304 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height()));
3346 3305
3347 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3306 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3348 rootPtr = root.get(); 3307 rootPtr = root.get();
3349 3308
3350 root->setAnchorPoint(FloatPoint(0, 0)); 3309 root->setAnchorPoint(FloatPoint(0, 0));
3351 root->setPosition(FloatPoint(0, 0)); 3310 root->setPosition(FloatPoint(0, 0));
3352 root->setBounds(rootSize); 3311 root->setBounds(rootSize);
3353 root->setContentBounds(rootSize);
3354 root->setDrawsContent(true); 3312 root->setDrawsContent(true);
3355 root->setMasksToBounds(true); 3313 root->setMasksToBounds(true);
3356 myHostImpl->setRootLayer(root.Pass()); 3314 myHostImpl->setRootLayer(root.Pass());
3357 3315
3358 addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr); 3316 addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr);
3359 layerS1Ptr->setForceRenderSurface(true); 3317 layerS1Ptr->setForceRenderSurface(true);
3360 3318
3361 addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11 3319 addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11
3362 addDrawingLayerTo(layerS1Ptr, 4, IntRect(100, 0, 300, 300), 0); // L12 3320 addDrawingLayerTo(layerS1Ptr, 4, IntRect(100, 0, 300, 300), 0); // L12
3363 3321
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3426 3384
3427 myHostImpl->initializeRenderer(context.Pass()); 3385 myHostImpl->initializeRenderer(context.Pass());
3428 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height())); 3386 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height()));
3429 3387
3430 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3388 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3431 rootPtr = root.get(); 3389 rootPtr = root.get();
3432 3390
3433 root->setAnchorPoint(FloatPoint(0, 0)); 3391 root->setAnchorPoint(FloatPoint(0, 0));
3434 root->setPosition(FloatPoint(0, 0)); 3392 root->setPosition(FloatPoint(0, 0));
3435 root->setBounds(rootSize); 3393 root->setBounds(rootSize);
3436 root->setContentBounds(rootSize);
3437 root->setDrawsContent(true); 3394 root->setDrawsContent(true);
3438 root->setMasksToBounds(true); 3395 root->setMasksToBounds(true);
3439 myHostImpl->setRootLayer(root.Pass()); 3396 myHostImpl->setRootLayer(root.Pass());
3440 3397
3441 addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr); 3398 addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr);
3442 layerS1Ptr->setForceRenderSurface(true); 3399 layerS1Ptr->setForceRenderSurface(true);
3443 WebTransformationMatrix transform = layerS1Ptr->transform(); 3400 WebTransformationMatrix transform = layerS1Ptr->transform();
3444 transform.translate(200, 200); 3401 transform.translate(200, 200);
3445 transform.rotate(45); 3402 transform.rotate(45);
3446 transform.translate(-200, -200); 3403 transform.translate(-200, -200);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
3511 3468
3512 myHostImpl->initializeRenderer(context.Pass()); 3469 myHostImpl->initializeRenderer(context.Pass());
3513 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height())); 3470 myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), In tSize(rootSize.width(), rootSize.height()));
3514 3471
3515 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3472 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3516 rootPtr = root.get(); 3473 rootPtr = root.get();
3517 3474
3518 root->setAnchorPoint(FloatPoint(0, 0)); 3475 root->setAnchorPoint(FloatPoint(0, 0));
3519 root->setPosition(FloatPoint(0, 0)); 3476 root->setPosition(FloatPoint(0, 0));
3520 root->setBounds(rootSize); 3477 root->setBounds(rootSize);
3521 root->setContentBounds(rootSize);
3522 root->setDrawsContent(true); 3478 root->setDrawsContent(true);
3523 root->setMasksToBounds(true); 3479 root->setMasksToBounds(true);
3524 myHostImpl->setRootLayer(root.Pass()); 3480 myHostImpl->setRootLayer(root.Pass());
3525 3481
3526 addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr); 3482 addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr);
3527 layerS1Ptr->setForceRenderSurface(true); 3483 layerS1Ptr->setForceRenderSurface(true);
3528 3484
3529 addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11 3485 addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11
3530 addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12 3486 addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12
3531 3487
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 IntRect rootRect(0, 0, 100, 100); 3581 IntRect rootRect(0, 0, 100, 100);
3626 IntRect childRect(10, 10, 50, 50); 3582 IntRect childRect(10, 10, 50, 50);
3627 IntRect grandChildRect(5, 5, 150, 150); 3583 IntRect grandChildRect(5, 5, 150, 150);
3628 3584
3629 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>(); 3585 scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create (scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<Graphi csContext>();
3630 myHostImpl->initializeRenderer(context.Pass()); 3586 myHostImpl->initializeRenderer(context.Pass());
3631 3587
3632 root->setAnchorPoint(FloatPoint(0, 0)); 3588 root->setAnchorPoint(FloatPoint(0, 0));
3633 root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); 3589 root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
3634 root->setBounds(IntSize(rootRect.width(), rootRect.height())); 3590 root->setBounds(IntSize(rootRect.width(), rootRect.height()));
3635 root->setContentBounds(root->bounds());
3636 root->setDrawsContent(true); 3591 root->setDrawsContent(true);
3637 root->setMasksToBounds(true); 3592 root->setMasksToBounds(true);
3638 3593
3639 child->setAnchorPoint(FloatPoint(0, 0)); 3594 child->setAnchorPoint(FloatPoint(0, 0));
3640 child->setPosition(FloatPoint(childRect.x(), childRect.y())); 3595 child->setPosition(FloatPoint(childRect.x(), childRect.y()));
3641 child->setOpacity(0.5); 3596 child->setOpacity(0.5);
3642 child->setBounds(IntSize(childRect.width(), childRect.height())); 3597 child->setBounds(IntSize(childRect.width(), childRect.height()));
3643 child->setContentBounds(child->bounds());
3644 child->setDrawsContent(true); 3598 child->setDrawsContent(true);
3645 child->setSkipsDraw(false); 3599 child->setSkipsDraw(false);
3646 3600
3647 // child layer has 10x10 tiles. 3601 // child layer has 10x10 tiles.
3648 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(10, 10), LayerTilingData::HasBorderTexels); 3602 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(10, 10), LayerTilingData::HasBorderTexels);
3649 tiler->setBounds(child->contentBounds()); 3603 tiler->setBounds(child->contentBounds());
3650 child->setTilingData(*tiler.get()); 3604 child->setTilingData(*tiler.get());
3651 3605
3652 grandChild->setAnchorPoint(FloatPoint(0, 0)); 3606 grandChild->setAnchorPoint(FloatPoint(0, 0));
3653 grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); 3607 grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
3654 grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height( ))); 3608 grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height( )));
3655 grandChild->setContentBounds(grandChild->bounds());
3656 grandChild->setDrawsContent(true); 3609 grandChild->setDrawsContent(true);
3657 3610
3658 TiledLayerImpl* childPtr = child.get(); 3611 TiledLayerImpl* childPtr = child.get();
3659 RenderPass::Id childPassId(childPtr->id(), 0); 3612 RenderPass::Id childPassId(childPtr->id(), 0);
3660 3613
3661 child->addChild(grandChild.Pass()); 3614 child->addChild(grandChild.Pass());
3662 root->addChild(child.PassAs<LayerImpl>()); 3615 root->addChild(child.PassAs<LayerImpl>());
3663 myHostImpl->setRootLayer(root.Pass()); 3616 myHostImpl->setRootLayer(root.Pass());
3664 myHostImpl->setViewportSize(rootRect.size(), rootRect.size()); 3617 myHostImpl->setViewportSize(rootRect.size(), rootRect.size());
3665 3618
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
4376 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a); 4329 verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testDat a);
4377 testCaseIndex++; 4330 testCaseIndex++;
4378 } 4331 }
4379 } 4332 }
4380 4333
4381 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4334 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4382 LayerTreeHostImplTest, 4335 LayerTreeHostImplTest,
4383 ::testing::Values(false, true)); 4336 ::testing::Values(false, true));
4384 4337
4385 } // namespace 4338 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698