diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-15 18:16:55 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-15 18:16:55 +0000 |
commit | 904c5b70384be6b7b4f716c5c4ed524a89bbf11b (patch) | |
tree | 147036703b003a7fa3c1e4f8997e80d819b1f454 /ui | |
parent | ce143f104e5952ee384127e35a254469bb0a84dc (diff) | |
download | chromium_src-904c5b70384be6b7b4f716c5c4ed524a89bbf11b.zip chromium_src-904c5b70384be6b7b4f716c5c4ed524a89bbf11b.tar.gz chromium_src-904c5b70384be6b7b4f716c5c4ed524a89bbf11b.tar.bz2 |
Revert 188430 "mac: Fix sending of mouse moved events after resi..."
Somehow broke RenderWidgetHostViewMacTest.FullscreenCloseOnEscape in
content_unittests.
> mac: Fix sending of mouse moved events after resizing window's lower left corner
>
> NSTrackingInVisibleRect is apparently just broken (see
> http://openradar.appspot.com/radar?id=2773401 ), so keep the tracking area
> frame up to date manually.
>
> I tried to write a test, but failed to simulate mouse events that impress
> NSTrackingArea, see patch sets on the review.
>
> BUG=176725
> TEST=see bug: Open the html file in the first comment, then put the cursor in the inside lower left corner of the window and click-drag-resize the window so that it grows in y direction (x direction doesn't matter). The js-triggered position display should continue updating when moving the cursor to the upper right (further into the window) after the resize operation.
>
> Review URL: https://codereview.chromium.org/12330108
TBR=thakis@chromium.org
Review URL: https://codereview.chromium.org/12512007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/cocoa/base_view.h | 2 | ||||
-rw-r--r-- | ui/base/cocoa/base_view.mm | 39 |
2 files changed, 19 insertions, 22 deletions
diff --git a/ui/base/cocoa/base_view.h b/ui/base/cocoa/base_view.h index 4c40502..136b125 100644 --- a/ui/base/cocoa/base_view.h +++ b/ui/base/cocoa/base_view.h @@ -22,6 +22,8 @@ scoped_nsobject<NSEvent> pendingExitEvent_; } +- (id)initWithFrame:(NSRect)frame; + // Override these methods in a subclass. - (void)mouseEvent:(NSEvent *)theEvent; - (void)keyEvent:(NSEvent *)theEvent; diff --git a/ui/base/cocoa/base_view.mm b/ui/base/cocoa/base_view.mm index ad1f1fe..d5f89e8 100644 --- a/ui/base/cocoa/base_view.mm +++ b/ui/base/cocoa/base_view.mm @@ -8,15 +8,26 @@ NSString* kViewDidBecomeFirstResponder = @"Chromium.kViewDidBecomeFirstResponder"; NSString* kSelectionDirection = @"Chromium.kSelectionDirection"; -const int kTrackingOptions = NSTrackingMouseMoved | - NSTrackingMouseEnteredAndExited | - NSTrackingActiveAlways; - @implementation BaseView +- (id)initWithFrame:(NSRect)frame { + self = [super initWithFrame:frame]; + if (self) { + trackingArea_ = + [[NSTrackingArea alloc] initWithRect:frame + options:NSTrackingMouseMoved | + NSTrackingMouseEnteredAndExited | + NSTrackingActiveInActiveApp | + NSTrackingInVisibleRect + owner:self + userInfo:nil]; + [self addTrackingArea:trackingArea_]; + } + return self; +} + - (void)dealloc { - if (trackingArea_) - [self removeTrackingArea:trackingArea_]; + [self removeTrackingArea:trackingArea_]; [trackingArea_ release]; [super dealloc]; @@ -132,20 +143,4 @@ const int kTrackingOptions = NSTrackingMouseMoved | return new_rect; } -- (void)updateTrackingAreas { - [super updateTrackingAreas]; - - // NSTrackingInVisibleRect doesn't work correctly with Lion's window resizing, - // http://crbug.com/176725 / http://openradar.appspot.com/radar?id=2773401 . - // Tear down old tracking area and create a new one as workaround. - if (trackingArea_) - [self removeTrackingArea:trackingArea_]; - [trackingArea_ release]; - trackingArea_ = [[NSTrackingArea alloc] initWithRect:[self frame] - options:kTrackingOptions - owner:self - userInfo:nil]; - [self addTrackingArea:trackingArea_]; -} - @end |