Commit 03edde3b authored by scheib@chromium.org's avatar scheib@chromium.org

Remove old Pointer Lock API.

https://bugs.webkit.org/show_bug.cgi?id=88892

Reviewed by Adam Barth.

Source/WebCore:

Removing the old Pointer Lock API as one of the final cleanup
changes for the Update to Fullscreen style locking Spec meta
bug https://bugs.webkit.org/show_bug.cgi?id=84402.

This change primarily removes idl, access in navigator,
one event, and supporting infrastructure in page/PointerLock.

In PointerLockController changes were already noted clearly with
TODOs differentiating old and new api sections.

Test: pointer-lock/pointerlockchange-event-on-lock-lost.html

* WebCore.gypi:
* dom/Element.cpp:
(WebCore::Element::webkitRequestPointerLock):
* dom/EventNames.h:
(WebCore):
* page/Navigator.cpp:
* page/Navigator.h:
(WebCore):
(Navigator):
* page/Navigator.idl:
* page/PointerLock.cpp: Removed.
* page/PointerLock.h: Removed.
* page/PointerLock.idl: Removed.
* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):
(WebCore::PointerLockController::didAcquirePointerLock):
(WebCore::PointerLockController::didNotAcquirePointerLock):
(WebCore::PointerLockController::didLosePointerLock):
* page/PointerLockController.h:
(PointerLockController):

Source/WebKit/chromium:

* src/WebViewImpl.cpp:
    Removed #include to old API header.

LayoutTests:

Tests for old API removed, and most remaining tests required only small
changes.

* platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt:
* pointer-lock/lock-already-locked-expected.txt:
* pointer-lock/lock-already-locked.html:
* pointer-lock/lock-fail-responses-expected.txt: Removed.
* pointer-lock/lock-fail-responses.html: Removed.
    This test only covered the old API. The related concept is tested
    for the new api in pointerlockchange-pointerlockerror-events.html.
* pointer-lock/pointer-lock-api-expected.txt:
* pointer-lock/pointer-lock-api.html:
* pointer-lock/pointerlockchange-event-on-lock-lost-expected.txt: Added.
* pointer-lock/pointerlockchange-event-on-lock-lost.html: Added.
* pointer-lock/pointerlocklost-event-expected.txt: Removed.
* pointer-lock/pointerlocklost-event.html: Removed.
    pointerlocklost-event.html renamed to pointerlockchange-event-on-lock-lost.html.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 536b2c38
