| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 EXPECT_EQ(cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP, innerClip->clip_type); | 462 EXPECT_EQ(cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP, innerClip->clip_type); |
| 463 EXPECT_TRUE(innerClip->layers_are_clipped); | 463 EXPECT_TRUE(innerClip->layers_are_clipped); |
| 464 EXPECT_EQ(gfx::RectF(200, 200, 700, 100), innerClip->clip); | 464 EXPECT_EQ(gfx::RectF(200, 200, 700, 100), innerClip->clip); |
| 465 EXPECT_EQ(outerClip->id, innerClip->parent_id); | 465 EXPECT_EQ(outerClip->id, innerClip->parent_id); |
| 466 } | 466 } |
| 467 | 467 |
| 468 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, DeeplyNestedClips) { | 468 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, DeeplyNestedClips) { |
| 469 Vector<RefPtr<ClipPaintPropertyNode>> clips; | 469 Vector<RefPtr<ClipPaintPropertyNode>> clips; |
| 470 for (unsigned i = 1; i <= 10; i++) { | 470 for (unsigned i = 1; i <= 10; i++) { |
| 471 clips.append(ClipPaintPropertyNode::create( | 471 clips.append(ClipPaintPropertyNode::create( |
| 472 clips.isEmpty() ? ClipPaintPropertyNode::root() : clips.last(), | 472 clips.isEmpty() ? ClipPaintPropertyNode::root() : clips.back(), |
| 473 TransformPaintPropertyNode::root(), | 473 TransformPaintPropertyNode::root(), |
| 474 FloatRoundedRect(5 * i, 0, 100, 200 - 10 * i))); | 474 FloatRoundedRect(5 * i, 0, 100, 200 - 10 * i))); |
| 475 } | 475 } |
| 476 | 476 |
| 477 TestPaintArtifact artifact; | 477 TestPaintArtifact artifact; |
| 478 artifact | 478 artifact |
| 479 .chunk(TransformPaintPropertyNode::root(), clips.last(), | 479 .chunk(TransformPaintPropertyNode::root(), clips.back(), |
| 480 EffectPaintPropertyNode::root()) | 480 EffectPaintPropertyNode::root()) |
| 481 .rectDrawing(FloatRect(0, 0, 200, 200), Color::white); | 481 .rectDrawing(FloatRect(0, 0, 200, 200), Color::white); |
| 482 update(artifact.build()); | 482 update(artifact.build()); |
| 483 | 483 |
| 484 // Check the drawing layer. | 484 // Check the drawing layer. |
| 485 ASSERT_EQ(1u, contentLayerCount()); | 485 ASSERT_EQ(1u, contentLayerCount()); |
| 486 const cc::Layer* drawingLayer = contentLayerAt(0); | 486 const cc::Layer* drawingLayer = contentLayerAt(0); |
| 487 EXPECT_THAT(drawingLayer->GetPicture(), | 487 EXPECT_THAT(drawingLayer->GetPicture(), |
| 488 Pointee(drawsRectangle(FloatRect(0, 0, 200, 200), Color::white))); | 488 Pointee(drawsRectangle(FloatRect(0, 0, 200, 200), Color::white))); |
| 489 EXPECT_EQ(gfx::Transform(), drawingLayer->screen_space_transform()); | 489 EXPECT_EQ(gfx::Transform(), drawingLayer->screen_space_transform()); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 scrollTree.current_scroll_offset(contentLayerAt(1)->id())); | 720 scrollTree.current_scroll_offset(contentLayerAt(1)->id())); |
| 721 | 721 |
| 722 EXPECT_TRUE(scrollNodeA.main_thread_scrolling_reasons & | 722 EXPECT_TRUE(scrollNodeA.main_thread_scrolling_reasons & |
| 723 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); | 723 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); |
| 724 EXPECT_FALSE(scrollNodeB.main_thread_scrolling_reasons & | 724 EXPECT_FALSE(scrollNodeB.main_thread_scrolling_reasons & |
| 725 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); | 725 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); |
| 726 } | 726 } |
| 727 | 727 |
| 728 } // namespace | 728 } // namespace |
| 729 } // namespace blink | 729 } // namespace blink |
| OLD | NEW |