Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Unified Diff: content/renderer/render_widget.cc

Issue 288393004: [DevTools] Send ack early when paused in mouse move to keep events coming. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 5c82eda23832f6bf500bb5cb2975ce53e2c71cbd..6d69198747eb5cc87c571a6550c9579cdc1c581d 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -4,6 +4,7 @@
#include "content/renderer/render_widget.h"
+#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
@@ -373,7 +374,8 @@ RenderWidget::RenderWidget(blink::WebPopupType popup_type,
has_focus_(false),
handling_input_event_(false),
handling_ime_event_(false),
- handling_touchstart_event_(false),
+ handling_event_type_(WebInputEvent::Undefined),
+ ignore_ack_for_mouse_move_from_debugger_(false),
closing_(false),
is_swapped_out_(swapped_out),
input_method_is_active_(false),
@@ -903,11 +905,12 @@ void RenderWidget::OnSwapBuffersComplete() {
void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
const ui::LatencyInfo& latency_info,
bool is_keyboard_shortcut) {
- handling_input_event_ = true;
- if (!input_event) {
- handling_input_event_ = false;
+ base::AutoReset<bool> handling_input_event_resetter(
+ &handling_input_event_, true);
+ if (!input_event)
return;
- }
+ base::AutoReset<WebInputEvent::Type> handling_event_type_resetter(
+ &handling_event_type_, input_event->type);
base::TimeTicks start_time;
if (base::TimeTicks::IsHighResNowFastAndReliable())
@@ -993,9 +996,6 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
prevent_default = prevent_default || WillHandleGestureEvent(gesture_event);
}
- if (input_event->type == WebInputEvent::TouchStart)
- handling_touchstart_event_ = true;
-
bool processed = prevent_default;
if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) {
suppress_next_char_events_ = false;
@@ -1003,8 +1003,6 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
processed = webwidget_->handleInputEvent(*input_event);
}
- handling_touchstart_event_ = false;
-
// If this RawKeyDown event corresponds to a browser keyboard shortcut and
// it's not processed by webkit, then we need to suppress the upcoming Char
// events.
@@ -1053,7 +1051,11 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
TRACE_EVENT_SYNTHETIC_DELAY_END("blink.HandleInputEvent");
- if (!WebInputEventTraits::IgnoresAckDisposition(*input_event)) {
+ // Note that we can't use handling_event_type_ here since it will be overriden
+ // by reentrant calls for events after the paused one.
+ bool no_ack = ignore_ack_for_mouse_move_from_debugger_ &&
+ input_event->type == WebInputEvent::MouseMove;
+ if (!WebInputEventTraits::IgnoresAckDisposition(*input_event) && !no_ack) {
InputHostMsg_HandleInputEvent_ACK_Params ack;
ack.type = input_event->type;
ack.state = ack_result;
@@ -1080,6 +1082,7 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
Send(response.release());
}
}
+ ignore_ack_for_mouse_move_from_debugger_ = false;
#if defined(OS_ANDROID)
// Allow the IME to be shown when the focus changes as a consequence
@@ -1094,8 +1097,6 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
UpdateTextInputState(SHOW_IME_IF_NEEDED, FROM_IME);
#endif
- handling_input_event_ = false;
-
if (!prevent_default) {
if (WebInputEvent::isKeyboardEventType(input_event->type))
DidHandleKeyEvent();
@@ -1517,6 +1518,21 @@ bool RenderWidget::ShouldHandleImeEvent() {
#endif
}
+bool RenderWidget::SendAckForMouseMoveFromDebugger() {
+ if (handling_event_type_ == WebInputEvent::MouseMove) {
+ InputHostMsg_HandleInputEvent_ACK_Params ack;
+ ack.type = handling_event_type_;
+ ack.state = INPUT_EVENT_ACK_STATE_CONSUMED;
+ Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, ack));
+ return true;
+ }
+ return false;
+}
+
+void RenderWidget::IgnoreAckForMouseMoveFromDebugger() {
+ ignore_ack_for_mouse_move_from_debugger_ = true;
+}
+
void RenderWidget::SetDeviceScaleFactor(float device_scale_factor) {
if (device_scale_factor_ == device_scale_factor)
return;
@@ -1963,7 +1979,7 @@ void RenderWidget::setTouchAction(
// Ignore setTouchAction calls that result from synthetic touch events (eg.
// when blink is emulating touch with mouse).
- if (!handling_touchstart_event_)
+ if (handling_event_type_ != WebInputEvent::TouchStart)
return;
// Verify the same values are used by the types so we can cast between them.
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698