OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/renderer_host/render_widget_host_input_event_router.h" | 5 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "cc/quads/surface_draw_quad.h" | 10 #include "cc/quads/surface_draw_quad.h" |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 void RenderWidgetHostInputEventRouter::BubbleScrollEvent( | 549 void RenderWidgetHostInputEventRouter::BubbleScrollEvent( |
550 RenderWidgetHostViewBase* target_view, | 550 RenderWidgetHostViewBase* target_view, |
551 const blink::WebGestureEvent& event) { | 551 const blink::WebGestureEvent& event) { |
552 // TODO(kenrb, tdresser): This needs to be refactored when scroll latching | 552 // TODO(kenrb, tdresser): This needs to be refactored when scroll latching |
553 // is implemented (see https://crbug.com/526463). This design has some | 553 // is implemented (see https://crbug.com/526463). This design has some |
554 // race problems that can result in lost scroll delta, which are very | 554 // race problems that can result in lost scroll delta, which are very |
555 // difficult to resolve until this is changed to do all scroll targeting, | 555 // difficult to resolve until this is changed to do all scroll targeting, |
556 // including bubbling, based on GestureScrollBegin. | 556 // including bubbling, based on GestureScrollBegin. |
557 DCHECK(target_view); | 557 DCHECK(target_view); |
558 DCHECK(event.GetType() == blink::WebInputEvent::kGestureScrollUpdate || | 558 DCHECK(event.GetType() == blink::WebInputEvent::kGestureScrollUpdate || |
559 event.GetType() == blink::WebInputEvent::kGestureScrollEnd); | 559 event.GetType() == blink::WebInputEvent::kGestureScrollEnd || |
| 560 event.GetType() == blink::WebInputEvent::kGestureFlingStart); |
560 // DCHECK_XNOR the current and original bubble targets. Both should be set | 561 // DCHECK_XNOR the current and original bubble targets. Both should be set |
561 // if a bubbling gesture scroll is in progress. | 562 // if a bubbling gesture scroll is in progress. |
562 DCHECK(!first_bubbling_scroll_target_.target == | 563 DCHECK(!first_bubbling_scroll_target_.target == |
563 !bubbling_gesture_scroll_target_.target); | 564 !bubbling_gesture_scroll_target_.target); |
564 | 565 |
565 ui::LatencyInfo latency_info = | 566 ui::LatencyInfo latency_info = |
566 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent(event); | 567 ui::WebInputEventTraits::CreateLatencyInfoForWebGestureEvent(event); |
567 | 568 |
568 // If target_view is already set up for bubbled scrolls, we forward | 569 // If target_view is already set up for bubbled scrolls, we forward |
569 // the event to the current scroll target without further consideration. | 570 // the event to the current scroll target without further consideration. |
570 if (target_view == first_bubbling_scroll_target_.target) { | 571 if (target_view == first_bubbling_scroll_target_.target) { |
571 bubbling_gesture_scroll_target_.target->ProcessGestureEvent(event, | 572 bubbling_gesture_scroll_target_.target->ProcessGestureEvent(event, |
572 latency_info); | 573 latency_info); |
573 if (event.GetType() == blink::WebInputEvent::kGestureScrollEnd) { | 574 if (event.GetType() == blink::WebInputEvent::kGestureScrollEnd || |
| 575 event.GetType() == blink::WebInputEvent::kGestureFlingStart) { |
574 first_bubbling_scroll_target_.target = nullptr; | 576 first_bubbling_scroll_target_.target = nullptr; |
575 bubbling_gesture_scroll_target_.target = nullptr; | 577 bubbling_gesture_scroll_target_.target = nullptr; |
576 } | 578 } |
577 return; | 579 return; |
578 } | 580 } |
579 | 581 |
580 // Disregard GestureScrollEnd events going to non-current targets. | 582 // Disregard GestureScrollEnd events going to non-current targets. |
581 // These should only happen on ACKs of synthesized GSE events that are | 583 // These should only happen on ACKs of synthesized GSE events that are |
582 // sent from SendGestureScrollEnd calls, and are not relevant here. | 584 // sent from SendGestureScrollEnd calls, and are not relevant here. |
583 if (event.GetType() == blink::WebInputEvent::kGestureScrollEnd) | 585 if (event.GetType() == blink::WebInputEvent::kGestureScrollEnd) |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 std::vector<RenderWidgetHostView*> | 836 std::vector<RenderWidgetHostView*> |
835 RenderWidgetHostInputEventRouter::GetRenderWidgetHostViewsForTests() const { | 837 RenderWidgetHostInputEventRouter::GetRenderWidgetHostViewsForTests() const { |
836 std::vector<RenderWidgetHostView*> hosts; | 838 std::vector<RenderWidgetHostView*> hosts; |
837 for (auto entry : owner_map_) | 839 for (auto entry : owner_map_) |
838 hosts.push_back(entry.second); | 840 hosts.push_back(entry.second); |
839 | 841 |
840 return hosts; | 842 return hosts; |
841 } | 843 } |
842 | 844 |
843 } // namespace content | 845 } // namespace content |
OLD | NEW |