Add new Pointer Lock spec webkitRequestPointerLock and webkitExitPointerLock methods.
authorscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jun 2012 19:53:27 +0000 (19:53 +0000)
committerscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jun 2012 19:53:27 +0000 (19:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88891

Reviewed by Dimitri Glazkov.

Part of a series of refactoring changes to update pointer lock API to
the fullscreen locking style. https://bugs.webkit.org/show_bug.cgi?id=84402

Entering and exiting mouse lock is provided in the new webkitRequestPointerLock and
webkitExitPointerLock methods.

Source/WebCore:

Existing pointer-lock tests updated to use the new methods.

* dom/Document.cpp:
(WebCore::Document::webkitExitPointerLock):
(WebCore):
* dom/Document.h:
(Document):
* dom/Document.idl:
* dom/Element.cpp:
(WebCore):
(WebCore::Element::webkitRequestPointerLock):
* dom/Element.h:
* dom/Element.idl:

LayoutTests:

Existing tests updated to use the new methods. Also, several updated to
support manual testing.

* pointer-lock/lock-already-locked-expected.txt:
* pointer-lock/lock-already-locked.html:
* pointer-lock/mouse-event-delivery-expected.txt:
* pointer-lock/mouse-event-delivery.html:
* pointer-lock/pointer-lock-api-expected.txt:
* pointer-lock/pointer-lock-api.html:
* pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt:
* pointer-lock/pointerlockchange-pointerlockerror-events.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120486 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
LayoutTests/ChangeLog
LayoutTests/pointer-lock/lock-already-locked-expected.txt
LayoutTests/pointer-lock/lock-already-locked.html
LayoutTests/pointer-lock/mouse-event-delivery-expected.txt
LayoutTests/pointer-lock/mouse-event-delivery.html
LayoutTests/pointer-lock/pointer-lock-api-expected.txt
LayoutTests/pointer-lock/pointer-lock-api.html
LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt
LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events.html
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl

index 7d73abc..a0c5639 100644 (file)
@@ -1,3 +1,28 @@
+2012-06-13  Vincent Scheib  <scheib@chromium.org>
+
+        Add new Pointer Lock spec webkitRequestPointerLock and webkitExitPointerLock methods.
+        https://bugs.webkit.org/show_bug.cgi?id=88891
+
+        Reviewed by Dimitri Glazkov.
+
+        Part of a series of refactoring changes to update pointer lock API to
+        the fullscreen locking style. https://bugs.webkit.org/show_bug.cgi?id=84402
+
+        Entering and exiting mouse lock is provided in the new webkitRequestPointerLock and
+        webkitExitPointerLock methods.
+
+        Existing tests updated to use the new methods. Also, several updated to
+        support manual testing.
+
+        * pointer-lock/lock-already-locked-expected.txt:
+        * pointer-lock/lock-already-locked.html:
+        * pointer-lock/mouse-event-delivery-expected.txt:
+        * pointer-lock/mouse-event-delivery.html:
+        * pointer-lock/pointer-lock-api-expected.txt:
+        * pointer-lock/pointer-lock-api.html:
+        * pointer-lock/pointerlockchange-pointerlockerror-events-expected.txt:
+        * pointer-lock/pointerlockchange-pointerlockerror-events.html:
+
 2012-06-15  Abhishek Arya  <inferno@chromium.org>
 
         Unreviewed. Rebaselines for r120477.
index 76f1ec9..f65fc38 100644 (file)
@@ -3,7 +3,18 @@ Test calling lock when already in a locked state.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS navigator.webkitPointer.isLocked is false
+PASS document.webkitPointerLockElement is null
+     Locking targetdiv1.
+PASS document.onwebkitpointerlockchange event received.
+PASS document.webkitPointerLockElement is targetdiv1
+     Locking targetdiv1, again.
+PASS document.onwebkitpointerlockchange event received.
+PASS document.webkitPointerLockElement is targetdiv1
+     Locking targetdiv2.
+PASS expectTarget1Unlock is true
+PASS document.onwebkitpointerlockchange event received.
+PASS document.webkitPointerLockElement is targetdiv2
+PASS expectTarget2Unlock is true
 PASS Lock target1 succeeded.
 PASS navigator.webkitPointer.isLocked is true
 PASS document.onwebkitpointerlockchange event received.
@@ -20,4 +31,5 @@ PASS document.webkitPointerLockElement is targetdiv2
 PASS successfullyParsed is true
 
 TEST COMPLETE
+doNextStep for manual testing
 
index 6975346..ec024f6 100644 (file)
@@ -5,6 +5,7 @@
 </head>
 <body>
 <div>
+  <button onclick="doNextStep('manual');">doNextStep for manual testing</button>
   <div id="target1"></div>
   <div id="target2"></div>
 </div>
@@ -21,6 +22,7 @@
         {
             testPassed("document.onwebkitpointerlockchange event received.");
             shouldBe("document.webkitPointerLockElement", expectedTargetToBeLockedString);
+            doNextStep();
         };
     document.onwebkitpointerlockerror =
         function () { testFailed("document.onwebkitpointerlockerror event received."); finishJSTest(); };
     targetdiv1.addEventListener("webkitpointerlocklost",
         function () { shouldBe("expectTarget1Unlock", "true"); });
 
+    var expectTarget2Unlock = false;
     targetdiv2.addEventListener("webkitpointerlocklost",
-        function () { testFailed("Unexpected targetdiv2 pointerlocklost."); });
+        function () { shouldBe("expectTarget2Unlock", "true"); });
 
     currentStep = 0;
