Changes

Jump to: navigation, search

Implementing the Mouse Lock API in Firefox

1,893 bytes added, 17:33, 15 December 2011
High-Level Mouse Lock Implementation Tasks
## [http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html CGAssociateMouseAndMouseCursorPosition and CGGetLastMouseDelta] on OS X
## [http://www.x.org/archive/X11R6.8.2/doc/XGrabPointer.3.html XGrabPointer] on Linux
 
====Review Issues====
 
* <s>Rewrite DOM node removal unlocking logic to use nsIMutatationObserver</s> humph, diogogmt
* <s>Space, bracing, tabs, etc style nits</s> humph
* clientX, clientY, screenX, screenY values should follow spec as per [https://bugzilla.mozilla.org/show_bug.cgi?id=633602#c55 scheib's comment]
* Confirm |aEvent->lastRefPoint = nsIntPoint(bounds.width/2, bounds.height/2);| that / 2 is right
* "nsCOMPtr<nsIContent> mMouseLockedElement; - Shouldn't this be a static member variable? Or how does the patch handle cases when the document which has iframe and mouse moves over those iframes." Probably wants a test for this case, too.
* "nsDOMMouseLockable::ShouldLock...QI to nsINode and check IsInDoc()"
* "nsRefPtr<nsMouseLockableRequest> request = new nsMouseLockableRequest(aSuccessCallback, aFailureCallback); -- You should store aTarget (QI'ed to nsINode or nsIContent or Element or nsIDOMEventTarget) so that when calling callback you push Cx to stack; nsCxPusher pusher: // defined in nsContentUtils.h NS_ENSURE_STATE(pusher.Push(target));"
* "nsDOMMouseLockable looks like it should be cycle collectable"
* Break .pointer out of Navigator, and add nsIDOMMozNavigatorPointer (not sure if this name is best) as a new interface to Navigator, similar to nsIDOMMozNavigatorBattery.
* Rename for moz* prefix. The API should be probably prefixed. So, navigator.mozPointer and all the interfaces should start with nsIDOMMoz. Similar to what webkit* is doing:
** navigator.webkitPointer.unlock();
** navigator.webkitPointer.lock();
** navigator.webkitPointer.isLocked();
** document.body.addEventListener("webkitpointerlocklost", ...
** mouseMoveEvent.webkitMovementX
** mouseMoveEvent.webkitMovementY
* Follow discussion unfolding here for other changes: http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/1558.html
* Finish tests, updated to changes above.
===Tests===

Navigation menu