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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1766053002: Clean LayerImpl's scroll offset callers in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove transform tree update setting Created 4 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
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 false); 338 false);
339 scoped_ptr<LayerImpl> clip_layer_scoped_ptr( 339 scoped_ptr<LayerImpl> clip_layer_scoped_ptr(
340 LayerImpl::Create(host_impl.active_tree(), 4)); 340 LayerImpl::Create(host_impl.active_tree(), 4));
341 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); 341 LayerImpl* clip_layer = clip_layer_scoped_ptr.get();
342 342
343 scroll_layer->SetScrollClipLayer(clip_layer->id()); 343 scroll_layer->SetScrollClipLayer(clip_layer->id());
344 clip_layer->SetBounds( 344 clip_layer->SetBounds(
345 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), 345 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(),
346 scroll_layer->bounds().height() + kMaxScrollOffset.y())); 346 scroll_layer->bounds().height() + kMaxScrollOffset.y()));
347 scroll_layer->SetScrollClipLayer(clip_layer->id()); 347 scroll_layer->SetScrollClipLayer(clip_layer->id());
348 scroll_layer->SetScrollDelta(kScrollDelta); 348 SetScrollOffsetDelta(scroll_layer, kScrollDelta);
349 gfx::Transform impl_transform; 349 gfx::Transform impl_transform;
350 scroll_layer->AddChild(std::move(sublayer_scoped_ptr)); 350 scroll_layer->AddChild(std::move(sublayer_scoped_ptr));
351 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); 351 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get();
352 clip_layer->AddChild(std::move(scroll_layer_scoped_ptr)); 352 clip_layer->AddChild(std::move(scroll_layer_scoped_ptr));
353 scroll_layer_raw_ptr->PushScrollOffsetFromMainThread(kScrollOffset); 353 scroll_layer_raw_ptr->layer_tree_impl()
354 ->property_trees()
355 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer_raw_ptr->id(),
356 kScrollOffset);
354 357
355 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); 358 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3));
356 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 359 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
357 gfx::PointF(), gfx::Size(3, 4), true, false, 360 gfx::PointF(), gfx::Size(3, 4), true, false,
358 false); 361 false);
359 root->AddChild(std::move(clip_layer_scoped_ptr)); 362 root->AddChild(std::move(clip_layer_scoped_ptr));
360 root->SetHasRenderSurface(true); 363 root->SetHasRenderSurface(true);
361 364
362 ExecuteCalculateDrawProperties( 365 ExecuteCalculateDrawProperties(
363 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); 366 root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
(...skipping 6742 matching lines...) Expand 10 before | Expand all | Expand 10 after
7106 // + container 7109 // + container
7107 // + scroller 7110 // + scroller
7108 // + fixed 7111 // + fixed
7109 // 7112 //
7110 FakeImplTaskRunnerProvider task_runner_provider; 7113 FakeImplTaskRunnerProvider task_runner_provider;
7111 TestSharedBitmapManager shared_bitmap_manager; 7114 TestSharedBitmapManager shared_bitmap_manager;
7112 TestTaskGraphRunner task_graph_runner; 7115 TestTaskGraphRunner task_graph_runner;
7113 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 7116 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
7114 &task_graph_runner); 7117 &task_graph_runner);
7115 host_impl.CreatePendingTree(); 7118 host_impl.CreatePendingTree();
7116 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 7119 scoped_ptr<LayerImpl> root_ptr =
7120 LayerImpl::Create(host_impl.active_tree(), 1);
7121 LayerImpl* root = root_ptr.get();
7117 scoped_ptr<LayerImpl> container = 7122 scoped_ptr<LayerImpl> container =
7118 LayerImpl::Create(host_impl.active_tree(), 2); 7123 LayerImpl::Create(host_impl.active_tree(), 2);
7119 LayerImpl* container_layer = container.get(); 7124 LayerImpl* container_layer = container.get();
7120 scoped_ptr<LayerImpl> scroller = 7125 scoped_ptr<LayerImpl> scroller =
7121 LayerImpl::Create(host_impl.active_tree(), 3); 7126 LayerImpl::Create(host_impl.active_tree(), 3);
7122 LayerImpl* scroll_layer = scroller.get(); 7127 LayerImpl* scroll_layer = scroller.get();
7123 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 7128 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
7124 LayerImpl* fixed_layer = fixed.get(); 7129 LayerImpl* fixed_layer = fixed.get();
7125 7130
7126 container->SetIsContainerForFixedPositionLayers(true); 7131 container->SetIsContainerForFixedPositionLayers(true);
7127 7132
7128 LayerPositionConstraint constraint; 7133 LayerPositionConstraint constraint;
7129 constraint.set_is_fixed_position(true); 7134 constraint.set_is_fixed_position(true);
7130 fixed->SetPositionConstraint(constraint); 7135 fixed->SetPositionConstraint(constraint);
7131 7136
7132 scroller->SetScrollClipLayer(container->id()); 7137 scroller->SetScrollClipLayer(container->id());
7133 7138
7134 gfx::Transform identity_transform; 7139 gfx::Transform identity_transform;
7135 gfx::Transform container_transform; 7140 gfx::Transform container_transform;
7136 container_transform.Translate3d(10.0, 20.0, 0.0); 7141 container_transform.Translate3d(10.0, 20.0, 0.0);
7137 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); 7142 gfx::Vector2dF container_offset = container_transform.To2dTranslation();
7138 7143
7139 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), 7144 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
7140 gfx::PointF(), gfx::Size(50, 50), true, false, 7145 gfx::PointF(), gfx::Size(50, 50), true, false,
7141 true); 7146 true);
7142 SetLayerPropertiesForTesting(container.get(), container_transform, 7147 SetLayerPropertiesForTesting(container.get(), container_transform,
7143 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), 7148 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
7144 true, false, false); 7149 true, false, false);
7145 SetLayerPropertiesForTesting(scroller.get(), identity_transform, 7150 SetLayerPropertiesForTesting(scroller.get(), identity_transform,
7146 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 7151 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
7147 true, false, false); 7152 true, false, false);
7148 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), 7153 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(),
7149 gfx::PointF(), gfx::Size(50, 50), true, false, 7154 gfx::PointF(), gfx::Size(50, 50), true, false,
7150 false); 7155 false);
7151 7156
7152 root->SetDrawsContent(true); 7157 root->SetDrawsContent(true);
7153 container->SetDrawsContent(true); 7158 container->SetDrawsContent(true);
7154 scroller->SetDrawsContent(true); 7159 scroller->SetDrawsContent(true);
7155 fixed->SetDrawsContent(true); 7160 fixed->SetDrawsContent(true);
7156 scroller->AddChild(std::move(fixed)); 7161 scroller->AddChild(std::move(fixed));
7157 container->AddChild(std::move(scroller)); 7162 container->AddChild(std::move(scroller));
7158 root->AddChild(std::move(container)); 7163 root->AddChild(std::move(container));
7159 7164
7160 // Rounded to integers already. 7165 // Rounded to integers already.
7161 { 7166 {
7167 root->layer_tree_impl()->SetRootLayer(std::move(root_ptr));
7168 root->layer_tree_impl()->BuildPropertyTreesForTesting();
7169
7162 gfx::Vector2dF scroll_delta(3.0, 5.0); 7170 gfx::Vector2dF scroll_delta(3.0, 5.0);
7163 scroll_layer->SetScrollDelta(scroll_delta); 7171 SetScrollOffsetDelta(scroll_layer, scroll_delta);
7164 7172
7165 LayerImplList render_surface_layer_list; 7173 LayerImplList render_surface_layer_list;
7166 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); 7174 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
7167 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 7175 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
7168 root.get(), root->bounds(), &render_surface_layer_list, 7176 root, root->bounds(), &render_surface_layer_list,
7169 root->layer_tree_impl()->current_render_surface_list_id()); 7177 root->layer_tree_impl()->current_render_surface_list_id());
7178 root->layer_tree_impl()
7179 ->property_trees()
7180 ->transform_tree.set_source_to_parent_updates_allowed(false);
7170 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 7181 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
7171 7182
7172 EXPECT_TRANSFORMATION_MATRIX_EQ( 7183 EXPECT_TRANSFORMATION_MATRIX_EQ(
7173 container_layer->draw_properties().screen_space_transform, 7184 container_layer->draw_properties().screen_space_transform,
7174 fixed_layer->draw_properties().screen_space_transform); 7185 fixed_layer->draw_properties().screen_space_transform);
7175 EXPECT_VECTOR_EQ( 7186 EXPECT_VECTOR_EQ(
7176 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), 7187 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
7177 container_offset); 7188 container_offset);
7178 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() 7189 EXPECT_VECTOR_EQ(scroll_layer->draw_properties()
7179 .screen_space_transform.To2dTranslation(), 7190 .screen_space_transform.To2dTranslation(),
7180 container_offset - scroll_delta); 7191 container_offset - scroll_delta);
7181 } 7192 }
7182 7193
7183 // Scroll delta requiring rounding. 7194 // Scroll delta requiring rounding.
7184 { 7195 {
7196 root->layer_tree_impl()->BuildPropertyTreesForTesting();
7197
7185 gfx::Vector2dF scroll_delta(4.1f, 8.1f); 7198 gfx::Vector2dF scroll_delta(4.1f, 8.1f);
7186 scroll_layer->SetScrollDelta(scroll_delta); 7199 SetScrollOffsetDelta(scroll_layer, scroll_delta);
7187 7200
7188 gfx::Vector2dF rounded_scroll_delta(4.f, 8.f); 7201 gfx::Vector2dF rounded_scroll_delta(4.f, 8.f);
7189 7202
7190 LayerImplList render_surface_layer_list; 7203 LayerImplList render_surface_layer_list;
7191 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); 7204 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
7192 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 7205 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
7193 root.get(), root->bounds(), &render_surface_layer_list, 7206 root, root->bounds(), &render_surface_layer_list,
7194 root->layer_tree_impl()->current_render_surface_list_id()); 7207 root->layer_tree_impl()->current_render_surface_list_id());
7195 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 7208 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
7196 7209
7197 EXPECT_TRANSFORMATION_MATRIX_EQ( 7210 EXPECT_TRANSFORMATION_MATRIX_EQ(
7198 container_layer->draw_properties().screen_space_transform, 7211 container_layer->draw_properties().screen_space_transform,
7199 fixed_layer->draw_properties().screen_space_transform); 7212 fixed_layer->draw_properties().screen_space_transform);
7200 EXPECT_VECTOR_EQ( 7213 EXPECT_VECTOR_EQ(
7201 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), 7214 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
7202 container_offset); 7215 container_offset);
7203 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() 7216 EXPECT_VECTOR_EQ(scroll_layer->draw_properties()
7204 .screen_space_transform.To2dTranslation(), 7217 .screen_space_transform.To2dTranslation(),
7205 container_offset - rounded_scroll_delta); 7218 container_offset - rounded_scroll_delta);
7206 } 7219 }
7207 7220
7208 // Scale is applied earlier in the tree. 7221 // Scale is applied earlier in the tree.
7209 { 7222 {
7223 SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF());
7210 gfx::Transform scaled_container_transform = container_transform; 7224 gfx::Transform scaled_container_transform = container_transform;
7211 scaled_container_transform.Scale3d(2.0, 2.0, 1.0); 7225 scaled_container_transform.Scale3d(2.0, 2.0, 1.0);
7212 container_layer->SetTransform(scaled_container_transform); 7226 container_layer->SetTransform(scaled_container_transform);
7213 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 7227 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
7214 root->layer_tree_impl() 7228 root->layer_tree_impl()->BuildPropertyTreesForTesting();
7215 ->property_trees()
7216 ->transform_tree.set_source_to_parent_updates_allowed(true);
7217 7229
7218 gfx::Vector2dF scroll_delta(4.5f, 8.5f); 7230 gfx::Vector2dF scroll_delta(4.5f, 8.5f);
7219 scroll_layer->SetScrollDelta(scroll_delta); 7231 SetScrollOffsetDelta(scroll_layer, scroll_delta);
7220 7232
7221 LayerImplList render_surface_layer_list; 7233 LayerImplList render_surface_layer_list;
7222 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); 7234 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
7223 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 7235 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
7224 root.get(), root->bounds(), &render_surface_layer_list, 7236 root, root->bounds(), &render_surface_layer_list,
7225 root->layer_tree_impl()->current_render_surface_list_id()); 7237 root->layer_tree_impl()->current_render_surface_list_id());
7226 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 7238 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
7227 7239
7228 EXPECT_TRANSFORMATION_MATRIX_EQ( 7240 EXPECT_TRANSFORMATION_MATRIX_EQ(
7229 container_layer->draw_properties().screen_space_transform, 7241 container_layer->draw_properties().screen_space_transform,
7230 fixed_layer->draw_properties().screen_space_transform); 7242 fixed_layer->draw_properties().screen_space_transform);
7231 EXPECT_VECTOR_EQ( 7243 EXPECT_VECTOR_EQ(
7232 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), 7244 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
7233 container_offset); 7245 container_offset);
7234 7246
(...skipping 10 matching lines...) Expand all
7245 // + container 7257 // + container
7246 // + scroller 7258 // + scroller
7247 // + fixed 7259 // + fixed
7248 // 7260 //
7249 FakeImplTaskRunnerProvider task_runner_provider; 7261 FakeImplTaskRunnerProvider task_runner_provider;
7250 TestSharedBitmapManager shared_bitmap_manager; 7262 TestSharedBitmapManager shared_bitmap_manager;
7251 TestTaskGraphRunner task_graph_runner; 7263 TestTaskGraphRunner task_graph_runner;
7252 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 7264 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
7253 &task_graph_runner); 7265 &task_graph_runner);
7254 host_impl.CreatePendingTree(); 7266 host_impl.CreatePendingTree();
7255 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 7267 scoped_ptr<LayerImpl> root_ptr =
7268 LayerImpl::Create(host_impl.active_tree(), 1);
7269 LayerImpl* root = root_ptr.get();
7256 scoped_ptr<LayerImpl> container = 7270 scoped_ptr<LayerImpl> container =
7257 LayerImpl::Create(host_impl.active_tree(), 2); 7271 LayerImpl::Create(host_impl.active_tree(), 2);
7258 LayerImpl* container_layer = container.get(); 7272 LayerImpl* container_layer = container.get();
7259 scoped_ptr<LayerImpl> scroller = 7273 scoped_ptr<LayerImpl> scroller =
7260 LayerImpl::Create(host_impl.active_tree(), 3); 7274 LayerImpl::Create(host_impl.active_tree(), 3);
7261 LayerImpl* scroll_layer = scroller.get(); 7275 LayerImpl* scroll_layer = scroller.get();
7262 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 7276 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
7263 LayerImpl* fixed_layer = fixed.get(); 7277 LayerImpl* fixed_layer = fixed.get();
7264 7278
7265 container->SetIsContainerForFixedPositionLayers(true); 7279 container->SetIsContainerForFixedPositionLayers(true);
7266 7280
7267 LayerPositionConstraint constraint; 7281 LayerPositionConstraint constraint;
7268 constraint.set_is_fixed_position(true); 7282 constraint.set_is_fixed_position(true);
7269 container->SetDrawsContent(true); 7283 container->SetDrawsContent(true);
7270 fixed->SetDrawsContent(true); 7284 fixed->SetDrawsContent(true);
7271 fixed->SetPositionConstraint(constraint); 7285 fixed->SetPositionConstraint(constraint);
7272 7286
7273 scroller->SetDrawsContent(true); 7287 scroller->SetDrawsContent(true);
7274 scroller->SetScrollClipLayer(container->id()); 7288 scroller->SetScrollClipLayer(container->id());
7275 7289
7276 gfx::Transform identity_transform; 7290 gfx::Transform identity_transform;
7277 gfx::Transform container_transform; 7291 gfx::Transform container_transform;
7278 container_transform.Translate3d(10.0, 20.0, 0.0); 7292 container_transform.Translate3d(10.0, 20.0, 0.0);
7279 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); 7293 gfx::Vector2dF container_offset = container_transform.To2dTranslation();
7280 7294
7281 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), 7295 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
7282 gfx::PointF(), gfx::Size(50, 50), true, false, 7296 gfx::PointF(), gfx::Size(50, 50), true, false,
7283 true); 7297 true);
7284 SetLayerPropertiesForTesting(container.get(), container_transform, 7298 SetLayerPropertiesForTesting(container.get(), container_transform,
7285 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), 7299 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
7286 true, false, false); 7300 true, false, false);
7287 SetLayerPropertiesForTesting(scroller.get(), identity_transform, 7301 SetLayerPropertiesForTesting(scroller.get(), identity_transform,
7288 gfx::Point3F(), gfx::PointF(0.0, 0.0), 7302 gfx::Point3F(), gfx::PointF(0.0, 0.0),
7289 gfx::Size(30, 30), true, false, false); 7303 gfx::Size(30, 30), true, false, false);
7290 7304
7291 gfx::ScrollOffset scroll_offset(3.3, 4.2); 7305 gfx::ScrollOffset scroll_offset(3.3, 4.2);
7292 gfx::Vector2dF main_scroll_fractional_part(0.3f, 0.2f); 7306 gfx::Vector2dF main_scroll_fractional_part(0.3f, 0.2f);
7293 gfx::Vector2dF scroll_delta(0.1f, 0.4f); 7307 gfx::Vector2dF scroll_delta(0.1f, 0.4f);
7294 // Blink only uses the integer part of the scroll_offset for fixed 7308 // Blink only uses the integer part of the scroll_offset for fixed
7295 // position layer. 7309 // position layer.
7296 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), 7310 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(),
7297 gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true, 7311 gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true,
7298 false, false); 7312 false, false);
7299 scroll_layer->PushScrollOffsetFromMainThread(scroll_offset); 7313 scroll_layer->layer_tree_impl()
7300 scroll_layer->SetScrollDelta(scroll_delta); 7314 ->property_trees()
7315 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(),
7316 scroll_offset);
7317
7301 scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part); 7318 scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part);
7302 7319
7303 scroller->AddChild(std::move(fixed)); 7320 scroller->AddChild(std::move(fixed));
7304 container->AddChild(std::move(scroller)); 7321 container->AddChild(std::move(scroller));
7305 root->AddChild(std::move(container)); 7322 root->AddChild(std::move(container));
7306 7323
7324 root->layer_tree_impl()->SetRootLayer(std::move(root_ptr));
7325 root->layer_tree_impl()->BuildPropertyTreesForTesting();
7326
7327 SetScrollOffsetDelta(scroll_layer, scroll_delta);
7328
7307 LayerImplList render_surface_layer_list; 7329 LayerImplList render_surface_layer_list;
7308 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); 7330 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
7309 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 7331 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
7310 root.get(), root->bounds(), &render_surface_layer_list, 7332 root, root->bounds(), &render_surface_layer_list,
7311 root->layer_tree_impl()->current_render_surface_list_id()); 7333 root->layer_tree_impl()->current_render_surface_list_id());
7312 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 7334 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
7313 7335
7314 EXPECT_TRANSFORMATION_MATRIX_EQ( 7336 EXPECT_TRANSFORMATION_MATRIX_EQ(
7315 container_layer->draw_properties().screen_space_transform, 7337 container_layer->draw_properties().screen_space_transform,
7316 fixed_layer->draw_properties().screen_space_transform); 7338 fixed_layer->draw_properties().screen_space_transform);
7317 EXPECT_VECTOR_EQ( 7339 EXPECT_VECTOR_EQ(
7318 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), 7340 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
7319 container_offset); 7341 container_offset);
7320 7342
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
7373 end_operations.AppendMatrix(end_scale); 7395 end_operations.AppendMatrix(end_scale);
7374 if (layer_settings().use_compositor_animation_timelines) { 7396 if (layer_settings().use_compositor_animation_timelines) {
7375 AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), 7397 AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(),
7376 1.0, start_operations, 7398 1.0, start_operations,
7377 end_operations); 7399 end_operations);
7378 } else { 7400 } else {
7379 AddAnimatedTransformToLayer(animated_layer, 1.0, start_operations, 7401 AddAnimatedTransformToLayer(animated_layer, 1.0, start_operations,
7380 end_operations); 7402 end_operations);
7381 } 7403 }
7382 gfx::Vector2dF scroll_delta(5.f, 9.f); 7404 gfx::Vector2dF scroll_delta(5.f, 9.f);
7383 scroller->SetScrollDelta(scroll_delta); 7405 SetScrollOffsetDelta(scroller, scroll_delta);
7384 7406
7385 ExecuteCalculateDrawProperties(root); 7407 ExecuteCalculateDrawProperties(root);
7386 7408
7387 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); 7409 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f);
7388 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, 7410 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation,
7389 scroller->DrawTransform().To2dTranslation()); 7411 scroller->DrawTransform().To2dTranslation());
7390 } 7412 }
7391 7413
7392 class AnimationScaleFactorTrackingLayerImpl : public LayerImpl { 7414 class AnimationScaleFactorTrackingLayerImpl : public LayerImpl {
7393 public: 7415 public:
(...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after
10199 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10221 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10200 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10222 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10201 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10223 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10202 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10224 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10203 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10225 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10204 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10226 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10205 } 10227 }
10206 10228
10207 } // namespace 10229 } // namespace
10208 } // namespace cc 10230 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698