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 <set> | 7 #include <set> |
8 | 8 |
9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "cc/test/fake_impl_proxy.h" | 23 #include "cc/test/fake_impl_proxy.h" |
24 #include "cc/test/fake_layer_tree_host.h" | 24 #include "cc/test/fake_layer_tree_host.h" |
25 #include "cc/test/fake_layer_tree_host_impl.h" | 25 #include "cc/test/fake_layer_tree_host_impl.h" |
26 #include "cc/test/geometry_test_utils.h" | 26 #include "cc/test/geometry_test_utils.h" |
27 #include "cc/test/layer_tree_host_common_test.h" | 27 #include "cc/test/layer_tree_host_common_test.h" |
28 #include "cc/trees/layer_tree_impl.h" | 28 #include "cc/trees/layer_tree_impl.h" |
29 #include "cc/trees/proxy.h" | 29 #include "cc/trees/proxy.h" |
30 #include "cc/trees/single_thread_proxy.h" | 30 #include "cc/trees/single_thread_proxy.h" |
31 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 33 #include "ui/gfx/geometry/size_conversions.h" |
33 #include "ui/gfx/quad_f.h" | 34 #include "ui/gfx/quad_f.h" |
34 #include "ui/gfx/transform.h" | 35 #include "ui/gfx/transform.h" |
35 | 36 |
36 namespace cc { | 37 namespace cc { |
37 namespace { | 38 namespace { |
38 | 39 |
39 class LayerWithForcedDrawsContent : public Layer { | 40 class LayerWithForcedDrawsContent : public Layer { |
40 public: | 41 public: |
41 LayerWithForcedDrawsContent() {} | 42 LayerWithForcedDrawsContent() {} |
42 | 43 |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 gfx::PointF(), | 1152 gfx::PointF(), |
1152 gfx::Size(20, 20), | 1153 gfx::Size(20, 20), |
1153 true, | 1154 true, |
1154 false); | 1155 false); |
1155 | 1156 |
1156 gfx::Transform translate; | 1157 gfx::Transform translate; |
1157 translate.Translate(50, 50); | 1158 translate.Translate(50, 50); |
1158 { | 1159 { |
1159 RenderSurfaceLayerList render_surface_layer_list; | 1160 RenderSurfaceLayerList render_surface_layer_list; |
1160 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1161 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
1161 root.get(), root->bounds(), translate, &render_surface_layer_list); | 1162 root.get(), |
| 1163 gfx::ToCeiledSize(root->bounds()), |
| 1164 translate, |
| 1165 &render_surface_layer_list); |
1162 inputs.can_adjust_raster_scales = true; | 1166 inputs.can_adjust_raster_scales = true; |
1163 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1167 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1164 EXPECT_EQ(translate, root->draw_properties().target_space_transform); | 1168 EXPECT_EQ(translate, root->draw_properties().target_space_transform); |
1165 EXPECT_EQ(translate, child->draw_properties().target_space_transform); | 1169 EXPECT_EQ(translate, child->draw_properties().target_space_transform); |
1166 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1170 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
1167 EXPECT_EQ(1.f, root->draw_properties().device_scale_factor); | 1171 EXPECT_EQ(1.f, root->draw_properties().device_scale_factor); |
1168 EXPECT_EQ(1.f, child->draw_properties().device_scale_factor); | 1172 EXPECT_EQ(1.f, child->draw_properties().device_scale_factor); |
1169 } | 1173 } |
1170 | 1174 |
1171 gfx::Transform scale; | 1175 gfx::Transform scale; |
1172 scale.Scale(2, 2); | 1176 scale.Scale(2, 2); |
1173 { | 1177 { |
1174 RenderSurfaceLayerList render_surface_layer_list; | 1178 RenderSurfaceLayerList render_surface_layer_list; |
1175 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1179 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
1176 root.get(), root->bounds(), scale, &render_surface_layer_list); | 1180 root.get(), |
| 1181 gfx::ToCeiledSize(root->bounds()), |
| 1182 scale, |
| 1183 &render_surface_layer_list); |
1177 inputs.can_adjust_raster_scales = true; | 1184 inputs.can_adjust_raster_scales = true; |
1178 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1185 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1179 EXPECT_EQ(scale, root->draw_properties().target_space_transform); | 1186 EXPECT_EQ(scale, root->draw_properties().target_space_transform); |
1180 EXPECT_EQ(scale, child->draw_properties().target_space_transform); | 1187 EXPECT_EQ(scale, child->draw_properties().target_space_transform); |
1181 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1188 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
1182 EXPECT_EQ(2.f, root->draw_properties().device_scale_factor); | 1189 EXPECT_EQ(2.f, root->draw_properties().device_scale_factor); |
1183 EXPECT_EQ(2.f, child->draw_properties().device_scale_factor); | 1190 EXPECT_EQ(2.f, child->draw_properties().device_scale_factor); |
1184 } | 1191 } |
1185 | 1192 |
1186 gfx::Transform rotate; | 1193 gfx::Transform rotate; |
1187 rotate.Rotate(2); | 1194 rotate.Rotate(2); |
1188 { | 1195 { |
1189 RenderSurfaceLayerList render_surface_layer_list; | 1196 RenderSurfaceLayerList render_surface_layer_list; |
1190 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1197 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
1191 root.get(), root->bounds(), rotate, &render_surface_layer_list); | 1198 root.get(), |
| 1199 gfx::ToCeiledSize(root->bounds()), |
| 1200 rotate, |
| 1201 &render_surface_layer_list); |
1192 inputs.can_adjust_raster_scales = true; | 1202 inputs.can_adjust_raster_scales = true; |
1193 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1203 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1194 EXPECT_EQ(rotate, root->draw_properties().target_space_transform); | 1204 EXPECT_EQ(rotate, root->draw_properties().target_space_transform); |
1195 EXPECT_EQ(rotate, child->draw_properties().target_space_transform); | 1205 EXPECT_EQ(rotate, child->draw_properties().target_space_transform); |
1196 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1206 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
1197 EXPECT_EQ(1.f, root->draw_properties().device_scale_factor); | 1207 EXPECT_EQ(1.f, root->draw_properties().device_scale_factor); |
1198 EXPECT_EQ(1.f, child->draw_properties().device_scale_factor); | 1208 EXPECT_EQ(1.f, child->draw_properties().device_scale_factor); |
1199 } | 1209 } |
1200 | 1210 |
1201 gfx::Transform composite; | 1211 gfx::Transform composite; |
1202 composite.ConcatTransform(translate); | 1212 composite.ConcatTransform(translate); |
1203 composite.ConcatTransform(scale); | 1213 composite.ConcatTransform(scale); |
1204 composite.ConcatTransform(rotate); | 1214 composite.ConcatTransform(rotate); |
1205 { | 1215 { |
1206 RenderSurfaceLayerList render_surface_layer_list; | 1216 RenderSurfaceLayerList render_surface_layer_list; |
1207 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1217 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
1208 root.get(), root->bounds(), composite, &render_surface_layer_list); | 1218 root.get(), |
| 1219 gfx::ToCeiledSize(root->bounds()), |
| 1220 composite, |
| 1221 &render_surface_layer_list); |
1209 inputs.can_adjust_raster_scales = true; | 1222 inputs.can_adjust_raster_scales = true; |
1210 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1223 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1211 EXPECT_EQ(composite, root->draw_properties().target_space_transform); | 1224 EXPECT_EQ(composite, root->draw_properties().target_space_transform); |
1212 EXPECT_EQ(composite, child->draw_properties().target_space_transform); | 1225 EXPECT_EQ(composite, child->draw_properties().target_space_transform); |
1213 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1226 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
1214 } | 1227 } |
1215 | 1228 |
1216 // Verify it composes correctly with device scale. | 1229 // Verify it composes correctly with device scale. |
1217 float device_scale_factor = 1.5f; | 1230 float device_scale_factor = 1.5f; |
1218 | 1231 |
1219 { | 1232 { |
1220 RenderSurfaceLayerList render_surface_layer_list; | 1233 RenderSurfaceLayerList render_surface_layer_list; |
1221 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1234 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
1222 root.get(), root->bounds(), translate, &render_surface_layer_list); | 1235 root.get(), |
| 1236 gfx::ToCeiledSize(root->bounds()), |
| 1237 translate, |
| 1238 &render_surface_layer_list); |
1223 inputs.device_scale_factor = device_scale_factor; | 1239 inputs.device_scale_factor = device_scale_factor; |
1224 inputs.can_adjust_raster_scales = true; | 1240 inputs.can_adjust_raster_scales = true; |
1225 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1241 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1226 gfx::Transform device_scaled_translate = translate; | 1242 gfx::Transform device_scaled_translate = translate; |
1227 device_scaled_translate.Scale(device_scale_factor, device_scale_factor); | 1243 device_scaled_translate.Scale(device_scale_factor, device_scale_factor); |
1228 EXPECT_EQ(device_scaled_translate, | 1244 EXPECT_EQ(device_scaled_translate, |
1229 root->draw_properties().target_space_transform); | 1245 root->draw_properties().target_space_transform); |
1230 EXPECT_EQ(device_scaled_translate, | 1246 EXPECT_EQ(device_scaled_translate, |
1231 child->draw_properties().target_space_transform); | 1247 child->draw_properties().target_space_transform); |
1232 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1248 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
1233 EXPECT_EQ(device_scale_factor, root->draw_properties().device_scale_factor); | 1249 EXPECT_EQ(device_scale_factor, root->draw_properties().device_scale_factor); |
1234 EXPECT_EQ(device_scale_factor, | 1250 EXPECT_EQ(device_scale_factor, |
1235 child->draw_properties().device_scale_factor); | 1251 child->draw_properties().device_scale_factor); |
1236 } | 1252 } |
1237 | 1253 |
1238 // Verify it composes correctly with page scale. | 1254 // Verify it composes correctly with page scale. |
1239 float page_scale_factor = 2.f; | 1255 float page_scale_factor = 2.f; |
1240 | 1256 |
1241 { | 1257 { |
1242 RenderSurfaceLayerList render_surface_layer_list; | 1258 RenderSurfaceLayerList render_surface_layer_list; |
1243 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1259 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
1244 root.get(), root->bounds(), translate, &render_surface_layer_list); | 1260 root.get(), |
| 1261 gfx::ToCeiledSize(root->bounds()), |
| 1262 translate, |
| 1263 &render_surface_layer_list); |
1245 inputs.page_scale_factor = page_scale_factor; | 1264 inputs.page_scale_factor = page_scale_factor; |
1246 inputs.page_scale_application_layer = root.get(); | 1265 inputs.page_scale_application_layer = root.get(); |
1247 inputs.can_adjust_raster_scales = true; | 1266 inputs.can_adjust_raster_scales = true; |
1248 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1267 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1249 gfx::Transform page_scaled_translate = translate; | 1268 gfx::Transform page_scaled_translate = translate; |
1250 page_scaled_translate.Scale(page_scale_factor, page_scale_factor); | 1269 page_scaled_translate.Scale(page_scale_factor, page_scale_factor); |
1251 EXPECT_EQ(translate, root->draw_properties().target_space_transform); | 1270 EXPECT_EQ(translate, root->draw_properties().target_space_transform); |
1252 EXPECT_EQ(page_scaled_translate, | 1271 EXPECT_EQ(page_scaled_translate, |
1253 child->draw_properties().target_space_transform); | 1272 child->draw_properties().target_space_transform); |
1254 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1273 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
1255 EXPECT_EQ(1.f, root->draw_properties().device_scale_factor); | 1274 EXPECT_EQ(1.f, root->draw_properties().device_scale_factor); |
1256 EXPECT_EQ(1.f, child->draw_properties().device_scale_factor); | 1275 EXPECT_EQ(1.f, child->draw_properties().device_scale_factor); |
1257 } | 1276 } |
1258 | 1277 |
1259 // Verify that it composes correctly with transforms directly on root layer. | 1278 // Verify that it composes correctly with transforms directly on root layer. |
1260 root->SetTransform(composite); | 1279 root->SetTransform(composite); |
1261 | 1280 |
1262 { | 1281 { |
1263 RenderSurfaceLayerList render_surface_layer_list; | 1282 RenderSurfaceLayerList render_surface_layer_list; |
1264 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1283 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
1265 root.get(), root->bounds(), composite, &render_surface_layer_list); | 1284 root.get(), |
| 1285 gfx::ToCeiledSize(root->bounds()), |
| 1286 composite, |
| 1287 &render_surface_layer_list); |
1266 inputs.can_adjust_raster_scales = true; | 1288 inputs.can_adjust_raster_scales = true; |
1267 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1289 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
1268 gfx::Transform compositeSquared = composite; | 1290 gfx::Transform compositeSquared = composite; |
1269 compositeSquared.ConcatTransform(composite); | 1291 compositeSquared.ConcatTransform(composite); |
1270 EXPECT_TRANSFORMATION_MATRIX_EQ( | 1292 EXPECT_TRANSFORMATION_MATRIX_EQ( |
1271 compositeSquared, root->draw_properties().target_space_transform); | 1293 compositeSquared, root->draw_properties().target_space_transform); |
1272 EXPECT_TRANSFORMATION_MATRIX_EQ( | 1294 EXPECT_TRANSFORMATION_MATRIX_EQ( |
1273 compositeSquared, child->draw_properties().target_space_transform); | 1295 compositeSquared, child->draw_properties().target_space_transform); |
1274 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1296 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
1275 } | 1297 } |
(...skipping 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4464 | 4486 |
4465 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 4487 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
4466 host->SetRootLayer(root); | 4488 host->SetRootLayer(root); |
4467 | 4489 |
4468 float device_scale_factor = 2.5f; | 4490 float device_scale_factor = 2.5f; |
4469 float page_scale_factor = 1.f; | 4491 float page_scale_factor = 1.f; |
4470 | 4492 |
4471 { | 4493 { |
4472 RenderSurfaceLayerList render_surface_layer_list; | 4494 RenderSurfaceLayerList render_surface_layer_list; |
4473 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4495 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4474 root.get(), root->bounds(), &render_surface_layer_list); | 4496 root.get(), |
| 4497 gfx::ToCeiledSize(root->bounds()), |
| 4498 &render_surface_layer_list); |
4475 inputs.device_scale_factor = device_scale_factor; | 4499 inputs.device_scale_factor = device_scale_factor; |
4476 inputs.page_scale_factor = page_scale_factor; | 4500 inputs.page_scale_factor = page_scale_factor; |
4477 inputs.page_scale_application_layer = root.get(); | 4501 inputs.page_scale_application_layer = root.get(); |
4478 inputs.can_adjust_raster_scales = true; | 4502 inputs.can_adjust_raster_scales = true; |
4479 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4503 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4480 | 4504 |
4481 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4505 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4482 initial_parent_scale, parent); | 4506 initial_parent_scale, parent); |
4483 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4507 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4484 initial_parent_scale * initial_child_scale, | 4508 initial_parent_scale * initial_child_scale, |
(...skipping 22 matching lines...) Expand all Loading... |
4507 } | 4531 } |
4508 | 4532 |
4509 // If the device_scale_factor or page_scale_factor changes, then it should be | 4533 // If the device_scale_factor or page_scale_factor changes, then it should be |
4510 // updated using the initial transform as the raster scale. | 4534 // updated using the initial transform as the raster scale. |
4511 device_scale_factor = 2.25f; | 4535 device_scale_factor = 2.25f; |
4512 page_scale_factor = 1.25f; | 4536 page_scale_factor = 1.25f; |
4513 | 4537 |
4514 { | 4538 { |
4515 RenderSurfaceLayerList render_surface_layer_list; | 4539 RenderSurfaceLayerList render_surface_layer_list; |
4516 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4540 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4517 root.get(), root->bounds(), &render_surface_layer_list); | 4541 root.get(), |
| 4542 gfx::ToCeiledSize(root->bounds()), |
| 4543 &render_surface_layer_list); |
4518 inputs.device_scale_factor = device_scale_factor; | 4544 inputs.device_scale_factor = device_scale_factor; |
4519 inputs.page_scale_factor = page_scale_factor; | 4545 inputs.page_scale_factor = page_scale_factor; |
4520 inputs.page_scale_application_layer = root.get(); | 4546 inputs.page_scale_application_layer = root.get(); |
4521 inputs.can_adjust_raster_scales = true; | 4547 inputs.can_adjust_raster_scales = true; |
4522 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4548 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4523 | 4549 |
4524 EXPECT_CONTENTS_SCALE_EQ( | 4550 EXPECT_CONTENTS_SCALE_EQ( |
4525 device_scale_factor * page_scale_factor * initial_parent_scale, parent); | 4551 device_scale_factor * page_scale_factor * initial_parent_scale, parent); |
4526 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4552 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4527 initial_parent_scale * initial_child_scale, | 4553 initial_parent_scale * initial_child_scale, |
4528 child_scale); | 4554 child_scale); |
4529 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4555 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4530 initial_parent_scale * initial_child_scale, | 4556 initial_parent_scale * initial_child_scale, |
4531 child_empty); | 4557 child_empty); |
4532 EXPECT_CONTENTS_SCALE_EQ(1, child_no_scale); | 4558 EXPECT_CONTENTS_SCALE_EQ(1, child_no_scale); |
4533 } | 4559 } |
4534 | 4560 |
4535 // If the transform changes, we expect the raster scale to be reset to 1.0. | 4561 // If the transform changes, we expect the raster scale to be reset to 1.0. |
4536 SkMScalar second_child_scale = 1.75; | 4562 SkMScalar second_child_scale = 1.75; |
4537 child_scale_matrix.Scale(second_child_scale / initial_child_scale, | 4563 child_scale_matrix.Scale(second_child_scale / initial_child_scale, |
4538 second_child_scale / initial_child_scale); | 4564 second_child_scale / initial_child_scale); |
4539 child_scale->SetTransform(child_scale_matrix); | 4565 child_scale->SetTransform(child_scale_matrix); |
4540 child_empty->SetTransform(child_scale_matrix); | 4566 child_empty->SetTransform(child_scale_matrix); |
4541 | 4567 |
4542 { | 4568 { |
4543 RenderSurfaceLayerList render_surface_layer_list; | 4569 RenderSurfaceLayerList render_surface_layer_list; |
4544 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4570 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4545 root.get(), root->bounds(), &render_surface_layer_list); | 4571 root.get(), |
| 4572 gfx::ToCeiledSize(root->bounds()), |
| 4573 &render_surface_layer_list); |
4546 inputs.device_scale_factor = device_scale_factor; | 4574 inputs.device_scale_factor = device_scale_factor; |
4547 inputs.page_scale_factor = page_scale_factor; | 4575 inputs.page_scale_factor = page_scale_factor; |
4548 inputs.page_scale_application_layer = root.get(); | 4576 inputs.page_scale_application_layer = root.get(); |
4549 inputs.can_adjust_raster_scales = true; | 4577 inputs.can_adjust_raster_scales = true; |
4550 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4578 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4551 | 4579 |
4552 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4580 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4553 initial_parent_scale, | 4581 initial_parent_scale, |
4554 parent); | 4582 parent); |
4555 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, | 4583 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, |
4556 child_scale); | 4584 child_scale); |
4557 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, | 4585 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, |
4558 child_empty); | 4586 child_empty); |
4559 EXPECT_CONTENTS_SCALE_EQ(1, child_no_scale); | 4587 EXPECT_CONTENTS_SCALE_EQ(1, child_no_scale); |
4560 } | 4588 } |
4561 | 4589 |
4562 // If the device_scale_factor or page_scale_factor changes, then it should be | 4590 // If the device_scale_factor or page_scale_factor changes, then it should be |
4563 // updated, but still using 1.0 as the raster scale. | 4591 // updated, but still using 1.0 as the raster scale. |
4564 device_scale_factor = 2.75f; | 4592 device_scale_factor = 2.75f; |
4565 page_scale_factor = 1.75f; | 4593 page_scale_factor = 1.75f; |
4566 | 4594 |
4567 { | 4595 { |
4568 RenderSurfaceLayerList render_surface_layer_list; | 4596 RenderSurfaceLayerList render_surface_layer_list; |
4569 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4597 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4570 root.get(), root->bounds(), &render_surface_layer_list); | 4598 root.get(), |
| 4599 gfx::ToCeiledSize(root->bounds()), |
| 4600 &render_surface_layer_list); |
4571 inputs.device_scale_factor = device_scale_factor; | 4601 inputs.device_scale_factor = device_scale_factor; |
4572 inputs.page_scale_factor = page_scale_factor; | 4602 inputs.page_scale_factor = page_scale_factor; |
4573 inputs.page_scale_application_layer = root.get(); | 4603 inputs.page_scale_application_layer = root.get(); |
4574 inputs.can_adjust_raster_scales = true; | 4604 inputs.can_adjust_raster_scales = true; |
4575 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4605 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4576 | 4606 |
4577 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4607 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4578 initial_parent_scale, | 4608 initial_parent_scale, |
4579 parent); | 4609 parent); |
4580 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, | 4610 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4648 | 4678 |
4649 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 4679 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
4650 host->SetRootLayer(root); | 4680 host->SetRootLayer(root); |
4651 | 4681 |
4652 RenderSurfaceLayerList render_surface_layer_list; | 4682 RenderSurfaceLayerList render_surface_layer_list; |
4653 | 4683 |
4654 float device_scale_factor = 2.5f; | 4684 float device_scale_factor = 2.5f; |
4655 float page_scale_factor = 1.f; | 4685 float page_scale_factor = 1.f; |
4656 | 4686 |
4657 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4687 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4658 root.get(), root->bounds(), &render_surface_layer_list); | 4688 root.get(), |
| 4689 gfx::ToCeiledSize(root->bounds()), |
| 4690 &render_surface_layer_list); |
4659 inputs.device_scale_factor = device_scale_factor; | 4691 inputs.device_scale_factor = device_scale_factor; |
4660 inputs.page_scale_factor = page_scale_factor; | 4692 inputs.page_scale_factor = page_scale_factor; |
4661 inputs.page_scale_application_layer = root.get(), | 4693 inputs.page_scale_application_layer = root.get(), |
4662 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4694 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4663 | 4695 |
4664 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, parent); | 4696 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, parent); |
4665 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, | 4697 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, |
4666 child_scale); | 4698 child_scale); |
4667 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, | 4699 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, |
4668 child_empty); | 4700 child_empty); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4730 | 4762 |
4731 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 4763 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
4732 host->SetRootLayer(root); | 4764 host->SetRootLayer(root); |
4733 | 4765 |
4734 float device_scale_factor = 2.5f; | 4766 float device_scale_factor = 2.5f; |
4735 float page_scale_factor = 0.01f; | 4767 float page_scale_factor = 0.01f; |
4736 | 4768 |
4737 { | 4769 { |
4738 RenderSurfaceLayerList render_surface_layer_list; | 4770 RenderSurfaceLayerList render_surface_layer_list; |
4739 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4771 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4740 root.get(), root->bounds(), &render_surface_layer_list); | 4772 root.get(), |
| 4773 gfx::ToCeiledSize(root->bounds()), |
| 4774 &render_surface_layer_list); |
4741 inputs.device_scale_factor = device_scale_factor; | 4775 inputs.device_scale_factor = device_scale_factor; |
4742 inputs.page_scale_factor = page_scale_factor; | 4776 inputs.page_scale_factor = page_scale_factor; |
4743 inputs.page_scale_application_layer = root.get(); | 4777 inputs.page_scale_application_layer = root.get(); |
4744 inputs.can_adjust_raster_scales = true; | 4778 inputs.can_adjust_raster_scales = true; |
4745 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4779 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4746 | 4780 |
4747 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4781 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4748 initial_parent_scale, | 4782 initial_parent_scale, |
4749 parent); | 4783 parent); |
4750 // The child's scale is < 1, so we should not save and use that scale | 4784 // The child's scale is < 1, so we should not save and use that scale |
4751 // factor. | 4785 // factor. |
4752 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * 1, | 4786 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * 1, |
4753 child_scale); | 4787 child_scale); |
4754 } | 4788 } |
4755 | 4789 |
4756 // When chilld's total scale becomes >= 1, we should save and use that scale | 4790 // When chilld's total scale becomes >= 1, we should save and use that scale |
4757 // factor. | 4791 // factor. |
4758 child_scale_matrix.MakeIdentity(); | 4792 child_scale_matrix.MakeIdentity(); |
4759 SkMScalar final_child_scale = 0.75; | 4793 SkMScalar final_child_scale = 0.75; |
4760 child_scale_matrix.Scale(final_child_scale, final_child_scale); | 4794 child_scale_matrix.Scale(final_child_scale, final_child_scale); |
4761 child_scale->SetTransform(child_scale_matrix); | 4795 child_scale->SetTransform(child_scale_matrix); |
4762 | 4796 |
4763 { | 4797 { |
4764 RenderSurfaceLayerList render_surface_layer_list; | 4798 RenderSurfaceLayerList render_surface_layer_list; |
4765 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4799 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4766 root.get(), root->bounds(), &render_surface_layer_list); | 4800 root.get(), |
| 4801 gfx::ToCeiledSize(root->bounds()), |
| 4802 &render_surface_layer_list); |
4767 inputs.device_scale_factor = device_scale_factor; | 4803 inputs.device_scale_factor = device_scale_factor; |
4768 inputs.page_scale_factor = page_scale_factor; | 4804 inputs.page_scale_factor = page_scale_factor; |
4769 inputs.page_scale_application_layer = root.get(); | 4805 inputs.page_scale_application_layer = root.get(); |
4770 inputs.can_adjust_raster_scales = true; | 4806 inputs.can_adjust_raster_scales = true; |
4771 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4807 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4772 | 4808 |
4773 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4809 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4774 initial_parent_scale, | 4810 initial_parent_scale, |
4775 parent); | 4811 parent); |
4776 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4812 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4877 surface_no_scale->AddChild(surface_no_scale_child_no_scale); | 4913 surface_no_scale->AddChild(surface_no_scale_child_no_scale); |
4878 | 4914 |
4879 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 4915 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
4880 host->SetRootLayer(root); | 4916 host->SetRootLayer(root); |
4881 | 4917 |
4882 SkMScalar device_scale_factor = 5; | 4918 SkMScalar device_scale_factor = 5; |
4883 SkMScalar page_scale_factor = 7; | 4919 SkMScalar page_scale_factor = 7; |
4884 | 4920 |
4885 RenderSurfaceLayerList render_surface_layer_list; | 4921 RenderSurfaceLayerList render_surface_layer_list; |
4886 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4922 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
4887 root.get(), root->bounds(), &render_surface_layer_list); | 4923 root.get(), |
| 4924 gfx::ToCeiledSize(root->bounds()), |
| 4925 &render_surface_layer_list); |
4888 inputs.device_scale_factor = device_scale_factor; | 4926 inputs.device_scale_factor = device_scale_factor; |
4889 inputs.page_scale_factor = page_scale_factor; | 4927 inputs.page_scale_factor = page_scale_factor; |
4890 inputs.page_scale_application_layer = root.get(); | 4928 inputs.page_scale_application_layer = root.get(); |
4891 inputs.can_adjust_raster_scales = true; | 4929 inputs.can_adjust_raster_scales = true; |
4892 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4930 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4893 | 4931 |
4894 EXPECT_CONTENTS_SCALE_EQ( | 4932 EXPECT_CONTENTS_SCALE_EQ( |
4895 device_scale_factor * page_scale_factor * initial_parent_scale, parent); | 4933 device_scale_factor * page_scale_factor * initial_parent_scale, parent); |
4896 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * | 4934 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor * |
4897 initial_parent_scale * initial_child_scale, | 4935 initial_parent_scale * initial_child_scale, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5078 surface_no_scale->AddChild(surface_no_scale_child_no_scale); | 5116 surface_no_scale->AddChild(surface_no_scale_child_no_scale); |
5079 | 5117 |
5080 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 5118 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
5081 host->SetRootLayer(root); | 5119 host->SetRootLayer(root); |
5082 | 5120 |
5083 RenderSurfaceLayerList render_surface_layer_list; | 5121 RenderSurfaceLayerList render_surface_layer_list; |
5084 | 5122 |
5085 SkMScalar device_scale_factor = 5.0; | 5123 SkMScalar device_scale_factor = 5.0; |
5086 SkMScalar page_scale_factor = 7.0; | 5124 SkMScalar page_scale_factor = 7.0; |
5087 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5125 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
5088 root.get(), root->bounds(), &render_surface_layer_list); | 5126 root.get(), |
| 5127 gfx::ToCeiledSize(root->bounds()), |
| 5128 &render_surface_layer_list); |
5089 inputs.device_scale_factor = device_scale_factor; | 5129 inputs.device_scale_factor = device_scale_factor; |
5090 inputs.page_scale_factor = page_scale_factor; | 5130 inputs.page_scale_factor = page_scale_factor; |
5091 inputs.page_scale_application_layer = root.get(); | 5131 inputs.page_scale_application_layer = root.get(); |
5092 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5132 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5093 | 5133 |
5094 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, | 5134 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, |
5095 parent); | 5135 parent); |
5096 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, | 5136 EXPECT_CONTENTS_SCALE_EQ(device_scale_factor * page_scale_factor, |
5097 surface_scale); | 5137 surface_scale); |
5098 EXPECT_CONTENTS_SCALE_EQ(1.f, surface_no_scale); | 5138 EXPECT_CONTENTS_SCALE_EQ(1.f, surface_no_scale); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5223 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 5263 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
5224 host->SetRootLayer(root); | 5264 host->SetRootLayer(root); |
5225 | 5265 |
5226 // Now put an animating transform on child. | 5266 // Now put an animating transform on child. |
5227 int animation_id = AddAnimatedTransformToController( | 5267 int animation_id = AddAnimatedTransformToController( |
5228 child_scale->layer_animation_controller(), 10.0, 30, 0); | 5268 child_scale->layer_animation_controller(), 10.0, 30, 0); |
5229 | 5269 |
5230 { | 5270 { |
5231 RenderSurfaceLayerList render_surface_layer_list; | 5271 RenderSurfaceLayerList render_surface_layer_list; |
5232 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5272 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
5233 root.get(), root->bounds(), &render_surface_layer_list); | 5273 root.get(), |
| 5274 gfx::ToCeiledSize(root->bounds()), |
| 5275 &render_surface_layer_list); |
5234 inputs.can_adjust_raster_scales = true; | 5276 inputs.can_adjust_raster_scales = true; |
5235 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5277 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5236 | 5278 |
5237 EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale, parent); | 5279 EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale, parent); |
5238 // The layers with animating transforms should not compute a contents scale | 5280 // The layers with animating transforms should not compute a contents scale |
5239 // other than 1 until they finish animating. | 5281 // other than 1 until they finish animating. |
5240 EXPECT_CONTENTS_SCALE_EQ(1, child_scale); | 5282 EXPECT_CONTENTS_SCALE_EQ(1, child_scale); |
5241 } | 5283 } |
5242 | 5284 |
5243 // Remove the animation, now it can save a raster scale. | 5285 // Remove the animation, now it can save a raster scale. |
5244 child_scale->layer_animation_controller()->RemoveAnimation(animation_id); | 5286 child_scale->layer_animation_controller()->RemoveAnimation(animation_id); |
5245 | 5287 |
5246 { | 5288 { |
5247 RenderSurfaceLayerList render_surface_layer_list; | 5289 RenderSurfaceLayerList render_surface_layer_list; |
5248 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5290 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
5249 root.get(), root->bounds(), &render_surface_layer_list); | 5291 root.get(), |
| 5292 gfx::ToCeiledSize(root->bounds()), |
| 5293 &render_surface_layer_list); |
5250 inputs.can_adjust_raster_scales = true; | 5294 inputs.can_adjust_raster_scales = true; |
5251 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5295 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5252 | 5296 |
5253 EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale, parent); | 5297 EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale, parent); |
5254 // The layers with animating transforms should not compute a contents scale | 5298 // The layers with animating transforms should not compute a contents scale |
5255 // other than 1 until they finish animating. | 5299 // other than 1 until they finish animating. |
5256 EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale * initial_child_scale, | 5300 EXPECT_CONTENTS_SCALE_EQ(initial_parent_scale * initial_child_scale, |
5257 child_scale); | 5301 child_scale); |
5258 } | 5302 } |
5259 } | 5303 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5650 child->SetOpacity(0.0f); | 5694 child->SetOpacity(0.0f); |
5651 | 5695 |
5652 // Add opacity animation. | 5696 // Add opacity animation. |
5653 AddOpacityTransitionToController( | 5697 AddOpacityTransitionToController( |
5654 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); | 5698 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); |
5655 | 5699 |
5656 root->AddChild(child.Pass()); | 5700 root->AddChild(child.Pass()); |
5657 | 5701 |
5658 LayerImplList render_surface_layer_list; | 5702 LayerImplList render_surface_layer_list; |
5659 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5703 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
5660 root.get(), root->bounds(), &render_surface_layer_list); | 5704 root.get(), |
| 5705 gfx::ToCeiledSize(root->bounds()), |
| 5706 &render_surface_layer_list); |
5661 inputs.can_adjust_raster_scales = true; | 5707 inputs.can_adjust_raster_scales = true; |
5662 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5708 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5663 | 5709 |
5664 // We should have one render surface and two layers. The child | 5710 // We should have one render surface and two layers. The child |
5665 // layer should be included even though it is transparent. | 5711 // layer should be included even though it is transparent. |
5666 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5712 ASSERT_EQ(1u, render_surface_layer_list.size()); |
5667 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 5713 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
5668 } | 5714 } |
5669 | 5715 |
5670 typedef std::tr1::tuple<bool, bool> LCDTextTestParam; | 5716 typedef std::tr1::tuple<bool, bool> LCDTextTestParam; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5860 grand_child->SetHideLayerAndSubtree(true); | 5906 grand_child->SetHideLayerAndSubtree(true); |
5861 | 5907 |
5862 child->AddChild(grand_child); | 5908 child->AddChild(grand_child); |
5863 root->AddChild(child); | 5909 root->AddChild(child); |
5864 | 5910 |
5865 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 5911 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
5866 host->SetRootLayer(root); | 5912 host->SetRootLayer(root); |
5867 | 5913 |
5868 RenderSurfaceLayerList render_surface_layer_list; | 5914 RenderSurfaceLayerList render_surface_layer_list; |
5869 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5915 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
5870 root.get(), root->bounds(), &render_surface_layer_list); | 5916 root.get(), |
| 5917 gfx::ToCeiledSize(root->bounds()), |
| 5918 &render_surface_layer_list); |
5871 inputs.can_adjust_raster_scales = true; | 5919 inputs.can_adjust_raster_scales = true; |
5872 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5920 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5873 | 5921 |
5874 // We should have one render surface and two layers. The grand child has | 5922 // We should have one render surface and two layers. The grand child has |
5875 // hidden itself. | 5923 // hidden itself. |
5876 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5924 ASSERT_EQ(1u, render_surface_layer_list.size()); |
5877 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 5925 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
5878 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 5926 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
5879 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id()); | 5927 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id()); |
5880 } | 5928 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5916 true, | 5964 true, |
5917 false); | 5965 false); |
5918 grand_child->SetDrawsContent(true); | 5966 grand_child->SetDrawsContent(true); |
5919 grand_child->SetHideLayerAndSubtree(true); | 5967 grand_child->SetHideLayerAndSubtree(true); |
5920 | 5968 |
5921 child->AddChild(grand_child.Pass()); | 5969 child->AddChild(grand_child.Pass()); |
5922 root->AddChild(child.Pass()); | 5970 root->AddChild(child.Pass()); |
5923 | 5971 |
5924 LayerImplList render_surface_layer_list; | 5972 LayerImplList render_surface_layer_list; |
5925 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5973 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
5926 root.get(), root->bounds(), &render_surface_layer_list); | 5974 root.get(), |
| 5975 gfx::ToCeiledSize(root->bounds()), |
| 5976 &render_surface_layer_list); |
5927 inputs.can_adjust_raster_scales = true; | 5977 inputs.can_adjust_raster_scales = true; |
5928 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5978 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5929 | 5979 |
5930 // We should have one render surface and two layers. The grand child has | 5980 // We should have one render surface and two layers. The grand child has |
5931 // hidden itself. | 5981 // hidden itself. |
5932 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5982 ASSERT_EQ(1u, render_surface_layer_list.size()); |
5933 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 5983 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
5934 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); | 5984 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); |
5935 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); | 5985 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); |
5936 } | 5986 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5974 grand_child->SetIsDrawable(true); | 6024 grand_child->SetIsDrawable(true); |
5975 | 6025 |
5976 child->AddChild(grand_child); | 6026 child->AddChild(grand_child); |
5977 root->AddChild(child); | 6027 root->AddChild(child); |
5978 | 6028 |
5979 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 6029 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
5980 host->SetRootLayer(root); | 6030 host->SetRootLayer(root); |
5981 | 6031 |
5982 RenderSurfaceLayerList render_surface_layer_list; | 6032 RenderSurfaceLayerList render_surface_layer_list; |
5983 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 6033 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
5984 root.get(), root->bounds(), &render_surface_layer_list); | 6034 root.get(), |
| 6035 gfx::ToCeiledSize(root->bounds()), |
| 6036 &render_surface_layer_list); |
5985 inputs.can_adjust_raster_scales = true; | 6037 inputs.can_adjust_raster_scales = true; |
5986 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6038 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5987 | 6039 |
5988 // We should have one render surface and one layers. The child has | 6040 // We should have one render surface and one layers. The child has |
5989 // hidden itself and the grand child. | 6041 // hidden itself and the grand child. |
5990 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6042 ASSERT_EQ(1u, render_surface_layer_list.size()); |
5991 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 6043 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
5992 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 6044 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
5993 } | 6045 } |
5994 | 6046 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6029 gfx::Size(30, 30), | 6081 gfx::Size(30, 30), |
6030 true, | 6082 true, |
6031 false); | 6083 false); |
6032 grand_child->SetDrawsContent(true); | 6084 grand_child->SetDrawsContent(true); |
6033 | 6085 |
6034 child->AddChild(grand_child.Pass()); | 6086 child->AddChild(grand_child.Pass()); |
6035 root->AddChild(child.Pass()); | 6087 root->AddChild(child.Pass()); |
6036 | 6088 |
6037 LayerImplList render_surface_layer_list; | 6089 LayerImplList render_surface_layer_list; |
6038 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6090 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
6039 root.get(), root->bounds(), &render_surface_layer_list); | 6091 root.get(), |
| 6092 gfx::ToCeiledSize(root->bounds()), |
| 6093 &render_surface_layer_list); |
6040 inputs.can_adjust_raster_scales = true; | 6094 inputs.can_adjust_raster_scales = true; |
6041 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6095 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6042 | 6096 |
6043 // We should have one render surface and one layers. The child has | 6097 // We should have one render surface and one layers. The child has |
6044 // hidden itself and the grand child. | 6098 // hidden itself and the grand child. |
6045 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6099 ASSERT_EQ(1u, render_surface_layer_list.size()); |
6046 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 6100 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
6047 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); | 6101 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); |
6048 } | 6102 } |
6049 | 6103 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6141 // hidden subtree on copy_layer. | 6195 // hidden subtree on copy_layer. |
6142 copy_grand_parent->SetHideLayerAndSubtree(true); | 6196 copy_grand_parent->SetHideLayerAndSubtree(true); |
6143 copy_grand_parent_sibling_before->SetHideLayerAndSubtree(true); | 6197 copy_grand_parent_sibling_before->SetHideLayerAndSubtree(true); |
6144 copy_grand_parent_sibling_after->SetHideLayerAndSubtree(true); | 6198 copy_grand_parent_sibling_after->SetHideLayerAndSubtree(true); |
6145 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( | 6199 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( |
6146 base::Bind(&EmptyCopyOutputCallback))); | 6200 base::Bind(&EmptyCopyOutputCallback))); |
6147 EXPECT_TRUE(copy_layer->HasCopyRequest()); | 6201 EXPECT_TRUE(copy_layer->HasCopyRequest()); |
6148 | 6202 |
6149 RenderSurfaceLayerList render_surface_layer_list; | 6203 RenderSurfaceLayerList render_surface_layer_list; |
6150 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 6204 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
6151 root.get(), root->bounds(), &render_surface_layer_list); | 6205 root.get(), |
| 6206 gfx::ToCeiledSize(root->bounds()), |
| 6207 &render_surface_layer_list); |
6152 inputs.can_adjust_raster_scales = true; | 6208 inputs.can_adjust_raster_scales = true; |
6153 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6209 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6154 | 6210 |
6155 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); | 6211 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); |
6156 EXPECT_TRUE(copy_grand_parent->draw_properties(). | 6212 EXPECT_TRUE(copy_grand_parent->draw_properties(). |
6157 layer_or_descendant_has_copy_request); | 6213 layer_or_descendant_has_copy_request); |
6158 EXPECT_TRUE(copy_parent->draw_properties(). | 6214 EXPECT_TRUE(copy_parent->draw_properties(). |
6159 layer_or_descendant_has_copy_request); | 6215 layer_or_descendant_has_copy_request); |
6160 EXPECT_TRUE(copy_layer->draw_properties(). | 6216 EXPECT_TRUE(copy_layer->draw_properties(). |
6161 layer_or_descendant_has_copy_request); | 6217 layer_or_descendant_has_copy_request); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6250 | 6306 |
6251 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 6307 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
6252 host->SetRootLayer(root); | 6308 host->SetRootLayer(root); |
6253 | 6309 |
6254 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( | 6310 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( |
6255 base::Bind(&EmptyCopyOutputCallback))); | 6311 base::Bind(&EmptyCopyOutputCallback))); |
6256 EXPECT_TRUE(copy_layer->HasCopyRequest()); | 6312 EXPECT_TRUE(copy_layer->HasCopyRequest()); |
6257 | 6313 |
6258 RenderSurfaceLayerList render_surface_layer_list; | 6314 RenderSurfaceLayerList render_surface_layer_list; |
6259 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 6315 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
6260 root.get(), root->bounds(), &render_surface_layer_list); | 6316 root.get(), |
| 6317 gfx::ToCeiledSize(root->bounds()), |
| 6318 &render_surface_layer_list); |
6261 inputs.can_adjust_raster_scales = true; | 6319 inputs.can_adjust_raster_scales = true; |
6262 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6320 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6263 | 6321 |
6264 // We should have one render surface, as the others are clipped out. | 6322 // We should have one render surface, as the others are clipped out. |
6265 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6323 ASSERT_EQ(1u, render_surface_layer_list.size()); |
6266 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id()); | 6324 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id()); |
6267 | 6325 |
6268 // The root render surface should only have 1 contributing layer, since the | 6326 // The root render surface should only have 1 contributing layer, since the |
6269 // other layers are empty/clipped away. | 6327 // other layers are empty/clipped away. |
6270 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 6328 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6310 surface_child->SetIsDrawable(true); | 6368 surface_child->SetIsDrawable(true); |
6311 | 6369 |
6312 surface->AddChild(surface_child); | 6370 surface->AddChild(surface_child); |
6313 root->AddChild(surface); | 6371 root->AddChild(surface); |
6314 | 6372 |
6315 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 6373 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
6316 host->SetRootLayer(root); | 6374 host->SetRootLayer(root); |
6317 | 6375 |
6318 RenderSurfaceLayerList render_surface_layer_list; | 6376 RenderSurfaceLayerList render_surface_layer_list; |
6319 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 6377 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
6320 root.get(), root->bounds(), &render_surface_layer_list); | 6378 root.get(), |
| 6379 gfx::ToCeiledSize(root->bounds()), |
| 6380 &render_surface_layer_list); |
6321 inputs.can_adjust_raster_scales = true; | 6381 inputs.can_adjust_raster_scales = true; |
6322 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6382 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6323 | 6383 |
6324 // The visible_content_rect for the |surface_child| should not be clipped by | 6384 // The visible_content_rect for the |surface_child| should not be clipped by |
6325 // the viewport. | 6385 // the viewport. |
6326 EXPECT_EQ(gfx::Rect(50, 50).ToString(), | 6386 EXPECT_EQ(gfx::Rect(50, 50).ToString(), |
6327 surface_child->visible_content_rect().ToString()); | 6387 surface_child->visible_content_rect().ToString()); |
6328 } | 6388 } |
6329 | 6389 |
6330 TEST_F(LayerTreeHostCommonTest, TransformedClipParent) { | 6390 TEST_F(LayerTreeHostCommonTest, TransformedClipParent) { |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6939 child3->Set3dSortingContextId(1); | 6999 child3->Set3dSortingContextId(1); |
6940 | 7000 |
6941 child2->AddChild(child3.Pass()); | 7001 child2->AddChild(child3.Pass()); |
6942 child1->AddChild(child2.Pass()); | 7002 child1->AddChild(child2.Pass()); |
6943 root->AddChild(child1.Pass()); | 7003 root->AddChild(child1.Pass()); |
6944 | 7004 |
6945 { | 7005 { |
6946 LayerImplList render_surface_layer_list; | 7006 LayerImplList render_surface_layer_list; |
6947 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); | 7007 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); |
6948 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7008 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
6949 root.get(), root->bounds(), &render_surface_layer_list); | 7009 root.get(), |
| 7010 gfx::ToCeiledSize(root->bounds()), |
| 7011 &render_surface_layer_list); |
6950 inputs.can_render_to_separate_surface = true; | 7012 inputs.can_render_to_separate_surface = true; |
6951 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7013 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6952 | 7014 |
6953 EXPECT_EQ(2u, render_surface_layer_list.size()); | 7015 EXPECT_EQ(2u, render_surface_layer_list.size()); |
6954 } | 7016 } |
6955 | 7017 |
6956 { | 7018 { |
6957 LayerImplList render_surface_layer_list; | 7019 LayerImplList render_surface_layer_list; |
6958 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7020 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
6959 root.get(), root->bounds(), &render_surface_layer_list); | 7021 root.get(), |
| 7022 gfx::ToCeiledSize(root->bounds()), |
| 7023 &render_surface_layer_list); |
6960 inputs.can_render_to_separate_surface = false; | 7024 inputs.can_render_to_separate_surface = false; |
6961 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7025 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6962 | 7026 |
6963 EXPECT_EQ(1u, render_surface_layer_list.size()); | 7027 EXPECT_EQ(1u, render_surface_layer_list.size()); |
6964 } | 7028 } |
6965 } | 7029 } |
6966 | 7030 |
6967 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { | 7031 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { |
6968 scoped_refptr<Layer> root = Layer::Create(); | 7032 scoped_refptr<Layer> root = Layer::Create(); |
6969 scoped_refptr<Layer> render_surface = Layer::Create(); | 7033 scoped_refptr<Layer> render_surface = Layer::Create(); |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7494 gfx::Size(50, 50), | 7558 gfx::Size(50, 50), |
7495 true, | 7559 true, |
7496 false); | 7560 false); |
7497 | 7561 |
7498 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 7562 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
7499 host->SetRootLayer(root); | 7563 host->SetRootLayer(root); |
7500 | 7564 |
7501 RenderSurfaceLayerList render_surface_layer_list; | 7565 RenderSurfaceLayerList render_surface_layer_list; |
7502 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 7566 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
7503 root.get(), | 7567 root.get(), |
7504 root->bounds(), | 7568 gfx::ToCeiledSize(root->bounds()), |
7505 identity_transform, | 7569 identity_transform, |
7506 &render_surface_layer_list); | 7570 &render_surface_layer_list); |
7507 | 7571 |
7508 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7572 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
7509 | 7573 |
7510 EXPECT_TRUE(root->render_surface()); | 7574 EXPECT_TRUE(root->render_surface()); |
7511 | 7575 |
7512 EXPECT_EQ(gfx::Rect(0, 0, 20, 20).ToString(), | 7576 EXPECT_EQ(gfx::Rect(0, 0, 20, 20).ToString(), |
7513 scroll_child->clip_rect().ToString()); | 7577 scroll_child->clip_rect().ToString()); |
7514 EXPECT_TRUE(scroll_child->is_clipped()); | 7578 EXPECT_TRUE(scroll_child->is_clipped()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7630 scroll_child->AddChild(top_content.Pass()); | 7694 scroll_child->AddChild(top_content.Pass()); |
7631 scroll_child->AddChild(bottom_content.Pass()); | 7695 scroll_child->AddChild(bottom_content.Pass()); |
7632 root->AddChild(scroll_child.Pass()); | 7696 root->AddChild(scroll_child.Pass()); |
7633 | 7697 |
7634 scroll_parent_clip->AddChild(scroll_parent.Pass()); | 7698 scroll_parent_clip->AddChild(scroll_parent.Pass()); |
7635 scroll_parent_border->AddChild(scroll_parent_clip.Pass()); | 7699 scroll_parent_border->AddChild(scroll_parent_clip.Pass()); |
7636 root->AddChild(scroll_parent_border.Pass()); | 7700 root->AddChild(scroll_parent_border.Pass()); |
7637 | 7701 |
7638 LayerImplList render_surface_layer_list; | 7702 LayerImplList render_surface_layer_list; |
7639 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7703 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
7640 root.get(), root->bounds(), &render_surface_layer_list); | 7704 root.get(), |
| 7705 gfx::ToCeiledSize(root->bounds()), |
| 7706 &render_surface_layer_list); |
7641 | 7707 |
7642 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7708 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
7643 | 7709 |
7644 EXPECT_TRUE(root->render_surface()); | 7710 EXPECT_TRUE(root->render_surface()); |
7645 | 7711 |
7646 // If we don't sort by depth and let the layers get added in the order they | 7712 // If we don't sort by depth and let the layers get added in the order they |
7647 // would normally be visited in, then layers 6 and 7 will be out of order. In | 7713 // would normally be visited in, then layers 6 and 7 will be out of order. In |
7648 // other words, although we've had to shift 5, 6, and 7 to appear before 4 | 7714 // other words, although we've had to shift 5, 6, and 7 to appear before 4 |
7649 // in the list (because of the scroll parent relationship), this should not | 7715 // in the list (because of the scroll parent relationship), this should not |
7650 // have an effect on the the order of 5, 6, and 7 (which had been reordered | 7716 // have an effect on the the order of 5, 6, and 7 (which had been reordered |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7725 container->AddChild(scroller.Pass()); | 7791 container->AddChild(scroller.Pass()); |
7726 root->AddChild(container.Pass()); | 7792 root->AddChild(container.Pass()); |
7727 | 7793 |
7728 // Rounded to integers already. | 7794 // Rounded to integers already. |
7729 { | 7795 { |
7730 gfx::Vector2dF scroll_delta(3.0, 5.0); | 7796 gfx::Vector2dF scroll_delta(3.0, 5.0); |
7731 scroll_layer->SetScrollDelta(scroll_delta); | 7797 scroll_layer->SetScrollDelta(scroll_delta); |
7732 | 7798 |
7733 LayerImplList render_surface_layer_list; | 7799 LayerImplList render_surface_layer_list; |
7734 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7800 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
7735 root.get(), root->bounds(), &render_surface_layer_list); | 7801 root.get(), |
| 7802 gfx::ToCeiledSize(root->bounds()), |
| 7803 &render_surface_layer_list); |
7736 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7804 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
7737 | 7805 |
7738 EXPECT_TRANSFORMATION_MATRIX_EQ( | 7806 EXPECT_TRANSFORMATION_MATRIX_EQ( |
7739 container_layer->draw_properties().screen_space_transform, | 7807 container_layer->draw_properties().screen_space_transform, |
7740 fixed_layer->draw_properties().screen_space_transform); | 7808 fixed_layer->draw_properties().screen_space_transform); |
7741 EXPECT_VECTOR_EQ( | 7809 EXPECT_VECTOR_EQ( |
7742 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7810 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
7743 container_offset); | 7811 container_offset); |
7744 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() | 7812 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() |
7745 .screen_space_transform.To2dTranslation(), | 7813 .screen_space_transform.To2dTranslation(), |
7746 container_offset - scroll_delta); | 7814 container_offset - scroll_delta); |
7747 } | 7815 } |
7748 | 7816 |
7749 // Scroll delta requiring rounding. | 7817 // Scroll delta requiring rounding. |
7750 { | 7818 { |
7751 gfx::Vector2dF scroll_delta(4.1f, 8.1f); | 7819 gfx::Vector2dF scroll_delta(4.1f, 8.1f); |
7752 scroll_layer->SetScrollDelta(scroll_delta); | 7820 scroll_layer->SetScrollDelta(scroll_delta); |
7753 | 7821 |
7754 gfx::Vector2dF rounded_scroll_delta(4.f, 8.f); | 7822 gfx::Vector2dF rounded_scroll_delta(4.f, 8.f); |
7755 | 7823 |
7756 LayerImplList render_surface_layer_list; | 7824 LayerImplList render_surface_layer_list; |
7757 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7825 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
7758 root.get(), root->bounds(), &render_surface_layer_list); | 7826 root.get(), |
| 7827 gfx::ToCeiledSize(root->bounds()), |
| 7828 &render_surface_layer_list); |
7759 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7829 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
7760 | 7830 |
7761 EXPECT_TRANSFORMATION_MATRIX_EQ( | 7831 EXPECT_TRANSFORMATION_MATRIX_EQ( |
7762 container_layer->draw_properties().screen_space_transform, | 7832 container_layer->draw_properties().screen_space_transform, |
7763 fixed_layer->draw_properties().screen_space_transform); | 7833 fixed_layer->draw_properties().screen_space_transform); |
7764 EXPECT_VECTOR_EQ( | 7834 EXPECT_VECTOR_EQ( |
7765 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7835 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
7766 container_offset); | 7836 container_offset); |
7767 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() | 7837 EXPECT_VECTOR_EQ(scroll_layer->draw_properties() |
7768 .screen_space_transform.To2dTranslation(), | 7838 .screen_space_transform.To2dTranslation(), |
7769 container_offset - rounded_scroll_delta); | 7839 container_offset - rounded_scroll_delta); |
7770 } | 7840 } |
7771 | 7841 |
7772 // Scale is applied earlier in the tree. | 7842 // Scale is applied earlier in the tree. |
7773 { | 7843 { |
7774 gfx::Transform scaled_container_transform = container_transform; | 7844 gfx::Transform scaled_container_transform = container_transform; |
7775 scaled_container_transform.Scale3d(3.0, 3.0, 1.0); | 7845 scaled_container_transform.Scale3d(3.0, 3.0, 1.0); |
7776 container_layer->SetTransform(scaled_container_transform); | 7846 container_layer->SetTransform(scaled_container_transform); |
7777 | 7847 |
7778 gfx::Vector2dF scroll_delta(4.5f, 8.5f); | 7848 gfx::Vector2dF scroll_delta(4.5f, 8.5f); |
7779 scroll_layer->SetScrollDelta(scroll_delta); | 7849 scroll_layer->SetScrollDelta(scroll_delta); |
7780 | 7850 |
7781 LayerImplList render_surface_layer_list; | 7851 LayerImplList render_surface_layer_list; |
7782 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7852 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
7783 root.get(), root->bounds(), &render_surface_layer_list); | 7853 root.get(), |
| 7854 gfx::ToCeiledSize(root->bounds()), |
| 7855 &render_surface_layer_list); |
7784 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7856 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
7785 | 7857 |
7786 EXPECT_TRANSFORMATION_MATRIX_EQ( | 7858 EXPECT_TRANSFORMATION_MATRIX_EQ( |
7787 container_layer->draw_properties().screen_space_transform, | 7859 container_layer->draw_properties().screen_space_transform, |
7788 fixed_layer->draw_properties().screen_space_transform); | 7860 fixed_layer->draw_properties().screen_space_transform); |
7789 EXPECT_VECTOR_EQ( | 7861 EXPECT_VECTOR_EQ( |
7790 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7862 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
7791 container_offset); | 7863 container_offset); |
7792 | 7864 |
7793 container_layer->SetTransform(container_transform); | 7865 container_layer->SetTransform(container_transform); |
7794 } | 7866 } |
7795 | 7867 |
7796 // Scale is applied on the scroll layer itself. | 7868 // Scale is applied on the scroll layer itself. |
7797 { | 7869 { |
7798 gfx::Transform scale_transform; | 7870 gfx::Transform scale_transform; |
7799 scale_transform.Scale3d(3.0, 3.0, 1.0); | 7871 scale_transform.Scale3d(3.0, 3.0, 1.0); |
7800 scroll_layer->SetTransform(scale_transform); | 7872 scroll_layer->SetTransform(scale_transform); |
7801 | 7873 |
7802 gfx::Vector2dF scroll_delta(4.5f, 8.5f); | 7874 gfx::Vector2dF scroll_delta(4.5f, 8.5f); |
7803 scroll_layer->SetScrollDelta(scroll_delta); | 7875 scroll_layer->SetScrollDelta(scroll_delta); |
7804 | 7876 |
7805 LayerImplList render_surface_layer_list; | 7877 LayerImplList render_surface_layer_list; |
7806 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 7878 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
7807 root.get(), root->bounds(), &render_surface_layer_list); | 7879 root.get(), |
| 7880 gfx::ToCeiledSize(root->bounds()), |
| 7881 &render_surface_layer_list); |
7808 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7882 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
7809 | 7883 |
7810 EXPECT_VECTOR_EQ( | 7884 EXPECT_VECTOR_EQ( |
7811 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), | 7885 fixed_layer->draw_properties().screen_space_transform.To2dTranslation(), |
7812 container_offset); | 7886 container_offset); |
7813 | 7887 |
7814 scroll_layer->SetTransform(identity_transform); | 7888 scroll_layer->SetTransform(identity_transform); |
7815 } | 7889 } |
7816 } | 7890 } |
7817 | 7891 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8610 // by the viewport. | 8684 // by the viewport. |
8611 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); | 8685 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); |
8612 | 8686 |
8613 // Layers drawing to a child render surface should still have their visible | 8687 // Layers drawing to a child render surface should still have their visible |
8614 // content rect clipped by the viewport. | 8688 // content rect clipped by the viewport. |
8615 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); | 8689 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); |
8616 } | 8690 } |
8617 | 8691 |
8618 } // namespace | 8692 } // namespace |
8619 } // namespace cc | 8693 } // namespace cc |
OLD | NEW |