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

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

Issue 2642183003: Populate cc element id maps for transform/effect nodes. (Closed)
Patch Set: Sync to head. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4b5429d3ca4ac11d7e5b80b88a3db11bb51a32ed..a039525bffef4319117a8bb9f6337720445c576a 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp
@@ -96,6 +96,20 @@ class PaintArtifactCompositorTestWithPropertyTrees
->property_trees();
}
+ int elementIdToEffectNodeIndex(CompositorElementId elementId) {
+ return m_webLayerTreeView->layerTreeHost()
+ ->GetLayerTree()
+ ->property_trees()
+ ->element_id_to_effect_node_index[elementId];
+ }
+
+ int elementIdToTransformNodeIndex(CompositorElementId elementId) {
+ return m_webLayerTreeView->layerTreeHost()
+ ->GetLayerTree()
+ ->property_trees()
+ ->element_id_to_transform_node_index[elementId];
+ }
+
int elementIdToScrollNodeIndex(CompositorElementId elementId) {
return m_webLayerTreeView->layerTreeHost()
->GetLayerTree()
@@ -1617,4 +1631,41 @@ TEST_F(PaintArtifactCompositorTestWithPropertyTrees, PendingLayerKnownOpaque) {
EXPECT_TRUE(pendingLayer.knownToBeOpaque);
}
+TEST_F(PaintArtifactCompositorTestWithPropertyTrees, TransformWithElementId) {
+ CompositorElementId expectedCompositorElementId(2, 0);
+ RefPtr<TransformPaintPropertyNode> transform =
+ TransformPaintPropertyNode::create(
+ TransformPaintPropertyNode::root(), TransformationMatrix().rotate(90),
+ FloatPoint3D(100, 100, 0), false, 0, CompositingReason3DTransform,
+ expectedCompositorElementId);
+
+ TestPaintArtifact artifact;
+ artifact
+ .chunk(transform, ClipPaintPropertyNode::root(),
+ EffectPaintPropertyNode::root())
+ .rectDrawing(FloatRect(100, 100, 200, 100), Color::black);
+ update(artifact.build());
+
+ EXPECT_EQ(2, elementIdToTransformNodeIndex(expectedCompositorElementId));
+}
+
+TEST_F(PaintArtifactCompositorTestWithPropertyTrees, EffectWithElementId) {
+ CompositorElementId expectedCompositorElementId(2, 0);
+ float opacity = 2.0 / 255.0;
+ RefPtr<EffectPaintPropertyNode> effect = EffectPaintPropertyNode::create(
+ EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(),
+ ClipPaintPropertyNode::root(), CompositorFilterOperations(), opacity,
+ SkBlendMode::kSrcOver, CompositingReasonNone,
+ expectedCompositorElementId);
+
+ TestPaintArtifact artifact;
+ artifact
+ .chunk(TransformPaintPropertyNode::root(), ClipPaintPropertyNode::root(),
+ effect.get())
+ .rectDrawing(FloatRect(100, 100, 200, 100), Color::black);
+ update(artifact.build());
+
+ EXPECT_EQ(2, elementIdToEffectNodeIndex(expectedCompositorElementId));
+}
+
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/compositing/PropertyTreeManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698