Move pointer lock test resources to http/tests/resources in preparation for adding...
authorscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2012 19:17:58 +0000 (19:17 +0000)
committerscheib@chromium.org <scheib@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2012 19:17:58 +0000 (19:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91882

Reviewed by Adrienne Walker.

* http/tests/resources/pointer-lock/pointer-lock-test-harness.js: Renamed from LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js.
* pointer-lock/bug90391-move-then-window-open-crash.html:
* pointer-lock/lock-already-locked.html:
* pointer-lock/lock-element-not-in-dom.html:
* pointer-lock/lock-fail-responses.html:
* pointer-lock/locked-element-iframe-removed-from-dom.html:
* pointer-lock/locked-element-removed-from-dom.html:
* pointer-lock/mouse-event-api.html:
* pointer-lock/mouse-event-delivery.html:
* pointer-lock/pointer-lock-api.html:
* pointer-lock/pointerlockchange-pointerlockerror-events.html:
* pointer-lock/pointerlocklost-event.html:

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/resources/pointer-lock/pointer-lock-test-harness.js [moved from LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js with 100% similarity]
LayoutTests/pointer-lock/bug90391-move-then-window-open-crash.html
LayoutTests/pointer-lock/lock-already-locked.html
LayoutTests/pointer-lock/lock-element-not-in-dom.html
LayoutTests/pointer-lock/lock-fail-responses.html
LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html
LayoutTests/pointer-lock/locked-element-removed-from-dom.html
LayoutTests/pointer-lock/mouse-event-api.html
LayoutTests/pointer-lock/mouse-event-delivery.html
LayoutTests/pointer-lock/pointer-lock-api.html
LayoutTests/pointer-lock/pointerlockchange-pointerlockerror-events.html
LayoutTests/pointer-lock/pointerlocklost-event.html
Source/WebCore/dom/Document.cpp

index eb64319..a110153 100644 (file)
@@ -1,3 +1,23 @@
+2012-07-20  Vincent Scheib  <scheib@chromium.org>
+
+        Move pointer lock test resources to http/tests/resources in preparation for adding new tests to http.
+        https://bugs.webkit.org/show_bug.cgi?id=91882
+
+        Reviewed by Adrienne Walker.
+
+        * http/tests/resources/pointer-lock/pointer-lock-test-harness.js: Renamed from LayoutTests/pointer-lock/resources/pointer-lock-test-harness.js.
+        * pointer-lock/bug90391-move-then-window-open-crash.html:
+        * pointer-lock/lock-already-locked.html:
+        * pointer-lock/lock-element-not-in-dom.html:
+        * pointer-lock/lock-fail-responses.html:
+        * pointer-lock/locked-element-iframe-removed-from-dom.html:
+        * pointer-lock/locked-element-removed-from-dom.html:
+        * pointer-lock/mouse-event-api.html:
+        * pointer-lock/mouse-event-delivery.html:
+        * pointer-lock/pointer-lock-api.html:
+        * pointer-lock/pointerlockchange-pointerlockerror-events.html:
+        * pointer-lock/pointerlocklost-event.html:
+
 2012-07-20  Zan Dobersek  <zandobersek@gmail.com>
 
         Unreviewed GTK gardening, adding platform-specific baseline for
index 5fbf5b3..767b6e9 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
@@ -49,6 +49,6 @@
     ];
     doNextStepWithUserGesture();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index 9f4d574..2a3440e 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
     ];
     doNextStepWithUserGesture();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index 97a99a8..acb7358 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
@@ -26,6 +26,6 @@
     ];
     doNextStepWithUserGesture();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index d8c2977..b882133 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
@@ -38,6 +38,6 @@
     ];
     doNextStepWithUserGesture();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index 32f68d8..92732e0 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
@@ -44,6 +44,6 @@
     ];
     doNextStep();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index 8fda65f..9963d53 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
@@ -48,6 +48,6 @@
     ];
     doNextStep();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index 2feef3a..798394d 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
+<script src="../http/tests/resources/js-test-pre.js"></script>
 </head>
 <body>
 <script>
@@ -9,6 +9,6 @@
     shouldBeDefined("mouseEvent.webkitMovementX");
     shouldBeDefined("mouseEvent.webkitMovementY");
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index e2f0410..e103307 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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 id="body">
 <div>
@@ -98,6 +98,6 @@
     ];
     doNextStepWithUserGesture();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index ce12db4..7075f4e 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
@@ -35,6 +35,6 @@
     ];
     doNextStepWithUserGesture();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index 9a101c4..f795559 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
@@ -92,6 +92,6 @@
     ];
     doNextStep();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
index 3bc316f..f047088 100644 (file)
@@ -1,8 +1,8 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-<script src="resources/pointer-lock-test-harness.js"></script>
+<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>
     ];
     doNextStepWithUserGesture();
 </script>
-<script src="../fast/js/resources/js-test-post.js"></script>
+<script src="../http/tests/resources/js-test-post.js"></script>
 </body>
 </html>
 
index 74d48e8..c7bc299 100644 (file)
@@ -5816,6 +5816,23 @@ void Document::addDocumentToFullScreenChangeEventQueue(Document* doc)
 void Document::webkitExitPointerLock()
 {
     if (page())
+        page()->pointerLockController()->requestPointerLock(element, 0, 0);
+    else
+        element->document()->enqueueDocumentEvent(Event::create(eventNames().webkitpointerlockerrorEvent, true, false));
+}
+
+bool Document::webkitPointerLockEnabled() const
+{
+    return isAttributeOnAllOwners(webkitallowpointerlockAttr, ownerElement());
+}
+
+void Document::webkitExitPointerLock()
+{
+    Element* element;
+    if (!page() || !(element = page()->pointerLockController()->element()))
+        return;
+
+    if (securityOrigin()->canAccess(element->document()->securityOrigin()))
         page()->pointerLockController()->requestPointerUnlock();
 }