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 2755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 scroll_status = ScrollBegin(&scroll_state, ANIMATED_WHEEL); | 2766 scroll_status = ScrollBegin(&scroll_state, ANIMATED_WHEEL); |
2767 scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2767 scroll_node = scroll_tree.CurrentlyScrollingNode(); |
2768 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { | 2768 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { |
2769 gfx::Vector2dF pending_delta = scroll_delta; | 2769 gfx::Vector2dF pending_delta = scroll_delta; |
2770 if (scroll_node) { | 2770 if (scroll_node) { |
2771 for (; scroll_tree.parent(scroll_node); | 2771 for (; scroll_tree.parent(scroll_node); |
2772 scroll_node = scroll_tree.parent(scroll_node)) { | 2772 scroll_node = scroll_tree.parent(scroll_node)) { |
2773 if (!scroll_node->data.scrollable) | 2773 if (!scroll_node->data.scrollable) |
2774 continue; | 2774 continue; |
2775 | 2775 |
2776 LayerImpl* layer_impl = active_tree_->LayerById(scroll_node->owner_id); | 2776 gfx::ScrollOffset current_offset = |
2777 gfx::ScrollOffset current_offset = layer_impl->CurrentScrollOffset(); | 2777 scroll_tree.current_scroll_offset(scroll_node->owner_id); |
2778 gfx::ScrollOffset target_offset = | 2778 gfx::ScrollOffset target_offset = |
2779 ScrollOffsetWithDelta(current_offset, pending_delta); | 2779 ScrollOffsetWithDelta(current_offset, pending_delta); |
2780 target_offset.SetToMax(gfx::ScrollOffset()); | 2780 target_offset.SetToMax(gfx::ScrollOffset()); |
2781 target_offset.SetToMin(scroll_tree.MaxScrollOffset(scroll_node->id)); | 2781 target_offset.SetToMin(scroll_tree.MaxScrollOffset(scroll_node->id)); |
2782 gfx::Vector2dF actual_delta = target_offset.DeltaFrom(current_offset); | 2782 gfx::Vector2dF actual_delta = target_offset.DeltaFrom(current_offset); |
2783 | 2783 |
2784 if (!scroll_node->data.user_scrollable_horizontal) { | 2784 if (!scroll_node->data.user_scrollable_horizontal) { |
2785 actual_delta.set_x(0); | 2785 actual_delta.set_x(0); |
2786 target_offset.set_x(current_offset.x()); | 2786 target_offset.set_x(current_offset.x()); |
2787 } | 2787 } |
2788 if (!scroll_node->data.user_scrollable_vertical) { | 2788 if (!scroll_node->data.user_scrollable_vertical) { |
2789 actual_delta.set_y(0); | 2789 actual_delta.set_y(0); |
2790 target_offset.set_y(current_offset.y()); | 2790 target_offset.set_y(current_offset.y()); |
2791 } | 2791 } |
2792 | 2792 |
2793 const float kEpsilon = 0.1f; | 2793 const float kEpsilon = 0.1f; |
2794 bool can_layer_scroll = (std::abs(actual_delta.x()) > kEpsilon || | 2794 bool can_layer_scroll = (std::abs(actual_delta.x()) > kEpsilon || |
2795 std::abs(actual_delta.y()) > kEpsilon); | 2795 std::abs(actual_delta.y()) > kEpsilon); |
2796 | 2796 |
2797 if (!can_layer_scroll) { | 2797 if (!can_layer_scroll) { |
2798 layer_impl->ScrollBy(actual_delta); | 2798 scroll_tree.ScrollBy(scroll_node, actual_delta, active_tree()); |
2799 pending_delta -= actual_delta; | 2799 pending_delta -= actual_delta; |
2800 continue; | 2800 continue; |
2801 } | 2801 } |
2802 | 2802 |
2803 scroll_tree.set_currently_scrolling_node(scroll_node->id); | 2803 scroll_tree.set_currently_scrolling_node(scroll_node->id); |
2804 | 2804 |
2805 ScrollAnimationCreate(scroll_node, target_offset, current_offset); | 2805 ScrollAnimationCreate(scroll_node, target_offset, current_offset); |
2806 | 2806 |
2807 SetNeedsOneBeginImplFrame(); | 2807 SetNeedsOneBeginImplFrame(); |
2808 return scroll_status; | 2808 return scroll_status; |
2809 } | 2809 } |
2810 } | 2810 } |
2811 } | 2811 } |
2812 scroll_state.set_is_ending(true); | 2812 scroll_state.set_is_ending(true); |
2813 ScrollEnd(&scroll_state); | 2813 ScrollEnd(&scroll_state); |
2814 return scroll_status; | 2814 return scroll_status; |
2815 } | 2815 } |
2816 | 2816 |
2817 gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta( | 2817 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta( |
2818 LayerImpl* layer_impl, | 2818 ScrollNode* scroll_node, |
2819 const gfx::PointF& viewport_point, | 2819 const gfx::PointF& viewport_point, |
2820 const gfx::Vector2dF& viewport_delta) { | 2820 const gfx::Vector2dF& viewport_delta, |
| 2821 ScrollTree* scroll_tree) { |
2821 // Layers with non-invertible screen space transforms should not have passed | 2822 // Layers with non-invertible screen space transforms should not have passed |
2822 // the scroll hit test in the first place. | 2823 // the scroll hit test in the first place. |
2823 const gfx::Transform screen_space_transform = | 2824 const gfx::Transform screen_space_transform = |
2824 layer_impl->ScreenSpaceTransform(); | 2825 scroll_tree->ScreenSpaceTransform(scroll_node->id); |
2825 DCHECK(screen_space_transform.IsInvertible()); | 2826 DCHECK(screen_space_transform.IsInvertible()); |
2826 gfx::Transform inverse_screen_space_transform( | 2827 gfx::Transform inverse_screen_space_transform( |
2827 gfx::Transform::kSkipInitialization); | 2828 gfx::Transform::kSkipInitialization); |
2828 bool did_invert = | 2829 bool did_invert = |
2829 screen_space_transform.GetInverse(&inverse_screen_space_transform); | 2830 screen_space_transform.GetInverse(&inverse_screen_space_transform); |
2830 // TODO(shawnsingh): With the advent of impl-side scrolling for non-root | 2831 // TODO(shawnsingh): With the advent of impl-side scrolling for non-root |
2831 // layers, we may need to explicitly handle uninvertible transforms here. | 2832 // layers, we may need to explicitly handle uninvertible transforms here. |
2832 DCHECK(did_invert); | 2833 DCHECK(did_invert); |
2833 | 2834 |
2834 float scale_from_viewport_to_screen_space = | 2835 float scale_from_viewport_to_screen_space = |
(...skipping 17 matching lines...) Expand all Loading... |
2852 screen_space_end_point, | 2853 screen_space_end_point, |
2853 &end_clipped); | 2854 &end_clipped); |
2854 | 2855 |
2855 // In general scroll point coordinates should not get clipped. | 2856 // In general scroll point coordinates should not get clipped. |
2856 DCHECK(!start_clipped); | 2857 DCHECK(!start_clipped); |
2857 DCHECK(!end_clipped); | 2858 DCHECK(!end_clipped); |
2858 if (start_clipped || end_clipped) | 2859 if (start_clipped || end_clipped) |
2859 return gfx::Vector2dF(); | 2860 return gfx::Vector2dF(); |
2860 | 2861 |
2861 // Apply the scroll delta. | 2862 // Apply the scroll delta. |
2862 gfx::ScrollOffset previous_offset = layer_impl->CurrentScrollOffset(); | 2863 gfx::ScrollOffset previous_offset = |
2863 layer_impl->ScrollBy(local_end_point - local_start_point); | 2864 scroll_tree->current_scroll_offset(scroll_node->owner_id); |
| 2865 scroll_tree->ScrollBy(scroll_node, local_end_point - local_start_point, |
| 2866 active_tree()); |
2864 gfx::ScrollOffset scrolled = | 2867 gfx::ScrollOffset scrolled = |
2865 layer_impl->CurrentScrollOffset() - previous_offset; | 2868 scroll_tree->current_scroll_offset(scroll_node->owner_id) - |
| 2869 previous_offset; |
2866 | 2870 |
2867 // Get the end point in the layer's content space so we can apply its | 2871 // Get the end point in the layer's content space so we can apply its |
2868 // ScreenSpaceTransform. | 2872 // ScreenSpaceTransform. |
2869 gfx::PointF actual_local_end_point = | 2873 gfx::PointF actual_local_end_point = |
2870 local_start_point + gfx::Vector2dF(scrolled.x(), scrolled.y()); | 2874 local_start_point + gfx::Vector2dF(scrolled.x(), scrolled.y()); |
2871 | 2875 |
2872 // Calculate the applied scroll delta in viewport space coordinates. | 2876 // Calculate the applied scroll delta in viewport space coordinates. |
2873 gfx::PointF actual_screen_space_end_point = MathUtil::MapPoint( | 2877 gfx::PointF actual_screen_space_end_point = MathUtil::MapPoint( |
2874 screen_space_transform, actual_local_end_point, &end_clipped); | 2878 screen_space_transform, actual_local_end_point, &end_clipped); |
2875 DCHECK(!end_clipped); | 2879 DCHECK(!end_clipped); |
2876 if (end_clipped) | 2880 if (end_clipped) |
2877 return gfx::Vector2dF(); | 2881 return gfx::Vector2dF(); |
2878 gfx::PointF actual_viewport_end_point = | 2882 gfx::PointF actual_viewport_end_point = |
2879 gfx::ScalePoint(actual_screen_space_end_point, | 2883 gfx::ScalePoint(actual_screen_space_end_point, |
2880 1.f / scale_from_viewport_to_screen_space); | 2884 1.f / scale_from_viewport_to_screen_space); |
2881 return actual_viewport_end_point - viewport_point; | 2885 return actual_viewport_end_point - viewport_point; |
2882 } | 2886 } |
2883 | 2887 |
2884 static gfx::Vector2dF ScrollLayerWithLocalDelta( | 2888 static gfx::Vector2dF ScrollNodeWithLocalDelta( |
2885 LayerImpl* layer_impl, | 2889 ScrollNode* scroll_node, |
2886 const gfx::Vector2dF& local_delta, | 2890 const gfx::Vector2dF& local_delta, |
2887 float page_scale_factor) { | 2891 float page_scale_factor, |
2888 gfx::ScrollOffset previous_offset = layer_impl->CurrentScrollOffset(); | 2892 LayerTreeImpl* layer_tree_impl) { |
| 2893 ScrollTree& scroll_tree = layer_tree_impl->property_trees()->scroll_tree; |
| 2894 gfx::ScrollOffset previous_offset = |
| 2895 scroll_tree.current_scroll_offset(scroll_node->owner_id); |
2889 gfx::Vector2dF delta = local_delta; | 2896 gfx::Vector2dF delta = local_delta; |
2890 delta.Scale(1.f / page_scale_factor); | 2897 delta.Scale(1.f / page_scale_factor); |
2891 layer_impl->ScrollBy(delta); | 2898 scroll_tree.ScrollBy(scroll_node, delta, layer_tree_impl); |
2892 gfx::ScrollOffset scrolled = | 2899 gfx::ScrollOffset scrolled = |
2893 layer_impl->CurrentScrollOffset() - previous_offset; | 2900 scroll_tree.current_scroll_offset(scroll_node->owner_id) - |
| 2901 previous_offset; |
2894 gfx::Vector2dF consumed_scroll(scrolled.x(), scrolled.y()); | 2902 gfx::Vector2dF consumed_scroll(scrolled.x(), scrolled.y()); |
2895 consumed_scroll.Scale(page_scale_factor); | 2903 consumed_scroll.Scale(page_scale_factor); |
2896 | 2904 |
2897 return consumed_scroll; | 2905 return consumed_scroll; |
2898 } | 2906 } |
2899 | 2907 |
2900 // TODO(danakj): Make this into two functions, one with delta, one with | 2908 // TODO(danakj): Make this into two functions, one with delta, one with |
2901 // viewport_point, no bool required. | 2909 // viewport_point, no bool required. |
2902 gfx::Vector2dF LayerTreeHostImpl::ScrollLayer(LayerImpl* layer_impl, | 2910 gfx::Vector2dF LayerTreeHostImpl::ScrollSingleNode( |
2903 const gfx::Vector2dF& delta, | 2911 ScrollNode* scroll_node, |
2904 const gfx::Point& viewport_point, | 2912 const gfx::Vector2dF& delta, |
2905 bool is_direct_manipulation) { | 2913 const gfx::Point& viewport_point, |
| 2914 bool is_direct_manipulation, |
| 2915 ScrollTree* scroll_tree) { |
2906 // Events representing direct manipulation of the screen (such as gesture | 2916 // Events representing direct manipulation of the screen (such as gesture |
2907 // events) need to be transformed from viewport coordinates to local layer | 2917 // events) need to be transformed from viewport coordinates to local layer |
2908 // coordinates so that the scrolling contents exactly follow the user's | 2918 // coordinates so that the scrolling contents exactly follow the user's |
2909 // finger. In contrast, events not representing direct manipulation of the | 2919 // finger. In contrast, events not representing direct manipulation of the |
2910 // screen (such as wheel events) represent a fixed amount of scrolling so we | 2920 // screen (such as wheel events) represent a fixed amount of scrolling so we |
2911 // can just apply them directly, but the page scale factor is applied to the | 2921 // can just apply them directly, but the page scale factor is applied to the |
2912 // scroll delta. | 2922 // scroll delta. |
2913 if (is_direct_manipulation) { | 2923 if (is_direct_manipulation) { |
2914 return ScrollLayerWithViewportSpaceDelta( | 2924 return ScrollNodeWithViewportSpaceDelta( |
2915 layer_impl, gfx::PointF(viewport_point), delta); | 2925 scroll_node, gfx::PointF(viewport_point), delta, scroll_tree); |
2916 } | 2926 } |
2917 float scale_factor = active_tree()->current_page_scale_factor(); | 2927 float scale_factor = active_tree()->current_page_scale_factor(); |
2918 return ScrollLayerWithLocalDelta(layer_impl, delta, scale_factor); | 2928 return ScrollNodeWithLocalDelta(scroll_node, delta, scale_factor, |
| 2929 active_tree()); |
2919 } | 2930 } |
2920 | 2931 |
2921 void LayerTreeHostImpl::ApplyScroll(LayerImpl* layer, | 2932 void LayerTreeHostImpl::ApplyScroll(ScrollNode* scroll_node, |
2922 ScrollState* scroll_state) { | 2933 ScrollState* scroll_state) { |
2923 DCHECK(scroll_state); | 2934 DCHECK(scroll_state); |
2924 gfx::Point viewport_point(scroll_state->start_position_x(), | 2935 gfx::Point viewport_point(scroll_state->start_position_x(), |
2925 scroll_state->start_position_y()); | 2936 scroll_state->start_position_y()); |
2926 const gfx::Vector2dF delta(scroll_state->delta_x(), scroll_state->delta_y()); | 2937 const gfx::Vector2dF delta(scroll_state->delta_x(), scroll_state->delta_y()); |
2927 gfx::Vector2dF applied_delta; | 2938 gfx::Vector2dF applied_delta; |
2928 // TODO(tdresser): Use a more rational epsilon. See crbug.com/510550 for | 2939 // TODO(tdresser): Use a more rational epsilon. See crbug.com/510550 for |
2929 // details. | 2940 // details. |
2930 const float kEpsilon = 0.1f; | 2941 const float kEpsilon = 0.1f; |
2931 | 2942 |
2932 if (layer == InnerViewportScrollLayer()) { | 2943 if (scroll_node->data.is_inner_viewport_scroll_layer) { |
2933 bool affect_top_controls = !wheel_scrolling_; | 2944 bool affect_top_controls = !wheel_scrolling_; |
2934 Viewport::ScrollResult result = viewport()->ScrollBy( | 2945 Viewport::ScrollResult result = viewport()->ScrollBy( |
2935 delta, viewport_point, scroll_state->is_direct_manipulation(), | 2946 delta, viewport_point, scroll_state->is_direct_manipulation(), |
2936 affect_top_controls); | 2947 affect_top_controls); |
2937 applied_delta = result.consumed_delta; | 2948 applied_delta = result.consumed_delta; |
2938 scroll_state->set_caused_scroll( | 2949 scroll_state->set_caused_scroll( |
2939 std::abs(result.content_scrolled_delta.x()) > kEpsilon, | 2950 std::abs(result.content_scrolled_delta.x()) > kEpsilon, |
2940 std::abs(result.content_scrolled_delta.y()) > kEpsilon); | 2951 std::abs(result.content_scrolled_delta.y()) > kEpsilon); |
2941 scroll_state->ConsumeDelta(applied_delta.x(), applied_delta.y()); | 2952 scroll_state->ConsumeDelta(applied_delta.x(), applied_delta.y()); |
2942 } else { | 2953 } else { |
2943 applied_delta = ScrollLayer(layer, delta, viewport_point, | 2954 applied_delta = ScrollSingleNode( |
2944 scroll_state->is_direct_manipulation()); | 2955 scroll_node, delta, viewport_point, |
| 2956 scroll_state->is_direct_manipulation(), |
| 2957 &scroll_state->layer_tree_impl()->property_trees()->scroll_tree); |
2945 } | 2958 } |
2946 | 2959 |
2947 // If the layer wasn't able to move, try the next one in the hierarchy. | 2960 // If the layer wasn't able to move, try the next one in the hierarchy. |
2948 bool scrolled = std::abs(applied_delta.x()) > kEpsilon; | 2961 bool scrolled = std::abs(applied_delta.x()) > kEpsilon; |
2949 scrolled = scrolled || std::abs(applied_delta.y()) > kEpsilon; | 2962 scrolled = scrolled || std::abs(applied_delta.y()) > kEpsilon; |
2950 | 2963 |
2951 if (scrolled && layer != InnerViewportScrollLayer()) { | 2964 if (scrolled && !scroll_node->data.is_inner_viewport_scroll_layer) { |
2952 // If the applied delta is within 45 degrees of the input | 2965 // If the applied delta is within 45 degrees of the input |
2953 // delta, bail out to make it easier to scroll just one layer | 2966 // delta, bail out to make it easier to scroll just one layer |
2954 // in one direction without affecting any of its parents. | 2967 // in one direction without affecting any of its parents. |
2955 float angle_threshold = 45; | 2968 float angle_threshold = 45; |
2956 if (MathUtil::SmallestAngleBetweenVectors(applied_delta, delta) < | 2969 if (MathUtil::SmallestAngleBetweenVectors(applied_delta, delta) < |
2957 angle_threshold) { | 2970 angle_threshold) { |
2958 applied_delta = delta; | 2971 applied_delta = delta; |
2959 } else { | 2972 } else { |
2960 // Allow further movement only on an axis perpendicular to the direction | 2973 // Allow further movement only on an axis perpendicular to the direction |
2961 // in which the layer moved. | 2974 // in which the layer moved. |
2962 applied_delta = MathUtil::ProjectVector(delta, applied_delta); | 2975 applied_delta = MathUtil::ProjectVector(delta, applied_delta); |
2963 } | 2976 } |
2964 scroll_state->set_caused_scroll(std::abs(applied_delta.x()) > kEpsilon, | 2977 scroll_state->set_caused_scroll(std::abs(applied_delta.x()) > kEpsilon, |
2965 std::abs(applied_delta.y()) > kEpsilon); | 2978 std::abs(applied_delta.y()) > kEpsilon); |
2966 scroll_state->ConsumeDelta(applied_delta.x(), applied_delta.y()); | 2979 scroll_state->ConsumeDelta(applied_delta.x(), applied_delta.y()); |
2967 } | 2980 } |
2968 | 2981 |
2969 if (!scrolled) | 2982 if (!scrolled) |
2970 return; | 2983 return; |
2971 | 2984 |
2972 scroll_state->set_current_native_scrolling_node( | 2985 scroll_state->set_current_native_scrolling_node(scroll_node); |
2973 active_tree()->property_trees()->scroll_tree.Node( | |
2974 layer->scroll_tree_index())); | |
2975 } | 2986 } |
2976 | 2987 |
2977 void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) { | 2988 void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) { |
2978 // TODO(majidvp): in Blink we compute scroll chain only at scroll begin which | 2989 // TODO(majidvp): in Blink we compute scroll chain only at scroll begin which |
2979 // is not the case here. We eventually want to have the same behaviour on both | 2990 // is not the case here. We eventually want to have the same behaviour on both |
2980 // sides but it may become a non issue if we get rid of scroll chaining (see | 2991 // sides but it may become a non issue if we get rid of scroll chaining (see |
2981 // crbug.com/526462) | 2992 // crbug.com/526462) |
2982 std::list<const ScrollNode*> current_scroll_chain; | 2993 std::list<const ScrollNode*> current_scroll_chain; |
2983 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 2994 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
2984 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2995 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3078 // for events with WHEEL_PAGESCROLL set. | 3089 // for events with WHEEL_PAGESCROLL set. |
3079 bool LayerTreeHostImpl::ScrollVerticallyByPage(const gfx::Point& viewport_point, | 3090 bool LayerTreeHostImpl::ScrollVerticallyByPage(const gfx::Point& viewport_point, |
3080 ScrollDirection direction) { | 3091 ScrollDirection direction) { |
3081 DCHECK(wheel_scrolling_); | 3092 DCHECK(wheel_scrolling_); |
3082 | 3093 |
3083 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 3094 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
3084 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 3095 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
3085 if (scroll_node) { | 3096 if (scroll_node) { |
3086 for (; scroll_tree.parent(scroll_node); | 3097 for (; scroll_tree.parent(scroll_node); |
3087 scroll_node = scroll_tree.parent(scroll_node)) { | 3098 scroll_node = scroll_tree.parent(scroll_node)) { |
3088 LayerImpl* layer_impl = active_tree_->LayerById(scroll_node->owner_id); | |
3089 // The inner viewport layer represents the viewport. | 3099 // The inner viewport layer represents the viewport. |
3090 if (!scroll_node->data.scrollable || | 3100 if (!scroll_node->data.scrollable || |
3091 scroll_node->data.is_outer_viewport_scroll_layer) | 3101 scroll_node->data.is_outer_viewport_scroll_layer) |
3092 continue; | 3102 continue; |
3093 | 3103 |
3094 float height = | 3104 float height = |
3095 scroll_tree.scroll_clip_layer_bounds(scroll_node->id).height(); | 3105 scroll_tree.scroll_clip_layer_bounds(scroll_node->id).height(); |
3096 | 3106 |
3097 // These magical values match WebKit and are designed to scroll nearly the | 3107 // These magical values match WebKit and are designed to scroll nearly the |
3098 // entire visible content height but leave a bit of overlap. | 3108 // entire visible content height but leave a bit of overlap. |
3099 float page = std::max(height * 0.875f, 1.f); | 3109 float page = std::max(height * 0.875f, 1.f); |
3100 if (direction == SCROLL_BACKWARD) | 3110 if (direction == SCROLL_BACKWARD) |
3101 page = -page; | 3111 page = -page; |
3102 | 3112 |
3103 gfx::Vector2dF delta = gfx::Vector2dF(0.f, page); | 3113 gfx::Vector2dF delta = gfx::Vector2dF(0.f, page); |
3104 | 3114 |
3105 gfx::Vector2dF applied_delta = | 3115 gfx::Vector2dF applied_delta = |
3106 ScrollLayerWithLocalDelta(layer_impl, delta, 1.f); | 3116 ScrollNodeWithLocalDelta(scroll_node, delta, 1.f, active_tree()); |
3107 | 3117 |
3108 if (!applied_delta.IsZero()) { | 3118 if (!applied_delta.IsZero()) { |
3109 client_->SetNeedsCommitOnImplThread(); | 3119 client_->SetNeedsCommitOnImplThread(); |
3110 SetNeedsRedraw(); | 3120 SetNeedsRedraw(); |
3111 client_->RenewTreePriority(); | 3121 client_->RenewTreePriority(); |
3112 return true; | 3122 return true; |
3113 } | 3123 } |
3114 | 3124 |
3115 scroll_tree.set_currently_scrolling_node(scroll_node->id); | 3125 scroll_tree.set_currently_scrolling_node(scroll_node->id); |
3116 } | 3126 } |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3917 return task_runner_provider_->HasImplThread(); | 3927 return task_runner_provider_->HasImplThread(); |
3918 } | 3928 } |
3919 | 3929 |
3920 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3930 bool LayerTreeHostImpl::CommitToActiveTree() const { |
3921 // In single threaded mode we skip the pending tree and commit directly to the | 3931 // In single threaded mode we skip the pending tree and commit directly to the |
3922 // active tree. | 3932 // active tree. |
3923 return !task_runner_provider_->HasImplThread(); | 3933 return !task_runner_provider_->HasImplThread(); |
3924 } | 3934 } |
3925 | 3935 |
3926 } // namespace cc | 3936 } // namespace cc |
OLD | NEW |