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_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 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 void LayerTreeHostImpl::UpdateMaxScrollOffset() { | 1957 void LayerTreeHostImpl::UpdateMaxScrollOffset() { |
1958 active_tree_->UpdateMaxScrollOffset(); | 1958 active_tree_->UpdateMaxScrollOffset(); |
1959 } | 1959 } |
1960 | 1960 |
1961 void LayerTreeHostImpl::DidChangeTopControlsPosition() { | 1961 void LayerTreeHostImpl::DidChangeTopControlsPosition() { |
1962 SetNeedsRedraw(); | 1962 SetNeedsRedraw(); |
1963 active_tree_->set_needs_update_draw_properties(); | 1963 active_tree_->set_needs_update_draw_properties(); |
1964 SetFullRootLayerDamage(); | 1964 SetFullRootLayerDamage(); |
1965 } | 1965 } |
1966 | 1966 |
| 1967 void LayerTreeHostImpl::DidFinishTopControlsGesture() { |
| 1968 if (input_handler_client_) |
| 1969 input_handler_client_->DidFinishTopControlsGesture(); |
| 1970 } |
| 1971 |
1967 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { | 1972 bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() { |
1968 active_tree_->UpdateDrawProperties(); | 1973 active_tree_->UpdateDrawProperties(); |
1969 return !active_tree_->RenderSurfaceLayerList().empty(); | 1974 return !active_tree_->RenderSurfaceLayerList().empty(); |
1970 } | 1975 } |
1971 | 1976 |
1972 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { | 1977 void LayerTreeHostImpl::BindToClient(InputHandlerClient* client) { |
1973 DCHECK(input_handler_client_ == NULL); | 1978 DCHECK(input_handler_client_ == NULL); |
1974 input_handler_client_ = client; | 1979 input_handler_client_ = client; |
1975 } | 1980 } |
1976 | 1981 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 potentially_scrolling_layer_impl = scroll_layer_impl; | 2016 potentially_scrolling_layer_impl = scroll_layer_impl; |
2012 } | 2017 } |
2013 | 2018 |
2014 return potentially_scrolling_layer_impl; | 2019 return potentially_scrolling_layer_impl; |
2015 } | 2020 } |
2016 | 2021 |
2017 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 2022 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
2018 gfx::Point viewport_point, InputHandler::ScrollInputType type) { | 2023 gfx::Point viewport_point, InputHandler::ScrollInputType type) { |
2019 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 2024 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
2020 | 2025 |
2021 if (top_controls_manager_) | |
2022 top_controls_manager_->ScrollBegin(); | |
2023 | |
2024 DCHECK(!CurrentlyScrollingLayer()); | 2026 DCHECK(!CurrentlyScrollingLayer()); |
2025 ClearCurrentlyScrollingLayer(); | 2027 ClearCurrentlyScrollingLayer(); |
2026 | 2028 |
2027 if (!EnsureRenderSurfaceLayerList()) | 2029 if (!EnsureRenderSurfaceLayerList()) |
2028 return ScrollIgnored; | 2030 return ScrollIgnored; |
2029 | 2031 |
2030 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, | 2032 gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point, |
2031 device_scale_factor_); | 2033 device_scale_factor_); |
2032 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( | 2034 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( |
2033 device_viewport_point, | 2035 device_viewport_point, |
2034 active_tree_->RenderSurfaceLayerList()); | 2036 active_tree_->RenderSurfaceLayerList()); |
2035 bool scroll_on_main_thread = false; | 2037 bool scroll_on_main_thread = false; |
2036 LayerImpl* potentially_scrolling_layer_impl = | 2038 LayerImpl* potentially_scrolling_layer_impl = |
2037 FindScrollLayerForDeviceViewportPoint(device_viewport_point, type, | 2039 FindScrollLayerForDeviceViewportPoint(device_viewport_point, type, |
2038 layer_impl, &scroll_on_main_thread); | 2040 layer_impl, &scroll_on_main_thread); |
2039 | 2041 |
2040 if (scroll_on_main_thread) { | 2042 if (scroll_on_main_thread) { |
2041 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); | 2043 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); |
2042 return ScrollOnMainThread; | 2044 return ScrollOnMainThread; |
2043 } | 2045 } |
2044 | 2046 |
2045 if (!potentially_scrolling_layer_impl) | 2047 if (!potentially_scrolling_layer_impl) |
2046 potentially_scrolling_layer_impl = RootScrollLayer(); | 2048 potentially_scrolling_layer_impl = RootScrollLayer(); |
2047 | 2049 |
2048 if (potentially_scrolling_layer_impl) { | 2050 if (potentially_scrolling_layer_impl) { |
| 2051 if (top_controls_manager_) |
| 2052 top_controls_manager_->ScrollBegin(); |
| 2053 |
2049 active_tree_->SetCurrentlyScrollingLayer( | 2054 active_tree_->SetCurrentlyScrollingLayer( |
2050 potentially_scrolling_layer_impl); | 2055 potentially_scrolling_layer_impl); |
2051 should_bubble_scrolls_ = (type != NonBubblingGesture); | 2056 should_bubble_scrolls_ = (type != NonBubblingGesture); |
2052 wheel_scrolling_ = (type == Wheel); | 2057 wheel_scrolling_ = (type == Wheel); |
2053 client_->RenewTreePriority(); | 2058 client_->RenewTreePriority(); |
2054 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); | 2059 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); |
2055 return ScrollStarted; | 2060 return ScrollStarted; |
2056 } | 2061 } |
2057 return ScrollIgnored; | 2062 return ScrollIgnored; |
2058 } | 2063 } |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2907 swap_promise_monitor_.erase(monitor); | 2912 swap_promise_monitor_.erase(monitor); |
2908 } | 2913 } |
2909 | 2914 |
2910 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 2915 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
2911 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 2916 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
2912 for (; it != swap_promise_monitor_.end(); it++) | 2917 for (; it != swap_promise_monitor_.end(); it++) |
2913 (*it)->OnSetNeedsRedrawOnImpl(); | 2918 (*it)->OnSetNeedsRedrawOnImpl(); |
2914 } | 2919 } |
2915 | 2920 |
2916 } // namespace cc | 2921 } // namespace cc |
OLD | NEW |