OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 const WebInputEvent* input_event = | 474 const WebInputEvent* input_event = |
475 reinterpret_cast<const WebInputEvent*>(data); | 475 reinterpret_cast<const WebInputEvent*>(data); |
476 | 476 |
477 bool is_keyboard_shortcut = false; | 477 bool is_keyboard_shortcut = false; |
478 // is_keyboard_shortcut flag is only available for RawKeyDown events. | 478 // is_keyboard_shortcut flag is only available for RawKeyDown events. |
479 if (input_event->type == WebInputEvent::RawKeyDown) | 479 if (input_event->type == WebInputEvent::RawKeyDown) |
480 message.ReadBool(&iter, &is_keyboard_shortcut); | 480 message.ReadBool(&iter, &is_keyboard_shortcut); |
481 | 481 |
482 bool prevent_default = false; | 482 bool prevent_default = false; |
483 if (WebInputEvent::isMouseEventType(input_event->type)) { | 483 if (WebInputEvent::isMouseEventType(input_event->type)) { |
484 prevent_default = WillHandleMouseEvent( | 484 const WebMouseEvent& mouse_event = |
485 *(static_cast<const WebMouseEvent*>(input_event))); | 485 *static_cast<const WebMouseEvent*>(input_event); |
| 486 TRACE_EVENT2("renderer", "HandleMouseMove", |
| 487 "x", mouse_event.x, "y", mouse_event.y); |
| 488 prevent_default = WillHandleMouseEvent(mouse_event); |
486 } | 489 } |
487 | 490 |
488 bool processed = prevent_default; | 491 bool processed = prevent_default; |
489 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { | 492 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { |
490 suppress_next_char_events_ = false; | 493 suppress_next_char_events_ = false; |
491 if (!processed && webwidget_) | 494 if (!processed && webwidget_) |
492 processed = webwidget_->handleInputEvent(*input_event); | 495 processed = webwidget_->handleInputEvent(*input_event); |
493 } | 496 } |
494 | 497 |
495 // If this RawKeyDown event corresponds to a browser keyboard shortcut and | 498 // If this RawKeyDown event corresponds to a browser keyboard shortcut and |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 // rects to save the browser process from doing unecessary work. | 875 // rects to save the browser process from doing unecessary work. |
873 pending_update_params_->bitmap_rect = bounds; | 876 pending_update_params_->bitmap_rect = bounds; |
874 pending_update_params_->scroll_rect = gfx::Rect(); | 877 pending_update_params_->scroll_rect = gfx::Rect(); |
875 // We don't need an ack, because we're not sharing a DIB with the browser. | 878 // We don't need an ack, because we're not sharing a DIB with the browser. |
876 // If it needs to (e.g. composited UI), the GPU process does its own ACK | 879 // If it needs to (e.g. composited UI), the GPU process does its own ACK |
877 // with the browser for the GPU surface. | 880 // with the browser for the GPU surface. |
878 pending_update_params_->needs_ack = false; | 881 pending_update_params_->needs_ack = false; |
879 webwidget_->composite(false); | 882 webwidget_->composite(false); |
880 } | 883 } |
881 | 884 |
| 885 // If we're holding a pending input event ACK, send the ACK before sending the |
| 886 // UpdateReply message so we can receive another input event before the |
| 887 // UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within |
| 888 // the UpdateRect IPC message handler. |
| 889 if (pending_input_event_ack_.get()) |
| 890 Send(pending_input_event_ack_.release()); |
| 891 |
882 // If composite() called SwapBuffers, pending_update_params_ will be reset (in | 892 // If composite() called SwapBuffers, pending_update_params_ will be reset (in |
883 // OnSwapBuffersPosted), meaning a message has been added to the | 893 // OnSwapBuffersPosted), meaning a message has been added to the |
884 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send | 894 // updates_pending_swap_ queue, that will be sent later. Otherwise, we send |
885 // the message now. | 895 // the message now. |
886 if (pending_update_params_.get()) { | 896 if (pending_update_params_.get()) { |
887 // sending an ack to browser process that the paint is complete... | 897 // sending an ack to browser process that the paint is complete... |
888 update_reply_pending_ = pending_update_params_->needs_ack; | 898 update_reply_pending_ = pending_update_params_->needs_ack; |
889 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_)); | 899 Send(new ViewHostMsg_UpdateRect(routing_id_, *pending_update_params_)); |
890 pending_update_params_.reset(); | 900 pending_update_params_.reset(); |
891 } | 901 } |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 } | 1553 } |
1544 } | 1554 } |
1545 | 1555 |
1546 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1556 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1547 return false; | 1557 return false; |
1548 } | 1558 } |
1549 | 1559 |
1550 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1560 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1551 return false; | 1561 return false; |
1552 } | 1562 } |
OLD | NEW |