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

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

Issue 2888483002: Manage registering composited elements in PaintArtifactCompositor. (Closed)
Patch Set: Sync to head and disable flaky animation test. Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 7 #include <memory>
8 8
9 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 web_layer_tree_view_ = 89 web_layer_tree_view_ =
90 WTF::MakeUnique<WebLayerTreeViewWithCompositorFrameSink>(settings); 90 WTF::MakeUnique<WebLayerTreeViewWithCompositorFrameSink>(settings);
91 web_layer_tree_view_->SetRootLayer( 91 web_layer_tree_view_->SetRootLayer(
92 *paint_artifact_compositor_->GetWebLayer()); 92 *paint_artifact_compositor_->GetWebLayer());
93 } 93 }
94 94
95 const cc::PropertyTrees& GetPropertyTrees() { 95 const cc::PropertyTrees& GetPropertyTrees() {
96 return *web_layer_tree_view_->GetLayerTreeHost()->property_trees(); 96 return *web_layer_tree_view_->GetLayerTreeHost()->property_trees();
97 } 97 }
98 98
99 const cc::LayerTreeHost& GetLayerTreeHost() {
100 return *web_layer_tree_view_->GetLayerTreeHost();
101 }
102
99 int ElementIdToEffectNodeIndex(CompositorElementId element_id) { 103 int ElementIdToEffectNodeIndex(CompositorElementId element_id) {
100 return web_layer_tree_view_->GetLayerTreeHost() 104 return web_layer_tree_view_->GetLayerTreeHost()
101 ->property_trees() 105 ->property_trees()
102 ->element_id_to_effect_node_index[element_id]; 106 ->element_id_to_effect_node_index[element_id];
103 } 107 }
104 108
105 int ElementIdToTransformNodeIndex(CompositorElementId element_id) { 109 int ElementIdToTransformNodeIndex(CompositorElementId element_id) {
106 return web_layer_tree_view_->GetLayerTreeHost() 110 return web_layer_tree_view_->GetLayerTreeHost()
107 ->property_trees() 111 ->property_trees()
108 ->element_id_to_transform_node_index[element_id]; 112 ->element_id_to_transform_node_index[element_id];
(...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 tinyEffect); 2263 tinyEffect);
2260 TestPaintArtifact artifact; 2264 TestPaintArtifact artifact;
2261 artifact 2265 artifact
2262 .Chunk(TransformPaintPropertyNode::Root(), ClipPaintPropertyNode::Root(), 2266 .Chunk(TransformPaintPropertyNode::Root(), ClipPaintPropertyNode::Root(),
2263 visibleEffect) 2267 visibleEffect)
2264 .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack); 2268 .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack);
2265 Update(artifact.Build()); 2269 Update(artifact.Build());
2266 ASSERT_EQ(0u, ContentLayerCount()); 2270 ASSERT_EQ(0u, ContentLayerCount());
2267 } 2271 }
2268 2272
2273 TEST_F(PaintArtifactCompositorTestWithPropertyTrees,
2274 UpdateManagesLayerElementIds) {
2275 RefPtr<TransformPaintPropertyNode> transform =
2276 CreateSampleTransformNodeWithElementId();
2277 CompositorElementId element_id = transform->GetCompositorElementId();
2278
2279 {
2280 TestPaintArtifact artifact;
2281 artifact
2282 .Chunk(transform, ClipPaintPropertyNode::Root(),
2283 EffectPaintPropertyNode::Root())
2284 .RectDrawing(FloatRect(0, 0, 100, 100), Color::kBlack);
2285
2286 Update(artifact.Build());
2287 ASSERT_EQ(1u, ContentLayerCount());
2288 ASSERT_TRUE(GetLayerTreeHost().LayerByElementId(element_id));
2289 }
2290
2291 {
2292 TestPaintArtifact artifact;
2293 ASSERT_TRUE(GetLayerTreeHost().LayerByElementId(element_id));
2294 Update(artifact.Build());
2295 ASSERT_EQ(0u, ContentLayerCount());
2296 ASSERT_FALSE(GetLayerTreeHost().LayerByElementId(element_id));
2297 }
2298 }
2299
2269 } // namespace blink 2300 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698