Diff
Modified: trunk/LayoutTests/ChangeLog (120030 => 120031)
--- trunk/LayoutTests/ChangeLog 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/LayoutTests/ChangeLog 2012-06-12 03:02:16 UTC (rev 120031)
@@ -1,3 +1,24 @@
+2012-06-11 Vincent Scheib <[email protected]>
+
+ Add new Pointer Lock spec attribute webkitPointerLockElement.
+ https://bugs.webkit.org/show_bug.cgi?id=88799
+
+ 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
+
+ New attribute webkitPointerLockElement added. Follow up patches
+ will remove the previous isLocked attribute. Tests updated to use
+ the new attribute.
+
+ Reviewed by Dimitri Glazkov.
+
+ * pointer-lock/lock-already-locked-expected.txt:
+ * pointer-lock/lock-already-locked.html:
+ * pointer-lock/pointer-lock-api-expected.txt:
+ * pointer-lock/pointer-lock-api.html:
+ * pointer-lock/pointerlocklost-event-expected.txt:
+ * pointer-lock/pointerlocklost-event.html:
+
2012-06-11 Dominic Cooney <[email protected]>
[Chromium] Unreviewed: http/tests/xmlhttprequest/origin-exact-matching.html is timing out on XP about half the time
Modified: trunk/LayoutTests/pointer-lock/lock-already-locked-expected.txt (120030 => 120031)
--- trunk/LayoutTests/pointer-lock/lock-already-locked-expected.txt 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/LayoutTests/pointer-lock/lock-already-locked-expected.txt 2012-06-12 03:02:16 UTC (rev 120031)
@@ -7,14 +7,18 @@
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 document.onwebkitpointerlockchange event received.
+PASS document.webkitPointerLockElement is targetdiv2
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/pointer-lock/lock-already-locked.html (120030 => 120031)
--- trunk/LayoutTests/pointer-lock/lock-already-locked.html 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/LayoutTests/pointer-lock/lock-already-locked.html 2012-06-12 03:02:16 UTC (rev 120031)
@@ -16,8 +16,12 @@
targetdiv2 = document.getElementById("target2");
// Expect change event only for all transitions below.
- document._onwebkitpointerlockchange_ =
- function () { testPassed("document.onwebkitpointerlockchange event received."); };
+ expectedTargetToBeLockedString = "";
+ document._onwebkitpointerlockchange_ = function ()
+ {
+ testPassed("document.onwebkitpointerlockchange event received.");
+ shouldBe("document.webkitPointerLockElement", expectedTargetToBeLockedString);
+ };
document._onwebkitpointerlockerror_ =
function () { testFailed("document.onwebkitpointerlockerror event received."); finishJSTest(); };
@@ -45,6 +49,7 @@
testFailed("Lock failed.");
finishJSTest();
});
+ expectedTargetToBeLockedString = "targetdiv1";
},
function () {
navigator.webkitPointer.lock(targetdiv1,
@@ -57,7 +62,7 @@
testFailed("Lock failed.");
finishJSTest();
});
-
+ expectedTargetToBeLockedString = "targetdiv1";
},
function () {
expectTarget1Unlock = true;
@@ -71,7 +76,7 @@
testFailed("Lock failed.");
finishJSTest();
});
-
+ expectedTargetToBeLockedString = "targetdiv2";
},
finishJSTest
];
Modified: trunk/LayoutTests/pointer-lock/pointer-lock-api-expected.txt (120030 => 120031)
--- trunk/LayoutTests/pointer-lock/pointer-lock-api-expected.txt 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/LayoutTests/pointer-lock/pointer-lock-api-expected.txt 2012-06-12 03:02:16 UTC (rev 120031)
@@ -1,3 +1,8 @@
+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
@@ -2,9 +7,10 @@
PASS navigator.webkitPointer.lock() threw exception TypeError: Not enough arguments.
-PASS navigator.webkitPointer.lock(document) is undefined
+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.webkitPointerLockElement is null
PASS successfullyParsed is true
TEST COMPLETE
-
+doNextStep for manual testing
Modified: trunk/LayoutTests/pointer-lock/pointer-lock-api.html (120030 => 120031)
--- trunk/LayoutTests/pointer-lock/pointer-lock-api.html 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/LayoutTests/pointer-lock/pointer-lock-api.html 2012-06-12 03:02:16 UTC (rev 120031)
@@ -4,14 +4,43 @@
<script src=""
</head>
<body>
+<button _onclick_="doNextStep('manual');">doNextStep for manual testing</button>
<script>
- shouldBeDefined("navigator.webkitPointer");
- shouldEvaluateTo("navigator.webkitPointer.isLocked", false);
- shouldThrow("navigator.webkitPointer.lock()", "'TypeError: Not enough arguments'");
- shouldEvaluateTo("navigator.webkitPointer.lock(document)", "undefined");
- shouldEvaluateTo("navigator.webkitPointer.unlock()", "undefined");
- shouldBeDefined("document.onwebkitpointerlockchange");
- shouldBeDefined("document.onwebkitpointerlockerror");
+ description("Basic API existence test for Pointer Lock.")
+ window.jsTestIsAsync = true;
+
+ 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 () {
+ 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");
+ shouldEvaluateTo("document.webkitPointerLockElement", null);
+ doNextStep();
+ },
+ ];
+ doNextStep();
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/pointer-lock/pointerlocklost-event-expected.txt (120030 => 120031)
--- trunk/LayoutTests/pointer-lock/pointerlocklost-event-expected.txt 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/LayoutTests/pointer-lock/pointerlocklost-event-expected.txt 2012-06-12 03:02:16 UTC (rev 120031)
@@ -5,14 +5,17 @@
PASS window.layoutTestController 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
@@ -20,6 +23,7 @@
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
Modified: trunk/LayoutTests/pointer-lock/pointerlocklost-event.html (120030 => 120031)
--- trunk/LayoutTests/pointer-lock/pointerlocklost-event.html 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/LayoutTests/pointer-lock/pointerlocklost-event.html 2012-06-12 03:02:16 UTC (rev 120031)
@@ -65,12 +65,14 @@
});
},
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");
doNextStep();
},
@@ -86,6 +88,7 @@
});
},
function () {
+ shouldBe("document.webkitPointerLockElement", "targetdiv");
debug("Host initiated unlock.")
lockchangeToUnlockedReceipts = 0;
locklostreceipts = 0;
@@ -94,6 +97,7 @@
function () {
// locklostHandler will catch unlocks and call doNextStep to bring us here.
shouldBe("navigator.webkitPointer.isLocked", "false");
+ shouldBe("document.webkitPointerLockElement", "null");
doNextStep();
},
finishJSTest
Modified: trunk/Source/WebCore/ChangeLog (120030 => 120031)
--- trunk/Source/WebCore/ChangeLog 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Source/WebCore/ChangeLog 2012-06-12 03:02:16 UTC (rev 120031)
@@ -1,5 +1,30 @@
2012-06-11 Vincent Scheib <[email protected]>
+ Add new Pointer Lock spec attribute webkitPointerLockElement.
+ https://bugs.webkit.org/show_bug.cgi?id=88799
+
+ 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
+
+ New attribute webkitPointerLockElement added. Follow up patches
+ will remove the previous isLocked attribute. Tests updated to use
+ the new attribute.
+
+ * bindings/generic/RuntimeEnabledFeatures.h:
+ (WebCore::RuntimeEnabledFeatures::webkitPointerLockElementEnabled):
+ * dom/Document.cpp:
+ (WebCore):
+ (WebCore::Document::webkitPointerLockElement):
+ * dom/Document.h:
+ (Document):
+ * dom/Document.idl:
+ * page/PointerLockController.h:
+ (WebCore::PointerLockController::element):
+
+2012-06-11 Vincent Scheib <[email protected]>
+
Consolidate Pointer Lock runtime enabled flags to just one.
https://bugs.webkit.org/show_bug.cgi?id=88810
Modified: trunk/Source/WebCore/dom/Document.cpp (120030 => 120031)
--- trunk/Source/WebCore/dom/Document.cpp 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-06-12 03:02:16 UTC (rev 120031)
@@ -120,6 +120,7 @@
#include "PageTransitionEvent.h"
#include "PlatformKeyboardEvent.h"
#include "PluginDocument.h"
+#include "PointerLockController.h"
#include "PopStateEvent.h"
#include "ProcessingInstruction.h"
#include "RegisteredEventListener.h"
@@ -5731,6 +5732,13 @@
}
#endif
+#if ENABLE(POINTER_LOCK)
+Element* Document::webkitPointerLockElement() const
+{
+ return page() ? page()->pointerLockController()->element() : 0;
+}
+#endif
+
void Document::decrementLoadEventDelayCount()
{
ASSERT(m_loadEventDelayCount);
Modified: trunk/Source/WebCore/dom/Document.h (120030 => 120031)
--- trunk/Source/WebCore/dom/Document.h 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Source/WebCore/dom/Document.h 2012-06-12 03:02:16 UTC (rev 120031)
@@ -1064,6 +1064,10 @@
void webkitExitFullscreen();
#endif
+#if ENABLE(POINTER_LOCK)
+ Element* webkitPointerLockElement() const;
+#endif
+
// Used to allow element that loads data without going through a FrameLoader to delay the 'load' event.
void incrementLoadEventDelayCount() { ++m_loadEventDelayCount; }
void decrementLoadEventDelayCount();
Modified: trunk/Source/WebCore/dom/Document.idl (120030 => 120031)
--- trunk/Source/WebCore/dom/Document.idl 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Source/WebCore/dom/Document.idl 2012-06-12 03:02:16 UTC (rev 120031)
@@ -257,6 +257,8 @@
[V8EnabledAtRuntime] void webkitExitFullscreen();
#endif
+ readonly attribute [Conditional=POINTER_LOCK, V8EnabledAtRuntime=pointerLock] Element webkitPointerLockElement;
+
#if defined(ENABLE_CSS_REGIONS) && ENABLE_CSS_REGIONS
WebKitNamedFlow webkitGetFlowByName(in DOMString name);
#endif
Modified: trunk/Source/WebCore/page/PointerLockController.cpp (120030 => 120031)
--- trunk/Source/WebCore/page/PointerLockController.cpp 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Source/WebCore/page/PointerLockController.cpp 2012-06-12 03:02:16 UTC (rev 120031)
@@ -91,6 +91,11 @@
return m_page->chrome()->client()->isPointerLocked();
}
+Element* PointerLockController::element() const
+{
+ return m_element.get();
+}
+
void PointerLockController::didAcquirePointerLock()
{
// FIXME: Keep enqueueEvent usage. (https://bugs.webkit.org/show_bug.cgi?id=84402)
Modified: trunk/Source/WebCore/page/PointerLockController.h (120030 => 120031)
--- trunk/Source/WebCore/page/PointerLockController.h 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Source/WebCore/page/PointerLockController.h 2012-06-12 03:02:16 UTC (rev 120031)
@@ -46,6 +46,7 @@
void requestPointerLock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback);
void requestPointerUnlock();
bool isLocked();
+ Element* element() const;
void didAcquirePointerLock();
void didNotAcquirePointerLock();
Modified: trunk/Tools/ChangeLog (120030 => 120031)
--- trunk/Tools/ChangeLog 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Tools/ChangeLog 2012-06-12 03:02:16 UTC (rev 120031)
@@ -1,3 +1,26 @@
+2012-06-11 Vincent Scheib <[email protected]>
+
+ Add new Pointer Lock spec attribute webkitPointerLockElement.
+ https://bugs.webkit.org/show_bug.cgi?id=88799
+
+ 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
+
+ New attribute webkitPointerLockElement added. Follow up patches
+ will remove the previous isLocked attribute. Tests updated to use
+ the new attribute.
+
+ WebViewHost logic required modification to correctly repond to
+ a lock, unlock, pointerLockElement call series. Specifically,
+ unlocking must be queued after a lock command is issued always
+ as the lock state may not be set yet with a lock request in flight.
+
+ * DumpRenderTree/chromium/WebViewHost.cpp:
+ (WebViewHost::requestPointerUnlock): Always post didLosePointerLock task.
+ (WebViewHost::didLosePointerLock): Signal didLosePointerLock only if pointer was locked.
+
2012-06-11 Alexis Menard <[email protected]>
[CSS3 Backgrounds and Borders] Protect box-decoration-break behind a feature flag.
Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (120030 => 120031)
--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp 2012-06-12 02:51:59 UTC (rev 120030)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp 2012-06-12 03:02:16 UTC (rev 120031)
@@ -845,8 +845,7 @@
void WebViewHost::requestPointerUnlock()
{
- if (m_pointerLocked)
- postDelayedTask(new HostMethodTask(this, &WebViewHost::didLosePointerLock), 0);
+ postDelayedTask(new HostMethodTask(this, &WebViewHost::didLosePointerLock), 0);
}
bool WebViewHost::isPointerLocked()
@@ -869,9 +868,10 @@
void WebViewHost::didLosePointerLock()
{
- ASSERT(m_pointerLocked);
+ bool wasLocked = m_pointerLocked;
m_pointerLocked = false;
- webWidget()->didLosePointerLock();
+ if (wasLocked)
+ webWidget()->didLosePointerLock();
}
#endif