| 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 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 bool update_lcd_text = false; | 1924 bool update_lcd_text = false; |
| 1925 if (!UpdateDrawProperties(update_lcd_text)) | 1925 if (!UpdateDrawProperties(update_lcd_text)) |
| 1926 return NULL; | 1926 return NULL; |
| 1927 FindTouchEventLayerFunctor func = {screen_space_point}; | 1927 FindTouchEventLayerFunctor func = {screen_space_point}; |
| 1928 FindClosestMatchingLayerState state; | 1928 FindClosestMatchingLayerState state; |
| 1929 FindClosestMatchingLayer(screen_space_point, layer_list_[0], func, &state); | 1929 FindClosestMatchingLayer(screen_space_point, layer_list_[0], func, &state); |
| 1930 return state.closest_match; | 1930 return state.closest_match; |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 void LayerTreeImpl::RegisterSelection(const LayerSelection& selection) { | 1933 void LayerTreeImpl::RegisterSelection(const LayerSelection& selection) { |
| 1934 handle_visibility_changed_ = |
| 1935 selection_.is_handle_visible != selection.is_handle_visible; |
| 1934 selection_ = selection; | 1936 selection_ = selection; |
| 1935 } | 1937 } |
| 1936 | 1938 |
| 1939 bool LayerTreeImpl::HandleVisibilityChanged() { |
| 1940 return handle_visibility_changed_; |
| 1941 } |
| 1942 |
| 1937 static gfx::SelectionBound ComputeViewportSelectionBound( | 1943 static gfx::SelectionBound ComputeViewportSelectionBound( |
| 1938 const LayerSelectionBound& layer_bound, | 1944 const LayerSelectionBound& layer_bound, |
| 1939 LayerImpl* layer, | 1945 LayerImpl* layer, |
| 1940 float device_scale_factor) { | 1946 float device_scale_factor) { |
| 1941 gfx::SelectionBound viewport_bound; | 1947 gfx::SelectionBound viewport_bound; |
| 1942 viewport_bound.set_type(layer_bound.type); | 1948 viewport_bound.set_type(layer_bound.type); |
| 1943 | 1949 |
| 1944 if (!layer || layer_bound.type == gfx::SelectionBound::EMPTY) | 1950 if (!layer || layer_bound.type == gfx::SelectionBound::EMPTY) |
| 1945 return viewport_bound; | 1951 return viewport_bound; |
| 1946 | 1952 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 void LayerTreeImpl::GetViewportSelection( | 1995 void LayerTreeImpl::GetViewportSelection( |
| 1990 Selection<gfx::SelectionBound>* selection) { | 1996 Selection<gfx::SelectionBound>* selection) { |
| 1991 DCHECK(selection); | 1997 DCHECK(selection); |
| 1992 | 1998 |
| 1993 selection->start = ComputeViewportSelectionBound( | 1999 selection->start = ComputeViewportSelectionBound( |
| 1994 selection_.start, | 2000 selection_.start, |
| 1995 selection_.start.layer_id ? LayerById(selection_.start.layer_id) : NULL, | 2001 selection_.start.layer_id ? LayerById(selection_.start.layer_id) : NULL, |
| 1996 device_scale_factor()); | 2002 device_scale_factor()); |
| 1997 selection->is_editable = selection_.is_editable; | 2003 selection->is_editable = selection_.is_editable; |
| 1998 selection->is_empty_text_form_control = selection_.is_empty_text_form_control; | 2004 selection->is_empty_text_form_control = selection_.is_empty_text_form_control; |
| 2005 selection->is_handle_visible = selection_.is_handle_visible; |
| 1999 if (selection->start.type() == gfx::SelectionBound::CENTER || | 2006 if (selection->start.type() == gfx::SelectionBound::CENTER || |
| 2000 selection->start.type() == gfx::SelectionBound::EMPTY) { | 2007 selection->start.type() == gfx::SelectionBound::EMPTY) { |
| 2001 selection->end = selection->start; | 2008 selection->end = selection->start; |
| 2002 } else { | 2009 } else { |
| 2003 selection->end = ComputeViewportSelectionBound( | 2010 selection->end = ComputeViewportSelectionBound( |
| 2004 selection_.end, | 2011 selection_.end, |
| 2005 selection_.end.layer_id ? LayerById(selection_.end.layer_id) : NULL, | 2012 selection_.end.layer_id ? LayerById(selection_.end.layer_id) : NULL, |
| 2006 device_scale_factor()); | 2013 device_scale_factor()); |
| 2007 } | 2014 } |
| 2008 } | 2015 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2033 | 2040 |
| 2034 void LayerTreeImpl::ResetAllChangeTracking() { | 2041 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2035 layers_that_should_push_properties_.clear(); | 2042 layers_that_should_push_properties_.clear(); |
| 2036 // Iterate over all layers, including masks and replicas. | 2043 // Iterate over all layers, including masks and replicas. |
| 2037 for (auto& layer : *layers_) | 2044 for (auto& layer : *layers_) |
| 2038 layer->ResetChangeTracking(); | 2045 layer->ResetChangeTracking(); |
| 2039 property_trees_.ResetAllChangeTracking(); | 2046 property_trees_.ResetAllChangeTracking(); |
| 2040 } | 2047 } |
| 2041 | 2048 |
| 2042 } // namespace cc | 2049 } // namespace cc |
| OLD | NEW |