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_host_impl.h" | 5 #include "cc/trees/layer_tree_host_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 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2680 } | 2680 } |
| 2681 | 2681 |
| 2682 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 2682 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
| 2683 ScrollState* scroll_state, | 2683 ScrollState* scroll_state, |
| 2684 InputHandler::ScrollInputType type) { | 2684 InputHandler::ScrollInputType type) { |
| 2685 ScrollStatus scroll_status; | 2685 ScrollStatus scroll_status; |
| 2686 scroll_status.main_thread_scrolling_reasons = | 2686 scroll_status.main_thread_scrolling_reasons = |
| 2687 MainThreadScrollingReason::kNotScrollingOnMain; | 2687 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2688 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 2688 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
| 2689 | 2689 |
| 2690 // On Mac a scroll begin with |inertial_phase| = true happens to handle a | |
| 2691 // fling. | |
| 2692 if (scroll_state->is_in_inertial_phase()) | |
| 2693 return FlingScrollBegin(); | |
| 2694 | |
| 2690 ClearCurrentlyScrollingLayer(); | 2695 ClearCurrentlyScrollingLayer(); |
| 2691 | 2696 |
| 2692 gfx::Point viewport_point(scroll_state->position_x(), | 2697 gfx::Point viewport_point(scroll_state->position_x(), |
| 2693 scroll_state->position_y()); | 2698 scroll_state->position_y()); |
| 2694 | 2699 |
| 2695 gfx::PointF device_viewport_point = gfx::ScalePoint( | 2700 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 2696 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 2701 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 2697 LayerImpl* layer_impl = | 2702 LayerImpl* layer_impl = |
| 2698 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 2703 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 2699 | 2704 |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3227 scroll_affects_scroll_handler_ = false; | 3232 scroll_affects_scroll_handler_ = false; |
| 3228 accumulated_root_overscroll_ = gfx::Vector2dF(); | 3233 accumulated_root_overscroll_ = gfx::Vector2dF(); |
| 3229 } | 3234 } |
| 3230 | 3235 |
| 3231 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { | 3236 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { |
| 3232 DCHECK(scroll_state); | 3237 DCHECK(scroll_state); |
| 3233 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); | 3238 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); |
| 3234 | 3239 |
| 3235 DistributeScrollDelta(scroll_state); | 3240 DistributeScrollDelta(scroll_state); |
| 3236 top_controls_manager_->ScrollEnd(); | 3241 top_controls_manager_->ScrollEnd(); |
| 3237 ClearCurrentlyScrollingLayer(); | 3242 |
| 3243 if (scroll_state->is_in_inertial_phase()) { | |
|
dtapuska
2016/08/18 00:30:45
I'm a bit concerned this isn't correct for devices
sahel
2016/08/18 15:41:56
It's ok if we don't do the latching for whatever r
| |
| 3244 // Only clear the currently scrolling layer if we know the scroll is done. | |
| 3245 // A non-inertial scroll end could be followed by an inertial scroll. | |
| 3246 ClearCurrentlyScrollingLayer(); | |
| 3247 } | |
| 3238 } | 3248 } |
| 3239 | 3249 |
| 3240 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { | 3250 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { |
| 3241 InputHandler::ScrollStatus scroll_status; | 3251 InputHandler::ScrollStatus scroll_status; |
| 3242 scroll_status.main_thread_scrolling_reasons = | 3252 scroll_status.main_thread_scrolling_reasons = |
| 3243 MainThreadScrollingReason::kNotScrollingOnMain; | 3253 MainThreadScrollingReason::kNotScrollingOnMain; |
| 3244 if (!CurrentlyScrollingLayer()) { | 3254 if (!CurrentlyScrollingLayer()) { |
| 3245 scroll_status.thread = SCROLL_IGNORED; | 3255 scroll_status.thread = SCROLL_IGNORED; |
| 3246 scroll_status.main_thread_scrolling_reasons = | 3256 scroll_status.main_thread_scrolling_reasons = |
| 3247 MainThreadScrollingReason::kNoScrollingLayer; | 3257 MainThreadScrollingReason::kNoScrollingLayer; |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4066 return task_runner_provider_->HasImplThread(); | 4076 return task_runner_provider_->HasImplThread(); |
| 4067 } | 4077 } |
| 4068 | 4078 |
| 4069 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4079 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4070 // In single threaded mode we skip the pending tree and commit directly to the | 4080 // In single threaded mode we skip the pending tree and commit directly to the |
| 4071 // active tree. | 4081 // active tree. |
| 4072 return !task_runner_provider_->HasImplThread(); | 4082 return !task_runner_provider_->HasImplThread(); |
| 4073 } | 4083 } |
| 4074 | 4084 |
| 4075 } // namespace cc | 4085 } // namespace cc |
| OLD | NEW |