| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 10 #include "cc/test/fake_impl_task_runner_provider.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
| (...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2373 } | 2373 } |
| 2374 | 2374 |
| 2375 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { | 2375 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { |
| 2376 host_impl().active_tree()->SetDeviceScaleFactor(1.f); | 2376 host_impl().active_tree()->SetDeviceScaleFactor(1.f); |
| 2377 host_impl().active_tree()->UpdateDrawProperties(false); | 2377 host_impl().active_tree()->UpdateDrawProperties(false); |
| 2378 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); | 2378 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); |
| 2379 host_impl().active_tree()->SetDeviceScaleFactor(2.f); | 2379 host_impl().active_tree()->SetDeviceScaleFactor(2.f); |
| 2380 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); | 2380 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); |
| 2381 } | 2381 } |
| 2382 | 2382 |
| 2383 TEST_F(LayerTreeImplTest, HitTestingCorrectLayerWheelListener) { |
| 2384 host_impl().active_tree()->set_event_listener_properties( |
| 2385 EventListenerClass::kMouseWheel, EventListenerProperties::kBlocking); |
| 2386 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 2387 scoped_ptr<LayerImpl> left_child = |
| 2388 LayerImpl::Create(host_impl().active_tree(), 2); |
| 2389 scoped_ptr<LayerImpl> right_child = |
| 2390 LayerImpl::Create(host_impl().active_tree(), 3); |
| 2391 |
| 2392 gfx::Point3F transform_origin; |
| 2393 gfx::PointF position; |
| 2394 gfx::Size bounds(100, 100); |
| 2395 { |
| 2396 gfx::Transform translate_z; |
| 2397 translate_z.Translate3d(0, 0, 10); |
| 2398 SetLayerPropertiesForTesting(root.get(), translate_z, transform_origin, |
| 2399 position, bounds, false, false, true); |
| 2400 root->SetDrawsContent(true); |
| 2401 } |
| 2402 { |
| 2403 gfx::Transform translate_z; |
| 2404 translate_z.Translate3d(0, 0, 10); |
| 2405 SetLayerPropertiesForTesting(left_child.get(), translate_z, |
| 2406 transform_origin, position, bounds, false, |
| 2407 false, false); |
| 2408 left_child->SetDrawsContent(true); |
| 2409 } |
| 2410 { |
| 2411 gfx::Transform translate_z; |
| 2412 translate_z.Translate3d(0, 0, 10); |
| 2413 SetLayerPropertiesForTesting(right_child.get(), translate_z, |
| 2414 transform_origin, position, bounds, false, |
| 2415 false, false); |
| 2416 } |
| 2417 |
| 2418 root->AddChild(std::move(left_child)); |
| 2419 root->AddChild(std::move(right_child)); |
| 2420 |
| 2421 host_impl().SetViewportSize(root->bounds()); |
| 2422 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 2423 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 2424 CHECK_EQ(1u, RenderSurfaceLayerList().size()); |
| 2425 |
| 2426 gfx::PointF test_point = gfx::PointF(1.f, 1.f); |
| 2427 LayerImpl* result_layer = |
| 2428 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 2429 |
| 2430 CHECK(result_layer); |
| 2431 EXPECT_EQ(2, result_layer->id()); |
| 2432 } |
| 2433 |
| 2383 } // namespace | 2434 } // namespace |
| 2384 } // namespace cc | 2435 } // namespace cc |
| OLD | NEW |