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

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

Issue 2254543004: cc : Delete LayerImpl::transform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use test properties transform Created 4 years, 4 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 26 matching lines...) Expand all
37 { 37 {
38 LayerTreeSettings settings; 38 LayerTreeSettings settings;
39 settings.layer_transforms_should_scale_layer_contents = true; 39 settings.layer_transforms_should_scale_layer_contents = true;
40 m_hostImpl.reset(new FakeLayerTreeHostImpl(settings, &m_taskRunnerProvid er, &m_sharedBitmapManager, &m_taskGraphRunner)); 40 m_hostImpl.reset(new FakeLayerTreeHostImpl(settings, &m_taskRunnerProvid er, &m_sharedBitmapManager, &m_taskGraphRunner));
41 m_hostImpl->SetVisible(true); 41 m_hostImpl->SetVisible(true);
42 EXPECT_TRUE(m_hostImpl->InitializeRenderer(m_outputSurface.get())); 42 EXPECT_TRUE(m_hostImpl->InitializeRenderer(m_outputSurface.get()));
43 } 43 }
44 44
45 void SetLayerPropertiesForTesting(LayerImpl* layer) 45 void SetLayerPropertiesForTesting(LayerImpl* layer)
46 { 46 {
47 layer->SetTransform(gfx::Transform()); 47 layer->test_properties()->transform = gfx::Transform();
48 layer->SetPosition(gfx::PointF()); 48 layer->SetPosition(gfx::PointF());
49 layer->SetBounds(gfx::Size(100, 100)); 49 layer->SetBounds(gfx::Size(100, 100));
50 layer->Set3dSortingContextId(0); 50 layer->Set3dSortingContextId(0);
51 layer->SetDrawsContent(true); 51 layer->SetDrawsContent(true);
52 } 52 }
53 53
54 FakeLayerTreeHostImpl& hostImpl() { return *m_hostImpl; } 54 FakeLayerTreeHostImpl& hostImpl() { return *m_hostImpl; }
55 55
56 LayerImpl* rootLayer() { return m_hostImpl->active_tree()->root_layer_for_te sting(); } 56 LayerImpl* rootLayer() { return m_hostImpl->active_tree()->root_layer_for_te sting(); }
57 57
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 hostImpl().active_tree()->SetRootLayerForTesting(std::move(root)); 111 hostImpl().active_tree()->SetRootLayerForTesting(std::move(root));
112 hostImpl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 112 hostImpl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
113 113
114 CompositorMutations mutations; 114 CompositorMutations mutations;
115 CompositorMutableStateProvider provider(hostImpl().active_tree(), &mutations ); 115 CompositorMutableStateProvider provider(hostImpl().active_tree(), &mutations );
116 116
117 std::unique_ptr<CompositorMutableState> state(provider.getMutableStateFor(pr imaryId)); 117 std::unique_ptr<CompositorMutableState> state(provider.getMutableStateFor(pr imaryId));
118 EXPECT_TRUE(state.get()); 118 EXPECT_TRUE(state.get());
119 119
120 EXPECT_EQ(1.0, rootLayer()->Opacity()); 120 EXPECT_EQ(1.0, rootLayer()->Opacity());
121 EXPECT_EQ(gfx::Transform().ToString(), rootLayer()->transform().ToString()); 121 EXPECT_EQ(gfx::Transform().ToString(), rootLayer()->Transform().ToString());
122 EXPECT_EQ(0.0, layer->CurrentScrollOffset().x()); 122 EXPECT_EQ(0.0, layer->CurrentScrollOffset().x());
123 EXPECT_EQ(0.0, layer->CurrentScrollOffset().y()); 123 EXPECT_EQ(0.0, layer->CurrentScrollOffset().y());
124 124
125 gfx::Transform zero(0, 0, 0, 0, 0, 0); 125 gfx::Transform zero(0, 0, 0, 0, 0, 0);
126 state->setOpacity(0.5); 126 state->setOpacity(0.5);
127 state->setTransform(zero.matrix()); 127 state->setTransform(zero.matrix());
128 state->setScrollLeft(1.0); 128 state->setScrollLeft(1.0);
129 state->setScrollTop(1.0); 129 state->setScrollTop(1.0);
130 130
131 EXPECT_EQ(0.5, rootLayer()->Opacity()); 131 EXPECT_EQ(0.5, rootLayer()->Opacity());
132 EXPECT_EQ(zero.ToString(), rootLayer()->transform().ToString()); 132 EXPECT_EQ(zero.ToString(), rootLayer()->Transform().ToString());
133 EXPECT_EQ(1.0, layer->CurrentScrollOffset().x()); 133 EXPECT_EQ(1.0, layer->CurrentScrollOffset().x());
134 EXPECT_EQ(1.0, layer->CurrentScrollOffset().y()); 134 EXPECT_EQ(1.0, layer->CurrentScrollOffset().y());
135 135
136 // The corresponding mutation should reflect the changed values. 136 // The corresponding mutation should reflect the changed values.
137 EXPECT_EQ(1ul, mutations.map.size()); 137 EXPECT_EQ(1ul, mutations.map.size());
138 138
139 const CompositorMutation& mutation = *mutations.map.find(primaryId)->value; 139 const CompositorMutation& mutation = *mutations.map.find(primaryId)->value;
140 EXPECT_TRUE(mutation.isOpacityMutated()); 140 EXPECT_TRUE(mutation.isOpacityMutated());
141 EXPECT_TRUE(mutation.isTransformMutated()); 141 EXPECT_TRUE(mutation.isTransformMutated());
142 EXPECT_TRUE(mutation.isScrollLeftMutated()); 142 EXPECT_TRUE(mutation.isScrollLeftMutated());
143 EXPECT_TRUE(mutation.isScrollTopMutated()); 143 EXPECT_TRUE(mutation.isScrollTopMutated());
144 144
145 EXPECT_EQ(0.5, mutation.opacity()); 145 EXPECT_EQ(0.5, mutation.opacity());
146 EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString()); 146 EXPECT_EQ(zero.ToString(), gfx::Transform(mutation.transform()).ToString());
147 EXPECT_EQ(1.0, mutation.scrollLeft()); 147 EXPECT_EQ(1.0, mutation.scrollLeft());
148 EXPECT_EQ(1.0, mutation.scrollTop()); 148 EXPECT_EQ(1.0, mutation.scrollTop());
149 } 149 }
150 150
151 } // namespace blink 151 } // 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