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 f07624d36fb5ea2df0db0caa3f408626678b0833..02468c2fddab2f516aa8491297a5396f134ee123 100644 |
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp |
@@ -12,10 +12,12 @@ |
#include "cc/trees/clip_node.h" |
#include "cc/trees/effect_node.h" |
#include "cc/trees/layer_tree_host.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" |
@@ -146,11 +148,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()); |
@@ -188,9 +190,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()); |
@@ -234,7 +236,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()); |
@@ -280,13 +282,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()); |
@@ -335,7 +337,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()); |
@@ -359,13 +361,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()); |
@@ -415,7 +417,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()); |
@@ -447,9 +449,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()); |
@@ -502,11 +504,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()); |
@@ -537,5 +539,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 |