OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 TRACE_EVENT0("renderer", "RenderWidget::OnHandleInputEvent"); | 537 TRACE_EVENT0("renderer", "RenderWidget::OnHandleInputEvent"); |
538 PickleIterator iter(message); | 538 PickleIterator iter(message); |
539 | 539 |
540 const char* data; | 540 const char* data; |
541 int data_length; | 541 int data_length; |
542 handling_input_event_ = true; | 542 handling_input_event_ = true; |
543 if (!message.ReadData(&iter, &data, &data_length)) { | 543 if (!message.ReadData(&iter, &data, &data_length)) { |
544 handling_input_event_ = false; | 544 handling_input_event_ = false; |
545 return; | 545 return; |
546 } | 546 } |
547 DCHECK(webwidget_); | |
547 | 548 |
548 const WebInputEvent* input_event = | 549 const WebInputEvent* input_event = |
549 reinterpret_cast<const WebInputEvent*>(data); | 550 reinterpret_cast<const WebInputEvent*>(data); |
550 | 551 |
551 bool is_keyboard_shortcut = false; | 552 bool is_keyboard_shortcut = false; |
552 // is_keyboard_shortcut flag is only available for RawKeyDown events. | 553 // is_keyboard_shortcut flag is only available for RawKeyDown events. |
553 if (input_event->type == WebInputEvent::RawKeyDown) | 554 if (input_event->type == WebInputEvent::RawKeyDown) |
554 message.ReadBool(&iter, &is_keyboard_shortcut); | 555 message.ReadBool(&iter, &is_keyboard_shortcut); |
555 | 556 |
556 bool prevent_default = false; | 557 bool prevent_default = false; |
557 if (WebInputEvent::isMouseEventType(input_event->type)) { | 558 if (WebInputEvent::isMouseEventType(input_event->type)) { |
558 const WebMouseEvent& mouse_event = | 559 const WebMouseEvent& mouse_event = |
559 *static_cast<const WebMouseEvent*>(input_event); | 560 *static_cast<const WebMouseEvent*>(input_event); |
560 TRACE_EVENT2("renderer", "HandleMouseMove", | 561 TRACE_EVENT2("renderer", "HandleMouseMove", |
561 "x", mouse_event.x, "y", mouse_event.y); | 562 "x", mouse_event.x, "y", mouse_event.y); |
562 prevent_default = WillHandleMouseEvent(mouse_event); | 563 prevent_default = WillHandleMouseEvent(mouse_event); |
563 } | 564 } |
564 | 565 |
565 bool processed = prevent_default; | 566 bool processed = prevent_default; |
566 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { | 567 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { |
567 suppress_next_char_events_ = false; | 568 suppress_next_char_events_ = false; |
568 if (!processed && webwidget_) | 569 if (!processed && webwidget_) |
Tyler Breisacher (Chromium)
2012/07/26 18:32:15
I think you misread what Coverity is saying. This
Kyle Horimoto
2012/07/26 18:40:57
Line 587 dereferences webwidget_. If it is indeed
nduca
2012/07/26 19:27:11
Just say webwidget_ ? webwidget_xxx : yyy where ne
Kyle Horimoto
2012/07/26 21:58:52
Sorry, I'm don't understand exactly you're saying
| |
569 processed = webwidget_->handleInputEvent(*input_event); | 570 processed = webwidget_->handleInputEvent(*input_event); |
570 } | 571 } |
571 | 572 |
572 // If this RawKeyDown event corresponds to a browser keyboard shortcut and | 573 // If this RawKeyDown event corresponds to a browser keyboard shortcut and |
573 // it's not processed by webkit, then we need to suppress the upcoming Char | 574 // it's not processed by webkit, then we need to suppress the upcoming Char |
574 // events. | 575 // events. |
575 if (!processed && is_keyboard_shortcut) | 576 if (!processed && is_keyboard_shortcut) |
576 suppress_next_char_events_ = true; | 577 suppress_next_char_events_ = true; |
577 | 578 |
578 IPC::Message* response = | 579 IPC::Message* response = |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1773 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); | 1774 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); |
1774 } | 1775 } |
1775 | 1776 |
1776 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1777 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1777 return false; | 1778 return false; |
1778 } | 1779 } |
1779 | 1780 |
1780 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1781 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
1781 return false; | 1782 return false; |
1782 } | 1783 } |
OLD | NEW |