Index: ui/views/cocoa/bridged_content_view.mm |
diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm |
index 6b53860e202bfe7ff39ef2d021a92653b57c4382..57b9c434577dcbad31c6fc62d296e889dd949020 100644 |
--- a/ui/views/cocoa/bridged_content_view.mm |
+++ b/ui/views/cocoa/bridged_content_view.mm |
@@ -35,6 +35,13 @@ namespace { |
NSString* const kFullKeyboardAccessChangedNotification = |
@"com.apple.KeyboardUIModeDidChange"; |
+// We're sending simulated mouse events in CocoaWindowMoveLoop, and don't want |
+// BridgedContentView to react when we're starting/ending the RunMoveLoop. |
+// When reattaching the dragged tab we're sending the mouse down event to the |
+// parent window we don't have the pointer to, so this flag is global for the |
+// RunMoveLoop. |
+bool g_ignore_mouse_events = false; |
+ |
// Returns true if all four corners of |rect| are contained inside |path|. |
bool IsRectInsidePath(NSRect rect, NSBezierPath* path) { |
return [path containsPoint:rect.origin] && |
@@ -276,6 +283,10 @@ base::string16 AttributedSubstringForRangeHelper( |
return self; |
} |
++ (void)setIgnoreMouseEvents:(BOOL)flag { |
+ g_ignore_mouse_events = flag; |
+} |
+ |
- (void)clearView { |
textInputClient_ = nullptr; |
hostedView_ = nullptr; |
@@ -459,7 +470,7 @@ base::string16 AttributedSubstringForRangeHelper( |
// Translates the location of |theEvent| to toolkit-views coordinates and passes |
// the event to NativeWidgetMac for handling. |
- (void)mouseEvent:(NSEvent*)theEvent { |
- if (!hostedView_) |
+ if (!hostedView_ || g_ignore_mouse_events) |
return; |
ui::MouseEvent event(theEvent); |