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 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2677 | 2677 |
2678 return ScrollBeginImpl(scroll_state, InnerViewportScrollLayer(), type); | 2678 return ScrollBeginImpl(scroll_state, InnerViewportScrollLayer(), type); |
2679 } | 2679 } |
2680 | 2680 |
2681 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 2681 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
2682 ScrollState* scroll_state, | 2682 ScrollState* scroll_state, |
2683 InputHandler::ScrollInputType type) { | 2683 InputHandler::ScrollInputType type) { |
2684 ScrollStatus scroll_status; | 2684 ScrollStatus scroll_status; |
2685 scroll_status.main_thread_scrolling_reasons = | 2685 scroll_status.main_thread_scrolling_reasons = |
2686 MainThreadScrollingReason::kNotScrollingOnMain; | 2686 MainThreadScrollingReason::kNotScrollingOnMain; |
2687 | |
2687 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 2688 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
2688 | 2689 |
2690 // In Mac a scroll begin with inertial_phase = true happens to handle a fling. | |
tdresser
2016/07/22 15:43:15
In Mac -> On Mac
| |
2691 if (scroll_state->is_in_inertial_phase()) | |
2692 return FlingScrollBegin(); | |
2693 | |
2689 ClearCurrentlyScrollingLayer(); | 2694 ClearCurrentlyScrollingLayer(); |
2690 | 2695 |
2691 gfx::Point viewport_point(scroll_state->position_x(), | 2696 gfx::Point viewport_point(scroll_state->position_x(), |
2692 scroll_state->position_y()); | 2697 scroll_state->position_y()); |
2693 | 2698 |
2694 gfx::PointF device_viewport_point = gfx::ScalePoint( | 2699 gfx::PointF device_viewport_point = gfx::ScalePoint( |
2695 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 2700 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
2696 LayerImpl* layer_impl = | 2701 LayerImpl* layer_impl = |
2697 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 2702 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
2698 | 2703 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3231 scroll_affects_scroll_handler_ = false; | 3236 scroll_affects_scroll_handler_ = false; |
3232 accumulated_root_overscroll_ = gfx::Vector2dF(); | 3237 accumulated_root_overscroll_ = gfx::Vector2dF(); |
3233 } | 3238 } |
3234 | 3239 |
3235 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { | 3240 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { |
3236 DCHECK(scroll_state); | 3241 DCHECK(scroll_state); |
3237 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); | 3242 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); |
3238 | 3243 |
3239 DistributeScrollDelta(scroll_state); | 3244 DistributeScrollDelta(scroll_state); |
3240 top_controls_manager_->ScrollEnd(); | 3245 top_controls_manager_->ScrollEnd(); |
3241 ClearCurrentlyScrollingLayer(); | 3246 |
3247 if (scroll_state->is_in_inertial_phase()) { | |
3248 // There might be a fling after the scroll end. In those cases, | |
3249 // don't clear the currently scrolling layer to avoid a new hit test for the | |
3250 // fling. | |
tdresser
2016/07/22 15:43:15
This comment is a bit confusing, since it's talkin
| |
3251 ClearCurrentlyScrollingLayer(); | |
3252 } | |
3242 } | 3253 } |
3243 | 3254 |
3244 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { | 3255 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { |
3245 InputHandler::ScrollStatus scroll_status; | 3256 InputHandler::ScrollStatus scroll_status; |
3246 scroll_status.main_thread_scrolling_reasons = | 3257 scroll_status.main_thread_scrolling_reasons = |
3247 MainThreadScrollingReason::kNotScrollingOnMain; | 3258 MainThreadScrollingReason::kNotScrollingOnMain; |
3248 if (!CurrentlyScrollingLayer()) { | 3259 if (!CurrentlyScrollingLayer()) { |
3249 scroll_status.thread = SCROLL_IGNORED; | 3260 scroll_status.thread = SCROLL_IGNORED; |
3250 scroll_status.main_thread_scrolling_reasons = | 3261 scroll_status.main_thread_scrolling_reasons = |
3251 MainThreadScrollingReason::kNoScrollingLayer; | 3262 MainThreadScrollingReason::kNoScrollingLayer; |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4039 return task_runner_provider_->HasImplThread(); | 4050 return task_runner_provider_->HasImplThread(); |
4040 } | 4051 } |
4041 | 4052 |
4042 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4053 bool LayerTreeHostImpl::CommitToActiveTree() const { |
4043 // In single threaded mode we skip the pending tree and commit directly to the | 4054 // In single threaded mode we skip the pending tree and commit directly to the |
4044 // active tree. | 4055 // active tree. |
4045 return !task_runner_provider_->HasImplThread(); | 4056 return !task_runner_provider_->HasImplThread(); |
4046 } | 4057 } |
4047 | 4058 |
4048 } // namespace cc | 4059 } // namespace cc |
OLD | NEW |