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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 2890143003: Move ContextMenu show/hide state tracking to WebContents (Closed)
Patch Set: Fixing another compile error Created 3 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
Index: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index b27aebf241f040f0c2782136d7aea7d4b7963b50..d1c8b6ab5c35733e7d87452781a5f04862bf351e 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -736,6 +736,32 @@ RenderWidgetHostViewMac::GetFocusedRenderWidgetHostDelegate() {
return render_widget_host_->delegate();
}
+void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) {
kenrb 2017/06/05 17:39:16 Is this change intentional? It looks like you just
EhsanK 2017/06/06 12:34:46 Thanks! Moved it back where it used to be. The onl
+ // Create a fake mouse event to inform the render widget that the mouse
+ // left or entered.
+ NSWindow* window = [cocoa_view_ window];
+ // TODO(asvitkine): If the location outside of the event stream doesn't
+ // correspond to the current event (due to delayed event processing), then
+ // this may result in a cursor flicker if there are later mouse move events
+ // in the pipeline. Find a way to use the mouse location from the event that
+ // dismissed the context menu.
+ NSPoint location = [window mouseLocationOutsideOfEventStream];
+ NSTimeInterval event_time = [[NSApp currentEvent] timestamp];
+ NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved
+ location:location
+ modifierFlags:0
+ timestamp:event_time
+ windowNumber:window_number()
+ context:nil
+ eventNumber:0
+ clickCount:0
+ pressure:0];
+ WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_);
+ if (showing)
+ web_event.SetType(WebInputEvent::kMouseLeave);
+ ForwardMouseEvent(web_event);
+}
+
void RenderWidgetHostViewMac::UpdateBackingStoreProperties() {
if (!render_widget_host_)
return;
@@ -1136,34 +1162,6 @@ void RenderWidgetHostViewMac::StopSpeaking() {
// which implements NSServicesRequests protocol.
//
-void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) {
- RenderWidgetHostViewBase::SetShowingContextMenu(showing);
-
- // Create a fake mouse event to inform the render widget that the mouse
- // left or entered.
- NSWindow* window = [cocoa_view_ window];
- // TODO(asvitkine): If the location outside of the event stream doesn't
- // correspond to the current event (due to delayed event processing), then
- // this may result in a cursor flicker if there are later mouse move events
- // in the pipeline. Find a way to use the mouse location from the event that
- // dismissed the context menu.
- NSPoint location = [window mouseLocationOutsideOfEventStream];
- NSTimeInterval event_time = [[NSApp currentEvent] timestamp];
- NSEvent* event = [NSEvent mouseEventWithType:NSMouseMoved
- location:location
- modifierFlags:0
- timestamp:event_time
- windowNumber:window_number()
- context:nil
- eventNumber:0
- clickCount:0
- pressure:0];
- WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_);
- if (showing)
- web_event.SetType(WebInputEvent::kMouseLeave);
- ForwardMouseEvent(web_event);
-}
-
bool RenderWidgetHostViewMac::IsPopup() const {
return popup_type_ != blink::kWebPopupTypeNone;
}

Powered by Google App Engine
This is Rietveld 408576698