-    function doNextStep() {
-      setTimeout(function () { todo[currentStep++](); }, 0);
+    function doNextStep(manual)
+    {
+        if (!window.layoutTestController && !manual)
+            return;
+        if (currentStep < todo.length)
+            setTimeout(function () { todo[currentStep++](); }, 0);
+        else if (currentStep++ == todo.length)
+            setTimeout(function () { finishJSTest(); }, 0);
     }
     todo = [
         function () {
-            shouldBe("navigator.webkitPointer.isLocked", "false");
+            shouldBe("document.webkitPointerLockElement", "null");
+            debug("     Locking targetdiv1.")
+            targetdiv1.webkitRequestPointerLock();
+            expectedTargetToBeLockedString = "targetdiv1";
+            // doNextStep() called by onwebkitpointerlockchange handler.
+        },
+        function () {
+            debug("     Locking targetdiv1, again.")
+            targetdiv1.webkitRequestPointerLock();
+            expectedTargetToBeLockedString = "targetdiv1";
+            // doNextStep() called by onwebkitpointerlockchange handler.
+        },
+        function () {
+            debug("     Locking targetdiv2.")
+            expectTarget1Unlock = true;
+            targetdiv2.webkitRequestPointerLock();
+            expectedTargetToBeLockedString = "targetdiv2";
+            // doNextStep() called by onwebkitpointerlockchange handler.
+        },
+        function () {
+            expectTarget1Unlock = false;
+            expectTarget2Unlock = true;
             navigator.webkitPointer.lock(targetdiv1,
                 function () {
                     testPassed("Lock target1 succeeded.");
                     shouldBe("navigator.webkitPointer.isLocked", "true");
-                    doNextStep();
+                    // doNextStep() called by onwebkitpointerlockchange handler.
                 },
                 function () {
                     testFailed("Lock failed.");
             expectedTargetToBeLockedString = "targetdiv1";
         },
         function () {
+            expectTarget2Unlock = false;
             navigator.webkitPointer.lock(targetdiv1,
                 function () {
                     testPassed("Lock target1 succeeded again.");
                     shouldBe("navigator.webkitPointer.isLocked", "true");
-                    doNextStep();
+                    // doNextStep() called by onwebkitpointerlockchange handler.
                 },
                 function () {
                     testFailed("Lock failed.");
                 function () {
                     testPassed("Lock target2 succeeded.");
                     shouldBe("navigator.webkitPointer.isLocked", "true");
-                    doNextStep();
+                    // doNextStep() called by onwebkitpointerlockchange handler.
                 },
                 function () {
                     testFailed("Lock failed.");
                 });
             expectedTargetToBeLockedString = "targetdiv2";
         },
-        finishJSTest
     ];
     doNextStep();
 </script>
index 1797c27..a2cfae4 100644 (file)
@@ -3,17 +3,18 @@ Test mouse events are routed to lock target.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS window.eventSender is defined.
-PASS Lock target1 succeeded.
-With a lock in place send a click.
+PASS document.onwebkitpointerlockchange event received.
+PASS document.webkitPointerLockElement is targetdiv1
+     With a lock in place send a click.
 PASS event type: mousedown, target: target1, received on: target1
 PASS event type: mousedown, target: target1, received on: body
-PASS Lock target2 succeeded.
-With a lock in place send a click.
+PASS document.onwebkitpointerlockchange event received.
+PASS document.webkitPointerLockElement is targetdiv2
+     With a lock in place send a click.
 PASS event type: mousedown, target: target2, received on: target2
 PASS event type: mousedown, target: target2, received on: body
-Ensure double clicks work as expected, sending 4 clicks.
-Creating a click and dblclick.
+     Ensure double clicks work as expected, sending 4 clicks.
+     Creating a click and dblclick.
 PASS event type: mousedown, target: target2, received on: target2
 PASS event type: mouseup, target: target2, received on: target2
 PASS event type: click, target: target2, received on: target2
@@ -21,7 +22,7 @@ PASS event type: mousedown, target: target2, received on: target2
 PASS event type: mouseup, target: target2, received on: target2
 PASS event type: click, target: target2, received on: target2
 PASS event type: dblclick, target: target2, received on: target2
-Ensuring no false dblclicks if we continue.
+     Ensuring no false dblclicks if we continue.
 PASS event type: mousedown, target: target2, received on: target2
 PASS event type: mouseup, target: target2, received on: target2
 PASS event type: click, target: target2, received on: target2
@@ -31,4 +32,5 @@ PASS event type: click, target: target2, received on: target2
 PASS successfullyParsed is true
 
 TEST COMPLETE
+doNextStep for manual testing
 
index c3b4e28..8d07a0a 100644 (file)
@@ -5,17 +5,28 @@
 </head>
 <body id="body">
 <div>
+  <button onclick="doNextStep('manual');">doNextStep for manual testing</button>
   <div id="target1"></div>
   <div id="target2"></div>
 </div>
 <script>
     description("Test mouse events are routed to lock target.")
     window.jsTestIsAsync = true;
-    shouldBeDefined("window.eventSender");
 
     targetdiv1 = document.getElementById("target1");
     targetdiv2 = document.getElementById("target2");
 
+    // Expect change event only for all transitions below.
+    expectedTargetToBeLockedString = "";
+    document.onwebkitpointerlockchange = function ()
+        {
+            testPassed("document.onwebkitpointerlockchange event received.");
+            shouldBe("document.webkitPointerLockElement", expectedTargetToBeLockedString);
+            doNextStep('manual');
+        };
+    document.onwebkitpointerlockerror =
+        function () { testFailed("document.onwebkitpointerlockerror event received."); finishJSTest(); };
+
     function eventNotExpected(e) {
         testFailed("Unexpected event " + e.type + " on " + e.currentTarget.id);
         finishJSTest();
     }
 
     currentStep = 0;
-    function doNextStep() {
-      todo[currentStep++]();
+    function doNextStep(manual)
+    {
+        if (!window.layoutTestController && !manual)
+            return;
+        if (currentStep < todo.length)
+            setTimeout(function () { todo[currentStep++](); }, 0);
+        else if (currentStep++ == todo.length)
+            setTimeout(function () { finishJSTest(); }, 0);
     }
     todo = [
         function () {
-            navigator.webkitPointer.lock(targetdiv1,
-                function () {
-                    testPassed("Lock target1 succeeded.");
-                    doNextStep();
-                },
-                function () {
-                    testFailed("Lock failed.");
-                    finishJSTest();
-                });
+            targetdiv1.webkitRequestPointerLock();
+            expectedTargetToBeLockedString = "targetdiv1";
+            // doNextStep() called by onwebkitpointerlockchange handler.
         },
         function () {
-            debug("With a lock in place send a click.")
+            debug("     With a lock in place send a click.")
             targetdiv1.onmousedown = eventExpected;
             targetdiv2.onmousedown = eventNotExpected;
             document.body.onmousedown = eventExpected;
-            window.eventSender.leapForward(1000);
-            window.eventSender.mouseDown();
-            window.eventSender.mouseUp();
-            targetdiv1.onmousedown = undefined;
-            targetdiv2.onmousedown = undefined;
-            document.body.onmousedown = undefined;
+            if (window.eventSender) {
+                window.eventSender.leapForward(1000);
+                window.eventSender.mouseDown();
+                window.eventSender.mouseUp();
+            }
             doNextStep();
         },
         function () {
-            navigator.webkitPointer.lock(targetdiv2,
-                function () {
-                    testPassed("Lock target2 succeeded.");
-                    doNextStep();
-                },
-                function () {
-                    testFailed("Lock failed.");
-                    finishJSTest();
-                });
+            targetdiv2.webkitRequestPointerLock();
+            expectedTargetToBeLockedString = "targetdiv2";
+            // doNextStep() called by onwebkitpointerlockchange handler.
         },
         function () {
-            debug("With a lock in place send a click.")
+            debug("     With a lock in place send a click.")
             targetdiv1.onmousedown = eventNotExpected;
             targetdiv2.onmousedown = eventExpected;
             document.body.onmousedown = eventExpected;
-            window.eventSender.leapForward(1000);
-            window.eventSender.mouseDown();
-            window.eventSender.mouseUp();
-            targetdiv1.onmousedown = undefined;
-            targetdiv2.onmousedown = undefined;
-            document.body.onmousedown = undefined;
+            if (window.eventSender) {
+                window.eventSender.leapForward(1000);
+                window.eventSender.mouseDown();
+                window.eventSender.mouseUp();
+            }
             doNextStep();
         },
         function () {
-            debug("Ensure double clicks work as expected, sending 4 clicks.")
+            debug("     Ensure double clicks work as expected, sending 4 clicks.")
+            targetdiv1.onmousedown = undefined;
+            document.body.onmousedown = undefined;
             targetdiv2.onmousedown = eventExpected;
             targetdiv2.onmouseup = eventExpected;
             targetdiv2.onclick = eventExpected;
             targetdiv2.ondblclick = eventExpected;
-            debug("Creating a click and dblclick.");
-            window.eventSender.leapForward(1000);
-            window.eventSender.mouseDown();
-            window.eventSender.mouseUp();
-            window.eventSender.mouseDown();
-            window.eventSender.mouseUp();
-            debug("Ensuring no false dblclicks if we continue.");
-            window.eventSender.mouseDown();
-            window.eventSender.mouseUp();
-            window.eventSender.mouseDown();
-            window.eventSender.mouseUp();
-            targetdiv2.onmousedown = undefined;
-            targetdiv2.onmouseup = undefined;
-            targetdiv2.onclick = undefined;
-            targetdiv2.ondblclick = undefined;
+            debug("     Creating a click and dblclick.");
+            if (window.eventSender) {
+                window.eventSender.leapForward(1000);
+                window.eventSender.mouseDown();
+                window.eventSender.mouseUp();
+                window.eventSender.mouseDown();
+                window.eventSender.mouseUp();
+            }
+            debug("     Ensuring no false dblclicks if we continue.");
+            if (window.eventSender) {
+                window.eventSender.mouseDown();
+                window.eventSender.mouseUp();
+                window.eventSender.mouseDown();
+                window.eventSender.mouseUp();
+            }
             doNextStep();
         },
-        finishJSTest
     ];
     doNextStep();
 </script>
index b1d1c88..add2aaa 100644 (file)
@@ -11,7 +11,9 @@ PASS navigator.webkitPointer.lock(document.body) is undefined
 PASS navigator.webkitPointer.unlock() is undefined
 PASS document.onwebkitpointerlockchange is defined.
 PASS document.onwebkitpointerlockerror is defined.
+PASS document.webkitExitPointerLock is defined.
 PASS document.webkitPointerLockElement is null
+PASS element.webkitRequestPointerLock is defined.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 8119e6e..fb14dc4 100644 (file)
         function () {
             shouldBeDefined("document.onwebkitpointerlockchange");
             shouldBeDefined("document.onwebkitpointerlockerror");
+            shouldBeDefined("document.webkitExitPointerLock");
             shouldEvaluateTo("document.webkitPointerLockElement", null);
+            element = document.createElement();
+            shouldBeDefined("element.webkitRequestPointerLock");
             doNextStep();
         },
     ];
index bf2ff99..69c6633 100644 (file)
@@ -14,7 +14,6 @@ PASS onwebkitpointerlockchange received after: Lock targetDiv1 again.
 PASS onwebkitpointerlockchange received after: Lock targetDiv2.
      Lock targetDiv2 again.
 PASS onwebkitpointerlockchange received after: Lock targetDiv2 again.
-     Lock null.
      Lock targetIframe1.
      Lock targetIframe1 (handler for iframe1).
 PASS onwebkitpointerlockchange received after: Lock targetIframe1 (handler for iframe1).
index aee1514..20c13b5 100644 (file)
     todo = [
         function () {
             expectNoEvents("Unlock.");
-            navigator.webkitPointer.unlock();
+            document.webkitExitPointerLock();
             doNextStep();
         },
         function () {
             expectOnlyChangeEvent("Lock targetDiv1.");
-            navigator.webkitPointer.lock(targetDiv1);
+            targetDiv1.webkitRequestPointerLock();
         },
         function () {
             expectOnlyChangeEvent("Unlock again.");
-            navigator.webkitPointer.unlock();
+            document.webkitExitPointerLock();
         },
         function () {
             expectOnlyChangeEvent("Lock targetDiv1 again.");
-            navigator.webkitPointer.lock(targetDiv1);
+            targetDiv1.webkitRequestPointerLock();
         },
         function () {
             expectOnlyChangeEvent("Lock targetDiv2.");
-            navigator.webkitPointer.lock(targetDiv2);
+            targetDiv2.webkitRequestPointerLock();
         },
         function () {
             expectOnlyChangeEvent("Lock targetDiv2 again.");
-            navigator.webkitPointer.lock(targetDiv2);
-        },
-        function () {
-            expectNoEvents("Lock null.");
-            navigator.webkitPointer.lock(null);
-            doNextStep();
+            targetDiv2.webkitRequestPointerLock();
         },
         function () {
             targetIframe1.src = "about:blank";
         function () {
             expectOnlyChangeEvent("Lock targetIframe1.");
             expectOnlyChangeEvent("Lock targetIframe1 (handler for iframe1).", targetIframe1.contentDocument);
-            navigator.webkitPointer.lock(targetIframe1.contentDocument.body);
+            targetIframe1.contentDocument.body.webkitRequestPointerLock();
         },
         function () {
             // Absorb an extra doNextStep() from previous event handlers.
             expectNoEvents("Lock targetIframe2.");
             expectOnlyChangeEvent("Lock targetIframe2 (handler for iframe1).", targetIframe1.contentDocument);
             expectOnlyChangeEvent("Lock targetIframe2 (handler for iframe2).", targetIframe2.contentDocument);
-            navigator.webkitPointer.lock(targetIframe2.contentDocument.body);
+            targetIframe2.contentDocument.body.webkitRequestPointerLock();
         },
         function () {
             // Absorb an extra doNextStep() from previous event handlers.
             expectNoEvents("Unlock targetIframe2.");
             expectNoEvents("Unlock targetIframe2 (handler for iframe1).", targetIframe1.contentDocument);
             expectOnlyChangeEvent("Unlock targetIframe2 (handler for iframe2).", targetIframe2.contentDocument);
-            navigator.webkitPointer.unlock();
+            document.webkitExitPointerLock();
         },
         function () {
             shouldBeDefined("testRunner.setPointerLockWillFailSynchronously");
             testRunner.setPointerLockWillFailSynchronously();
             expectOnlyErrorEvent("Lock with synchronous failure.");
-            navigator.webkitPointer.lock(targetDiv1);
+            targetDiv1.webkitRequestPointerLock();
         },
         function () {
             shouldBeDefined("testRunner.setPointerLockWillFailAsynchronously");
             testRunner.setPointerLockWillFailAsynchronously();
             expectOnlyErrorEvent("Lock with asynchronous failure.");
-            navigator.webkitPointer.lock(targetDiv1);
+            targetDiv1.webkitRequestPointerLock();
         },
     ];
     doNextStep();
index 71cbd2c..bbee453 100644 (file)
@@ -1,3 +1,30 @@
+2012-06-13  Vincent Scheib  <scheib@chromium.org>
+
+        Add new Pointer Lock spec webkitRequestPointerLock and webkitExitPointerLock methods.
+        https://bugs.webkit.org/show_bug.cgi?id=88891
+
+        Reviewed by Dimitri Glazkov.
+
+        Part of a series of refactoring changes to update pointer lock API to
+        the fullscreen locking style. https://bugs.webkit.org/show_bug.cgi?id=84402
+
+        Entering and exiting mouse lock is provided in the new webkitRequestPointerLock and
+        webkitExitPointerLock methods.
+
+        Existing pointer-lock tests updated to use the new methods.
+
+        * dom/Document.cpp:
+        (WebCore::Document::webkitExitPointerLock):
+        (WebCore):
+        * dom/Document.h:
+        (Document):
+        * dom/Document.idl:
+        * dom/Element.cpp:
+        (WebCore):
+        (WebCore::Element::webkitRequestPointerLock):
+        * dom/Element.h:
+        * dom/Element.idl:
+
 2012-06-15  Tony Payne  <tpayne@chromium.org>
 
        [chromium] Add iccjpeg and qcms to chromium port
index f789ecf..b93c6b0 100644 (file)
@@ -5753,6 +5753,12 @@ void Document::addDocumentToFullScreenChangeEventQueue(Document* doc)
 #endif
 
 #if ENABLE(POINTER_LOCK)
+void Document::webkitExitPointerLock()
+{
+    if (page())
+        page()->pointerLockController()->requestPointerUnlock();
+}
+
 Element* Document::webkitPointerLockElement() const
 {
     return page() ? page()->pointerLockController()->element() : 0;
index 93e3041..ab9205a 100644 (file)
@@ -1069,6 +1069,7 @@ public:
 #endif
 
 #if ENABLE(POINTER_LOCK)
+    void webkitExitPointerLock();
     Element* webkitPointerLockElement() const;
 #endif
 
index f38e9dd..7c1c483 100644 (file)
@@ -265,6 +265,7 @@ module core {
         [V8EnabledAtRuntime] void webkitExitFullscreen();
 #endif
 
+        [Conditional=POINTER_LOCK, V8EnabledAtRuntime=pointerLock] void webkitExitPointerLock();
         readonly attribute [Conditional=POINTER_LOCK, V8EnabledAtRuntime=pointerLock] Element webkitPointerLockElement;
 
 #if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS
index 005264c..9da156b 100644 (file)
@@ -57,6 +57,7 @@
 #include "NodeRenderStyle.h"
 #include "NodeRenderingContext.h"
 #include "Page.h"
+#include "PointerLockController.h"
 #include "RenderRegion.h"
 #include "RenderView.h"
 #include "RenderWidget.h"
@@ -66,6 +67,7 @@
 #include "StyleResolver.h"
 #include "Text.h"
 #include "TextIterator.h"
+#include "VoidCallback.h"
 #include "WebKitMutationObserver.h"
 #include "WebKitAnimationList.h"
 #include "XMLNSNames.h"
@@ -1867,6 +1869,13 @@ void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo
 }
 #endif    
 
+#if ENABLE(POINTER_LOCK)
+void Element::webkitRequestPointerLock()
+{
+    document()->frame()->page()->pointerLockController()->requestPointerLock(this, 0, 0);
+}
+#endif
+
 SpellcheckAttributeState Element::spellcheckAttributeState() const
 {
     const AtomicString& value = getAttribute(HTMLNames::spellcheckAttr);
index 9074e2b..de3f0c5 100644 (file)
@@ -403,6 +403,10 @@ public:
     void webkitRequestFullscreen();
 #endif
 
+#if ENABLE(POINTER_LOCK)
+    void webkitRequestPointerLock();
+#endif
+
     virtual bool isSpellCheckingEnabled() const;
 
     PassRefPtr<WebKitAnimationList> webkitGetAnimations() const;
index 955bd47..fdf6f36 100644 (file)
@@ -137,6 +137,8 @@ module core {
         [V8EnabledAtRuntime] void webkitRequestFullscreen();
 #endif
 
+        [Conditional=POINTER_LOCK, V8EnabledAtRuntime=pointerLock] void webkitRequestPointerLock();
+
         // CSS Regions API
         readonly attribute DOMString webkitRegionOverflow;