| Index: third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
|
| index 29f7353d4bbf72ed866887bd25f0f6803b68a32f..bd06f90e472914a5fa516aaa1a9b69f4c5713813 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
|
| @@ -12,7 +12,6 @@
|
| #include "cc/test/test_task_graph_runner.h"
|
| #include "cc/trees/layer_tree_host_impl.h"
|
| #include "cc/trees/layer_tree_impl.h"
|
| -#include "platform/graphics/CompositorElementId.h"
|
| #include "platform/graphics/CompositorMutableProperties.h"
|
| #include "platform/graphics/CompositorMutableStateProvider.h"
|
| #include "platform/graphics/CompositorMutation.h"
|
| @@ -84,6 +83,24 @@
|
| EXPECT_FALSE(state);
|
| }
|
|
|
| +TEST_F(CompositorMutableStateTest, MutableStateNoMutableProperties)
|
| +{
|
| + // In this test, there is a layer with an element id, but no mutable
|
| + // properties. This should behave just as if we'd had no element id.
|
| + std::unique_ptr<LayerImpl> root = LayerImpl::Create(hostImpl().active_tree(), 42);
|
| + SetLayerPropertiesForTesting(root.get());
|
| + root->SetElementId(42);
|
| +
|
| + hostImpl().SetViewportSize(root->bounds());
|
| + hostImpl().active_tree()->SetRootLayer(std::move(root));
|
| + hostImpl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
|
| +
|
| + CompositorMutations mutations;
|
| + CompositorMutableStateProvider provider(hostImpl().active_tree(), &mutations);
|
| + OwnPtr<CompositorMutableState> state(provider.getMutableStateFor(42));
|
| + EXPECT_FALSE(state);
|
| +}
|
| +
|
| TEST_F(CompositorMutableStateTest, MutableStateMutableProperties)
|
| {
|
| // In this test, there is a layer with an element id and mutable properties.
|
| @@ -99,10 +116,8 @@
|
| root->AddChild(std::move(scopedLayer));
|
|
|
| SetLayerPropertiesForTesting(layer);
|
| -
|
| - int primaryId = 12;
|
| - root->SetElementId(createCompositorElementId(primaryId, CompositorSubElementId::Primary));
|
| - layer->SetElementId(createCompositorElementId(primaryId, CompositorSubElementId::Scroll));
|
| + layer->SetElementId(12);
|
| + root->SetElementId(layer->element_id());
|
|
|
| root->SetMutableProperties(CompositorMutableProperty::kOpacity | CompositorMutableProperty::kTransform);
|
| layer->SetMutableProperties(CompositorMutableProperty::kScrollLeft | CompositorMutableProperty::kScrollTop);
|
| @@ -114,7 +129,7 @@
|
| CompositorMutations mutations;
|
| CompositorMutableStateProvider provider(hostImpl().active_tree(), &mutations);
|
|
|
| - OwnPtr<CompositorMutableState> state(provider.getMutableStateFor(primaryId));
|
| + OwnPtr<CompositorMutableState> state(provider.getMutableStateFor(layer->element_id()));
|
| EXPECT_TRUE(state.get());
|
|
|
| EXPECT_EQ(1.0, rootLayer()->Opacity());
|
| @@ -136,7 +151,7 @@
|
| // The corresponding mutation should reflect the changed values.
|
| EXPECT_EQ(1ul, mutations.map.size());
|
|
|
| - const CompositorMutation& mutation = *mutations.map.find(primaryId)->value;
|
| + const CompositorMutation& mutation = *mutations.map.find(layer->element_id())->value;
|
| EXPECT_TRUE(mutation.isOpacityMutated());
|
| EXPECT_TRUE(mutation.isTransformMutated());
|
| EXPECT_TRUE(mutation.isScrollLeftMutated());
|
|
|