| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 bool not_consumed = ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || | 342 bool not_consumed = ack_result == INPUT_EVENT_ACK_STATE_NOT_CONSUMED || |
| 343 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 343 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
| 344 // GestureScrollBegin is consumed by the target frame and not forwarded, | 344 // GestureScrollBegin is consumed by the target frame and not forwarded, |
| 345 // because we don't know whether we will need to bubble scroll until we | 345 // because we don't know whether we will need to bubble scroll until we |
| 346 // receive a GestureScrollUpdate ACK. GestureScrollUpdate with unused | 346 // receive a GestureScrollUpdate ACK. GestureScrollUpdate with unused |
| 347 // scroll extent is forwarded for bubbling, while GestureScrollEnd is | 347 // scroll extent is forwarded for bubbling, while GestureScrollEnd is |
| 348 // always forwarded and handled according to current scroll state in the | 348 // always forwarded and handled according to current scroll state in the |
| 349 // RenderWidgetHostInputEventRouter. | 349 // RenderWidgetHostInputEventRouter. |
| 350 if (!frame_connector_) | 350 if (!frame_connector_) |
| 351 return; | 351 return; |
| 352 if ((event.type == blink::WebInputEvent::GestureScrollUpdate && | 352 if ((event.type() == blink::WebInputEvent::GestureScrollUpdate && |
| 353 not_consumed) || | 353 not_consumed) || |
| 354 event.type == blink::WebInputEvent::GestureScrollEnd) | 354 event.type() == blink::WebInputEvent::GestureScrollEnd) |
| 355 frame_connector_->BubbleScrollEvent(event); | 355 frame_connector_->BubbleScrollEvent(event); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void RenderWidgetHostViewChildFrame::SurfaceDrawn( | 358 void RenderWidgetHostViewChildFrame::SurfaceDrawn( |
| 359 uint32_t compositor_frame_sink_id) { | 359 uint32_t compositor_frame_sink_id) { |
| 360 DCHECK_GT(ack_pending_count_, 0U); | 360 DCHECK_GT(ack_pending_count_, 0U); |
| 361 if (host_) { | 361 if (host_) { |
| 362 host_->Send(new ViewMsg_ReclaimCompositorResources( | 362 host_->Send(new ViewMsg_ReclaimCompositorResources( |
| 363 host_->GetRoutingID(), compositor_frame_sink_id, true /* is_swap_ack */, | 363 host_->GetRoutingID(), compositor_frame_sink_id, true /* is_swap_ack */, |
| 364 surface_returned_resources_)); | 364 surface_returned_resources_)); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent( | 496 void RenderWidgetHostViewChildFrame::ProcessMouseWheelEvent( |
| 497 const blink::WebMouseWheelEvent& event, | 497 const blink::WebMouseWheelEvent& event, |
| 498 const ui::LatencyInfo& latency) { | 498 const ui::LatencyInfo& latency) { |
| 499 if (event.deltaX != 0 || event.deltaY != 0) | 499 if (event.deltaX != 0 || event.deltaY != 0) |
| 500 host_->ForwardWheelEventWithLatencyInfo(event, latency); | 500 host_->ForwardWheelEventWithLatencyInfo(event, latency); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void RenderWidgetHostViewChildFrame::ProcessTouchEvent( | 503 void RenderWidgetHostViewChildFrame::ProcessTouchEvent( |
| 504 const blink::WebTouchEvent& event, | 504 const blink::WebTouchEvent& event, |
| 505 const ui::LatencyInfo& latency) { | 505 const ui::LatencyInfo& latency) { |
| 506 if (event.type == blink::WebInputEvent::TouchStart && | 506 if (event.type() == blink::WebInputEvent::TouchStart && frame_connector_ && |
| 507 frame_connector_ && !frame_connector_->HasFocus()) { | 507 !frame_connector_->HasFocus()) { |
| 508 frame_connector_->FocusRootView(); | 508 frame_connector_->FocusRootView(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 host_->ForwardTouchEventWithLatencyInfo(event, latency); | 511 host_->ForwardTouchEventWithLatencyInfo(event, latency); |
| 512 } | 512 } |
| 513 | 513 |
| 514 void RenderWidgetHostViewChildFrame::ProcessGestureEvent( | 514 void RenderWidgetHostViewChildFrame::ProcessGestureEvent( |
| 515 const blink::WebGestureEvent& event, | 515 const blink::WebGestureEvent& event, |
| 516 const ui::LatencyInfo& latency) { | 516 const ui::LatencyInfo& latency) { |
| 517 host_->ForwardGestureEventWithLatencyInfo(event, latency); | 517 host_->ForwardGestureEventWithLatencyInfo(event, latency); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 return; | 693 return; |
| 694 | 694 |
| 695 if (needs_begin_frames) | 695 if (needs_begin_frames) |
| 696 begin_frame_source_->AddObserver(this); | 696 begin_frame_source_->AddObserver(this); |
| 697 else | 697 else |
| 698 begin_frame_source_->RemoveObserver(this); | 698 begin_frame_source_->RemoveObserver(this); |
| 699 } | 699 } |
| 700 | 700 |
| 701 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( | 701 InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent( |
| 702 const blink::WebInputEvent& input_event) { | 702 const blink::WebInputEvent& input_event) { |
| 703 if (input_event.type == blink::WebInputEvent::GestureFlingStart) { | 703 if (input_event.type() == blink::WebInputEvent::GestureFlingStart) { |
| 704 const blink::WebGestureEvent& gesture_event = | 704 const blink::WebGestureEvent& gesture_event = |
| 705 static_cast<const blink::WebGestureEvent&>(input_event); | 705 static_cast<const blink::WebGestureEvent&>(input_event); |
| 706 // Zero-velocity touchpad flings are an Aura-specific signal that the | 706 // Zero-velocity touchpad flings are an Aura-specific signal that the |
| 707 // touchpad scroll has ended, and should not be forwarded to the renderer. | 707 // touchpad scroll has ended, and should not be forwarded to the renderer. |
| 708 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && | 708 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad && |
| 709 !gesture_event.data.flingStart.velocityX && | 709 !gesture_event.data.flingStart.velocityX && |
| 710 !gesture_event.data.flingStart.velocityY) { | 710 !gesture_event.data.flingStart.velocityY) { |
| 711 // Here we indicate that there was no consumer for this event, as | 711 // Here we indicate that there was no consumer for this event, as |
| 712 // otherwise the fling animation system will try to run an animation | 712 // otherwise the fling animation system will try to run an animation |
| 713 // and will also expect a notification when the fling ends. Since | 713 // and will also expect a notification when the fling ends. Since |
| (...skipping 23 matching lines...) Expand all Loading... |
| 737 | 737 |
| 738 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { | 738 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { |
| 739 return true; | 739 return true; |
| 740 } | 740 } |
| 741 | 741 |
| 742 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { | 742 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { |
| 743 return cc::SurfaceId(frame_sink_id_, local_frame_id_); | 743 return cc::SurfaceId(frame_sink_id_, local_frame_id_); |
| 744 }; | 744 }; |
| 745 | 745 |
| 746 } // namespace content | 746 } // namespace content |
| OLD | NEW |