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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2637403012: Suppress ET_MOUSE_MOVE when the mouse hasn't moved on Windows. (Closed)
Patch Set: Move to render_host_widget Created 3 years, 11 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/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index eb6449f0c8996436534491c40ce5542f4c6c6d3e..5b940bfb9ceb5b5485fc6385e917062afb5724ce 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -217,6 +217,34 @@ void EmbedCallback(bool result) {
DVLOG(1) << "embed failed";
}
+// We need to watch for mouse events outside a Web Popup or its parent
+// and dismiss the popup for certain events.
+class EventFilterForMouseMove : public ui::EventHandler {
+ public:
+ EventFilterForMouseMove() {
+ aura::Env::GetInstance()->AddPreTargetHandler(this);
sadrul 2017/01/27 00:22:03 This should install the event-handler on the RWHVA
+ }
+
+ ~EventFilterForMouseMove() override {
+ aura::Env::GetInstance()->RemovePreTargetHandler(this);
+ }
+
+ // Overridden from ui::EventHandler
+ void OnMouseEvent(ui::MouseEvent* event) override {
+ if (event->type() != ui::ET_MOUSE_MOVED)
+ return;
+ if (event->location() == last_location_) {
+ event->SetHandled();
+ return;
+ }
+ last_location_ = event->location();
+ }
+
+ private:
+ gfx::Point last_location_;
+ DISALLOW_COPY_AND_ASSIGN(EventFilterForMouseMove);
+};
+
} // namespace
// We need to watch for mouse events outside a Web Popup or its parent
@@ -420,6 +448,13 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,
// first to rebaseline some unreliable layout tests.
ignore_result(rvh->GetWebkitPreferences());
}
+
+#if defined(OS_WIN)
+ // Windows will post a WM_MOUSEMOVE after a click event. Other platforms
+ // do not do this so we filter out mouse moves where the position doesn't
+ // change from the last event.
+ event_filter_for_mouse_move_.reset(new EventFilterForMouseMove());
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -1853,6 +1888,8 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
event_filter_for_popup_exit_.reset();
#if defined(OS_WIN)
+ event_filter_for_mouse_move_.reset();
+
// The LegacyRenderWidgetHostHWND window should have been destroyed in
// RenderWidgetHostViewAura::OnWindowDestroying and the pointer should
// be set to NULL.
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698