Commit 50a79895 authored by scheib@chromium.org's avatar scheib@chromium.org

Pointer Lock requestPointerLock rejects locking an element not in a document.

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

Reviewed by Adrienne Walker.

Source/WebCore:

Test: pointer-lock/lock-element-not-in-dom.html

* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):

LayoutTests:

* pointer-lock/lock-element-not-in-dom-expected.txt: Added.
* pointer-lock/lock-element-not-in-dom.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@122169 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f32fcdcc
2012-07-09 Vincent Scheib <scheib@chromium.org>
Pointer Lock requestPointerLock rejects locking an element not in a document.
https://bugs.webkit.org/show_bug.cgi?id=90821
Reviewed by Adrienne Walker.
* pointer-lock/lock-element-not-in-dom-expected.txt: Added.
* pointer-lock/lock-element-not-in-dom.html: Added.
2012-07-09 Eric Seidel <eric@webkit.org>
document.write of scripts that also document.write sometimes writes async
Test locking an element not in a document is rejected and pointerlockerror event dispatched.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS targetDiv1.parentElement is not null
Remove targetDiv1 from document, and try to lock it.
PASS targetDiv1.parentElement is null
PASS onwebkitpointerlockerror received after: Remove targetDiv1 from document, and try to lock it.
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML>
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
<script src="resources/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
<div id="target1"></div>
</div>
<script>
description("Test locking an element not in a document is rejected and pointerlockerror event dispatched.")
window.jsTestIsAsync = true;
targetDiv1 = document.getElementById("target1");
todo = [
function () {
shouldNotBe("targetDiv1.parentElement", "null");
expectOnlyErrorEvent("Remove targetDiv1 from document, and try to lock it.");
targetDiv1.parentElement.removeChild(targetDiv1);
shouldBe("targetDiv1.parentElement", "null");
targetDiv1.webkitRequestPointerLock();
// doNextStep called by event handler.
},
];
doNextStepWithUserGesture();
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2012-07-09 Vincent Scheib <scheib@chromium.org>
Pointer Lock requestPointerLock rejects locking an element not in a document.
https://bugs.webkit.org/show_bug.cgi?id=90821
Reviewed by Adrienne Walker.
Test: pointer-lock/lock-element-not-in-dom.html
* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):
2012-07-09 Eric Seidel <eric@webkit.org>
document.write of scripts that also document.write sometimes writes async
......@@ -51,6 +51,11 @@ void PointerLockController::requestPointerLock(Element* target, PassRefPtr<VoidC
if (!target)
return;
if (!target->inDocument()) {
enqueueEvent(eventNames().webkitpointerlockerrorEvent, target);
return;
}
if (isLocked()) {
// FIXME: Keep enqueueEvent usage. (https://bugs.webkit.org/show_bug.cgi?id=84402)
enqueueEvent(eventNames().webkitpointerlockchangeEvent, target);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment