Pointer Lock: Implement pointer interface
authorscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 19:06:41 +0000 (19:06 +0000)
committerscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jan 2012 19:06:41 +0000 (19:06 +0000)
commitb93bec86380e929fe5edf41bfe20a85c7c9677e5
treef8b9d06b6fd73519f42bb7a967b2ad9c22edbe0a
parentede5cfde6695b1694a6bd32b228573ab9420d4a5
Pointer Lock: Implement pointer interface
https://bugs.webkit.org/show_bug.cgi?id=75762

Source/WebCore:

Reviewed by Julien Chaffraix.

Implement the navigator.pointer interface via a new
PointerLockController class, as per
http://dvcs.w3.org/hg/webevents/raw-file/default/mouse-lock.html.

The implementation is being made in steps, the feature is still behind
compile-time and run-time flags, 'webkit' prefixed, and not yet enabled
in any browser. (Chromium has a developer flag required.) Follow-up
work will include handling DOM elements being removed, making all
callbacks asynchronous, iframe permissions (similar to Full Screen),
etc.

PointerLockController maintains state of which Element is the current
lock target and the success and failure callbacks. ChromeClient has
methods added to expose the required state change requests.

Tests: pointer-lock/lock-already-locked.html
       pointer-lock/lock-fail-responses.html
       pointer-lock/mouse-event-delivery.html
       pointer-lock/pointerlocklost-event.html

* WebCore.gypi:
* dom/EventNames.h:
* page/ChromeClient.h:
(WebCore::ChromeClient::requestPointerLock):
(WebCore::ChromeClient::requestPointerUnlock):
(WebCore::ChromeClient::isPointerLocked):
* page/Navigator.cpp:
(WebCore::Navigator::webkitPointer):
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::pointerLockController):
* page/PointerLock.cpp:
(WebCore::PointerLock::PointerLock):
(WebCore::PointerLock::create):
(WebCore::PointerLock::lock):
(WebCore::PointerLock::unlock):
(WebCore::PointerLock::isLocked):
* page/PointerLock.h:
(WebCore::PointerLock::create):
* page/PointerLockController.cpp: Added.
(WebCore::PointerLockController::PointerLockController):
(WebCore::PointerLockController::requestPointerLock):
(WebCore::PointerLockController::requestPointerUnlock):
(WebCore::PointerLockController::isLocked):
(WebCore::PointerLockController::didAcquirePointerLock):
(WebCore::PointerLockController::didNotAcquirePointerLock):
(WebCore::PointerLockController::didLosePointerLock):
(WebCore::PointerLockController::dispatchLockedMouseEvent):
* page/PointerLockController.h: Copied from Source/WebCore/page/PointerLock.h.

Source/WebKit/chromium:

Add calls to the PointerLockController added in this patch to WebCore.

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::close):
(WebKit::WebViewImpl::didAcquirePointerLock):
(WebKit::WebViewImpl::didNotAcquirePointerLock):
(WebKit::WebViewImpl::didLosePointerLock):
(WebKit::WebViewImpl::pointerLockMouseEvent):

LayoutTests:

Reviewed by Julien Chaffraix.

* pointer-lock/lock-already-locked-expected.txt: Added.
* pointer-lock/lock-already-locked.html: Added.
* pointer-lock/lock-fail-responses-expected.txt: Added.
* pointer-lock/lock-fail-responses.html: Added.
* pointer-lock/mouse-event-delivery-expected.txt: Added.
* pointer-lock/mouse-event-delivery.html: Added.
* pointer-lock/pointerlocklost-event-expected.txt: Added.
* pointer-lock/pointerlocklost-event.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/pointer-lock/lock-already-locked-expected.txt [new file with mode: 0644]
LayoutTests/pointer-lock/lock-already-locked.html [new file with mode: 0644]
LayoutTests/pointer-lock/lock-fail-responses-expected.txt [new file with mode: 0644]
LayoutTests/pointer-lock/lock-fail-responses.html [new file with mode: 0644]
LayoutTests/pointer-lock/mouse-event-api.html
LayoutTests/pointer-lock/mouse-event-delivery-expected.txt [new file with mode: 0644]
LayoutTests/pointer-lock/mouse-event-delivery.html [new file with mode: 0644]
LayoutTests/pointer-lock/pointer-lock-api.html
LayoutTests/pointer-lock/pointerlocklost-event-expected.txt [new file with mode: 0644]
LayoutTests/pointer-lock/pointerlocklost-event.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/dom/EventNames.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/Navigator.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/PointerLock.cpp
Source/WebCore/page/PointerLock.h
Source/WebCore/page/PointerLockController.cpp [new file with mode: 0644]
Source/WebCore/page/PointerLockController.h [new file with mode: 0644]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebViewImpl.cpp