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

Side by Side Diff: webkit/compositor_bindings/web_layer_impl_fixed_bounds_unittest.cc

Issue 12760011: cc: Chromify LayerTreeHostCommon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/occlusion_tracker_unittest.cc ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <vector> 5 #include <vector>
6 #include "cc/layers/picture_image_layer.h" 6 #include "cc/layers/picture_image_layer.h"
7 #include "cc/test/geometry_test_utils.h" 7 #include "cc/test/geometry_test_utils.h"
8 #include "cc/trees/layer_tree_host_common.h" 8 #include "cc/trees/layer_tree_host_common.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 normal_layer->addChild(sublayer_under_normal_layer); 122 normal_layer->addChild(sublayer_under_normal_layer);
123 normal_layer->setBounds(bounds); 123 normal_layer->setBounds(bounds);
124 normal_layer->setAnchorPoint(anchor_point); 124 normal_layer->setAnchorPoint(anchor_point);
125 normal_layer->setTransform(transform.matrix()); 125 normal_layer->setTransform(transform.matrix());
126 normal_layer->setSublayerTransform(sublayer_transform.matrix()); 126 normal_layer->setSublayerTransform(sublayer_transform.matrix());
127 normal_layer->setPosition(position); 127 normal_layer->setPosition(position);
128 root_layer->addChild(normal_layer); 128 root_layer->addChild(normal_layer);
129 129
130 std::vector<scoped_refptr<cc::Layer> > render_surface_layer_list; 130 std::vector<scoped_refptr<cc::Layer> > render_surface_layer_list;
131 cc::LayerTreeHostCommon::calculateDrawProperties( 131 cc::LayerTreeHostCommon::CalculateDrawProperties(
132 root_layer->layer(), 132 root_layer->layer(),
133 kDeviceViewportSize, 133 kDeviceViewportSize,
134 kDeviceScaleFactor, 134 kDeviceScaleFactor,
135 kPageScaleFactor, 135 kPageScaleFactor,
136 kMaxTextureSize, 136 kMaxTextureSize,
137 false, 137 false,
138 render_surface_layer_list); 138 &render_surface_layer_list);
139 ExpectEqualLayerRectsInTarget(normal_layer->layer(), 139 ExpectEqualLayerRectsInTarget(normal_layer->layer(),
140 fixed_bounds_layer->layer()); 140 fixed_bounds_layer->layer());
141 ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(), 141 ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(),
142 sublayer_under_fixed_bounds_layer->layer()); 142 sublayer_under_fixed_bounds_layer->layer());
143 143
144 // Change of fixed bounds should not affect the target geometries. 144 // Change of fixed bounds should not affect the target geometries.
145 fixed_bounds_layer->SetFixedBounds(gfx::Size(fixed_bounds.width() / 2, 145 fixed_bounds_layer->SetFixedBounds(gfx::Size(fixed_bounds.width() / 2,
146 fixed_bounds.height() * 2)); 146 fixed_bounds.height() * 2));
147 cc::LayerTreeHostCommon::calculateDrawProperties( 147 cc::LayerTreeHostCommon::CalculateDrawProperties(
148 root_layer->layer(), 148 root_layer->layer(),
149 kDeviceViewportSize, 149 kDeviceViewportSize,
150 kDeviceScaleFactor, 150 kDeviceScaleFactor,
151 kPageScaleFactor, 151 kPageScaleFactor,
152 kMaxTextureSize, 152 kMaxTextureSize,
153 false, 153 false,
154 render_surface_layer_list); 154 &render_surface_layer_list);
155 ExpectEqualLayerRectsInTarget(normal_layer->layer(), 155 ExpectEqualLayerRectsInTarget(normal_layer->layer(),
156 fixed_bounds_layer->layer()); 156 fixed_bounds_layer->layer());
157 ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(), 157 ExpectEqualLayerRectsInTarget(sublayer_under_normal_layer->layer(),
158 sublayer_under_fixed_bounds_layer->layer()); 158 sublayer_under_fixed_bounds_layer->layer());
159 159
160 } 160 }
161 161
162 // A black box test that ensures WebLayerImplFixedBounds won't change target 162 // A black box test that ensures WebLayerImplFixedBounds won't change target
163 // geometries. Simple case: identity transforms and zero anchor point. 163 // geometries. Simple case: identity transforms and zero anchor point.
164 TEST(WebLayerImplFixedBoundsTest, CompareToWebLayerImplSimple) { 164 TEST(WebLayerImplFixedBoundsTest, CompareToWebLayerImplSimple) {
(...skipping 23 matching lines...) Expand all
188 188
189 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to 189 // With non-zero anchor point, WebLayerImplFixedBounds will fall back to
190 // WebLayerImpl. 190 // WebLayerImpl.
191 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f), 191 CompareFixedBoundsLayerAndNormalLayer(WebFloatPoint(0.4f, 0.6f),
192 transform, 192 transform,
193 sublayer_transform); 193 sublayer_transform);
194 } 194 }
195 195
196 } // namespace 196 } // namespace
197 } // namespace webkit 197 } // namespace webkit
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698