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

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

Issue 2018833002: cc : Delete LayerImpl::opacity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/CompositorMutableState.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/CompositorMutableState.h" 5 #include "platform/graphics/CompositorMutableState.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "cc/test/fake_impl_task_runner_provider.h" 8 #include "cc/test/fake_impl_task_runner_provider.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 9 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/test/fake_output_surface.h" 10 #include "cc/test/fake_output_surface.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 hostImpl().SetViewportSize(layer->bounds()); 125 hostImpl().SetViewportSize(layer->bounds());
126 hostImpl().active_tree()->SetRootLayer(std::move(root)); 126 hostImpl().active_tree()->SetRootLayer(std::move(root));
127 hostImpl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 127 hostImpl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
128 128
129 CompositorMutations mutations; 129 CompositorMutations mutations;
130 CompositorMutableStateProvider provider(hostImpl().active_tree(), &mutations ); 130 CompositorMutableStateProvider provider(hostImpl().active_tree(), &mutations );
131 131
132 OwnPtr<CompositorMutableState> state(provider.getMutableStateFor(layer->elem ent_id())); 132 OwnPtr<CompositorMutableState> state(provider.getMutableStateFor(layer->elem ent_id()));
133 EXPECT_TRUE(state.get()); 133 EXPECT_TRUE(state.get());
134 134
135 EXPECT_EQ(1.0, rootLayer()->opacity()); 135 EXPECT_EQ(1.0, rootLayer()->Opacity());
136 EXPECT_EQ(gfx::Transform().ToString(), rootLayer()->transform().ToString()); 136 EXPECT_EQ(gfx::Transform().ToString(), rootLayer()->transform().ToString());
137 EXPECT_EQ(0.0, layer->CurrentScrollOffset().x()); 137 EXPECT_EQ(0.0, layer->CurrentScrollOffset().x());
138 EXPECT_EQ(0.0, layer->CurrentScrollOffset().y()); 138 EXPECT_EQ(0.0, layer->CurrentScrollOffset().y());
139 139
140 gfx::Transform zero(0, 0, 0, 0, 0, 0); 140 gfx::Transform zero(0, 0, 0, 0, 0, 0);
141 state->setOpacity(0.5); 141 state->setOpacity(0.5);
142 state->setTransform(zero.matrix()); 142 state->setTransform(zero.matrix());
143 state->setScrollLeft(1.0); 143 state->setScrollLeft(1.0);
144 state->setScrollTop(1.0); 144 state->setScrollTop(1.0);
145 145
146 EXPECT_EQ(0.5, rootLayer()->opacity()); 146 EXPECT_EQ(0.5, rootLayer()->Opacity());
147 EXPECT_EQ(zero.ToString(), rootLayer()->transform().ToString()); 147 EXPECT_EQ(zero.ToString(), rootLayer()->transform().ToString());
148 EXPECT_EQ(1.0, layer->CurrentScrollOffset().x()); 148 EXPECT_EQ(1.0, layer->CurrentScrollOffset().x());
149 EXPECT_EQ(1.0, layer->CurrentScrollOffset().y()); 149 EXPECT_EQ(1.0, layer->CurrentScrollOffset().y());
150 150
151 // The corresponding mutation should reflect the changed values. 151 // The corresponding mutation should reflect the changed values.
152 EXPECT_EQ(1ul, mutations.map.size()); 152 EXPECT_EQ(1ul, mutations.map.size());
153 153
154 const CompositorMutation& mutation = *mutations.map.find(layer->element_id() )->value; 154 const CompositorMutation& mutation = *mutations.map.find(layer->element_id() )->value;
155 EXPECT_TRUE(mutation.isOpacityMutated()); 155 EXPECT_TRUE(mutation.isOpacityMutated());
156 EXPECT_TRUE(mutation.isTransformMutated()); 156 EXPECT_TRUE(mutation.isTransformMutated());
157 EXPECT_TRUE(mutation.isScrollLeftMutated()); 157 EXPECT_TRUE(mutation.isScrollLeftMutated());
158 EXPECT_TRUE(mutation.isScrollTopMutated()); 158 EXPECT_TRUE(mutation.isScrollTopMutated());
159 159
160 EXPECT_EQ(0.5, mutation.opacity()); 160 EXPECT_EQ(0.5, mutation.opacity());
161 EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString()); 161 EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString());
162 EXPECT_EQ(1.0, mutation.scrollLeft()); 162 EXPECT_EQ(1.0, mutation.scrollLeft());
163 EXPECT_EQ(1.0, mutation.scrollTop()); 163 EXPECT_EQ(1.0, mutation.scrollTop());
164 } 164 }
165 165
166 } // namespace blink 166 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698