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

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

Issue 2345403003: Add background attachment fixed main thread scrolling reason [spv2] (Closed)
Patch Set: Minor cleanup Created 4 years, 3 months 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 EXPECT_EQ(gfx::Size(27, 31), scrollNode.bounds); 562 EXPECT_EQ(gfx::Size(27, 31), scrollNode.bounds);
563 EXPECT_TRUE(scrollNode.user_scrollable_horizontal); 563 EXPECT_TRUE(scrollNode.user_scrollable_horizontal);
564 EXPECT_FALSE(scrollNode.user_scrollable_vertical); 564 EXPECT_FALSE(scrollNode.user_scrollable_vertical);
565 EXPECT_EQ(1, scrollNode.parent_id); 565 EXPECT_EQ(1, scrollNode.parent_id);
566 566
567 const cc::TransformTree& transformTree = propertyTrees().transform_tree; 567 const cc::TransformTree& transformTree = propertyTrees().transform_tree;
568 const cc::TransformNode& transformNode = *transformTree.Node(scrollNode.tran sform_id); 568 const cc::TransformNode& transformNode = *transformTree.Node(scrollNode.tran sform_id);
569 EXPECT_TRUE(transformNode.local.IsIdentity()); 569 EXPECT_TRUE(transformNode.local.IsIdentity());
570 570
571 EXPECT_EQ(gfx::ScrollOffset(-7, -9), scrollTree.current_scroll_offset(conten tLayerAt(0)->id())); 571 EXPECT_EQ(gfx::ScrollOffset(-7, -9), scrollTree.current_scroll_offset(conten tLayerAt(0)->id()));
572
573 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, scrollNode.main_th read_scrolling_reasons);
572 } 574 }
573 575
574 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, NestedScrollNodes) 576 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, NestedScrollNodes)
575 { 577 {
576 RefPtr<EffectPaintPropertyNode> effect = EffectPaintPropertyNode::create(dum myRootEffect(), 0.5); 578 RefPtr<EffectPaintPropertyNode> effect = EffectPaintPropertyNode::create(dum myRootEffect(), 0.5);
577 579
578 RefPtr<TransformPaintPropertyNode> scrollTranslationA = TransformPaintProper tyNode::create( 580 RefPtr<TransformPaintPropertyNode> scrollTranslationA = TransformPaintProper tyNode::create(
579 nullptr, TransformationMatrix().translate(11, 13), FloatPoint3D()); 581 nullptr, TransformationMatrix().translate(11, 13), FloatPoint3D());
580 RefPtr<ScrollPaintPropertyNode> scrollA = ScrollPaintPropertyNode::create( 582 RefPtr<ScrollPaintPropertyNode> scrollA = ScrollPaintPropertyNode::create(
581 nullptr, scrollTranslationA, IntSize(2, 3), IntSize(5, 7), false, true); 583 nullptr, scrollTranslationA, IntSize(2, 3), IntSize(5, 7), false, true);
582 RefPtr<TransformPaintPropertyNode> scrollTranslationB = TransformPaintProper tyNode::create( 584 RefPtr<TransformPaintPropertyNode> scrollTranslationB = TransformPaintProper tyNode::create(
583 scrollTranslationA, TransformationMatrix().translate(37, 41), FloatPoint 3D()); 585 scrollTranslationA, TransformationMatrix().translate(37, 41), FloatPoint 3D());
584 RefPtr<ScrollPaintPropertyNode> scrollB = ScrollPaintPropertyNode::create( 586 RefPtr<ScrollPaintPropertyNode> scrollB = ScrollPaintPropertyNode::create(
585 scrollA, scrollTranslationB, IntSize(19, 23), IntSize(29, 31), true, fal se); 587 scrollA, scrollTranslationB, IntSize(19, 23), IntSize(29, 31), true, fal se);
588 scrollB->setBackgroundAttachmentFixedMainThreadScrollingReason();
586 589
587 TestPaintArtifact artifact; 590 TestPaintArtifact artifact;
588 artifact.chunk(scrollTranslationA, nullptr, effect, scrollA) 591 artifact.chunk(scrollTranslationA, nullptr, effect, scrollA)
589 .rectDrawing(FloatRect(7, 11, 13, 17), Color::white); 592 .rectDrawing(FloatRect(7, 11, 13, 17), Color::white);
590 artifact.chunk(scrollTranslationB, nullptr, effect, scrollB) 593 artifact.chunk(scrollTranslationB, nullptr, effect, scrollB)
591 .rectDrawing(FloatRect(1, 2, 3, 5), Color::white); 594 .rectDrawing(FloatRect(1, 2, 3, 5), Color::white);
592 update(artifact.build()); 595 update(artifact.build());
593 596
594 const cc::ScrollTree& scrollTree = propertyTrees().scroll_tree; 597 const cc::ScrollTree& scrollTree = propertyTrees().scroll_tree;
595 // Node #0 reserved for null; #1 for root render surface. 598 // Node #0 reserved for null; #1 for root render surface.
(...skipping 12 matching lines...) Expand all
608 EXPECT_EQ(scrollNodeA.id, scrollNodeB.parent_id); 611 EXPECT_EQ(scrollNodeA.id, scrollNodeB.parent_id);
609 612
610 const cc::TransformTree& transformTree = propertyTrees().transform_tree; 613 const cc::TransformTree& transformTree = propertyTrees().transform_tree;
611 const cc::TransformNode& transformNodeA = *transformTree.Node(scrollNodeA.tr ansform_id); 614 const cc::TransformNode& transformNodeA = *transformTree.Node(scrollNodeA.tr ansform_id);
612 EXPECT_TRUE(transformNodeA.local.IsIdentity()); 615 EXPECT_TRUE(transformNodeA.local.IsIdentity());
613 const cc::TransformNode& transformNodeB = *transformTree.Node(scrollNodeB.tr ansform_id); 616 const cc::TransformNode& transformNodeB = *transformTree.Node(scrollNodeB.tr ansform_id);
614 EXPECT_TRUE(transformNodeB.local.IsIdentity()); 617 EXPECT_TRUE(transformNodeB.local.IsIdentity());
615 618
616 EXPECT_EQ(gfx::ScrollOffset(-11, -13), scrollTree.current_scroll_offset(cont entLayerAt(0)->id())); 619 EXPECT_EQ(gfx::ScrollOffset(-11, -13), scrollTree.current_scroll_offset(cont entLayerAt(0)->id()));
617 EXPECT_EQ(gfx::ScrollOffset(-37, -41), scrollTree.current_scroll_offset(cont entLayerAt(1)->id())); 620 EXPECT_EQ(gfx::ScrollOffset(-37, -41), scrollTree.current_scroll_offset(cont entLayerAt(1)->id()));
621
622 // The main thread scrolling bits from scrollNodeB should have been propagat ed to scrollNodeA.
623 EXPECT_TRUE(scrollNodeA.main_thread_scrolling_reasons & MainThreadScrollingR eason::kHasBackgroundAttachmentFixedObjects);
624 EXPECT_TRUE(scrollNodeB.main_thread_scrolling_reasons & MainThreadScrollingR eason::kHasBackgroundAttachmentFixedObjects);
618 } 625 }
619 626
620 } // namespace 627 } // namespace
621 } // namespace blink 628 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698