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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp

Issue 2506353002: Incrementally build main thread scrolling reasons [spv2] (Closed)
Patch Set: Cleanup comments Created 4 years, 1 month 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
OLDNEW
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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 EXPECT_EQ(convertedEffect3.id, contentLayerAt(2)->effect_tree_index()); 622 EXPECT_EQ(convertedEffect3.id, contentLayerAt(2)->effect_tree_index());
623 } 623 }
624 624
625 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, OneScrollNode) { 625 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, OneScrollNode) {
626 RefPtr<TransformPaintPropertyNode> scrollTranslation = 626 RefPtr<TransformPaintPropertyNode> scrollTranslation =
627 TransformPaintPropertyNode::create(TransformPaintPropertyNode::root(), 627 TransformPaintPropertyNode::create(TransformPaintPropertyNode::root(),
628 TransformationMatrix().translate(7, 9), 628 TransformationMatrix().translate(7, 9),
629 FloatPoint3D()); 629 FloatPoint3D());
630 RefPtr<ScrollPaintPropertyNode> scroll = ScrollPaintPropertyNode::create( 630 RefPtr<ScrollPaintPropertyNode> scroll = ScrollPaintPropertyNode::create(
631 ScrollPaintPropertyNode::root(), scrollTranslation, IntSize(11, 13), 631 ScrollPaintPropertyNode::root(), scrollTranslation, IntSize(11, 13),
632 IntSize(27, 31), true, false); 632 IntSize(27, 31), true, false, false, false);
633 633
634 TestPaintArtifact artifact; 634 TestPaintArtifact artifact;
635 artifact 635 artifact
636 .chunk(scrollTranslation, ClipPaintPropertyNode::root(), 636 .chunk(scrollTranslation, ClipPaintPropertyNode::root(),
637 EffectPaintPropertyNode::root(), scroll) 637 EffectPaintPropertyNode::root(), scroll)
638 .rectDrawing(FloatRect(11, 13, 17, 19), Color::white); 638 .rectDrawing(FloatRect(11, 13, 17, 19), Color::white);
639 update(artifact.build()); 639 update(artifact.build());
640 640
641 const cc::ScrollTree& scrollTree = propertyTrees().scroll_tree; 641 const cc::ScrollTree& scrollTree = propertyTrees().scroll_tree;
642 // Node #0 reserved for null; #1 for root render surface. 642 // Node #0 reserved for null; #1 for root render surface.
(...skipping 21 matching lines...) Expand all
664 RefPtr<EffectPaintPropertyNode> effect = EffectPaintPropertyNode::create( 664 RefPtr<EffectPaintPropertyNode> effect = EffectPaintPropertyNode::create(
665 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 665 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(),
666 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5); 666 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5);
667 667
668 RefPtr<TransformPaintPropertyNode> scrollTranslationA = 668 RefPtr<TransformPaintPropertyNode> scrollTranslationA =
669 TransformPaintPropertyNode::create( 669 TransformPaintPropertyNode::create(
670 TransformPaintPropertyNode::root(), 670 TransformPaintPropertyNode::root(),
671 TransformationMatrix().translate(11, 13), FloatPoint3D()); 671 TransformationMatrix().translate(11, 13), FloatPoint3D());
672 RefPtr<ScrollPaintPropertyNode> scrollA = ScrollPaintPropertyNode::create( 672 RefPtr<ScrollPaintPropertyNode> scrollA = ScrollPaintPropertyNode::create(
673 ScrollPaintPropertyNode::root(), scrollTranslationA, IntSize(2, 3), 673 ScrollPaintPropertyNode::root(), scrollTranslationA, IntSize(2, 3),
674 IntSize(5, 7), false, true); 674 IntSize(5, 7), false, true, false, true);
675 scrollA->addMainThreadScrollingReasons(
676 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects);
677 RefPtr<TransformPaintPropertyNode> scrollTranslationB = 675 RefPtr<TransformPaintPropertyNode> scrollTranslationB =
678 TransformPaintPropertyNode::create( 676 TransformPaintPropertyNode::create(
679 scrollTranslationA, TransformationMatrix().translate(37, 41), 677 scrollTranslationA, TransformationMatrix().translate(37, 41),
680 FloatPoint3D()); 678 FloatPoint3D());
681 RefPtr<ScrollPaintPropertyNode> scrollB = ScrollPaintPropertyNode::create( 679 RefPtr<ScrollPaintPropertyNode> scrollB = ScrollPaintPropertyNode::create(
682 scrollA, scrollTranslationB, IntSize(19, 23), IntSize(29, 31), true, 680 scrollA, scrollTranslationB, IntSize(19, 23), IntSize(29, 31), true,
683 false); 681 false, false, false);
684 TestPaintArtifact artifact; 682 TestPaintArtifact artifact;
685 artifact 683 artifact
686 .chunk(scrollTranslationA, ClipPaintPropertyNode::root(), effect, scrollA) 684 .chunk(scrollTranslationA, ClipPaintPropertyNode::root(), effect, scrollA)
687 .rectDrawing(FloatRect(7, 11, 13, 17), Color::white); 685 .rectDrawing(FloatRect(7, 11, 13, 17), Color::white);
688 artifact 686 artifact
689 .chunk(scrollTranslationB, ClipPaintPropertyNode::root(), effect, scrollB) 687 .chunk(scrollTranslationB, ClipPaintPropertyNode::root(), effect, scrollB)
690 .rectDrawing(FloatRect(1, 2, 3, 5), Color::white); 688 .rectDrawing(FloatRect(1, 2, 3, 5), Color::white);
691 update(artifact.build()); 689 update(artifact.build());
692 690
693 const cc::ScrollTree& scrollTree = propertyTrees().scroll_tree; 691 const cc::ScrollTree& scrollTree = propertyTrees().scroll_tree;
(...skipping 26 matching lines...) Expand all
720 scrollTree.current_scroll_offset(contentLayerAt(1)->id())); 718 scrollTree.current_scroll_offset(contentLayerAt(1)->id()));
721 719
722 EXPECT_TRUE(scrollNodeA.main_thread_scrolling_reasons & 720 EXPECT_TRUE(scrollNodeA.main_thread_scrolling_reasons &
723 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); 721 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects);
724 EXPECT_FALSE(scrollNodeB.main_thread_scrolling_reasons & 722 EXPECT_FALSE(scrollNodeB.main_thread_scrolling_reasons &
725 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects); 723 MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects);
726 } 724 }
727 725
728 } // namespace 726 } // namespace
729 } // namespace blink 727 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698