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

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

Issue 155875: Kill popups when scrolling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 21106)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -434,6 +434,22 @@
}
- (void)scrollWheel:(NSEvent *)theEvent {
+ // On Windows, popups are implemented with a popup window style, so that when
+ // an event comes in that would "cancel" it, it receives the OnCancelMode
+ // message and can kill itself. Alas, on the Mac, views cannot capture events
+ // outside of themselves. While a click outside a popup kills it, that's just
+ // a defocusing of the text field in WebCore and our editor client kills the
+ // popup. But a scroll wheel event outside a popup must kill it.
+ //
+ // Thus this lovely case of filicide. If this view can be the key view, it is
+ // not a popup. Therefore, if it has any children, they are popups that need
+ // to be canceled.
+ if (canBeKeyView_) {
+ for (NSView* subview in [self subviews]) {
+ ((RenderWidgetHostViewCocoa*)subview)->renderWidgetHostView_->KillSelf();
+ }
+ }
+
const WebMouseWheelEvent& event =
WebInputEventFactory::mouseWheelEvent(theEvent, self);
if (renderWidgetHostView_->render_widget_host_)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698