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/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 private: | 54 private: |
55 ~LayerWithForcedDrawsContent() override {} | 55 ~LayerWithForcedDrawsContent() override {} |
56 }; | 56 }; |
57 | 57 |
58 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } | 58 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } |
59 | 59 |
60 class MockContentLayerClient : public ContentLayerClient { | 60 class MockContentLayerClient : public ContentLayerClient { |
61 public: | 61 public: |
62 MockContentLayerClient() {} | 62 MockContentLayerClient() {} |
63 ~MockContentLayerClient() override {} | 63 ~MockContentLayerClient() override {} |
| 64 gfx::Rect PaintableRegion() override { return gfx::Rect(); } |
64 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 65 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
65 const gfx::Rect& clip, | 66 const gfx::Rect& clip, |
66 PaintingControlSetting picture_control) override { | 67 PaintingControlSetting picture_control) override { |
67 NOTIMPLEMENTED(); | 68 NOTIMPLEMENTED(); |
68 return nullptr; | 69 return nullptr; |
69 } | 70 } |
70 bool FillsBoundsCompletely() const override { return false; } | 71 bool FillsBoundsCompletely() const override { return false; } |
71 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } | 72 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } |
72 }; | 73 }; |
73 | 74 |
(...skipping 8279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8353 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8354 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
8354 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), | 8355 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), |
8355 scroll_child->visible_rect_from_property_trees()); | 8356 scroll_child->visible_rect_from_property_trees()); |
8356 } | 8357 } |
8357 | 8358 |
8358 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { | 8359 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { |
8359 } | 8360 } |
8360 | 8361 |
8361 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { | 8362 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
8362 gfx::Transform identity; | 8363 gfx::Transform identity; |
| 8364 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
8363 FakeContentLayerClient client; | 8365 FakeContentLayerClient client; |
8364 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8366 client.set_bounds(root->bounds()); |
8365 scoped_refptr<LayerWithForcedDrawsContent> child = | 8367 scoped_refptr<LayerWithForcedDrawsContent> child = |
8366 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8368 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
8367 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 8369 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
8368 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8370 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
8369 scoped_refptr<FakePictureLayer> greatgrandchild( | 8371 scoped_refptr<FakePictureLayer> greatgrandchild( |
8370 FakePictureLayer::Create(layer_settings(), &client)); | 8372 FakePictureLayer::Create(layer_settings(), &client)); |
8371 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8373 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
8372 gfx::PointF(), gfx::Size(100, 100), true, false); | 8374 gfx::PointF(), gfx::Size(100, 100), true, false); |
8373 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 8375 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
8374 gfx::PointF(), gfx::Size(10, 10), true, false); | 8376 gfx::PointF(), gfx::Size(10, 10), true, false); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8527 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); | 8529 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); |
8528 | 8530 |
8529 greatgrandchild_ptr->PassCopyRequests(&requests); | 8531 greatgrandchild_ptr->PassCopyRequests(&requests); |
8530 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8532 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
8531 EXPECT_EQ(gfx::Rect(10, 10), | 8533 EXPECT_EQ(gfx::Rect(10, 10), |
8532 grandchild_ptr->visible_rect_from_property_trees()); | 8534 grandchild_ptr->visible_rect_from_property_trees()); |
8533 } | 8535 } |
8534 | 8536 |
8535 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 8537 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
8536 gfx::Transform identity; | 8538 gfx::Transform identity; |
| 8539 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
8537 FakeContentLayerClient client; | 8540 FakeContentLayerClient client; |
8538 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8541 client.set_bounds(root->bounds()); |
8539 scoped_refptr<LayerWithForcedDrawsContent> child = | 8542 scoped_refptr<LayerWithForcedDrawsContent> child = |
8540 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8543 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
8541 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8544 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
8542 gfx::PointF(), gfx::Size(100, 100), true, false); | 8545 gfx::PointF(), gfx::Size(100, 100), true, false); |
8543 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 8546 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
8544 gfx::PointF(), gfx::Size(10, 10), true, false); | 8547 gfx::PointF(), gfx::Size(10, 10), true, false); |
8545 root->AddChild(child); | 8548 root->AddChild(child); |
8546 | 8549 |
8547 host()->SetRootLayer(root); | 8550 host()->SetRootLayer(root); |
8548 | 8551 |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9266 bool root_in_rsll = | 9269 bool root_in_rsll = |
9267 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); | 9270 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); |
9268 EXPECT_TRUE(root_in_rsll); | 9271 EXPECT_TRUE(root_in_rsll); |
9269 bool render_surface2_in_rsll = | 9272 bool render_surface2_in_rsll = |
9270 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); | 9273 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); |
9271 EXPECT_FALSE(render_surface2_in_rsll); | 9274 EXPECT_FALSE(render_surface2_in_rsll); |
9272 } | 9275 } |
9273 | 9276 |
9274 } // namespace | 9277 } // namespace |
9275 } // namespace cc | 9278 } // namespace cc |
OLD | NEW |