OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1722 // Use hitTest to check whether the mouse is over a nonWebContentView - in | 1722 // Use hitTest to check whether the mouse is over a nonWebContentView - in |
1723 // which case the mouse event should not be handled by the render host. | 1723 // which case the mouse event should not be handled by the render host. |
1724 const SEL nonWebContentViewSelector = @selector(nonWebContentView); | 1724 const SEL nonWebContentViewSelector = @selector(nonWebContentView); |
1725 NSView* contentView = [window contentView]; | 1725 NSView* contentView = [window contentView]; |
1726 NSView* view = [contentView hitTest:[theEvent locationInWindow]]; | 1726 NSView* view = [contentView hitTest:[theEvent locationInWindow]]; |
1727 // Traverse the superview hierarchy as the hitTest will return the frontmost | 1727 // Traverse the superview hierarchy as the hitTest will return the frontmost |
1728 // view, such as an NSTextView, while nonWebContentView may be specified by | 1728 // view, such as an NSTextView, while nonWebContentView may be specified by |
1729 // its parent view. | 1729 // its parent view. |
1730 while (view) { | 1730 while (view) { |
1731 if ([view respondsToSelector:nonWebContentViewSelector] && | 1731 if ([view respondsToSelector:nonWebContentViewSelector] && |
1732 [view performSelector:nonWebContentViewSelector]) { | 1732 [view performSelector:nonWebContentViewSelector]) { |
Avi (use Gerrit)
2013/05/28 20:11:06
What the heck?
Alexei Svitkine (slow)
2013/05/28 20:37:59
You can blame Mento for this, if you want. ;)
I t
Avi (use Gerrit)
2013/05/28 20:41:54
:( I would hope for something a little more magica
Alexei Svitkine (slow)
2013/05/28 20:44:29
(It does that too using the -hitTest: above. The p
Avi (use Gerrit)
2013/05/28 20:47:52
Oh. Eeew.
Does this change now that we have compo
Alexei Svitkine (slow)
2013/05/28 20:58:12
No clue.
| |
1733 // The cursor is over a nonWebContentView - ignore this mouse event. | 1733 // The cursor is over a nonWebContentView - ignore this mouse event. |
1734 return YES; | 1734 return YES; |
1735 } | 1735 } |
1736 if ([view isKindOfClass:[self class]] && ![view isEqual:self]) { | |
1737 // The cursor is over an overlapping render widget. This check is done by | |
1738 // both views so the one that's returned by -hitTest: will end up | |
1739 // processing the event. | |
1740 return YES; | |
1741 } | |
1736 view = [view superview]; | 1742 view = [view superview]; |
1737 } | 1743 } |
1738 return NO; | 1744 return NO; |
1739 } | 1745 } |
1740 | 1746 |
1741 - (void)mouseEvent:(NSEvent*)theEvent { | 1747 - (void)mouseEvent:(NSEvent*)theEvent { |
1742 TRACE_EVENT0("browser", "RenderWidgetHostViewCocoa::mouseEvent"); | 1748 TRACE_EVENT0("browser", "RenderWidgetHostViewCocoa::mouseEvent"); |
1743 if (delegate_ && [delegate_ respondsToSelector:@selector(handleEvent:)]) { | 1749 if (delegate_ && [delegate_ respondsToSelector:@selector(handleEvent:)]) { |
1744 BOOL handled = [delegate_ handleEvent:theEvent]; | 1750 BOOL handled = [delegate_ handleEvent:theEvent]; |
1745 if (handled) | 1751 if (handled) |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3400 if (!string) return NO; | 3406 if (!string) return NO; |
3401 | 3407 |
3402 // If the user is currently using an IME, confirm the IME input, | 3408 // If the user is currently using an IME, confirm the IME input, |
3403 // and then insert the text from the service, the same as TextEdit and Safari. | 3409 // and then insert the text from the service, the same as TextEdit and Safari. |
3404 [self confirmComposition]; | 3410 [self confirmComposition]; |
3405 [self insertText:string]; | 3411 [self insertText:string]; |
3406 return YES; | 3412 return YES; |
3407 } | 3413 } |
3408 | 3414 |
3409 @end | 3415 @end |
OLD | NEW |