| Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
|
| index 0baf16cf81c278417981da8a85ec98819eae446f..0fbb90f25adb6cb1e26569b2f078d666ae4bc134 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
|
| @@ -13,10 +13,12 @@
|
| #include "cc/trees/effect_node.h"
|
| #include "cc/trees/layer_tree_host.h"
|
| #include "cc/trees/layer_tree_settings.h"
|
| +#include "cc/trees/scroll_node.h"
|
| #include "cc/trees/transform_node.h"
|
| #include "platform/RuntimeEnabledFeatures.h"
|
| #include "platform/graphics/paint/EffectPaintPropertyNode.h"
|
| #include "platform/graphics/paint/PaintArtifact.h"
|
| +#include "platform/graphics/paint/ScrollPaintPropertyNode.h"
|
| #include "platform/testing/PictureMatchers.h"
|
| #include "platform/testing/TestPaintArtifact.h"
|
| #include "platform/testing/WebLayerTreeViewImplForTesting.h"
|
| @@ -107,11 +109,11 @@ TEST_F(PaintArtifactCompositorTest, OneTransform)
|
| nullptr, TransformationMatrix().rotate(90), FloatPoint3D(100, 100, 0));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(transform, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 100, 100), Color::white);
|
| - artifact.chunk(nullptr, nullptr, dummyRootEffect())
|
| + artifact.chunk(nullptr, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 100, 100), Color::gray);
|
| - artifact.chunk(transform, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(100, 100, 200, 100), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -149,9 +151,9 @@ TEST_F(PaintArtifactCompositorTest, TransformCombining)
|
| transform1, TransformationMatrix().translate(5, 5), FloatPoint3D());
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(transform1, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform1, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::white);
|
| - artifact.chunk(transform2, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform2, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -182,7 +184,7 @@ TEST_F(PaintArtifactCompositorTest, LayerOriginCancellation)
|
| nullptr, TransformationMatrix().scale(2), FloatPoint3D());
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(transform, clip, nullptr)
|
| + artifact.chunk(transform, clip, nullptr, nullptr)
|
| .rectDrawing(FloatRect(12, 34, 56, 78), Color::white);
|
| update(artifact.build());
|
|
|
| @@ -208,7 +210,7 @@ TEST_F(PaintArtifactCompositorTest, OneClip)
|
| nullptr, nullptr, FloatRoundedRect(100, 100, 300, 200));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clip, nullptr)
|
| + artifact.chunk(nullptr, clip, nullptr, nullptr)
|
| .rectDrawing(FloatRect(220, 80, 300, 200), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -233,13 +235,13 @@ TEST_F(PaintArtifactCompositorTest, NestedClips)
|
| clip1, nullptr, FloatRoundedRect(200, 200, 700, 100));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clip1, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip1, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::white);
|
| - artifact.chunk(nullptr, clip2, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip2, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::lightGray);
|
| - artifact.chunk(nullptr, clip1, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip1, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::darkGray);
|
| - artifact.chunk(nullptr, clip2, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip2, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -296,7 +298,7 @@ TEST_F(PaintArtifactCompositorTest, DeeplyNestedClips)
|
| }
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clips.last(), nullptr)
|
| + artifact.chunk(nullptr, clips.last(), nullptr, nullptr)
|
| .rectDrawing(FloatRect(0, 0, 200, 200), Color::white);
|
| update(artifact.build());
|
|
|
| @@ -328,9 +330,9 @@ TEST_F(PaintArtifactCompositorTest, SiblingClips)
|
| commonClip, nullptr, FloatRoundedRect(400, 0, 400, 600));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clip1, nullptr)
|
| + artifact.chunk(nullptr, clip1, nullptr, nullptr)
|
| .rectDrawing(FloatRect(0, 0, 640, 480), Color::white);
|
| - artifact.chunk(nullptr, clip2, nullptr)
|
| + artifact.chunk(nullptr, clip2, nullptr, nullptr)
|
| .rectDrawing(FloatRect(0, 0, 640, 480), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -464,11 +466,11 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, OneTransform)
|
| nullptr, TransformationMatrix().rotate(90), FloatPoint3D(100, 100, 0));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(transform, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 100, 100), Color::white);
|
| - artifact.chunk(nullptr, nullptr, dummyRootEffect())
|
| + artifact.chunk(nullptr, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 100, 100), Color::gray);
|
| - artifact.chunk(transform, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(100, 100, 200, 100), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -506,9 +508,9 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, TransformCombining)
|
| transform1, TransformationMatrix().translate(5, 5), FloatPoint3D());
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(transform1, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform1, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::white);
|
| - artifact.chunk(transform2, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform2, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -552,7 +554,7 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, FlattensInheritedTransform)
|
| transformIsFlattened);
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(transform3, nullptr, nullptr)
|
| + artifact.chunk(transform3, nullptr, nullptr, nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::white);
|
| update(artifact.build());
|
|
|
| @@ -598,13 +600,13 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, SortingContextID)
|
| transform2, TransformationMatrix(), FloatPoint3D(), false, 2);
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(transform1, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform1, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::white);
|
| - artifact.chunk(transform2, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform2, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::lightGray);
|
| - artifact.chunk(transform3, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform3, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::darkGray);
|
| - artifact.chunk(transform4, nullptr, dummyRootEffect())
|
| + artifact.chunk(transform4, nullptr, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 300, 200), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -653,7 +655,7 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, OneClip)
|
| nullptr, nullptr, FloatRoundedRect(100, 100, 300, 200));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clip, nullptr)
|
| + artifact.chunk(nullptr, clip, nullptr, nullptr)
|
| .rectDrawing(FloatRect(220, 80, 300, 200), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -677,13 +679,13 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, NestedClips)
|
| clip1, nullptr, FloatRoundedRect(200, 200, 700, 100));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clip1, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip1, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::white);
|
| - artifact.chunk(nullptr, clip2, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip2, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::lightGray);
|
| - artifact.chunk(nullptr, clip1, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip1, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::darkGray);
|
| - artifact.chunk(nullptr, clip2, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip2, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(300, 350, 100, 100), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -733,7 +735,7 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, DeeplyNestedClips)
|
| }
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clips.last(), dummyRootEffect())
|
| + artifact.chunk(nullptr, clips.last(), dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 200, 200), Color::white);
|
| update(artifact.build());
|
|
|
| @@ -765,9 +767,9 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, SiblingClips)
|
| commonClip, nullptr, FloatRoundedRect(400, 0, 400, 600));
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, clip1, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip1, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 640, 480), Color::white);
|
| - artifact.chunk(nullptr, clip2, dummyRootEffect())
|
| + artifact.chunk(nullptr, clip2, dummyRootEffect(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 640, 480), Color::black);
|
| update(artifact.build());
|
|
|
| @@ -820,11 +822,11 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, EffectTreeConversion)
|
| RefPtr<EffectPaintPropertyNode> effect3 = EffectPaintPropertyNode::create(dummyRootEffect(), 0.2);
|
|
|
| TestPaintArtifact artifact;
|
| - artifact.chunk(nullptr, nullptr, effect2.get())
|
| + artifact.chunk(nullptr, nullptr, effect2.get(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 100, 100), Color::white);
|
| - artifact.chunk(nullptr, nullptr, effect1.get())
|
| + artifact.chunk(nullptr, nullptr, effect1.get(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 100, 100), Color::white);
|
| - artifact.chunk(nullptr, nullptr, effect3.get())
|
| + artifact.chunk(nullptr, nullptr, effect3.get(), nullptr)
|
| .rectDrawing(FloatRect(0, 0, 100, 100), Color::white);
|
| update(artifact.build());
|
|
|
| @@ -855,5 +857,30 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, EffectTreeConversion)
|
| EXPECT_EQ(convertedEffect3.id, contentLayerAt(2)->effect_tree_index());
|
| }
|
|
|
| +TEST_F(PaintArtifactCompositorTestWithPropertyTrees, OneScrollNode)
|
| +{
|
| + RefPtr<TransformPaintPropertyNode> scrollTranslation = TransformPaintPropertyNode::create(
|
| + nullptr, TransformationMatrix().translate(7, 9), FloatPoint3D());
|
| + RefPtr<ScrollPaintPropertyNode> scroll = ScrollPaintPropertyNode::create(
|
| + nullptr, scrollTranslation, FloatSize(), FloatSize(), true, true);
|
| +
|
| + TestPaintArtifact artifact;
|
| + artifact.chunk(scrollTranslation, nullptr, nullptr, scroll)
|
| + .rectDrawing(FloatRect(11, 13, 17, 19), Color::white);
|
| + update(artifact.build());
|
| +
|
| + const cc::ScrollTree& scrollTree = propertyTrees().scroll_tree;
|
| + // Node #0 reserved for null; #1 for root render surface.
|
| + ASSERT_EQ(3u, scrollTree.size());
|
| + const cc::ScrollNode& scrollNode = *scrollTree.Node(2);
|
| + EXPECT_EQ(1, scrollNode.parent_id);
|
| +
|
| + const cc::TransformTree& transformTree = propertyTrees().transform_tree;
|
| + const cc::TransformNode& transformNode = *transformTree.Node(scrollNode.transform_id);
|
| + // TransformNode no longer contain the scroll translation as a transform but instead as a scroll offset.
|
| + EXPECT_TRUE(transformNode.local.IsIdentity());
|
| + EXPECT_EQ(gfx::ScrollOffset(7, -9), transformNode.scroll_offset);
|
| +}
|
| +
|
| } // namespace
|
| } // namespace blink
|
|
|