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 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 16 matching lines...) Expand all Loading... | |
27 #include "cc/debug/benchmark_instrumentation.h" | 27 #include "cc/debug/benchmark_instrumentation.h" |
28 #include "cc/debug/debug_rect_history.h" | 28 #include "cc/debug/debug_rect_history.h" |
29 #include "cc/debug/devtools_instrumentation.h" | 29 #include "cc/debug/devtools_instrumentation.h" |
30 #include "cc/debug/frame_rate_counter.h" | 30 #include "cc/debug/frame_rate_counter.h" |
31 #include "cc/debug/frame_viewer_instrumentation.h" | 31 #include "cc/debug/frame_viewer_instrumentation.h" |
32 #include "cc/debug/paint_time_counter.h" | 32 #include "cc/debug/paint_time_counter.h" |
33 #include "cc/debug/rendering_stats_instrumentation.h" | 33 #include "cc/debug/rendering_stats_instrumentation.h" |
34 #include "cc/debug/traced_value.h" | 34 #include "cc/debug/traced_value.h" |
35 #include "cc/input/page_scale_animation.h" | 35 #include "cc/input/page_scale_animation.h" |
36 #include "cc/input/scroll_elasticity_helper.h" | 36 #include "cc/input/scroll_elasticity_helper.h" |
37 #include "cc/input/scroll_state.h" | |
37 #include "cc/input/top_controls_manager.h" | 38 #include "cc/input/top_controls_manager.h" |
38 #include "cc/layers/append_quads_data.h" | 39 #include "cc/layers/append_quads_data.h" |
39 #include "cc/layers/heads_up_display_layer_impl.h" | 40 #include "cc/layers/heads_up_display_layer_impl.h" |
40 #include "cc/layers/layer_impl.h" | 41 #include "cc/layers/layer_impl.h" |
41 #include "cc/layers/layer_iterator.h" | 42 #include "cc/layers/layer_iterator.h" |
42 #include "cc/layers/painted_scrollbar_layer_impl.h" | 43 #include "cc/layers/painted_scrollbar_layer_impl.h" |
43 #include "cc/layers/render_surface_impl.h" | 44 #include "cc/layers/render_surface_impl.h" |
44 #include "cc/layers/scrollbar_layer_impl_base.h" | 45 #include "cc/layers/scrollbar_layer_impl_base.h" |
45 #include "cc/layers/viewport.h" | 46 #include "cc/layers/viewport.h" |
46 #include "cc/output/compositor_frame_metadata.h" | 47 #include "cc/output/compositor_frame_metadata.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 has_gpu_rasterization_trigger_(false), | 205 has_gpu_rasterization_trigger_(false), |
205 use_gpu_rasterization_(false), | 206 use_gpu_rasterization_(false), |
206 use_msaa_(false), | 207 use_msaa_(false), |
207 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 208 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
208 tree_resources_for_gpu_rasterization_dirty_(false), | 209 tree_resources_for_gpu_rasterization_dirty_(false), |
209 input_handler_client_(NULL), | 210 input_handler_client_(NULL), |
210 did_lock_scrolling_layer_(false), | 211 did_lock_scrolling_layer_(false), |
211 should_bubble_scrolls_(false), | 212 should_bubble_scrolls_(false), |
212 wheel_scrolling_(false), | 213 wheel_scrolling_(false), |
213 scroll_affects_scroll_handler_(false), | 214 scroll_affects_scroll_handler_(false), |
215 in_inertial_scroll_(false), | |
214 scroll_layer_id_when_mouse_over_scrollbar_(0), | 216 scroll_layer_id_when_mouse_over_scrollbar_(0), |
215 tile_priorities_dirty_(false), | 217 tile_priorities_dirty_(false), |
216 root_layer_scroll_offset_delegate_(NULL), | 218 root_layer_scroll_offset_delegate_(NULL), |
217 settings_(settings), | 219 settings_(settings), |
218 visible_(true), | 220 visible_(true), |
219 cached_managed_memory_policy_( | 221 cached_managed_memory_policy_( |
220 GetDefaultMemoryAllocationLimit(), | 222 GetDefaultMemoryAllocationLimit(), |
221 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 223 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
222 ManagedMemoryPolicy::kDefaultNumResourcesLimit), | 224 ManagedMemoryPolicy::kDefaultNumResourcesLimit), |
223 pinch_gesture_active_(false), | 225 pinch_gesture_active_(false), |
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2431 static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) { | 2433 static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) { |
2432 DCHECK(scroll_ancestor); | 2434 DCHECK(scroll_ancestor); |
2433 for (LayerImpl* ancestor = child; ancestor; | 2435 for (LayerImpl* ancestor = child; ancestor; |
2434 ancestor = NextScrollLayer(ancestor)) { | 2436 ancestor = NextScrollLayer(ancestor)) { |
2435 if (ancestor->scrollable()) | 2437 if (ancestor->scrollable()) |
2436 return ancestor == scroll_ancestor; | 2438 return ancestor == scroll_ancestor; |
2437 } | 2439 } |
2438 return false; | 2440 return false; |
2439 } | 2441 } |
2440 | 2442 |
2443 static LayerImpl* nextLayerInScrollOrder(LayerImpl* layer) { | |
Ian Vollick
2015/07/09 14:03:55
This feels like it would be a function in the Scro
| |
2444 if (layer->scroll_parent()) | |
2445 return layer->scroll_parent(); | |
2446 | |
2447 return layer->parent(); | |
2448 } | |
2449 | |
2441 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( | 2450 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( |
2442 LayerImpl* scrolling_layer_impl, | 2451 LayerImpl* scrolling_layer_impl, |
2443 InputHandler::ScrollInputType type) { | 2452 InputHandler::ScrollInputType type) { |
2444 if (!scrolling_layer_impl) | 2453 if (!scrolling_layer_impl) |
2445 return SCROLL_IGNORED; | 2454 return SCROLL_IGNORED; |
2446 | 2455 |
2447 top_controls_manager_->ScrollBegin(); | 2456 top_controls_manager_->ScrollBegin(); |
2448 | 2457 |
2449 active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl); | 2458 active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl); |
2450 should_bubble_scrolls_ = (type != NON_BUBBLING_GESTURE); | 2459 should_bubble_scrolls_ = (type != NON_BUBBLING_GESTURE); |
2451 wheel_scrolling_ = (type == WHEEL); | 2460 wheel_scrolling_ = (type == WHEEL); |
2461 in_inertial_scroll_ = false; | |
2462 | |
2452 client_->RenewTreePriority(); | 2463 client_->RenewTreePriority(); |
2453 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); | 2464 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); |
2454 return SCROLL_STARTED; | 2465 return SCROLL_STARTED; |
2455 } | 2466 } |
2456 | 2467 |
2457 InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin( | 2468 InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin( |
2458 InputHandler::ScrollInputType type) { | 2469 InputHandler::ScrollInputType type) { |
2459 TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin"); | 2470 TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin"); |
2460 | 2471 |
2461 DCHECK(!CurrentlyScrollingLayer()); | 2472 DCHECK(!CurrentlyScrollingLayer()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2550 LayerImpl* layer_impl, | 2561 LayerImpl* layer_impl, |
2551 const gfx::PointF& viewport_point, | 2562 const gfx::PointF& viewport_point, |
2552 const gfx::Vector2dF& viewport_delta) { | 2563 const gfx::Vector2dF& viewport_delta) { |
2553 // Layers with non-invertible screen space transforms should not have passed | 2564 // Layers with non-invertible screen space transforms should not have passed |
2554 // the scroll hit test in the first place. | 2565 // the scroll hit test in the first place. |
2555 DCHECK(layer_impl->screen_space_transform().IsInvertible()); | 2566 DCHECK(layer_impl->screen_space_transform().IsInvertible()); |
2556 gfx::Transform inverse_screen_space_transform( | 2567 gfx::Transform inverse_screen_space_transform( |
2557 gfx::Transform::kSkipInitialization); | 2568 gfx::Transform::kSkipInitialization); |
2558 bool did_invert = layer_impl->screen_space_transform().GetInverse( | 2569 bool did_invert = layer_impl->screen_space_transform().GetInverse( |
2559 &inverse_screen_space_transform); | 2570 &inverse_screen_space_transform); |
2560 // TODO(shawnsingh): With the advent of impl-side crolling for non-root | 2571 // TODO(shawnsingh): With the advent of impl-side scrolling for non-root |
2561 // layers, we may need to explicitly handle uninvertible transforms here. | 2572 // layers, we may need to explicitly handle uninvertible transforms here. |
2562 DCHECK(did_invert); | 2573 DCHECK(did_invert); |
2563 | 2574 |
2564 float scale_from_viewport_to_screen_space = device_scale_factor_; | 2575 float scale_from_viewport_to_screen_space = device_scale_factor_; |
2565 gfx::PointF screen_space_point = | 2576 gfx::PointF screen_space_point = |
2566 gfx::ScalePoint(viewport_point, scale_from_viewport_to_screen_space); | 2577 gfx::ScalePoint(viewport_point, scale_from_viewport_to_screen_space); |
2567 | 2578 |
2568 gfx::Vector2dF screen_space_delta = viewport_delta; | 2579 gfx::Vector2dF screen_space_delta = viewport_delta; |
2569 screen_space_delta.Scale(scale_from_viewport_to_screen_space); | 2580 screen_space_delta.Scale(scale_from_viewport_to_screen_space); |
2570 | 2581 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2637 // finger. In contrast, events not representing direct manipulation of the | 2648 // finger. In contrast, events not representing direct manipulation of the |
2638 // screen (such as wheel events) represent a fixed amount of scrolling so we | 2649 // screen (such as wheel events) represent a fixed amount of scrolling so we |
2639 // can just apply them directly, but the page scale factor is applied to the | 2650 // can just apply them directly, but the page scale factor is applied to the |
2640 // scroll delta. | 2651 // scroll delta. |
2641 if (is_direct_manipulation) | 2652 if (is_direct_manipulation) |
2642 return ScrollLayerWithViewportSpaceDelta(layer_impl, viewport_point, delta); | 2653 return ScrollLayerWithViewportSpaceDelta(layer_impl, viewport_point, delta); |
2643 float scale_factor = active_tree()->current_page_scale_factor(); | 2654 float scale_factor = active_tree()->current_page_scale_factor(); |
2644 return ScrollLayerWithLocalDelta(layer_impl, delta, scale_factor); | 2655 return ScrollLayerWithLocalDelta(layer_impl, delta, scale_factor); |
2645 } | 2656 } |
2646 | 2657 |
2647 static LayerImpl* nextLayerInScrollOrder(LayerImpl* layer) { | 2658 void LayerTreeHostImpl::ApplyScroll(LayerImpl* layer, |
2648 if (layer->scroll_parent()) | 2659 ScrollState* scroll_state) { |
2649 return layer->scroll_parent(); | 2660 DCHECK(scroll_state); |
2661 gfx::Point viewport_point(scroll_state->start_position_x(), | |
2662 scroll_state->start_position_y()); | |
2663 const gfx::Vector2dF delta(scroll_state->delta_x(), scroll_state->delta_y()); | |
2664 gfx::Vector2dF applied_delta; | |
2650 | 2665 |
2651 return layer->parent(); | 2666 if (layer == InnerViewportScrollLayer()) { |
2667 bool affect_top_controls = true; | |
2668 applied_delta = viewport()->ScrollBy(delta, viewport_point, | |
2669 scroll_state->is_direct_manipulation(), | |
2670 affect_top_controls); | |
2671 } else { | |
2672 applied_delta = ScrollLayer(layer, delta, viewport_point, | |
2673 scroll_state->is_direct_manipulation()); | |
2674 } | |
2675 | |
2676 // If the layer wasn't able to move, try the next one in the hierarchy. | |
2677 const float kEpsilon = 0.1f; | |
Ian Vollick
2015/07/09 14:03:55
Why this number? Should it not be one device pixel
tdresser
2015/07/09 16:07:45
I'm trying to avoid introducing any functional cha
Ian Vollick
2015/07/09 16:46:51
Yes, please file a bug for this, add a TODO and ex
tdresser
2015/07/16 14:04:50
Done.
| |
2678 bool scrolled = std::abs(applied_delta.x()) > kEpsilon; | |
2679 scrolled = scrolled || std::abs(applied_delta.y()) > kEpsilon; | |
2680 | |
2681 if (scrolled && layer != InnerViewportScrollLayer()) { | |
2682 // If the applied delta is within 45 degrees of the input | |
2683 // delta, bail out to make it easier to scroll just one layer | |
2684 // in one direction without affecting any of its parents. | |
2685 float angle_threshold = 45; | |
2686 if (MathUtil::SmallestAngleBetweenVectors(applied_delta, delta) < | |
2687 angle_threshold) { | |
2688 applied_delta = delta; | |
2689 } else { | |
2690 // Allow further movement only on an axis perpendicular to the direction | |
2691 // in which the layer moved. | |
2692 applied_delta = MathUtil::ProjectVector(delta, applied_delta); | |
2693 } | |
2694 } | |
2695 | |
2696 scroll_state->ConsumeDelta(applied_delta.x(), applied_delta.y()); | |
2697 | |
2698 if (!scrolled) | |
2699 return; | |
2700 // When scrolls are allowed to bubble, it's important that the original | |
2701 // scrolling layer be preserved. This ensures that, after a scroll | |
2702 // bubbles, the user can reverse scroll directions and immediately resume | |
2703 // scrolling the original layer that scrolled. | |
2704 if (!scroll_state->should_propagate()) | |
2705 scroll_state->set_current_native_scrolling_layer(layer); | |
2652 } | 2706 } |
2653 | 2707 |
2654 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 2708 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
2655 const gfx::Point& viewport_point, | 2709 const gfx::Point& viewport_point, |
2656 const gfx::Vector2dF& scroll_delta) { | 2710 const gfx::Vector2dF& scroll_delta) { |
2657 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 2711 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
2658 if (!CurrentlyScrollingLayer()) | 2712 if (!CurrentlyScrollingLayer()) |
2659 return InputHandlerScrollResult(); | 2713 return InputHandlerScrollResult(); |
2660 | 2714 |
2661 gfx::Vector2dF pending_delta = scroll_delta; | |
2662 gfx::Vector2dF unused_root_delta; | |
2663 bool did_scroll_x = false; | |
2664 bool did_scroll_y = false; | |
2665 | |
2666 if (pinch_gesture_active_ && settings().invert_viewport_scroll_order) { | 2715 if (pinch_gesture_active_ && settings().invert_viewport_scroll_order) { |
2667 // Scrolls during a pinch gesture should pan the visual viewport, rather | 2716 // Scrolls during a pinch gesture should pan the visual viewport, rather |
2668 // than a typical bubbling scroll. | 2717 // than a typical bubbling scroll. |
2669 viewport()->Pan(pending_delta); | 2718 viewport()->Pan(scroll_delta); |
2670 return InputHandlerScrollResult(); | 2719 return InputHandlerScrollResult(); |
2671 } | 2720 } |
2672 | 2721 |
2673 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); | 2722 ScrollState scroll_state( |
2674 layer_impl; | 2723 scroll_delta.x(), scroll_delta.y(), viewport_point.x(), |
2724 viewport_point.y(), in_inertial_scroll_ /* in_inertial_phase*/, | |
2725 should_bubble_scrolls_ /* should_propagate */, | |
2726 did_lock_scrolling_layer_ /* delta_consumed_for_scroll_sequence */, | |
2727 !wheel_scrolling_ /* is_direct_manipulation */); | |
2728 scroll_state.set_current_native_scrolling_layer( | |
2729 active_tree_->CurrentlyScrollingLayer()); | |
2730 | |
2731 std::list<LayerImpl*> current_scroll_chain; | |
2732 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; | |
2675 layer_impl = nextLayerInScrollOrder(layer_impl)) { | 2733 layer_impl = nextLayerInScrollOrder(layer_impl)) { |
2676 // Skip the outer viewport scroll layer so that we try to scroll the | 2734 // Skip the outer viewport scroll layer so that we try to scroll the |
2677 // viewport only once. i.e. The inner viewport layer represents the | 2735 // viewport only once. i.e. The inner viewport layer represents the |
2678 // viewport. | 2736 // viewport. |
2679 if (!layer_impl->scrollable() || layer_impl == OuterViewportScrollLayer()) | 2737 if (!layer_impl->scrollable() || layer_impl == OuterViewportScrollLayer()) |
2680 continue; | 2738 continue; |
2739 current_scroll_chain.push_front(layer_impl); | |
2740 } | |
2741 scroll_state.set_scroll_chain(current_scroll_chain); | |
2681 | 2742 |
2682 gfx::Vector2dF applied_delta; | 2743 scroll_state.DistributeToScrollChainDescendant(); |
2683 if (layer_impl == InnerViewportScrollLayer()) { | |
2684 bool affect_top_controls = true; | |
2685 applied_delta = | |
2686 viewport()->ScrollBy(pending_delta, viewport_point, !wheel_scrolling_, | |
2687 affect_top_controls); | |
2688 unused_root_delta = pending_delta - applied_delta; | |
2689 } else { | |
2690 applied_delta = ScrollLayer(layer_impl, pending_delta, viewport_point, | |
2691 !wheel_scrolling_); | |
2692 } | |
2693 | 2744 |
2694 // If the layer wasn't able to move, try the next one in the hierarchy. | 2745 active_tree_->SetCurrentlyScrollingLayer( |
2695 const float kEpsilon = 0.1f; | 2746 scroll_state.current_native_scrolling_layer()); |
2696 bool did_layer_consume_delta_x = std::abs(applied_delta.x()) > kEpsilon; | 2747 did_lock_scrolling_layer_ = scroll_state.delta_consumed_for_scroll_sequence(); |
2697 bool did_layer_consume_delta_y = std::abs(applied_delta.y()) > kEpsilon; | |
2698 | 2748 |
2699 did_scroll_x |= did_layer_consume_delta_x; | 2749 const float kEpsilon = 0.1f; |
2700 did_scroll_y |= did_layer_consume_delta_y; | 2750 bool did_scroll_x = |
2701 | 2751 std::abs(scroll_state.delta_x() - scroll_delta.x()) > kEpsilon; |
2702 if (did_layer_consume_delta_x || did_layer_consume_delta_y) { | 2752 bool did_scroll_y = |
2703 did_lock_scrolling_layer_ = true; | 2753 std::abs(scroll_state.delta_y() - scroll_delta.y()) > kEpsilon; |
2704 | |
2705 // When scrolls are allowed to bubble, it's important that the original | |
2706 // scrolling layer be preserved. This ensures that, after a scroll | |
2707 // bubbles, the user can reverse scroll directions and immediately resume | |
2708 // scrolling the original layer that scrolled. | |
2709 if (!should_bubble_scrolls_) { | |
2710 active_tree_->SetCurrentlyScrollingLayer(layer_impl); | |
2711 break; | |
2712 } | |
2713 | |
2714 // If the applied delta is within 45 degrees of the input delta, bail out | |
2715 // to make it easier to scroll just one layer in one direction without | |
2716 // affecting any of its parents. | |
2717 float angle_threshold = 45; | |
2718 if (MathUtil::SmallestAngleBetweenVectors(applied_delta, pending_delta) < | |
2719 angle_threshold) | |
2720 break; | |
2721 | |
2722 // Allow further movement only on an axis perpendicular to the direction | |
2723 // in which the layer moved. | |
2724 gfx::Vector2dF perpendicular_axis(-applied_delta.y(), applied_delta.x()); | |
2725 pending_delta = | |
2726 MathUtil::ProjectVector(pending_delta, perpendicular_axis); | |
2727 | |
2728 if (gfx::ToRoundedVector2d(pending_delta).IsZero()) | |
2729 break; | |
2730 } | |
2731 | |
2732 if (!should_bubble_scrolls_ && did_lock_scrolling_layer_) | |
2733 break; | |
2734 } | |
2735 | |
2736 bool did_scroll_content = did_scroll_x || did_scroll_y; | 2754 bool did_scroll_content = did_scroll_x || did_scroll_y; |
2737 if (did_scroll_content) { | 2755 if (did_scroll_content) { |
2738 // If we are scrolling with an active scroll handler, forward latency | 2756 // If we are scrolling with an active scroll handler, forward latency |
2739 // tracking information to the main thread so the delay introduced by the | 2757 // tracking information to the main thread so the delay introduced by the |
2740 // handler is accounted for. | 2758 // handler is accounted for. |
2741 if (scroll_affects_scroll_handler()) | 2759 if (scroll_affects_scroll_handler()) |
2742 NotifySwapPromiseMonitorsOfForwardingToMainThread(); | 2760 NotifySwapPromiseMonitorsOfForwardingToMainThread(); |
2743 client_->SetNeedsCommitOnImplThread(); | 2761 client_->SetNeedsCommitOnImplThread(); |
2744 SetNeedsRedraw(); | 2762 SetNeedsRedraw(); |
2745 client_->RenewTreePriority(); | 2763 client_->RenewTreePriority(); |
2746 } | 2764 } |
2747 | 2765 |
2748 // Scrolling along an axis resets accumulated root overscroll for that axis. | 2766 // Scrolling along an axis resets accumulated root overscroll for that axis. |
2749 if (did_scroll_x) | 2767 if (did_scroll_x) |
2750 accumulated_root_overscroll_.set_x(0); | 2768 accumulated_root_overscroll_.set_x(0); |
2751 if (did_scroll_y) | 2769 if (did_scroll_y) |
2752 accumulated_root_overscroll_.set_y(0); | 2770 accumulated_root_overscroll_.set_y(0); |
2771 gfx::Vector2dF unused_root_delta(scroll_state.delta_x(), | |
2772 scroll_state.delta_y()); | |
2753 accumulated_root_overscroll_ += unused_root_delta; | 2773 accumulated_root_overscroll_ += unused_root_delta; |
2754 | 2774 |
2755 InputHandlerScrollResult scroll_result; | 2775 InputHandlerScrollResult scroll_result; |
2756 scroll_result.did_scroll = did_scroll_content; | 2776 scroll_result.did_scroll = did_scroll_content; |
2757 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); | 2777 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); |
2758 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; | 2778 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; |
2759 scroll_result.unused_scroll_delta = unused_root_delta; | 2779 scroll_result.unused_scroll_delta = unused_root_delta; |
2760 return scroll_result; | 2780 return scroll_result; |
2761 } | 2781 } |
2762 | 2782 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2836 bool currently_scrolling_viewport = | 2856 bool currently_scrolling_viewport = |
2837 CurrentlyScrollingLayer() == OuterViewportScrollLayer() || | 2857 CurrentlyScrollingLayer() == OuterViewportScrollLayer() || |
2838 CurrentlyScrollingLayer() == InnerViewportScrollLayer(); | 2858 CurrentlyScrollingLayer() == InnerViewportScrollLayer(); |
2839 if (!wheel_scrolling_ && !currently_scrolling_viewport) { | 2859 if (!wheel_scrolling_ && !currently_scrolling_viewport) { |
2840 // Allow the fling to lock to the first layer that moves after the initial | 2860 // Allow the fling to lock to the first layer that moves after the initial |
2841 // fling |ScrollBy()| event, unless we're already scrolling the viewport. | 2861 // fling |ScrollBy()| event, unless we're already scrolling the viewport. |
2842 did_lock_scrolling_layer_ = false; | 2862 did_lock_scrolling_layer_ = false; |
2843 should_bubble_scrolls_ = false; | 2863 should_bubble_scrolls_ = false; |
2844 } | 2864 } |
2845 | 2865 |
2866 in_inertial_scroll_ = true; | |
2867 | |
2846 return SCROLL_STARTED; | 2868 return SCROLL_STARTED; |
2847 } | 2869 } |
2848 | 2870 |
2849 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( | 2871 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( |
2850 const gfx::PointF& device_viewport_point, | 2872 const gfx::PointF& device_viewport_point, |
2851 LayerImpl* layer_impl) { | 2873 LayerImpl* layer_impl) { |
2852 if (!layer_impl) | 2874 if (!layer_impl) |
2853 return std::numeric_limits<float>::max(); | 2875 return std::numeric_limits<float>::max(); |
2854 | 2876 |
2855 gfx::Rect layer_impl_bounds(layer_impl->bounds()); | 2877 gfx::Rect layer_impl_bounds(layer_impl->bounds()); |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3604 if (active_tree()) { | 3626 if (active_tree()) { |
3605 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); | 3627 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); |
3606 if (layer) | 3628 if (layer) |
3607 return layer->ScrollOffsetForAnimation(); | 3629 return layer->ScrollOffsetForAnimation(); |
3608 } | 3630 } |
3609 | 3631 |
3610 return gfx::ScrollOffset(); | 3632 return gfx::ScrollOffset(); |
3611 } | 3633 } |
3612 | 3634 |
3613 } // namespace cc | 3635 } // namespace cc |
OLD | NEW |