OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/compositing/PaintArtifactCompositor.h" | 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
6 | 6 |
7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/test/fake_compositor_frame_sink.h" | 10 #include "cc/test/fake_compositor_frame_sink.h" |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 propertyTrees().clip_tree.Node(blackLayer->clip_tree_index()); | 472 propertyTrees().clip_tree.Node(blackLayer->clip_tree_index()); |
473 EXPECT_EQ(cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP, innerClip->clip_type); | 473 EXPECT_EQ(cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP, innerClip->clip_type); |
474 EXPECT_TRUE(innerClip->layers_are_clipped); | 474 EXPECT_TRUE(innerClip->layers_are_clipped); |
475 EXPECT_EQ(gfx::RectF(200, 200, 700, 100), innerClip->clip); | 475 EXPECT_EQ(gfx::RectF(200, 200, 700, 100), innerClip->clip); |
476 EXPECT_EQ(outerClip->id, innerClip->parent_id); | 476 EXPECT_EQ(outerClip->id, innerClip->parent_id); |
477 } | 477 } |
478 | 478 |
479 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, DeeplyNestedClips) { | 479 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, DeeplyNestedClips) { |
480 Vector<RefPtr<ClipPaintPropertyNode>> clips; | 480 Vector<RefPtr<ClipPaintPropertyNode>> clips; |
481 for (unsigned i = 1; i <= 10; i++) { | 481 for (unsigned i = 1; i <= 10; i++) { |
482 clips.append(ClipPaintPropertyNode::create( | 482 clips.push_back(ClipPaintPropertyNode::create( |
483 clips.isEmpty() ? ClipPaintPropertyNode::root() : clips.back(), | 483 clips.isEmpty() ? ClipPaintPropertyNode::root() : clips.back(), |
484 TransformPaintPropertyNode::root(), | 484 TransformPaintPropertyNode::root(), |
485 FloatRoundedRect(5 * i, 0, 100, 200 - 10 * i))); | 485 FloatRoundedRect(5 * i, 0, 100, 200 - 10 * i))); |
486 } | 486 } |
487 | 487 |
488 TestPaintArtifact artifact; | 488 TestPaintArtifact artifact; |
489 artifact | 489 artifact |
490 .chunk(TransformPaintPropertyNode::root(), clips.back(), | 490 .chunk(TransformPaintPropertyNode::root(), clips.back(), |
491 EffectPaintPropertyNode::root()) | 491 EffectPaintPropertyNode::root()) |
492 .rectDrawing(FloatRect(0, 0, 200, 200), Color::white); | 492 .rectDrawing(FloatRect(0, 0, 200, 200), Color::white); |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 chunk3.properties.propertyTreeState = chunk1.properties.propertyTreeState; | 1551 chunk3.properties.propertyTreeState = chunk1.properties.propertyTreeState; |
1552 chunk3.bounds = FloatRect(0, 0, 50, 60); | 1552 chunk3.bounds = FloatRect(0, 0, 50, 60); |
1553 chunk3.knownToBeOpaque = true; | 1553 chunk3.knownToBeOpaque = true; |
1554 pendingLayer.add(chunk3, nullptr); | 1554 pendingLayer.add(chunk3, nullptr); |
1555 | 1555 |
1556 // Chunk 3 covers the entire layer, so now it's opaque. | 1556 // Chunk 3 covers the entire layer, so now it's opaque. |
1557 EXPECT_TRUE(pendingLayer.knownToBeOpaque); | 1557 EXPECT_TRUE(pendingLayer.knownToBeOpaque); |
1558 } | 1558 } |
1559 | 1559 |
1560 } // namespace blink | 1560 } // namespace blink |
OLD | NEW |