2012-08-02 Vincent Scheib <scheib@chromium.org>
Remove old Pointer Lock API.
https://bugs.webkit.org/show_bug.cgi?id=88892
Reviewed by Adam Barth.
Tests for old API removed, and most remaining tests required only small
changes.
* platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt:
* pointer-lock/lock-already-locked-expected.txt:
* pointer-lock/lock-already-locked.html:
* pointer-lock/lock-fail-responses-expected.txt: Removed.
* pointer-lock/lock-fail-responses.html: Removed.
This test only covered the old API. The related concept is tested
for the new api in pointerlockchange-pointerlockerror-events.html.
* pointer-lock/pointer-lock-api-expected.txt:
* pointer-lock/pointer-lock-api.html:
* pointer-lock/pointerlockchange-event-on-lock-lost-expected.txt: Added.
* pointer-lock/pointerlockchange-event-on-lock-lost.html: Added.
* pointer-lock/pointerlocklost-event-expected.txt: Removed.
* pointer-lock/pointerlocklost-event.html: Removed.
pointerlocklost-event.html renamed to pointerlockchange-event-on-lock-lost.html.
2012-08-02 Ryosuke Niwa <rniwa@webkit.org>
scripts in formaction should be stripped upon paste
......@@ -18,7 +18,6 @@ navigator.userAgent is OK
navigator.vendor is OK
navigator.vendorSub is OK
navigator.webkitGetGamepads() is OK
navigator.webkitPointer is OK
navigator.webkitStartActivity() threw err TypeError: Not enough arguments
navigator.appCodeName is OK
navigator.appName is OK
......@@ -38,6 +37,5 @@ navigator.userAgent is OK
navigator.vendor is OK
navigator.vendorSub is OK
navigator.webkitGetGamepads() is OK
navigator.webkitPointer is OK
navigator.webkitStartActivity() threw err TypeError: Not enough arguments
......@@ -11,21 +11,6 @@ PASS document.webkitPointerLockElement is targetdiv1
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.
PASS document.webkitPointerLockElement is targetdiv1
PASS Lock target1 succeeded again.
PASS navigator.webkitPointer.isLocked is true
PASS document.onwebkitpointerlockchange event received.
PASS document.webkitPointerLockElement is targetdiv1
PASS expectTarget1Unlock is true
PASS Lock target2 succeeded.
PASS navigator.webkitPointer.isLocked is true
PASS document.onwebkitpointerlockchange event received.
PASS document.webkitPointerLockElement is targetdiv2
PASS successfullyParsed is true
......
......@@ -56,49 +56,6 @@
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() called by onwebkitpointerlockchange handler.
},
function () {
testFailed("Lock failed.");
finishJSTest();
});
expectedTargetToBeLockedString = "targetdiv1";
},
function () {
expectTarget2Unlock = false;
navigator.webkitPointer.lock(targetdiv1,
function () {
testPassed("Lock target1 succeeded again.");
shouldBe("navigator.webkitPointer.isLocked", "true");
// doNextStep() called by onwebkitpointerlockchange handler.
},
function () {
testFailed("Lock failed.");
finishJSTest();
});
expectedTargetToBeLockedString = "targetdiv1";
},
function () {
expectTarget1Unlock = true;
navigator.webkitPointer.lock(targetdiv2,
function () {
testPassed("Lock target2 succeeded.");
shouldBe("navigator.webkitPointer.isLocked", "true");
// doNextStep() called by onwebkitpointerlockchange handler.
},
function () {
testFailed("Lock failed.");
finishJSTest();
});
expectedTargetToBeLockedString = "targetdiv2";
},
];
doNextStepWithUserGesture();
</script>
......
......@@ -3,12 +3,6 @@ Basic API existence test for Pointer Lock.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS navigator.webkitPointer is defined.
PASS typeof navigator.webkitPointer.isLocked is 'boolean'
PASS navigator.webkitPointer.isLocked is false
PASS navigator.webkitPointer.lock() threw exception TypeError: Not enough arguments.
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.
......
......@@ -2,38 +2,17 @@
<html>
<head>
<script src="../http/tests/resources/js-test-pre.js"></script>
<script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<script>
description("Basic API existence test for Pointer Lock.")
window.jsTestIsAsync = true;
todo = [
function () {
shouldBeDefined("navigator.webkitPointer");
shouldEvaluateTo("navigator.webkitPointer.isLocked", false);
shouldThrow("navigator.webkitPointer.lock()", "'TypeError: Not enough arguments'");
shouldEvaluateTo("navigator.webkitPointer.lock(document.body)", "undefined");
// Exit call stack to allow lock to take effect.
doNextStep();
},
function () {
shouldEvaluateTo("navigator.webkitPointer.unlock()", "undefined");
// Exit call stack to allow unlock to take effect.
doNextStep();
},
function () {
shouldBeDefined("document.onwebkitpointerlockchange");
shouldBeDefined("document.onwebkitpointerlockerror");
shouldBeDefined("document.webkitExitPointerLock");
shouldEvaluateTo("document.webkitPointerLockElement", null);
element = document.createElement();
shouldBeDefined("element.webkitRequestPointerLock");
doNextStep();
},
];
doNextStepWithUserGesture();
shouldBeDefined("document.onwebkitpointerlockchange");
shouldBeDefined("document.onwebkitpointerlockerror");
shouldBeDefined("document.webkitExitPointerLock");
shouldEvaluateTo("document.webkitPointerLockElement", null);
element = document.createElement();
shouldBeDefined("element.webkitRequestPointerLock");
</script>
<script src="../http/tests/resources/js-test-post.js"></script>
</body>
......
Test asynchronous results of calling lock.
Test that webkitpointerlockchange event is dispatched when lock is lost.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS window.testRunner is defined.
PASS Lock failed (after we called testRunner.setPointerLockWillFailSynchronously)
PASS Lock failed (after we called testRunner.setPointerLockWillFailAsynchronously)
Lock targetDiv1.
PASS onwebkitpointerlockchange received after: Lock targetDiv1.
PASS document.webkitPointerLockElement is targetDiv1
Host initiated unlock.
PASS onwebkitpointerlockchange received after: Host initiated unlock.
PASS document.webkitPointerLockElement is null
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -5,35 +5,31 @@
<script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
<div id="target1"></div>
</div>
<script>
description("Test asynchronous results of calling lock.")
description("Test that webkitpointerlockchange event is dispatched when lock is lost.")
window.jsTestIsAsync = true;
shouldBeDefined("window.testRunner");
targetDiv1 = document.getElementById("target1");
todo = [
function () {
testRunner.setPointerLockWillFailSynchronously();
navigator.webkitPointer.lock(document.body,
function () {
testFailed("Lock succeeded unexpectedly.");
finishJSTest();
},
function () {
testPassed("Lock failed (after we called testRunner.setPointerLockWillFailSynchronously)");
doNextStepWithUserGesture();
});
expectOnlyChangeEvent("Lock targetDiv1.");
targetDiv1.webkitRequestPointerLock();
// doNextStep called by event handler.
},
function () {
shouldBe("document.webkitPointerLockElement", "targetDiv1");
expectOnlyChangeEvent("Host initiated unlock.");
testRunner.didLosePointerLock();
// doNextStep called by event handler.
},
function () {
testRunner.setPointerLockWillFailAsynchronously();
navigator.webkitPointer.lock(document.body,
function () {
testFailed("Lock succeeded unexpectedly.");
finishJSTest();
},
function () {
testPassed("Lock failed (after we called testRunner.setPointerLockWillFailAsynchronously)");
doNextStep();
});
shouldBe("document.webkitPointerLockElement", "null");
doNextStep();
},
];
doNextStepWithUserGesture();
......@@ -41,3 +37,4 @@
<script src="../http/tests/resources/js-test-post.js"></script>
</body>
</html>
Test that pointerlocklost event is dispatched.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS window.testRunner is defined.
PASS navigator.webkitPointer.isLocked is true
PASS document.webkitPointerLockElement is targetdiv
JavaScript initiated unlock.
PASS webkitpointerlocklost handler call 0
PASS webkitpointerlocklost handler call 1
PASS All expected webkitpointerlocklost events received.
PASS onwebkitpointerlockchange received.
PASS All expected onwebkitpointerlockchange events received.
PASS document.webkitPointerLockElement is null
PASS navigator.webkitPointer.isLocked is false
PASS navigator.webkitPointer.isLocked is true
PASS document.webkitPointerLockElement is targetdiv
Host initiated unlock.
PASS webkitpointerlocklost handler call 0
PASS webkitpointerlocklost handler call 1
PASS All expected webkitpointerlocklost events received.
PASS onwebkitpointerlockchange received.
PASS All expected onwebkitpointerlockchange events received.
PASS navigator.webkitPointer.isLocked is false
PASS document.webkitPointerLockElement is null
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML>
<html>
<head>
<script src="../http/tests/resources/js-test-pre.js"></script>
<script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
<div id="target"></div>
</div>
<script>
// FIXME: Rename this test to pointerlockchange-event-on-lock-lost. (https://bugs.webkit.org/show_bug.cgi?id=84402)
description("Test that pointerlocklost event is dispatched.")
window.jsTestIsAsync = true;
shouldBeDefined("window.testRunner");
targetdiv = document.getElementById("target");
// FIXME: Keep pointerlockchange and pointerlockerror event usage. (https://bugs.webkit.org/show_bug.cgi?id=84402)
document.onwebkitpointerlockchange = lockchangeToUnlockedHandler;
document.onwebkitpointerlockerror =
function () { testFailed("document.onwebkitpointerlockerror dispatched"); finishJSTest(); };
lockchangeToUnlockedHandlers = 1;
lockchangeToUnlockedReceipts = 0;
function lockchangeToUnlockedHandler() {
if (navigator.webkitPointer.isLocked == false) {
testPassed("onwebkitpointerlockchange received.");
lockchangeToUnlockedReceipts++;
if (lockchangeToUnlockedReceipts == lockchangeToUnlockedHandlers) {
testPassed("All expected onwebkitpointerlockchange events received.");
}
}
}
// FIXME: Remove pointerlocklost usage. (https://bugs.webkit.org/show_bug.cgi?id=84402)
document.addEventListener("webkitpointerlocklost", locklostHandler);
targetdiv.addEventListener("webkitpointerlocklost", locklostHandler);
locklosthandlers = 2;
locklostreceipts = 0;
function locklostHandler() {
testPassed("webkitpointerlocklost handler call " + locklostreceipts);
locklostreceipts++;
if (locklostreceipts == locklosthandlers) {
testPassed("All expected webkitpointerlocklost events received.");
doNextStep();
}
}
todo = [
function () {
navigator.webkitPointer.lock(targetdiv,
function () {
shouldBe("navigator.webkitPointer.isLocked", "true");
doNextStep();
},
function () {
testFailed("Lock failed.");
finishJSTest();
});
},
function () {
shouldBe("document.webkitPointerLockElement", "targetdiv");
debug("JavaScript initiated unlock.")
locklostreceipts = 0;
navigator.webkitPointer.unlock();
},
function () {
// locklostHandler will catch unlocks and call doNextStep to bring us here.
shouldBe("document.webkitPointerLockElement", "null");
shouldBe("navigator.webkitPointer.isLocked", "false");
doNextStepWithUserGesture();
},
function () {
navigator.webkitPointer.lock(targetdiv,
function () {
shouldBe("navigator.webkitPointer.isLocked", "true");
doNextStep();
},
function () {
testFailed("Lock failed.");
finishJSTest();
});
},
function () {
shouldBe("document.webkitPointerLockElement", "targetdiv");
debug("Host initiated unlock.")
lockchangeToUnlockedReceipts = 0;
locklostreceipts = 0;
testRunner.didLosePointerLock();
},
function () {
// locklostHandler will catch unlocks and call doNextStep to bring us here.
shouldBe("navigator.webkitPointer.isLocked", "false");
shouldBe("document.webkitPointerLockElement", "null");
doNextStep();
},
];
doNextStepWithUserGesture();
</script>
<script src="../http/tests/resources/js-test-post.js"></script>
</body>
</html>
2012-08-02 Vincent Scheib <scheib@chromium.org>
Remove old Pointer Lock API.
https://bugs.webkit.org/show_bug.cgi?id=88892
Reviewed by Adam Barth.
Removing the old Pointer Lock API as one of the final cleanup
changes for the Update to Fullscreen style locking Spec meta
bug https://bugs.webkit.org/show_bug.cgi?id=84402.
This change primarily removes idl, access in navigator,
one event, and supporting infrastructure in page/PointerLock.
In PointerLockController changes were already noted clearly with
TODOs differentiating old and new api sections.
Test: pointer-lock/pointerlockchange-event-on-lock-lost.html
* WebCore.gypi:
* dom/Element.cpp:
(WebCore::Element::webkitRequestPointerLock):
* dom/EventNames.h:
(WebCore):
* page/Navigator.cpp:
* page/Navigator.h:
(WebCore):
(Navigator):
* page/Navigator.idl:
* page/PointerLock.cpp: Removed.
* page/PointerLock.h: Removed.
* page/PointerLock.idl: Removed.
* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):
(WebCore::PointerLockController::didAcquirePointerLock):
(WebCore::PointerLockController::didNotAcquirePointerLock):
(WebCore::PointerLockController::didLosePointerLock):
* page/PointerLockController.h:
(PointerLockController):
2012-08-02 Ryosuke Niwa <rniwa@webkit.org>
scripts in formaction should be stripped upon paste
......@@ -1183,7 +1183,6 @@
'page/PerformanceNavigation.idl',
'page/PerformanceResourceTiming.idl',
'page/PerformanceTiming.idl',
'page/PointerLock.idl',
'page/Screen.idl',
'page/SpeechInputEvent.idl',
'page/SpeechInputResult.idl',
......@@ -3119,8 +3118,6 @@
'page/PerformanceResourceTiming.h',
'page/PerformanceTiming.cpp',
'page/PerformanceTiming.h',
'page/PointerLock.cpp',
'page/PointerLock.h',
'page/PointerLockController.cpp',
'page/PointerLockController.h',
'page/PrintContext.cpp',
......
......@@ -1934,7 +1934,7 @@ void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo
void Element::webkitRequestPointerLock()
{
if (document()->page())
document()->page()->pointerLockController()->requestPointerLock(this, 0, 0);
document()->page()->pointerLockController()->requestPointerLock(this);
}
#endif
......
......@@ -229,7 +229,6 @@ namespace WebCore {
\
macro(show) \
\
macro(webkitpointerlocklost) \
macro(webkitpointerlockchange) \
macro(webkitpointerlockerror) \
\
......
......@@ -34,7 +34,6 @@
#include "Language.h"
#include "Page.h"
#include "PluginData.h"
#include "PointerLock.h"
#include "SecurityOrigin.h"
#include "Settings.h"
#include "StorageNamespace.h"
......@@ -135,15 +134,6 @@ bool Navigator::javaEnabled() const
return true;
}
#if ENABLE(POINTER_LOCK)
PointerLock* Navigator::webkitPointer() const
{
if (!m_pointer && m_frame && m_frame->page())
m_pointer = PointerLock::create(m_frame);
return m_pointer.get();
}
#endif
void Navigator::getStorageUpdates()
{
// FIXME: Remove this method or rename to yieldForStorageUpdates.
......
......@@ -34,7 +34,6 @@ namespace WebCore {
class DOMMimeTypeArray;
class DOMPluginArray;
class Frame;
class PointerLock;
class PluginData;
typedef int ExceptionCode;
......@@ -53,10 +52,6 @@ public:
virtual String userAgent() const;
#if ENABLE(POINTER_LOCK)
PointerLock* webkitPointer() const;
#endif
// Relinquishes the storage lock, if one exists.
void getStorageUpdates();
......@@ -65,9 +60,6 @@ private:
mutable RefPtr<DOMPluginArray> m_plugins;
mutable RefPtr<DOMMimeTypeArray> m_mimeTypes;
#if ENABLE(POINTER_LOCK)
mutable RefPtr<PointerLock> m_pointer;
#endif
};
}
......
......@@ -40,10 +40,6 @@ module window {
readonly attribute boolean onLine;
#if defined(ENABLE_POINTER_LOCK) && ENABLE_POINTER_LOCK // FIXME: Remove reliance on PointerLock.idl when removing old Pointer Lock API. (https://bugs.webkit.org/show_bug.cgi?id=84402)
readonly attribute [Conditional=POINTER_LOCK, V8EnabledAtRuntime=pointerLock] PointerLock webkitPointer;
#endif
void getStorageUpdates(); // FIXME: Remove this method or rename to yieldForStorageUpdates.
};
......
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "PointerLock.h"
#include "Frame.h"
#include "Page.h"
#include "PointerLockController.h"
#if ENABLE(POINTER_LOCK)
namespace WebCore {
PointerLock::PointerLock(Frame* frame)
: DOMWindowProperty(frame)
, m_controller(0)
{
ASSERT(m_frame);
m_controller = frame->page()->pointerLockController();
}
PointerLock::~PointerLock()
{
ASSERT(!m_controller);
}
void PointerLock::disconnectFrameForPageCache()
{
DOMWindowProperty::disconnectFrameForPageCache();
m_controller = 0;
}
void PointerLock::willDestroyGlobalObjectInFrame()
{
DOMWindowProperty::willDestroyGlobalObjectInFrame();
m_controller = 0;
}
void PointerLock::lock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback)
{
if (m_controller)
m_controller->requestPointerLock(target, successCallback, failureCallback);
}
void PointerLock::unlock()
{
if (m_controller)
m_controller->requestPointerUnlock();
}
bool PointerLock::isLocked()
{
return m_controller && m_controller->isLocked();
}
}
#endif // ENABLE(POINTER_LOCK)
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PointerLock_h
#define PointerLock_h
#if ENABLE(POINTER_LOCK)
#include "DOMWindowProperty.h"
#include "VoidCallback.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class Element;
class Frame;
class PointerLockController;
class PointerLock : public RefCounted<PointerLock>, public DOMWindowProperty {
public:
static PassRefPtr<PointerLock> create(Frame* frame) { return adoptRef(new PointerLock(frame)); }
~PointerLock();
// DOMWindowProperty Interface
virtual void disconnectFrameForPageCache() OVERRIDE;
virtual void willDestroyGlobalObjectInFrame() OVERRIDE;
void lock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback);
void unlock();
bool isLocked();
private:
explicit PointerLock(Frame*);
PointerLockController* m_controller;
};
} // namespace WebCore
#endif // ENABLE(POINTER_LOCK)
#endif // PointerLock_h
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module core {
interface [
Conditional=POINTER_LOCK,
OmitConstructor
] PointerLock {