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

Side by Side Diff: ui/base/cocoa/tool_tip_base_view.mm

Issue 2686723003: Use correct timestamp for generated mouse events on Mac. (Closed)
Patch Set: fix Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "ui/base/cocoa/tool_tip_base_view.h" 5 #import "ui/base/cocoa/tool_tip_base_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 // Below is the nasty tooltip stuff -- copied from WebKit's WebHTMLView.mm 9 // Below is the nasty tooltip stuff -- copied from WebKit's WebHTMLView.mm
10 // with minor modifications for code style and commenting. 10 // with minor modifications for code style and commenting.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 continue; 124 continue;
125 DCHECK(tag == kTrackingRectTag); 125 DCHECK(tag == kTrackingRectTag);
126 trackingRectOwner_ = nil; 126 trackingRectOwner_ = nil;
127 } 127 }
128 } 128 }
129 129
130 // Sends a fake NSMouseExited event to the view for its current tracking rect. 130 // Sends a fake NSMouseExited event to the view for its current tracking rect.
131 - (void)_sendToolTipMouseExited { 131 - (void)_sendToolTipMouseExited {
132 // Nothing matters except window, trackingNumber, and userData. 132 // Nothing matters except window, trackingNumber, and userData.
133 int windowNumber = [[self window] windowNumber]; 133 int windowNumber = [[self window] windowNumber];
134 NSTimeInterval eventTime = [[NSApp currentEvent] timestamp];
134 NSEvent* fakeEvent = [NSEvent enterExitEventWithType:NSMouseExited 135 NSEvent* fakeEvent = [NSEvent enterExitEventWithType:NSMouseExited
135 location:NSZeroPoint 136 location:NSZeroPoint
136 modifierFlags:0 137 modifierFlags:0
137 timestamp:0 138 timestamp:eventTime
138 windowNumber:windowNumber 139 windowNumber:windowNumber
139 context:NULL 140 context:NULL
140 eventNumber:0 141 eventNumber:0
141 trackingNumber:kTrackingRectTag 142 trackingNumber:kTrackingRectTag
142 userData:trackingRectUserData_]; 143 userData:trackingRectUserData_];
143 [trackingRectOwner_ mouseExited:fakeEvent]; 144 [trackingRectOwner_ mouseExited:fakeEvent];
144 } 145 }
145 146
146 // Sends a fake NSMouseEntered event to the view for its current tracking rect. 147 // Sends a fake NSMouseEntered event to the view for its current tracking rect.
147 - (void)_sendToolTipMouseEntered { 148 - (void)_sendToolTipMouseEntered {
148 // Nothing matters except window, trackingNumber, and userData. 149 // Nothing matters except window, trackingNumber, and userData.
149 int windowNumber = [[self window] windowNumber]; 150 int windowNumber = [[self window] windowNumber];
151 NSTimeInterval eventTime = [[NSApp currentEvent] timestamp];
150 NSEvent* fakeEvent = [NSEvent enterExitEventWithType:NSMouseEntered 152 NSEvent* fakeEvent = [NSEvent enterExitEventWithType:NSMouseEntered
151 location:NSZeroPoint 153 location:NSZeroPoint
152 modifierFlags:0 154 modifierFlags:0
153 timestamp:0 155 timestamp:eventTime
154 windowNumber:windowNumber 156 windowNumber:windowNumber
155 context:NULL 157 context:NULL
156 eventNumber:0 158 eventNumber:0
157 trackingNumber:kTrackingRectTag 159 trackingNumber:kTrackingRectTag
158 userData:trackingRectUserData_]; 160 userData:trackingRectUserData_];
159 [trackingRectOwner_ mouseEntered:fakeEvent]; 161 [trackingRectOwner_ mouseEntered:fakeEvent];
160 } 162 }
161 163
162 // Sets the view's current tooltip, to be displayed at the current mouse 164 // Sets the view's current tooltip, to be displayed at the current mouse
163 // location. (This does not make the tooltip appear -- as usual, it only 165 // location. (This does not make the tooltip appear -- as usual, it only
(...skipping 25 matching lines...) Expand all
189 191
190 // NSView calls this to get the text when displaying the tooltip. 192 // NSView calls this to get the text when displaying the tooltip.
191 - (NSString *)view:(NSView *)view 193 - (NSString *)view:(NSView *)view
192 stringForToolTip:(NSToolTipTag)tag 194 stringForToolTip:(NSToolTipTag)tag
193 point:(NSPoint)point 195 point:(NSPoint)point
194 userData:(void *)data { 196 userData:(void *)data {
195 return [[toolTip_ copy] autorelease]; 197 return [[toolTip_ copy] autorelease];
196 } 198 }
197 199
198 @end 200 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698