Chromium Code Reviews| 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.h" | 5 #include "cc/trees/layer_tree_host.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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 info->elastic_overscroll_delta); | 730 info->elastic_overscroll_delta); |
| 731 // TODO(ccameron): pass the elastic overscroll here so that input events | 731 // TODO(ccameron): pass the elastic overscroll here so that input events |
| 732 // may be translated appropriately. | 732 // may be translated appropriately. |
| 733 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), | 733 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), |
| 734 info->elastic_overscroll_delta, | 734 info->elastic_overscroll_delta, |
| 735 info->page_scale_delta, | 735 info->page_scale_delta, |
| 736 info->top_controls_delta); | 736 info->top_controls_delta); |
| 737 SetNeedsUpdateLayers(); | 737 SetNeedsUpdateLayers(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 void LayerTreeHost::RecordWheelAndTouchScrollingCount(ScrollAndScaleSet* info) { | |
| 741 bool has_scrolled_by_wheel = false; | |
| 742 bool has_scrolled_by_touch = false; | |
| 743 | |
| 744 if (!info) | |
| 745 return; | |
| 746 | |
| 747 switch (info->scroll_source_info) { | |
| 748 case InputHandler::ScrollSourceInfo::NONE: | |
| 749 break; | |
|
dtapuska
2017/03/08 21:18:00
Can you return here?
sahel
2017/03/10 16:21:33
Done.
| |
| 750 case InputHandler::ScrollSourceInfo::SCROLLED_BY_TOUCH: | |
| 751 has_scrolled_by_touch = true; | |
| 752 break; | |
| 753 case InputHandler::ScrollSourceInfo::SCROLLED_BY_WHEEL: | |
| 754 has_scrolled_by_wheel = true; | |
| 755 break; | |
| 756 case InputHandler::ScrollSourceInfo::SCROLLED_BY_TOUCH_AND_WHEEL: | |
| 757 has_scrolled_by_wheel = true; | |
| 758 has_scrolled_by_touch = true; | |
| 759 break; | |
| 760 } | |
| 761 client_->RecordWheelAndTouchScrollingCount(has_scrolled_by_wheel, | |
| 762 has_scrolled_by_touch); | |
| 763 } | |
| 764 | |
| 740 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 765 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
| 741 for (auto& swap_promise : info->swap_promises) { | 766 for (auto& swap_promise : info->swap_promises) { |
| 742 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 767 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
| 743 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 768 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
| 744 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 769 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 745 "step", "Main thread scroll update"); | 770 "step", "Main thread scroll update"); |
| 746 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); | 771 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); |
| 747 } | 772 } |
| 748 | 773 |
| 749 if (root_layer_) { | 774 if (root_layer_) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 760 if (!layer) | 785 if (!layer) |
| 761 continue; | 786 continue; |
| 762 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); | 787 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); |
| 763 } | 788 } |
| 764 } | 789 } |
| 765 | 790 |
| 766 // This needs to happen after scroll deltas have been sent to prevent top | 791 // This needs to happen after scroll deltas have been sent to prevent top |
| 767 // controls from clamping the layout viewport both on the compositor and | 792 // controls from clamping the layout viewport both on the compositor and |
| 768 // on the main thread. | 793 // on the main thread. |
| 769 ApplyViewportDeltas(info); | 794 ApplyViewportDeltas(info); |
| 795 | |
| 796 RecordWheelAndTouchScrollingCount(info); | |
| 770 } | 797 } |
| 771 | 798 |
| 772 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() | 799 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() |
| 773 const { | 800 const { |
| 774 return input_handler_weak_ptr_; | 801 return input_handler_weak_ptr_; |
| 775 } | 802 } |
| 776 | 803 |
| 777 void LayerTreeHost::UpdateBrowserControlsState( | 804 void LayerTreeHost::UpdateBrowserControlsState( |
| 778 BrowserControlsState constraints, | 805 BrowserControlsState constraints, |
| 779 BrowserControlsState current, | 806 BrowserControlsState current, |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1331 LayerListReverseIterator<Layer> LayerTreeHost::rend() { | 1358 LayerListReverseIterator<Layer> LayerTreeHost::rend() { |
| 1332 return LayerListReverseIterator<Layer>(nullptr); | 1359 return LayerListReverseIterator<Layer>(nullptr); |
| 1333 } | 1360 } |
| 1334 | 1361 |
| 1335 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1362 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
| 1336 for (auto* layer : *this) | 1363 for (auto* layer : *this) |
| 1337 layer->SetNeedsDisplay(); | 1364 layer->SetNeedsDisplay(); |
| 1338 } | 1365 } |
| 1339 | 1366 |
| 1340 } // namespace cc | 1367 } // namespace cc |
| OLD | NEW |