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

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

Issue 27718006: cc: Fix touch hit-testing for overlapping layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix-win Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 428
429 bool LayerTreeHostImpl::HaveTouchEventHandlersAt(gfx::Point viewport_point) { 429 bool LayerTreeHostImpl::HaveTouchEventHandlersAt(gfx::Point viewport_point) {
430 if (!settings_.touch_hit_testing) 430 if (!settings_.touch_hit_testing)
431 return true; 431 return true;
432 if (!EnsureRenderSurfaceLayerList()) 432 if (!EnsureRenderSurfaceLayerList())
433 return false; 433 return false;
434 434
435 gfx::PointF device_viewport_point = 435 gfx::PointF device_viewport_point =
436 gfx::ScalePoint(viewport_point, device_scale_factor_); 436 gfx::ScalePoint(viewport_point, device_scale_factor_);
437 437
438 // First find out which layer was hit from the saved list of visible layers 438 LayerImpl* layer_impl =
439 // in the most recent frame. 439 LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
440 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( 440 device_viewport_point,
441 device_viewport_point, 441 active_tree_->RenderSurfaceLayerList());
442 active_tree_->RenderSurfaceLayerList()); 442 return layer_impl != NULL;
443
444 // Walk up the hierarchy and look for a layer with a touch event handler
445 // region that the given point hits.
446 for (; layer_impl; layer_impl = layer_impl->parent()) {
447 if (LayerTreeHostCommon::LayerHasTouchEventHandlersAt(device_viewport_point,
448 layer_impl))
449 return true;
450 }
451
452 return false;
453 } 443 }
454 444
455 void LayerTreeHostImpl::SetLatencyInfoForInputEvent( 445 void LayerTreeHostImpl::SetLatencyInfoForInputEvent(
456 const ui::LatencyInfo& latency_info) { 446 const ui::LatencyInfo& latency_info) {
457 active_tree()->SetLatencyInfo(latency_info); 447 active_tree()->SetLatencyInfo(latency_info);
458 } 448 }
459 449
460 void LayerTreeHostImpl::TrackDamageForAllSurfaces( 450 void LayerTreeHostImpl::TrackDamageForAllSurfaces(
461 LayerImpl* root_draw_layer, 451 LayerImpl* root_draw_layer,
462 const LayerImplList& render_surface_layer_list) { 452 const LayerImplList& render_surface_layer_list) {
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 std::set<UIResourceId>::iterator found_in_evicted = 2798 std::set<UIResourceId>::iterator found_in_evicted =
2809 evicted_ui_resources_.find(uid); 2799 evicted_ui_resources_.find(uid);
2810 if (found_in_evicted == evicted_ui_resources_.end()) 2800 if (found_in_evicted == evicted_ui_resources_.end())
2811 return; 2801 return;
2812 evicted_ui_resources_.erase(found_in_evicted); 2802 evicted_ui_resources_.erase(found_in_evicted);
2813 if (evicted_ui_resources_.empty()) 2803 if (evicted_ui_resources_.empty())
2814 client_->OnCanDrawStateChanged(CanDraw()); 2804 client_->OnCanDrawStateChanged(CanDraw());
2815 } 2805 }
2816 2806
2817 } // namespace cc 2807 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common.cc ('K') | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698