Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 root->layer_tree_impl()->property_trees()->transform_tree.set_needs_update( | |
| 7170 true); | |
|
ajuma
2016/03/09 18:53:51
This line shouldn't be needed (setting a scroll de
| |
| 7171 | |
| 7162 gfx::Vector2dF scroll_delta(3.0, 5.0); | 7172 gfx::Vector2dF scroll_delta(3.0, 5.0); |
| 7163 scroll_layer->SetScrollDelta(scroll_delta); | 7173 SetScrollOffsetDelta(scroll_layer, scroll_delta); |
| 7164 | 7174 |
| 7165 LayerImplList render_surface_layer_list; | 7175 LayerImplList render_surface_layer_list; |
| 7166 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); | 7176 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 7167 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7177 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 7168 root.get(), root->bounds(), &render_surface_layer_list, | 7178 root, root->bounds(), &render_surface_layer_list, |
| 7169 root->layer_tree_impl()->current_render_surface_list_id()); | 7179 root->layer_tree_impl()->current_render_surface_list_id()); |
| 7180 root->layer_tree_impl() | |
| 7181 ->property_trees() | |
| 7182 ->transform_tree.set_source_to_parent_updates_allowed(false); | |
| 7170 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7183 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 7171 | 7184 |
| 7172 EXPECT_TRANSFORMATION_MATRIX_EQ( | 7185 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 7173 container_layer->draw_properties().screen_space_transform, | 7186 container_layer->draw_properties().screen_space_transform, |
| 7174 fixed_layer->draw_properties().screen_space_transform); | 7187 fixed_layer->draw_properties().screen_space_transform); |
| 7175 EXPECT_VECTOR_EQ( | 7188 EXPECT_VECTOR_EQ( |
| 7176 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7189 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
| 7177 container_offset); | 7190 container_offset); |
| 7178 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() | 7191 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() |
| 7179 .screen_space_transform.To2dTranslation(), | 7192 .screen_space_transform.To2dTranslation(), |
| 7180 container_offset - scroll_delta); | 7193 container_offset - scroll_delta); |
| 7181 } | 7194 } |
| 7182 | 7195 |
| 7183 // Scroll delta requiring rounding. | 7196 // Scroll delta requiring rounding. |
| 7184 { | 7197 { |
| 7198 root->layer_tree_impl()->BuildPropertyTreesForTesting(); | |
| 7199 | |
| 7185 gfx::Vector2dF scroll_delta(4.1f, 8.1f); | 7200 gfx::Vector2dF scroll_delta(4.1f, 8.1f); |
| 7186 scroll_layer->SetScrollDelta(scroll_delta); | 7201 SetScrollOffsetDelta(scroll_layer, scroll_delta); |
| 7187 | 7202 |
| 7188 gfx::Vector2dF rounded_scroll_delta(4.f, 8.f); | 7203 gfx::Vector2dF rounded_scroll_delta(4.f, 8.f); |
| 7189 | 7204 |
| 7190 LayerImplList render_surface_layer_list; | 7205 LayerImplList render_surface_layer_list; |
| 7191 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); | 7206 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 7192 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7207 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 7193 root.get(), root->bounds(), &render_surface_layer_list, | 7208 root, root->bounds(), &render_surface_layer_list, |
| 7194 root->layer_tree_impl()->current_render_surface_list_id()); | 7209 root->layer_tree_impl()->current_render_surface_list_id()); |
| 7195 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7210 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 7196 | 7211 |
| 7197 EXPECT_TRANSFORMATION_MATRIX_EQ( | 7212 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 7198 container_layer->draw_properties().screen_space_transform, | 7213 container_layer->draw_properties().screen_space_transform, |
| 7199 fixed_layer->draw_properties().screen_space_transform); | 7214 fixed_layer->draw_properties().screen_space_transform); |
| 7200 EXPECT_VECTOR_EQ( | 7215 EXPECT_VECTOR_EQ( |
| 7201 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7216 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
| 7202 container_offset); | 7217 container_offset); |
| 7203 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() | 7218 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() |
| 7204 .screen_space_transform.To2dTranslation(), | 7219 .screen_space_transform.To2dTranslation(), |
| 7205 container_offset - rounded_scroll_delta); | 7220 container_offset - rounded_scroll_delta); |
| 7206 } | 7221 } |
| 7207 | 7222 |
| 7208 // Scale is applied earlier in the tree. | 7223 // Scale is applied earlier in the tree. |
| 7209 { | 7224 { |
| 7225 SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF()); | |
| 7210 gfx::Transform scaled_container_transform = container_transform; | 7226 gfx::Transform scaled_container_transform = container_transform; |
| 7211 scaled_container_transform.Scale3d(2.0, 2.0, 1.0); | 7227 scaled_container_transform.Scale3d(2.0, 2.0, 1.0); |
| 7212 container_layer->SetTransform(scaled_container_transform); | 7228 container_layer->SetTransform(scaled_container_transform); |
| 7213 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7229 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7214 root->layer_tree_impl() | 7230 root->layer_tree_impl()->BuildPropertyTreesForTesting(); |
| 7215 ->property_trees() | |
| 7216 ->transform_tree.set_source_to_parent_updates_allowed(true); | |
| 7217 | 7231 |
| 7218 gfx::Vector2dF scroll_delta(4.5f, 8.5f); | 7232 gfx::Vector2dF scroll_delta(4.5f, 8.5f); |
| 7219 scroll_layer->SetScrollDelta(scroll_delta); | 7233 SetScrollOffsetDelta(scroll_layer, scroll_delta); |
| 7220 | 7234 |
| 7221 LayerImplList render_surface_layer_list; | 7235 LayerImplList render_surface_layer_list; |
| 7222 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); | 7236 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 7223 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7237 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 7224 root.get(), root->bounds(), &render_surface_layer_list, | 7238 root, root->bounds(), &render_surface_layer_list, |
| 7225 root->layer_tree_impl()->current_render_surface_list_id()); | 7239 root->layer_tree_impl()->current_render_surface_list_id()); |
| 7226 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7240 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 7227 | 7241 |
| 7228 EXPECT_TRANSFORMATION_MATRIX_EQ( | 7242 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 7229 container_layer->draw_properties().screen_space_transform, | 7243 container_layer->draw_properties().screen_space_transform, |
| 7230 fixed_layer->draw_properties().screen_space_transform); | 7244 fixed_layer->draw_properties().screen_space_transform); |
| 7231 EXPECT_VECTOR_EQ( | 7245 EXPECT_VECTOR_EQ( |
| 7232 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7246 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
| 7233 container_offset); | 7247 container_offset); |
| 7234 | 7248 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 7245 // + container | 7259 // + container |
| 7246 // + scroller | 7260 // + scroller |
| 7247 // + fixed | 7261 // + fixed |
| 7248 // | 7262 // |
| 7249 FakeImplTaskRunnerProvider task_runner_provider; | 7263 FakeImplTaskRunnerProvider task_runner_provider; |
| 7250 TestSharedBitmapManager shared_bitmap_manager; | 7264 TestSharedBitmapManager shared_bitmap_manager; |
| 7251 TestTaskGraphRunner task_graph_runner; | 7265 TestTaskGraphRunner task_graph_runner; |
| 7252 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 7266 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 7253 &task_graph_runner); | 7267 &task_graph_runner); |
| 7254 host_impl.CreatePendingTree(); | 7268 host_impl.CreatePendingTree(); |
| 7255 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 7269 scoped_ptr<LayerImpl> root_ptr = |
| 7270 LayerImpl::Create(host_impl.active_tree(), 1); | |
| 7271 LayerImpl* root = root_ptr.get(); | |
| 7256 scoped_ptr<LayerImpl> container = | 7272 scoped_ptr<LayerImpl> container = |
| 7257 LayerImpl::Create(host_impl.active_tree(), 2); | 7273 LayerImpl::Create(host_impl.active_tree(), 2); |
| 7258 LayerImpl* container_layer = container.get(); | 7274 LayerImpl* container_layer = container.get(); |
| 7259 scoped_ptr<LayerImpl> scroller = | 7275 scoped_ptr<LayerImpl> scroller = |
| 7260 LayerImpl::Create(host_impl.active_tree(), 3); | 7276 LayerImpl::Create(host_impl.active_tree(), 3); |
| 7261 LayerImpl* scroll_layer = scroller.get(); | 7277 LayerImpl* scroll_layer = scroller.get(); |
| 7262 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); | 7278 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); |
| 7263 LayerImpl* fixed_layer = fixed.get(); | 7279 LayerImpl* fixed_layer = fixed.get(); |
| 7264 | 7280 |
| 7265 container->SetIsContainerForFixedPositionLayers(true); | 7281 container->SetIsContainerForFixedPositionLayers(true); |
| 7266 | 7282 |
| 7267 LayerPositionConstraint constraint; | 7283 LayerPositionConstraint constraint; |
| 7268 constraint.set_is_fixed_position(true); | 7284 constraint.set_is_fixed_position(true); |
| 7269 container->SetDrawsContent(true); | 7285 container->SetDrawsContent(true); |
| 7270 fixed->SetDrawsContent(true); | 7286 fixed->SetDrawsContent(true); |
| 7271 fixed->SetPositionConstraint(constraint); | 7287 fixed->SetPositionConstraint(constraint); |
| 7272 | 7288 |
| 7273 scroller->SetDrawsContent(true); | 7289 scroller->SetDrawsContent(true); |
| 7274 scroller->SetScrollClipLayer(container->id()); | 7290 scroller->SetScrollClipLayer(container->id()); |
| 7275 | 7291 |
| 7276 gfx::Transform identity_transform; | 7292 gfx::Transform identity_transform; |
| 7277 gfx::Transform container_transform; | 7293 gfx::Transform container_transform; |
| 7278 container_transform.Translate3d(10.0, 20.0, 0.0); | 7294 container_transform.Translate3d(10.0, 20.0, 0.0); |
| 7279 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); | 7295 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); |
| 7280 | 7296 |
| 7281 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 7297 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), |
| 7282 gfx::PointF(), gfx::Size(50, 50), true, false, | 7298 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 7283 true); | 7299 true); |
| 7284 SetLayerPropertiesForTesting(container.get(), container_transform, | 7300 SetLayerPropertiesForTesting(container.get(), container_transform, |
| 7285 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), | 7301 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), |
| 7286 true, false, false); | 7302 true, false, false); |
| 7287 SetLayerPropertiesForTesting(scroller.get(), identity_transform, | 7303 SetLayerPropertiesForTesting(scroller.get(), identity_transform, |
| 7288 gfx::Point3F(), gfx::PointF(0.0, 0.0), | 7304 gfx::Point3F(), gfx::PointF(0.0, 0.0), |
| 7289 gfx::Size(30, 30), true, false, false); | 7305 gfx::Size(30, 30), true, false, false); |
| 7290 | 7306 |
| 7291 gfx::ScrollOffset scroll_offset(3.3, 4.2); | 7307 gfx::ScrollOffset scroll_offset(3.3, 4.2); |
| 7292 gfx::Vector2dF main_scroll_fractional_part(0.3f, 0.2f); | 7308 gfx::Vector2dF main_scroll_fractional_part(0.3f, 0.2f); |
| 7293 gfx::Vector2dF scroll_delta(0.1f, 0.4f); | 7309 gfx::Vector2dF scroll_delta(0.1f, 0.4f); |
| 7294 // Blink only uses the integer part of the scroll_offset for fixed | 7310 // Blink only uses the integer part of the scroll_offset for fixed |
| 7295 // position layer. | 7311 // position layer. |
| 7296 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), | 7312 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), |
| 7297 gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true, | 7313 gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true, |
| 7298 false, false); | 7314 false, false); |
| 7299 scroll_layer->PushScrollOffsetFromMainThread(scroll_offset); | 7315 scroll_layer->layer_tree_impl() |
| 7300 scroll_layer->SetScrollDelta(scroll_delta); | 7316 ->property_trees() |
| 7317 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), | |
| 7318 scroll_offset); | |
| 7319 | |
| 7301 scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part); | 7320 scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part); |
| 7302 | 7321 |
| 7303 scroller->AddChild(std::move(fixed)); | 7322 scroller->AddChild(std::move(fixed)); |
| 7304 container->AddChild(std::move(scroller)); | 7323 container->AddChild(std::move(scroller)); |
| 7305 root->AddChild(std::move(container)); | 7324 root->AddChild(std::move(container)); |
| 7306 | 7325 |
| 7326 root->layer_tree_impl()->SetRootLayer(std::move(root_ptr)); | |
| 7327 root->layer_tree_impl()->BuildPropertyTreesForTesting(); | |
| 7328 | |
| 7329 SetScrollOffsetDelta(scroll_layer, scroll_delta); | |
| 7330 | |
| 7307 LayerImplList render_surface_layer_list; | 7331 LayerImplList render_surface_layer_list; |
| 7308 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); | 7332 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); |
| 7309 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7333 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 7310 root.get(), root->bounds(), &render_surface_layer_list, | 7334 root, root->bounds(), &render_surface_layer_list, |
| 7311 root->layer_tree_impl()->current_render_surface_list_id()); | 7335 root->layer_tree_impl()->current_render_surface_list_id()); |
| 7312 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7336 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 7313 | 7337 |
| 7314 EXPECT_TRANSFORMATION_MATRIX_EQ( | 7338 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 7315 container_layer->draw_properties().screen_space_transform, | 7339 container_layer->draw_properties().screen_space_transform, |
| 7316 fixed_layer->draw_properties().screen_space_transform); | 7340 fixed_layer->draw_properties().screen_space_transform); |
| 7317 EXPECT_VECTOR_EQ( | 7341 EXPECT_VECTOR_EQ( |
| 7318 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7342 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
| 7319 container_offset); | 7343 container_offset); |
| 7320 | 7344 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7373 end_operations.AppendMatrix(end_scale); | 7397 end_operations.AppendMatrix(end_scale); |
| 7374 if (layer_settings().use_compositor_animation_timelines) { | 7398 if (layer_settings().use_compositor_animation_timelines) { |
| 7375 AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), | 7399 AddAnimatedTransformToLayerWithPlayer(animated_layer->id(), timeline_impl(), |
| 7376 1.0, start_operations, | 7400 1.0, start_operations, |
| 7377 end_operations); | 7401 end_operations); |
| 7378 } else { | 7402 } else { |
| 7379 AddAnimatedTransformToLayer(animated_layer, 1.0, start_operations, | 7403 AddAnimatedTransformToLayer(animated_layer, 1.0, start_operations, |
| 7380 end_operations); | 7404 end_operations); |
| 7381 } | 7405 } |
| 7382 gfx::Vector2dF scroll_delta(5.f, 9.f); | 7406 gfx::Vector2dF scroll_delta(5.f, 9.f); |
| 7383 scroller->SetScrollDelta(scroll_delta); | 7407 SetScrollOffsetDelta(scroller, scroll_delta); |
| 7384 | 7408 |
| 7385 ExecuteCalculateDrawProperties(root); | 7409 ExecuteCalculateDrawProperties(root); |
| 7386 | 7410 |
| 7387 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); | 7411 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); |
| 7388 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, | 7412 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, |
| 7389 scroller->DrawTransform().To2dTranslation()); | 7413 scroller->DrawTransform().To2dTranslation()); |
| 7390 } | 7414 } |
| 7391 | 7415 |
| 7392 class AnimationScaleFactorTrackingLayerImpl : public LayerImpl { | 7416 class AnimationScaleFactorTrackingLayerImpl : public LayerImpl { |
| 7393 public: | 7417 public: |
| (...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10199 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10223 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10200 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10224 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10201 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10225 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10202 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10226 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10203 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10227 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10204 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10228 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10205 } | 10229 } |
| 10206 | 10230 |
| 10207 } // namespace | 10231 } // namespace |
| 10208 } // namespace cc | 10232 } // namespace cc |
| OLD | NEW |