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

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

Issue 1843813002: Fix issue with hit testing on the layer tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 } 2378 }
2379 2379
2380 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { 2380 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) {
2381 host_impl().active_tree()->SetDeviceScaleFactor(1.f); 2381 host_impl().active_tree()->SetDeviceScaleFactor(1.f);
2382 host_impl().active_tree()->UpdateDrawProperties(false); 2382 host_impl().active_tree()->UpdateDrawProperties(false);
2383 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); 2383 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties());
2384 host_impl().active_tree()->SetDeviceScaleFactor(2.f); 2384 host_impl().active_tree()->SetDeviceScaleFactor(2.f);
2385 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); 2385 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties());
2386 } 2386 }
2387 2387
2388 TEST_F(LayerTreeImplTest, HitTestingCorrectLayerWheelListener) {
2389 host_impl().active_tree()->set_event_listener_properties(
2390 EventListenerClass::kMouseWheel, EventListenerProperties::kBlocking);
2391 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2392 scoped_ptr<LayerImpl> left_child =
2393 LayerImpl::Create(host_impl().active_tree(), 2);
2394 scoped_ptr<LayerImpl> right_child =
2395 LayerImpl::Create(host_impl().active_tree(), 3);
2396
2397 gfx::Point3F transform_origin;
2398 gfx::PointF position;
2399 gfx::Size bounds(100, 100);
2400 {
2401 gfx::Transform translate_z;
2402 translate_z.Translate3d(0, 0, 10);
2403 SetLayerPropertiesForTesting(root.get(), translate_z, transform_origin,
2404 position, bounds, false, false, true);
2405 root->SetDrawsContent(true);
2406 }
2407 {
2408 gfx::Transform translate_z;
2409 translate_z.Translate3d(0, 0, 10);
2410 SetLayerPropertiesForTesting(left_child.get(), translate_z,
2411 transform_origin, position, bounds, false,
2412 false, false);
2413 left_child->SetDrawsContent(true);
2414 }
2415 {
2416 gfx::Transform translate_z;
2417 translate_z.Translate3d(0, 0, 10);
2418 SetLayerPropertiesForTesting(right_child.get(), translate_z,
2419 transform_origin, position, bounds, false,
2420 false, false);
2421 }
2422
2423 root->AddChild(std::move(left_child));
2424 root->AddChild(std::move(right_child));
2425
2426 host_impl().SetViewportSize(root->bounds());
2427 host_impl().active_tree()->SetRootLayer(std::move(root));
2428 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2429 CHECK_EQ(1u, RenderSurfaceLayerList().size());
2430
2431 gfx::PointF test_point = gfx::PointF(1.f, 1.f);
2432 LayerImpl* result_layer =
2433 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
2434
2435 CHECK(result_layer);
2436 EXPECT_EQ(2, result_layer->id());
2437 }
2438
2388 } // namespace 2439 } // namespace
2389 } // namespace cc 2440 } // 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