| 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 18 matching lines...) Expand all Loading... |
| 29 #include "cc/animation/timing_function.h" | 29 #include "cc/animation/timing_function.h" |
| 30 #include "cc/base/histograms.h" | 30 #include "cc/base/histograms.h" |
| 31 #include "cc/base/math_util.h" | 31 #include "cc/base/math_util.h" |
| 32 #include "cc/debug/benchmark_instrumentation.h" | 32 #include "cc/debug/benchmark_instrumentation.h" |
| 33 #include "cc/debug/debug_rect_history.h" | 33 #include "cc/debug/debug_rect_history.h" |
| 34 #include "cc/debug/devtools_instrumentation.h" | 34 #include "cc/debug/devtools_instrumentation.h" |
| 35 #include "cc/debug/frame_rate_counter.h" | 35 #include "cc/debug/frame_rate_counter.h" |
| 36 #include "cc/debug/frame_viewer_instrumentation.h" | 36 #include "cc/debug/frame_viewer_instrumentation.h" |
| 37 #include "cc/debug/rendering_stats_instrumentation.h" | 37 #include "cc/debug/rendering_stats_instrumentation.h" |
| 38 #include "cc/debug/traced_value.h" | 38 #include "cc/debug/traced_value.h" |
| 39 #include "cc/input/main_thread_scrolling_reason.h" |
| 39 #include "cc/input/page_scale_animation.h" | 40 #include "cc/input/page_scale_animation.h" |
| 40 #include "cc/input/scroll_elasticity_helper.h" | 41 #include "cc/input/scroll_elasticity_helper.h" |
| 41 #include "cc/input/scroll_state.h" | 42 #include "cc/input/scroll_state.h" |
| 42 #include "cc/input/top_controls_manager.h" | 43 #include "cc/input/top_controls_manager.h" |
| 43 #include "cc/layers/append_quads_data.h" | 44 #include "cc/layers/append_quads_data.h" |
| 44 #include "cc/layers/heads_up_display_layer_impl.h" | 45 #include "cc/layers/heads_up_display_layer_impl.h" |
| 45 #include "cc/layers/layer_impl.h" | 46 #include "cc/layers/layer_impl.h" |
| 46 #include "cc/layers/layer_iterator.h" | 47 #include "cc/layers/layer_iterator.h" |
| 47 #include "cc/layers/painted_scrollbar_layer_impl.h" | 48 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 48 #include "cc/layers/render_surface_impl.h" | 49 #include "cc/layers/render_surface_impl.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 if (!scrolling_layer_impl) | 542 if (!scrolling_layer_impl) |
| 542 return false; | 543 return false; |
| 543 | 544 |
| 544 gfx::PointF device_viewport_point = gfx::ScalePoint( | 545 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 545 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 546 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 546 | 547 |
| 547 LayerImpl* layer_impl = | 548 LayerImpl* layer_impl = |
| 548 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 549 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 549 | 550 |
| 550 bool scroll_on_main_thread = false; | 551 bool scroll_on_main_thread = false; |
| 551 InputHandler::MainThreadScrollingReason main_thread_scrolling_reasons; | 552 uint32_t main_thread_scrolling_reasons; |
| 552 LayerImpl* test_layer_impl = FindScrollLayerForDeviceViewportPoint( | 553 LayerImpl* test_layer_impl = FindScrollLayerForDeviceViewportPoint( |
| 553 device_viewport_point, type, layer_impl, &scroll_on_main_thread, nullptr, | 554 device_viewport_point, type, layer_impl, &scroll_on_main_thread, nullptr, |
| 554 &main_thread_scrolling_reasons); | 555 &main_thread_scrolling_reasons); |
| 555 | 556 |
| 556 if (!test_layer_impl) | 557 if (!test_layer_impl) |
| 557 return false; | 558 return false; |
| 558 | 559 |
| 559 if (scrolling_layer_impl == test_layer_impl) | 560 if (scrolling_layer_impl == test_layer_impl) |
| 560 return true; | 561 return true; |
| 561 | 562 |
| (...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2472 DCHECK(input_handler_client_ == NULL); | 2473 DCHECK(input_handler_client_ == NULL); |
| 2473 input_handler_client_ = client; | 2474 input_handler_client_ = client; |
| 2474 } | 2475 } |
| 2475 | 2476 |
| 2476 LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( | 2477 LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint( |
| 2477 const gfx::PointF& device_viewport_point, | 2478 const gfx::PointF& device_viewport_point, |
| 2478 InputHandler::ScrollInputType type, | 2479 InputHandler::ScrollInputType type, |
| 2479 LayerImpl* layer_impl, | 2480 LayerImpl* layer_impl, |
| 2480 bool* scroll_on_main_thread, | 2481 bool* scroll_on_main_thread, |
| 2481 bool* optional_has_ancestor_scroll_handler, | 2482 bool* optional_has_ancestor_scroll_handler, |
| 2482 InputHandler::MainThreadScrollingReason* main_thread_scrolling_reasons) | 2483 uint32_t* main_thread_scrolling_reasons) const { |
| 2483 const { | |
| 2484 DCHECK(scroll_on_main_thread); | 2484 DCHECK(scroll_on_main_thread); |
| 2485 DCHECK(main_thread_scrolling_reasons); | 2485 DCHECK(main_thread_scrolling_reasons); |
| 2486 *main_thread_scrolling_reasons = InputHandler::NOT_SCROLLING_ON_MAIN; | 2486 *main_thread_scrolling_reasons = |
| 2487 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2487 | 2488 |
| 2488 ScrollBlocksOn block_mode = EffectiveScrollBlocksOn(layer_impl); | 2489 ScrollBlocksOn block_mode = EffectiveScrollBlocksOn(layer_impl); |
| 2489 | 2490 |
| 2490 // Walk up the hierarchy and look for a scrollable layer. | 2491 // Walk up the hierarchy and look for a scrollable layer. |
| 2491 LayerImpl* potentially_scrolling_layer_impl = NULL; | 2492 LayerImpl* potentially_scrolling_layer_impl = NULL; |
| 2492 for (; layer_impl; layer_impl = NextLayerInScrollOrder(layer_impl)) { | 2493 for (; layer_impl; layer_impl = NextLayerInScrollOrder(layer_impl)) { |
| 2493 // The content layer can also block attempts to scroll outside the main | 2494 // The content layer can also block attempts to scroll outside the main |
| 2494 // thread. | 2495 // thread. |
| 2495 ScrollStatus status = | 2496 ScrollStatus status = |
| 2496 layer_impl->TryScroll(device_viewport_point, type, block_mode); | 2497 layer_impl->TryScroll(device_viewport_point, type, block_mode); |
| 2497 if (status.thread == SCROLL_ON_MAIN_THREAD) { | 2498 if (status.thread == SCROLL_ON_MAIN_THREAD) { |
| 2498 if (layer_impl->should_scroll_on_main_thread()) { | 2499 if (layer_impl->should_scroll_on_main_thread()) { |
| 2499 DCHECK(status.main_thread_scrolling_reasons <= | 2500 DCHECK_LE(status.main_thread_scrolling_reasons, |
| 2500 InputHandler::MaxNonTransientScrollingReason); | 2501 MainThreadScrollingReason::kMaxNonTransientScrollingReason); |
| 2501 } else { | 2502 } else { |
| 2502 DCHECK(status.main_thread_scrolling_reasons > | 2503 DCHECK_GT(status.main_thread_scrolling_reasons, |
| 2503 InputHandler::MaxNonTransientScrollingReason); | 2504 MainThreadScrollingReason::kMaxNonTransientScrollingReason); |
| 2504 } | 2505 } |
| 2505 | 2506 |
| 2506 *scroll_on_main_thread = true; | 2507 *scroll_on_main_thread = true; |
| 2507 *main_thread_scrolling_reasons = status.main_thread_scrolling_reasons; | 2508 *main_thread_scrolling_reasons = status.main_thread_scrolling_reasons; |
| 2508 return NULL; | 2509 return NULL; |
| 2509 } | 2510 } |
| 2510 | 2511 |
| 2511 LayerImpl* scroll_layer_impl = FindScrollLayerForContentLayer(layer_impl); | 2512 LayerImpl* scroll_layer_impl = FindScrollLayerForContentLayer(layer_impl); |
| 2512 if (!scroll_layer_impl) | 2513 if (!scroll_layer_impl) |
| 2513 continue; | 2514 continue; |
| 2514 | 2515 |
| 2515 status = | 2516 status = |
| 2516 scroll_layer_impl->TryScroll(device_viewport_point, type, block_mode); | 2517 scroll_layer_impl->TryScroll(device_viewport_point, type, block_mode); |
| 2517 | 2518 |
| 2518 // If any layer wants to divert the scroll event to the main thread, abort. | 2519 // If any layer wants to divert the scroll event to the main thread, abort. |
| 2519 if (status.thread == SCROLL_ON_MAIN_THREAD) { | 2520 if (status.thread == SCROLL_ON_MAIN_THREAD) { |
| 2520 if (layer_impl->should_scroll_on_main_thread()) { | 2521 if (layer_impl->should_scroll_on_main_thread()) { |
| 2521 DCHECK(status.main_thread_scrolling_reasons <= | 2522 DCHECK_LE(status.main_thread_scrolling_reasons, |
| 2522 InputHandler::MaxNonTransientScrollingReason); | 2523 MainThreadScrollingReason::kMaxNonTransientScrollingReason); |
| 2523 } else { | 2524 } else { |
| 2524 DCHECK(status.main_thread_scrolling_reasons > | 2525 DCHECK_GT(status.main_thread_scrolling_reasons, |
| 2525 InputHandler::MaxNonTransientScrollingReason); | 2526 MainThreadScrollingReason::kMaxNonTransientScrollingReason); |
| 2526 } | 2527 } |
| 2527 | 2528 |
| 2528 *scroll_on_main_thread = true; | 2529 *scroll_on_main_thread = true; |
| 2529 *main_thread_scrolling_reasons = status.main_thread_scrolling_reasons; | 2530 *main_thread_scrolling_reasons = status.main_thread_scrolling_reasons; |
| 2530 return NULL; | 2531 return NULL; |
| 2531 } | 2532 } |
| 2532 | 2533 |
| 2533 if (optional_has_ancestor_scroll_handler && | 2534 if (optional_has_ancestor_scroll_handler && |
| 2534 scroll_layer_impl->have_scroll_event_handlers()) | 2535 scroll_layer_impl->have_scroll_event_handlers()) |
| 2535 *optional_has_ancestor_scroll_handler = true; | 2536 *optional_has_ancestor_scroll_handler = true; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2574 } | 2575 } |
| 2575 | 2576 |
| 2576 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( | 2577 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( |
| 2577 ScrollState* scroll_state, | 2578 ScrollState* scroll_state, |
| 2578 LayerImpl* scrolling_layer_impl, | 2579 LayerImpl* scrolling_layer_impl, |
| 2579 InputHandler::ScrollInputType type) { | 2580 InputHandler::ScrollInputType type) { |
| 2580 DCHECK(scroll_state); | 2581 DCHECK(scroll_state); |
| 2581 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); | 2582 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); |
| 2582 | 2583 |
| 2583 InputHandler::ScrollStatus scroll_status; | 2584 InputHandler::ScrollStatus scroll_status; |
| 2584 scroll_status.main_thread_scrolling_reasons = NOT_SCROLLING_ON_MAIN; | 2585 scroll_status.main_thread_scrolling_reasons = |
| 2586 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2585 if (!scrolling_layer_impl) { | 2587 if (!scrolling_layer_impl) { |
| 2586 scroll_status.thread = SCROLL_IGNORED; | 2588 scroll_status.thread = SCROLL_IGNORED; |
| 2587 scroll_status.main_thread_scrolling_reasons = NO_SCROLLING_LAYER; | 2589 scroll_status.main_thread_scrolling_reasons = |
| 2590 MainThreadScrollingReason::kNoScrollingLayer; |
| 2588 return scroll_status; | 2591 return scroll_status; |
| 2589 } | 2592 } |
| 2590 scroll_status.thread = SCROLL_ON_IMPL_THREAD; | 2593 scroll_status.thread = SCROLL_ON_IMPL_THREAD; |
| 2591 ScrollAnimationAbort(scrolling_layer_impl); | 2594 ScrollAnimationAbort(scrolling_layer_impl); |
| 2592 | 2595 |
| 2593 top_controls_manager_->ScrollBegin(); | 2596 top_controls_manager_->ScrollBegin(); |
| 2594 | 2597 |
| 2595 active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl); | 2598 active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl); |
| 2596 // TODO(majidvp): get rid of wheel_scrolling_ and set is_direct_manipulation | 2599 // TODO(majidvp): get rid of wheel_scrolling_ and set is_direct_manipulation |
| 2597 // in input_handler_proxy instead. | 2600 // in input_handler_proxy instead. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2617 | 2620 |
| 2618 ClearCurrentlyScrollingLayer(); | 2621 ClearCurrentlyScrollingLayer(); |
| 2619 | 2622 |
| 2620 return ScrollBeginImpl(scroll_state, InnerViewportScrollLayer(), type); | 2623 return ScrollBeginImpl(scroll_state, InnerViewportScrollLayer(), type); |
| 2621 } | 2624 } |
| 2622 | 2625 |
| 2623 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 2626 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
| 2624 ScrollState* scroll_state, | 2627 ScrollState* scroll_state, |
| 2625 InputHandler::ScrollInputType type) { | 2628 InputHandler::ScrollInputType type) { |
| 2626 ScrollStatus scroll_status; | 2629 ScrollStatus scroll_status; |
| 2627 scroll_status.main_thread_scrolling_reasons = NOT_SCROLLING_ON_MAIN; | 2630 scroll_status.main_thread_scrolling_reasons = |
| 2631 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2628 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 2632 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
| 2629 | 2633 |
| 2630 ClearCurrentlyScrollingLayer(); | 2634 ClearCurrentlyScrollingLayer(); |
| 2631 | 2635 |
| 2632 gfx::Point viewport_point(scroll_state->start_position_x(), | 2636 gfx::Point viewport_point(scroll_state->start_position_x(), |
| 2633 scroll_state->start_position_y()); | 2637 scroll_state->start_position_y()); |
| 2634 | 2638 |
| 2635 gfx::PointF device_viewport_point = gfx::ScalePoint( | 2639 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 2636 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 2640 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 2637 LayerImpl* layer_impl = | 2641 LayerImpl* layer_impl = |
| 2638 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 2642 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 2639 | 2643 |
| 2640 if (layer_impl) { | 2644 if (layer_impl) { |
| 2641 LayerImpl* scroll_layer_impl = | 2645 LayerImpl* scroll_layer_impl = |
| 2642 active_tree_->FindFirstScrollingLayerThatIsHitByPoint( | 2646 active_tree_->FindFirstScrollingLayerThatIsHitByPoint( |
| 2643 device_viewport_point); | 2647 device_viewport_point); |
| 2644 if (scroll_layer_impl && | 2648 if (scroll_layer_impl && |
| 2645 !HasScrollAncestor(layer_impl, scroll_layer_impl)) { | 2649 !HasScrollAncestor(layer_impl, scroll_layer_impl)) { |
| 2646 scroll_status.thread = SCROLL_UNKNOWN; | 2650 scroll_status.thread = SCROLL_UNKNOWN; |
| 2647 scroll_status.main_thread_scrolling_reasons = | 2651 scroll_status.main_thread_scrolling_reasons = |
| 2648 InputHandler::FAILED_HIT_TEST; | 2652 MainThreadScrollingReason::kFailedHitTest; |
| 2649 return scroll_status; | 2653 return scroll_status; |
| 2650 } | 2654 } |
| 2651 } | 2655 } |
| 2652 | 2656 |
| 2653 bool scroll_on_main_thread = false; | 2657 bool scroll_on_main_thread = false; |
| 2654 LayerImpl* scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint( | 2658 LayerImpl* scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint( |
| 2655 device_viewport_point, type, layer_impl, &scroll_on_main_thread, | 2659 device_viewport_point, type, layer_impl, &scroll_on_main_thread, |
| 2656 &scroll_affects_scroll_handler_, | 2660 &scroll_affects_scroll_handler_, |
| 2657 &scroll_status.main_thread_scrolling_reasons); | 2661 &scroll_status.main_thread_scrolling_reasons); |
| 2658 | 2662 |
| 2659 if (scroll_on_main_thread) { | 2663 if (scroll_on_main_thread) { |
| 2660 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); | 2664 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); |
| 2661 | 2665 |
| 2662 // TODO(lanwei): Will remove this metric in M50 when we have used the new | 2666 // TODO(lanwei): Will remove this metric in M50 when we have used the new |
| 2663 // metrics for one milestone, see https://crbug.com/557787. | 2667 // metrics for one milestone, see https://crbug.com/557787. |
| 2664 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); | 2668 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); |
| 2665 scroll_status.thread = SCROLL_ON_MAIN_THREAD; | 2669 scroll_status.thread = SCROLL_ON_MAIN_THREAD; |
| 2666 return scroll_status; | 2670 return scroll_status; |
| 2667 } | 2671 } |
| 2668 | 2672 |
| 2669 return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type); | 2673 return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type); |
| 2670 } | 2674 } |
| 2671 | 2675 |
| 2672 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( | 2676 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated( |
| 2673 const gfx::Point& viewport_point, | 2677 const gfx::Point& viewport_point, |
| 2674 const gfx::Vector2dF& scroll_delta) { | 2678 const gfx::Vector2dF& scroll_delta) { |
| 2675 InputHandler::ScrollStatus scroll_status; | 2679 InputHandler::ScrollStatus scroll_status; |
| 2676 scroll_status.main_thread_scrolling_reasons = NOT_SCROLLING_ON_MAIN; | 2680 scroll_status.main_thread_scrolling_reasons = |
| 2681 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2677 if (LayerImpl* layer_impl = CurrentlyScrollingLayer()) { | 2682 if (LayerImpl* layer_impl = CurrentlyScrollingLayer()) { |
| 2678 if (ScrollAnimationUpdateTarget(layer_impl, scroll_delta)) { | 2683 if (ScrollAnimationUpdateTarget(layer_impl, scroll_delta)) { |
| 2679 scroll_status.thread = SCROLL_ON_IMPL_THREAD; | 2684 scroll_status.thread = SCROLL_ON_IMPL_THREAD; |
| 2680 } else { | 2685 } else { |
| 2681 scroll_status.thread = SCROLL_IGNORED; | 2686 scroll_status.thread = SCROLL_IGNORED; |
| 2682 scroll_status.main_thread_scrolling_reasons = NOT_SCROLLABLE; | 2687 scroll_status.main_thread_scrolling_reasons = |
| 2688 MainThreadScrollingReason::kNotScrollable; |
| 2683 } | 2689 } |
| 2684 return scroll_status; | 2690 return scroll_status; |
| 2685 } | 2691 } |
| 2686 | 2692 |
| 2687 ScrollState scroll_state(0, 0, viewport_point.x(), viewport_point.y(), 0, 0, | 2693 ScrollState scroll_state(0, 0, viewport_point.x(), viewport_point.y(), 0, 0, |
| 2688 false, true, false); | 2694 false, true, false); |
| 2689 // ScrollAnimated is used for animated wheel scrolls. We find the first layer | 2695 // ScrollAnimated is used for animated wheel scrolls. We find the first layer |
| 2690 // that can scroll and set up an animation of its scroll offset. Note that | 2696 // that can scroll and set up an animation of its scroll offset. Note that |
| 2691 // this does not currently go through the scroll customization and viewport | 2697 // this does not currently go through the scroll customization and viewport |
| 2692 // machinery that ScrollBy uses for non-animated wheel scrolls. | 2698 // machinery that ScrollBy uses for non-animated wheel scrolls. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3047 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); | 3053 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); |
| 3048 | 3054 |
| 3049 DistributeScrollDelta(scroll_state); | 3055 DistributeScrollDelta(scroll_state); |
| 3050 top_controls_manager_->ScrollEnd(); | 3056 top_controls_manager_->ScrollEnd(); |
| 3051 ClearCurrentlyScrollingLayer(); | 3057 ClearCurrentlyScrollingLayer(); |
| 3052 } | 3058 } |
| 3053 | 3059 |
| 3054 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { | 3060 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { |
| 3055 InputHandler::ScrollStatus scroll_status; | 3061 InputHandler::ScrollStatus scroll_status; |
| 3056 scroll_status.main_thread_scrolling_reasons = | 3062 scroll_status.main_thread_scrolling_reasons = |
| 3057 InputHandler::NOT_SCROLLING_ON_MAIN; | 3063 MainThreadScrollingReason::kNotScrollingOnMain; |
| 3058 if (!CurrentlyScrollingLayer()) { | 3064 if (!CurrentlyScrollingLayer()) { |
| 3059 scroll_status.thread = SCROLL_IGNORED; | 3065 scroll_status.thread = SCROLL_IGNORED; |
| 3060 scroll_status.main_thread_scrolling_reasons = NO_SCROLLING_LAYER; | 3066 scroll_status.main_thread_scrolling_reasons = |
| 3067 MainThreadScrollingReason::kNoScrollingLayer; |
| 3061 } else { | 3068 } else { |
| 3062 scroll_status.thread = SCROLL_ON_IMPL_THREAD; | 3069 scroll_status.thread = SCROLL_ON_IMPL_THREAD; |
| 3063 } | 3070 } |
| 3064 return scroll_status; | 3071 return scroll_status; |
| 3065 } | 3072 } |
| 3066 | 3073 |
| 3067 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( | 3074 float LayerTreeHostImpl::DeviceSpaceDistanceToLayer( |
| 3068 const gfx::PointF& device_viewport_point, | 3075 const gfx::PointF& device_viewport_point, |
| 3069 LayerImpl* layer_impl) { | 3076 LayerImpl* layer_impl) { |
| 3070 if (!layer_impl) | 3077 if (!layer_impl) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3082 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3089 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| 3083 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3090 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 3084 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3091 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 3085 LayerImpl* layer_impl = | 3092 LayerImpl* layer_impl = |
| 3086 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3093 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
| 3087 HandleMouseOverScrollbar(layer_impl); | 3094 HandleMouseOverScrollbar(layer_impl); |
| 3088 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) | 3095 if (scroll_layer_id_when_mouse_over_scrollbar_ != Layer::INVALID_ID) |
| 3089 return; | 3096 return; |
| 3090 | 3097 |
| 3091 bool scroll_on_main_thread = false; | 3098 bool scroll_on_main_thread = false; |
| 3092 InputHandler::MainThreadScrollingReason main_thread_scrolling_reasons; | 3099 uint32_t main_thread_scrolling_reasons; |
| 3093 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( | 3100 LayerImpl* scroll_layer_impl = FindScrollLayerForDeviceViewportPoint( |
| 3094 device_viewport_point, InputHandler::GESTURE, layer_impl, | 3101 device_viewport_point, InputHandler::GESTURE, layer_impl, |
| 3095 &scroll_on_main_thread, NULL, &main_thread_scrolling_reasons); | 3102 &scroll_on_main_thread, NULL, &main_thread_scrolling_reasons); |
| 3096 if (scroll_layer_impl == InnerViewportScrollLayer()) | 3103 if (scroll_layer_impl == InnerViewportScrollLayer()) |
| 3097 scroll_layer_impl = OuterViewportScrollLayer(); | 3104 scroll_layer_impl = OuterViewportScrollLayer(); |
| 3098 if (scroll_on_main_thread || !scroll_layer_impl) | 3105 if (scroll_on_main_thread || !scroll_layer_impl) |
| 3099 return; | 3106 return; |
| 3100 | 3107 |
| 3101 ScrollbarAnimationController* animation_controller = | 3108 ScrollbarAnimationController* animation_controller = |
| 3102 ScrollbarAnimationControllerForId(scroll_layer_impl->id()); | 3109 ScrollbarAnimationControllerForId(scroll_layer_impl->id()); |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3895 return task_runner_provider_->HasImplThread(); | 3902 return task_runner_provider_->HasImplThread(); |
| 3896 } | 3903 } |
| 3897 | 3904 |
| 3898 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3905 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3899 // In single threaded mode we skip the pending tree and commit directly to the | 3906 // In single threaded mode we skip the pending tree and commit directly to the |
| 3900 // active tree. | 3907 // active tree. |
| 3901 return !task_runner_provider_->HasImplThread(); | 3908 return !task_runner_provider_->HasImplThread(); |
| 3902 } | 3909 } |
| 3903 | 3910 |
| 3904 } // namespace cc | 3911 } // namespace cc |
| OLD | NEW |