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

Side by Side Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11280263: Organize internal properties of cc/ layer types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed all feedback so far Created 8 years 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 "cc/layer_tree_host_impl.h" 5 #include "cc/layer_tree_host_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this, &m_proxy); 112 scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(set tings, this, &m_proxy);
113 113
114 myHostImpl->initializeRenderer(graphicsContext.Pass()); 114 myHostImpl->initializeRenderer(graphicsContext.Pass());
115 myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); 115 myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
116 116
117 root->setAnchorPoint(gfx::PointF(0, 0)); 117 root->setAnchorPoint(gfx::PointF(0, 0));
118 root->setPosition(gfx::PointF(0, 0)); 118 root->setPosition(gfx::PointF(0, 0));
119 root->setBounds(gfx::Size(10, 10)); 119 root->setBounds(gfx::Size(10, 10));
120 root->setContentBounds(gfx::Size(10, 10)); 120 root->setContentBounds(gfx::Size(10, 10));
121 root->setVisibleContentRect(gfx::Rect(0, 0, 10, 10));
122 root->setDrawsContent(true); 121 root->setDrawsContent(true);
122 root->drawProperties().visible_content_rect = gfx::Rect(0, 0, 10, 10);
123 myHostImpl->setRootLayer(root.Pass()); 123 myHostImpl->setRootLayer(root.Pass());
124 return myHostImpl.Pass(); 124 return myHostImpl.Pass();
125 } 125 }
126 126
127 static void expectClearedScrollDeltasRecursive(LayerImpl* layer) 127 static void expectClearedScrollDeltasRecursive(LayerImpl* layer)
128 { 128 {
129 ASSERT_EQ(layer->scrollDelta(), gfx::Vector2d()); 129 ASSERT_EQ(layer->scrollDelta(), gfx::Vector2d());
130 for (size_t i = 0; i < layer->children().size(); ++i) 130 for (size_t i = 0; i < layer->children().size(); ++i)
131 expectClearedScrollDeltasRecursive(layer->children()[i]); 131 expectClearedScrollDeltasRecursive(layer->children()[i]);
132 } 132 }
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 explicit DidDrawCheckLayer(int id) 903 explicit DidDrawCheckLayer(int id)
904 : TiledLayerImpl(id) 904 : TiledLayerImpl(id)
905 , m_didDrawCalled(false) 905 , m_didDrawCalled(false)
906 , m_willDrawCalled(false) 906 , m_willDrawCalled(false)
907 { 907 {
908 setAnchorPoint(gfx::PointF(0, 0)); 908 setAnchorPoint(gfx::PointF(0, 0));
909 setBounds(gfx::Size(10, 10)); 909 setBounds(gfx::Size(10, 10));
910 setContentBounds(gfx::Size(10, 10)); 910 setContentBounds(gfx::Size(10, 10));
911 setDrawsContent(true); 911 setDrawsContent(true);
912 setSkipsDraw(false); 912 setSkipsDraw(false);
913 setVisibleContentRect(gfx::Rect(0, 0, 10, 10)); 913 drawProperties().visible_content_rect = gfx::Rect(0, 0, 10, 10);
914 914
915 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10 0, 100), LayerTilingData::HasBorderTexels); 915 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10 0, 100), LayerTilingData::HasBorderTexels);
916 tiler->setBounds(contentBounds()); 916 tiler->setBounds(contentBounds());
917 setTilingData(*tiler.get()); 917 setTilingData(*tiler.get());
918 } 918 }
919 919
920 private: 920 private:
921 bool m_didDrawCalled; 921 bool m_didDrawCalled;
922 bool m_willDrawCalled; 922 bool m_willDrawCalled;
923 }; 923 };
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 2376
2377 gfx::Rect rootRect(0, 0, 100, 100); 2377 gfx::Rect rootRect(0, 0, 100, 100);
2378 gfx::Rect childRect(10, 10, 50, 50); 2378 gfx::Rect childRect(10, 10, 50, 50);
2379 gfx::Rect grandChildRect(5, 5, 150, 150); 2379 gfx::Rect grandChildRect(5, 5, 150, 150);
2380 2380
2381 root->createRenderSurface(); 2381 root->createRenderSurface();
2382 root->setAnchorPoint(gfx::PointF(0, 0)); 2382 root->setAnchorPoint(gfx::PointF(0, 0));
2383 root->setPosition(gfx::PointF(rootRect.x(), rootRect.y())); 2383 root->setPosition(gfx::PointF(rootRect.x(), rootRect.y()));
2384 root->setBounds(gfx::Size(rootRect.width(), rootRect.height())); 2384 root->setBounds(gfx::Size(rootRect.width(), rootRect.height()));
2385 root->setContentBounds(root->bounds()); 2385 root->setContentBounds(root->bounds());
2386 root->setVisibleContentRect(rootRect); 2386 root->drawProperties().visible_content_rect = rootRect;
2387 root->setDrawsContent(false); 2387 root->setDrawsContent(false);
2388 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root Rect.width(), rootRect.height()))); 2388 root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(root Rect.width(), rootRect.height())));
2389 2389
2390 child->setAnchorPoint(gfx::PointF(0, 0)); 2390 child->setAnchorPoint(gfx::PointF(0, 0));
2391 child->setPosition(gfx::PointF(childRect.x(), childRect.y())); 2391 child->setPosition(gfx::PointF(childRect.x(), childRect.y()));
2392 child->setOpacity(0.5f); 2392 child->setOpacity(0.5f);
2393 child->setBounds(gfx::Size(childRect.width(), childRect.height())); 2393 child->setBounds(gfx::Size(childRect.width(), childRect.height()));
2394 child->setContentBounds(child->bounds()); 2394 child->setContentBounds(child->bounds());
2395 child->setVisibleContentRect(childRect); 2395 child->drawProperties().visible_content_rect = childRect;
2396 child->setDrawsContent(false); 2396 child->setDrawsContent(false);
2397 child->setForceRenderSurface(true); 2397 child->setForceRenderSurface(true);
2398 2398
2399 grandChild->setAnchorPoint(gfx::PointF(0, 0)); 2399 grandChild->setAnchorPoint(gfx::PointF(0, 0));
2400 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y())); 2400 grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y()));
2401 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh t())); 2401 grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.heigh t()));
2402 grandChild->setContentBounds(grandChild->bounds()); 2402 grandChild->setContentBounds(grandChild->bounds());
2403 grandChild->setVisibleContentRect(grandChildRect); 2403 grandChild->drawProperties().visible_content_rect = grandChildRect;
2404 grandChild->setDrawsContent(true); 2404 grandChild->setDrawsContent(true);
2405 2405
2406 child->addChild(grandChild.Pass()); 2406 child->addChild(grandChild.Pass());
2407 root->addChild(child.Pass()); 2407 root->addChild(child.Pass());
2408 2408
2409 myHostImpl->setRootLayer(root.Pass()); 2409 myHostImpl->setRootLayer(root.Pass());
2410 return myHostImpl.Pass(); 2410 return myHostImpl.Pass();
2411 } 2411 }
2412 2412
2413 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap) 2413 TEST_P(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap)
(...skipping 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after
4895 { 4895 {
4896 pinchZoomPanViewportAndScrollBoundaryTest(2); 4896 pinchZoomPanViewportAndScrollBoundaryTest(2);
4897 } 4897 }
4898 4898
4899 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests, 4899 INSTANTIATE_TEST_CASE_P(LayerTreeHostImplTests,
4900 LayerTreeHostImplTest, 4900 LayerTreeHostImplTest,
4901 ::testing::Values(false, true)); 4901 ::testing::Values(false, true));
4902 4902
4903 } // namespace 4903 } // namespace
4904 } // namespace cc 4904 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698