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

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

Issue 2723553003: Revert of Refactor unreliable hit test code to avoid owning_layers (Closed)
Patch Set: Created 3 years, 9 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.h ('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 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_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 if (!state->closest_match || in_front_of_previous_candidate) { 1922 if (!state->closest_match || in_front_of_previous_candidate) {
1923 state->closest_distance = distance_to_intersection; 1923 state->closest_distance = distance_to_intersection;
1924 state->closest_match = layer; 1924 state->closest_match = layer;
1925 } 1925 }
1926 } 1926 }
1927 UMA_HISTOGRAM_COUNTS("Compositing.LayerTreeImpl.FindClosestMatchingLayerUs", 1927 UMA_HISTOGRAM_COUNTS("Compositing.LayerTreeImpl.FindClosestMatchingLayerUs",
1928 timer.Elapsed().InMicroseconds()); 1928 timer.Elapsed().InMicroseconds());
1929 } 1929 }
1930 } 1930 }
1931 1931
1932 struct FindScrollingLayerOrDrawnScrollbarFunctor { 1932 static bool IsScrollableOrDrawnScrollbarLayer(LayerImpl* layer) {
1933 return layer->scrollable() ||
1934 (layer->ToScrollbarLayer() &&
1935 layer->is_drawn_render_surface_layer_list_member());
1936 }
1937
1938 struct FindScrollingLayerOrScrollbarLayerFunctor {
1933 bool operator()(LayerImpl* layer) const { 1939 bool operator()(LayerImpl* layer) const {
1934 return layer->scrollable() || layer->IsDrawnScrollbar(); 1940 return IsScrollableOrDrawnScrollbarLayer(layer);
1935 } 1941 }
1936 }; 1942 };
1937 1943
1938 LayerImpl* 1944 LayerImpl*
1939 LayerTreeImpl::FindFirstScrollingLayerOrDrawnScrollbarThatIsHitByPoint( 1945 LayerTreeImpl::FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
1940 const gfx::PointF& screen_space_point) { 1946 const gfx::PointF& screen_space_point) {
1941 FindClosestMatchingLayerState state; 1947 FindClosestMatchingLayerState state;
1942 LayerImpl* root_layer = layer_list_.empty() ? nullptr : layer_list_[0]; 1948 LayerImpl* root_layer = layer_list_.empty() ? nullptr : layer_list_[0];
1943 FindClosestMatchingLayer(screen_space_point, root_layer, 1949 FindClosestMatchingLayer(screen_space_point, root_layer,
1944 FindScrollingLayerOrDrawnScrollbarFunctor(), &state); 1950 FindScrollingLayerOrScrollbarLayerFunctor(), &state);
1945 return state.closest_match; 1951 return state.closest_match;
1946 } 1952 }
1947 1953
1948 struct HitTestVisibleScrollableOrTouchableFunctor { 1954 struct HitTestVisibleScrollableOrTouchableFunctor {
1949 bool operator()(LayerImpl* layer) const { 1955 bool operator()(LayerImpl* layer) const {
1950 return layer->scrollable() || 1956 return layer->is_drawn_render_surface_layer_list_member() ||
1951 layer->is_drawn_render_surface_layer_list_member() || 1957 IsScrollableOrDrawnScrollbarLayer(layer) ||
1952 !layer->touch_event_handler_region().IsEmpty(); 1958 !layer->touch_event_handler_region().IsEmpty();
1953 } 1959 }
1954 }; 1960 };
1955 1961
1956 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( 1962 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint(
1957 const gfx::PointF& screen_space_point) { 1963 const gfx::PointF& screen_space_point) {
1958 if (layer_list_.empty()) 1964 if (layer_list_.empty())
1959 return NULL; 1965 return NULL;
1960 bool update_lcd_text = false; 1966 bool update_lcd_text = false;
1961 if (!UpdateDrawProperties(update_lcd_text)) 1967 if (!UpdateDrawProperties(update_lcd_text))
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 2118
2113 void LayerTreeImpl::ResetAllChangeTracking() { 2119 void LayerTreeImpl::ResetAllChangeTracking() {
2114 layers_that_should_push_properties_.clear(); 2120 layers_that_should_push_properties_.clear();
2115 // Iterate over all layers, including masks. 2121 // Iterate over all layers, including masks.
2116 for (auto& layer : *layers_) 2122 for (auto& layer : *layers_)
2117 layer->ResetChangeTracking(); 2123 layer->ResetChangeTracking();
2118 property_trees_.ResetAllChangeTracking(); 2124 property_trees_.ResetAllChangeTracking();
2119 } 2125 }
2120 2126
2121 } // namespace cc 2127 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698