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

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

Issue 1864633002: Fix issue with hit testing on the layer tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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
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
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698