Fixed tracking event listener test to actually look for tracking events, fixed some method documentation

This commit is contained in:
Aparajita Fishman
2013-01-30 18:15:42 +08:00
parent 6e424478f1
commit eefec02de4
2 changed files with 19 additions and 14 deletions
+11 -9
View File
@@ -915,11 +915,12 @@ CPRunContinuesResponse = -1002;
/*!
Fires a callback function when an event matching a given mask occurs.
@param aCallback - A js function to be fired.
@prarm aMask - An event mask for the next event.
@param anExpiration - The date for which this callback expires (not implemented).
@param aCallback A js function to be fired.
@prarm aMask An event mask for the next event.
@param anExpiration The date for which this callback expires (not implemented).
@param inMode (not implemented).
@param shouldDequeue (not implemented).
@param shouldDequeue YES to remove the event from the queue after calling the callback,
NO to deliver it normally.
*/
- (void)setCallback:(Function)aCallback forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue
{
@@ -930,12 +931,13 @@ CPRunContinuesResponse = -1002;
Assigns a target and action for the next event matching a given event mask.
The callback method called will be passed the CPEvent when it fires.
@param aTarget - The target object for the callback.
@param aSelector - The selector which should be called on the target object.
@param aMask - The mask for a given event which should trigger the callback.
@param anExpiration - The date for which the callback expires (not implemented).
@param aTarget The target object for the callback.
@param aSelector The selector which should be called on the target object.
@param aMask The mask for a given event which should trigger the callback.
@param anExpiration The date for which the callback expires (not implemented).
@param aMode (not implemented).
@param shouldDequeue (not implemented).
@param shouldDequeue YES to remove the event from the queue after calling the callback,
NO to deliver it normally.
*/
- (void)setTarget:(id)aTarget selector:(SEL)aSelector forNextEventMatchingMask:(unsigned int)aMask untilDate:(CPDate)anExpiration inMode:(CPString)aMode dequeue:(BOOL)shouldDequeue
{
+8 -5
View File
@@ -318,7 +318,8 @@ var resizeTimer = nil;
// Make sure the pastboard element is blurred.
_DOMPasteboardElement.blur();
// Create a full screen div to protect against iframes and other elements from consuming events during tracking
// Create a full screen div to protect against iframes and other elements
// from consuming events during tracking
// FIXME: multiple windows
_DOMEventGuard = theDocument.createElement("div");
_DOMEventGuard.style.position = "absolute";
@@ -1275,7 +1276,7 @@ var resizeTimer = nil;
_DOMEventMode = YES;
_mouseIsDown = YES;
//fake a down and up event so that event tracking mode will work correctly
// Fake a down and up event so that event tracking mode will work correctly
[CPApp sendEvent:[CPEvent mouseEventWithType:_mouseDownIsRightClick ? CPRightMouseDown : CPLeftMouseDown location:location modifierFlags:modifierFlags
timestamp:timestamp windowNumber:windowNumber context:nil eventNumber:-1
clickCount:CPDOMEventGetClickCount(_lastMouseDown, timestamp, location) pressure:0]];
@@ -1322,13 +1323,15 @@ var resizeTimer = nil;
if (StopDOMEventPropagation && (!supportsNativeDragAndDrop || type !== "mousedown" && !isDragging))
CPDOMEventStop(aDOMEvent, self);
// if there are any tracking event listeners then show the event guard so we don't lose events to iframes
// TODO Actually check for tracking event listeners, not just any listener but _CPRunModalLoop.
// If there are any tracking event listeners (listening for CPLeftMouseDraggedMask)
// then show the event guard so we don't lose events to iframes
var hasTrackingEventListener = NO;
for (var i = 0; i < CPApp._eventListeners.length; i++)
{
if (CPApp._eventListeners[i]._callback !== _CPRunModalLoop)
var listener = CPApp._eventListeners[i];
if (listener._callback !== _CPRunModalLoop && (listener._mask & CPLeftMouseDraggedMask))
{
hasTrackingEventListener = YES;
break;