Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2486673008: Touchpad scroll latching enabled for Mac behind flag. (Closed)
Patch Set: nit fixed: assignment instead of condition Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/mouse_wheel_event_queue.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 } 2637 }
2638 2638
2639 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( 2639 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
2640 ScrollState* scroll_state, 2640 ScrollState* scroll_state,
2641 InputHandler::ScrollInputType type) { 2641 InputHandler::ScrollInputType type) {
2642 ScrollStatus scroll_status; 2642 ScrollStatus scroll_status;
2643 scroll_status.main_thread_scrolling_reasons = 2643 scroll_status.main_thread_scrolling_reasons =
2644 MainThreadScrollingReason::kNotScrollingOnMain; 2644 MainThreadScrollingReason::kNotScrollingOnMain;
2645 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); 2645 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
2646 2646
2647 ClearCurrentlyScrollingLayer(); 2647 LayerImpl* scrolling_layer_impl = nullptr;
2648 bool scroll_on_main_thread = false;
2648 2649
2649 gfx::Point viewport_point(scroll_state->position_x(), 2650 if (scroll_state->is_in_inertial_phase())
2650 scroll_state->position_y()); 2651 scrolling_layer_impl = CurrentlyScrollingLayer();
2651 2652
2652 gfx::PointF device_viewport_point = gfx::ScalePoint( 2653 if (!scrolling_layer_impl) {
2653 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); 2654 ClearCurrentlyScrollingLayer();
2654 LayerImpl* layer_impl =
2655 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2656 2655
2657 if (layer_impl) { 2656 gfx::Point viewport_point(scroll_state->position_x(),
2658 LayerImpl* scroll_layer_impl = 2657 scroll_state->position_y());
2659 active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint( 2658
2660 device_viewport_point); 2659 gfx::PointF device_viewport_point = gfx::ScalePoint(
2661 if (scroll_layer_impl && 2660 gfx::PointF(viewport_point), active_tree_->device_scale_factor());
2662 !IsClosestScrollAncestor(layer_impl, scroll_layer_impl)) { 2661 LayerImpl* layer_impl =
2663 scroll_status.thread = SCROLL_UNKNOWN; 2662 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point);
2664 scroll_status.main_thread_scrolling_reasons = 2663
2665 MainThreadScrollingReason::kFailedHitTest; 2664 if (layer_impl) {
2666 return scroll_status; 2665 LayerImpl* scroll_layer_impl =
2666 active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint(
2667 device_viewport_point);
2668 if (scroll_layer_impl &&
2669 !IsClosestScrollAncestor(layer_impl, scroll_layer_impl)) {
2670 scroll_status.thread = SCROLL_UNKNOWN;
2671 scroll_status.main_thread_scrolling_reasons =
2672 MainThreadScrollingReason::kFailedHitTest;
2673 return scroll_status;
2674 }
2667 } 2675 }
2676
2677 scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
2678 device_viewport_point, type, layer_impl, &scroll_on_main_thread,
2679 &scroll_status.main_thread_scrolling_reasons);
2668 } 2680 }
2669
2670 bool scroll_on_main_thread = false;
2671 LayerImpl* scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint(
2672 device_viewport_point, type, layer_impl, &scroll_on_main_thread,
2673 &scroll_status.main_thread_scrolling_reasons);
2674
2675 if (scrolling_layer_impl) 2681 if (scrolling_layer_impl)
2676 scroll_affects_scroll_handler_ = 2682 scroll_affects_scroll_handler_ =
2677 scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers(); 2683 scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers();
2678 2684
2679 if (scroll_on_main_thread) { 2685 if (scroll_on_main_thread) {
2680 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); 2686 RecordCompositorSlowScrollMetric(type, MAIN_THREAD);
2681 2687
2682 scroll_status.thread = SCROLL_ON_MAIN_THREAD; 2688 scroll_status.thread = SCROLL_ON_MAIN_THREAD;
2683 return scroll_status; 2689 return scroll_status;
2684 } 2690 }
(...skipping 28 matching lines...) Expand all
2713 // ScrollAnimated is used for animated wheel scrolls. We find the first layer 2719 // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2714 // that can scroll and set up an animation of its scroll offset. Note that 2720 // that can scroll and set up an animation of its scroll offset. Note that
2715 // this does not currently go through the scroll customization machinery 2721 // this does not currently go through the scroll customization machinery
2716 // that ScrollBy uses for non-animated wheel scrolls. 2722 // that ScrollBy uses for non-animated wheel scrolls.
2717 scroll_status = ScrollBegin(&scroll_state, WHEEL); 2723 scroll_status = ScrollBegin(&scroll_state, WHEEL);
2718 scroll_node = scroll_tree.CurrentlyScrollingNode(); 2724 scroll_node = scroll_tree.CurrentlyScrollingNode();
2719 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 2725 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
2720 ScrollStateData scroll_state_end_data; 2726 ScrollStateData scroll_state_end_data;
2721 scroll_state_end_data.is_ending = true; 2727 scroll_state_end_data.is_ending = true;
2722 ScrollState scroll_state_end(scroll_state_end_data); 2728 ScrollState scroll_state_end(scroll_state_end_data);
2723 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
2724 // implemented, the current scrolling layer should not get cleared after
2725 // each animation (crbug.com/526463).
2726 ScrollEnd(&scroll_state_end); 2729 ScrollEnd(&scroll_state_end);
2727 ClearCurrentlyScrollingLayer();
2728 } 2730 }
2729 return scroll_status; 2731 return scroll_status;
2730 } 2732 }
2731 2733
2732 gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta( 2734 gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta(
2733 ScrollNode* scroll_node, 2735 ScrollNode* scroll_node,
2734 const gfx::Vector2dF& delta) { 2736 const gfx::Vector2dF& delta) {
2735 ScrollTree& scroll_tree = active_tree()->property_trees()->scroll_tree; 2737 ScrollTree& scroll_tree = active_tree()->property_trees()->scroll_tree;
2736 float scale_factor = active_tree()->current_page_scale_factor(); 2738 float scale_factor = active_tree()->current_page_scale_factor();
2737 2739
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 scroll_status.thread = SCROLL_IGNORED; 2806 scroll_status.thread = SCROLL_IGNORED;
2805 scroll_status.main_thread_scrolling_reasons = 2807 scroll_status.main_thread_scrolling_reasons =
2806 MainThreadScrollingReason::kNotScrollable; 2808 MainThreadScrollingReason::kNotScrollable;
2807 } 2809 }
2808 return scroll_status; 2810 return scroll_status;
2809 } 2811 }
2810 2812
2811 ScrollStateData scroll_state_data; 2813 ScrollStateData scroll_state_data;
2812 scroll_state_data.position_x = viewport_point.x(); 2814 scroll_state_data.position_x = viewport_point.x();
2813 scroll_state_data.position_y = viewport_point.y(); 2815 scroll_state_data.position_y = viewport_point.y();
2814 scroll_state_data.is_in_inertial_phase = true;
2815 ScrollState scroll_state(scroll_state_data); 2816 ScrollState scroll_state(scroll_state_data);
2816 2817
2817 // ScrollAnimated is used for animated wheel scrolls. We find the first layer 2818 // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2818 // that can scroll and set up an animation of its scroll offset. Note that 2819 // that can scroll and set up an animation of its scroll offset. Note that
2819 // this does not currently go through the scroll customization machinery 2820 // this does not currently go through the scroll customization machinery
2820 // that ScrollBy uses for non-animated wheel scrolls. 2821 // that ScrollBy uses for non-animated wheel scrolls.
2821 scroll_status = ScrollBegin(&scroll_state, WHEEL); 2822 scroll_status = ScrollBegin(&scroll_state, WHEEL);
2822 scroll_node = scroll_tree.CurrentlyScrollingNode(); 2823 scroll_node = scroll_tree.CurrentlyScrollingNode();
2823 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 2824 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
2824 gfx::Vector2dF pending_delta = scroll_delta; 2825 gfx::Vector2dF pending_delta = scroll_delta;
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
4085 worker_context_visibility_ = 4086 worker_context_visibility_ =
4086 worker_context->CacheController()->ClientBecameVisible(); 4087 worker_context->CacheController()->ClientBecameVisible();
4087 } else { 4088 } else {
4088 worker_context->CacheController()->ClientBecameNotVisible( 4089 worker_context->CacheController()->ClientBecameNotVisible(
4089 std::move(worker_context_visibility_)); 4090 std::move(worker_context_visibility_));
4090 } 4091 }
4091 } 4092 }
4092 } 4093 }
4093 4094
4094 } // namespace cc 4095 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/mouse_wheel_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698