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

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

Issue 2396083002: Clear last MouseMove root view in RWHIER if that view gets destroyed (Closed)
Patch Set: Not re-enabling test Created 4 years, 2 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
Index: content/browser/renderer_host/render_widget_host_input_event_router.cc
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc
index b0b580f1a0c9a1434153c6bf847f60f7f8ceefe0..85cd8ab7327e8318f757d0e20b1f991573b5719d 100644
--- a/content/browser/renderer_host/render_widget_host_input_event_router.cc
+++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -90,7 +90,7 @@ void RenderWidgetHostInputEventRouter::OnRenderWidgetHostViewBaseDestroyed(
else
last_mouse_move_target_ = nullptr;
- if (!last_mouse_move_target_)
+ if (!last_mouse_move_target_ || view == last_mouse_move_root_view_)
last_mouse_move_root_view_ = nullptr;
}
}
@@ -382,27 +382,36 @@ void RenderWidgetHostInputEventRouter::SendMouseEnterOrLeaveEvents(
std::vector<RenderWidgetHostViewBase*> exited_views;
RenderWidgetHostViewBase* cur_view = target;
entered_views.push_back(cur_view);
- while (cur_view != root_view) {
- // Non-root RWHVs are guaranteed to be RenderWidgetHostViewChildFrames.
+ while (cur_view->IsRenderWidgetHostViewChildFrame()) {
cur_view =
static_cast<RenderWidgetHostViewChildFrame*>(cur_view)->GetParentView();
// cur_view can possibly be nullptr for guestviews that are not currently
// connected to the webcontents tree.
- if (!cur_view)
- break;
+ if (!cur_view) {
+ last_mouse_move_target_ = target;
+ last_mouse_move_root_view_ = root_view;
+ return;
+ }
entered_views.push_back(cur_view);
}
+ // Non-root RWHVs are guaranteed to be RenderWidgetHostViewChildFrames,
+ // as long as they are the only embeddable RWHVs.
+ DCHECK_EQ(cur_view, root_view);
cur_view = last_mouse_move_target_;
if (cur_view) {
exited_views.push_back(cur_view);
- while (cur_view != root_view) {
+ while (cur_view->IsRenderWidgetHostViewChildFrame()) {
cur_view = static_cast<RenderWidgetHostViewChildFrame*>(cur_view)
->GetParentView();
- if (!cur_view)
- break;
+ if (!cur_view) {
+ last_mouse_move_target_ = target;
+ last_mouse_move_root_view_ = root_view;
+ return;
+ }
exited_views.push_back(cur_view);
}
+ DCHECK_EQ(cur_view, root_view);
}
// This removes common ancestors from the root downward.

Powered by Google App Engine
This is Rietveld 408576698