| 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 | 9 |
| 10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 private: | 53 private: |
| 54 ~LayerWithForcedDrawsContent() override {} | 54 ~LayerWithForcedDrawsContent() override {} |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } | 57 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } |
| 58 | 58 |
| 59 class MockContentLayerClient : public ContentLayerClient { | 59 class MockContentLayerClient : public ContentLayerClient { |
| 60 public: | 60 public: |
| 61 MockContentLayerClient() {} | 61 MockContentLayerClient() {} |
| 62 ~MockContentLayerClient() override {} | 62 ~MockContentLayerClient() override {} |
| 63 gfx::Rect PaintableRegion() override { return gfx::Rect(); } |
| 63 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( | 64 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( |
| 64 const gfx::Rect& clip, | 65 const gfx::Rect& clip, |
| 65 PaintingControlSetting picture_control) override { | 66 PaintingControlSetting picture_control) override { |
| 66 NOTIMPLEMENTED(); | 67 NOTIMPLEMENTED(); |
| 67 return nullptr; | 68 return nullptr; |
| 68 } | 69 } |
| 69 bool FillsBoundsCompletely() const override { return false; } | 70 bool FillsBoundsCompletely() const override { return false; } |
| 70 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } | 71 size_t GetApproximateUnsharedMemoryUsage() const override { return 0; } |
| 71 }; | 72 }; |
| 72 | 73 |
| (...skipping 8280 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 |