Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1880 distance_to_intersection > | 1880 distance_to_intersection > |
| 1881 state->closest_distance + std::numeric_limits<float>::epsilon(); | 1881 state->closest_distance + std::numeric_limits<float>::epsilon(); |
| 1882 | 1882 |
| 1883 if (!state->closest_match || in_front_of_previous_candidate) { | 1883 if (!state->closest_match || in_front_of_previous_candidate) { |
| 1884 state->closest_distance = distance_to_intersection; | 1884 state->closest_distance = distance_to_intersection; |
| 1885 state->closest_match = layer; | 1885 state->closest_match = layer; |
| 1886 } | 1886 } |
| 1887 } | 1887 } |
| 1888 } | 1888 } |
| 1889 | 1889 |
| 1890 static bool ScrollsOrScrollbarAnyDrawnRenderSurfaceLayerListMember( | 1890 static bool IsScrollableOrDrawnScrollbarLayer(LayerImpl* layer) { |
| 1891 LayerImpl* layer) { | 1891 return layer->scrollable() || |
|
majidvp
2016/11/14 17:21:11
Should we also check for LayerImpl::user_scrollabl
skobes
2016/11/14 17:46:33
ComputeLayerScrollsDrawnDescendants was not concer
| |
| 1892 return layer->scrolls_drawn_descendant() || | |
| 1893 (layer->ToScrollbarLayer() && | 1892 (layer->ToScrollbarLayer() && |
| 1894 layer->is_drawn_render_surface_layer_list_member()); | 1893 layer->is_drawn_render_surface_layer_list_member()); |
| 1895 } | 1894 } |
| 1896 | 1895 |
| 1897 struct FindScrollingLayerOrScrollbarLayerFunctor { | 1896 struct FindScrollingLayerOrScrollbarLayerFunctor { |
| 1898 bool operator()(LayerImpl* layer) const { | 1897 bool operator()(LayerImpl* layer) const { |
| 1899 return ScrollsOrScrollbarAnyDrawnRenderSurfaceLayerListMember(layer); | 1898 return IsScrollableOrDrawnScrollbarLayer(layer); |
| 1900 } | 1899 } |
| 1901 }; | 1900 }; |
| 1902 | 1901 |
| 1903 LayerImpl* | 1902 LayerImpl* |
| 1904 LayerTreeImpl::FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint( | 1903 LayerTreeImpl::FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint( |
| 1905 const gfx::PointF& screen_space_point) { | 1904 const gfx::PointF& screen_space_point) { |
| 1906 FindClosestMatchingLayerState state; | 1905 FindClosestMatchingLayerState state; |
| 1907 LayerImpl* root_layer = layer_list_.empty() ? nullptr : layer_list_[0]; | 1906 LayerImpl* root_layer = layer_list_.empty() ? nullptr : layer_list_[0]; |
| 1908 FindClosestMatchingLayer(screen_space_point, root_layer, | 1907 FindClosestMatchingLayer(screen_space_point, root_layer, |
| 1909 FindScrollingLayerOrScrollbarLayerFunctor(), &state); | 1908 FindScrollingLayerOrScrollbarLayerFunctor(), &state); |
| 1910 return state.closest_match; | 1909 return state.closest_match; |
| 1911 } | 1910 } |
| 1912 | 1911 |
| 1913 struct HitTestVisibleScrollableOrTouchableFunctor { | 1912 struct HitTestVisibleScrollableOrTouchableFunctor { |
| 1914 bool operator()(LayerImpl* layer) const { | 1913 bool operator()(LayerImpl* layer) const { |
| 1915 return layer->is_drawn_render_surface_layer_list_member() || | 1914 return layer->is_drawn_render_surface_layer_list_member() || |
| 1916 ScrollsOrScrollbarAnyDrawnRenderSurfaceLayerListMember(layer) || | 1915 IsScrollableOrDrawnScrollbarLayer(layer) || |
| 1917 !layer->touch_event_handler_region().IsEmpty(); | 1916 !layer->touch_event_handler_region().IsEmpty(); |
| 1918 } | 1917 } |
| 1919 }; | 1918 }; |
| 1920 | 1919 |
| 1921 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( | 1920 LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint( |
| 1922 const gfx::PointF& screen_space_point) { | 1921 const gfx::PointF& screen_space_point) { |
| 1923 if (layer_list_.empty()) | 1922 if (layer_list_.empty()) |
| 1924 return NULL; | 1923 return NULL; |
| 1925 bool update_lcd_text = false; | 1924 bool update_lcd_text = false; |
| 1926 if (!UpdateDrawProperties(update_lcd_text)) | 1925 if (!UpdateDrawProperties(update_lcd_text)) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2073 | 2072 |
| 2074 void LayerTreeImpl::ResetAllChangeTracking() { | 2073 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2075 layers_that_should_push_properties_.clear(); | 2074 layers_that_should_push_properties_.clear(); |
| 2076 // Iterate over all layers, including masks. | 2075 // Iterate over all layers, including masks. |
| 2077 for (auto& layer : *layers_) | 2076 for (auto& layer : *layers_) |
| 2078 layer->ResetChangeTracking(); | 2077 layer->ResetChangeTracking(); |
| 2079 property_trees_.ResetAllChangeTracking(); | 2078 property_trees_.ResetAllChangeTracking(); |
| 2080 } | 2079 } |
| 2081 | 2080 |
| 2082 } // namespace cc | 2081 } // namespace cc |
| OLD | NEW |