pointer lock needs to be feature detectable
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Dec 2016 23:48:15 +0000 (23:48 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Dec 2016 23:48:15 +0000 (23:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165426
<rdar://problem/29486715>

Reviewed by Antoine Quint.

Source/WebCore:

Annotate the public-facing API for pointer-lock, so
that it is hidden when not available.

Also move the Setting to a RuntimeEnabledFeature, since
pointer-lock is exposed from WebKit as a feature.

Tests: pointer-lock/pointerlock-interface-disabled.html
       pointer-lock/pointerlock-interface.html

* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setPointerLockEnabled):
(WebCore::RuntimeEnabledFeatures::pointerLockEnabled):
* dom/Document.idl:
* dom/Element.idl:
* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):
(WebCore::PointerLockController::requestPointerUnlock):
* page/Settings.in:

Source/WebKit/mac:

Set the RuntimeEnabledFeature as preferences
change.

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Set the RuntimeEnabledFeature as preferences
change.

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetPointerLockEnabled):
(WKPreferencesGetPointerLockEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Expose the comment line to turn on/off pointer lock.

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/TestOptions.mm:
(TestOptions::TestOptions):
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::viewSupportsOptions):

Websites/webkit.org:

We can now accurately detect pointer-lock.

* experimental-features.html:

LayoutTests:

Checks that the API is hidden when the feature is turned off.

* pointer-lock/pointerlock-interface-disabled-expected.txt: Added.
* pointer-lock/pointerlock-interface-disabled.html: Added.
* pointer-lock/pointerlock-interface-expected.txt: Added.
* pointer-lock/pointerlock-interface.html: Added.

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

27 files changed:
LayoutTests/ChangeLog
LayoutTests/pointer-lock/pointerlock-interface-disabled-expected.txt [new file with mode: 0644]
LayoutTests/pointer-lock/pointerlock-interface-disabled.html [new file with mode: 0644]
LayoutTests/pointer-lock/pointerlock-interface-expected.txt [new file with mode: 0644]
LayoutTests/pointer-lock/pointerlock-interface.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Element.idl
Source/WebCore/page/PointerLockController.cpp
Source/WebCore/page/Settings.in
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/TestOptions.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Websites/webkit.org/ChangeLog
Websites/webkit.org/experimental-features.html

index c8837a4..5b8e042 100644 (file)
@@ -1,3 +1,18 @@
+2016-12-05  Dean Jackson  <dino@apple.com>
+
+        pointer lock needs to be feature detectable
+        https://bugs.webkit.org/show_bug.cgi?id=165426
+        <rdar://problem/29486715>
+
+        Reviewed by Antoine Quint.
+
+        Checks that the API is hidden when the feature is turned off.
+
+        * pointer-lock/pointerlock-interface-disabled-expected.txt: Added.
+        * pointer-lock/pointerlock-interface-disabled.html: Added.
+        * pointer-lock/pointerlock-interface-expected.txt: Added.
+        * pointer-lock/pointerlock-interface.html: Added.
+
 2016-12-05  Dave Hyatt  <hyatt@apple.com>
 
         [CSS Parser] Skip a grid test
diff --git a/LayoutTests/pointer-lock/pointerlock-interface-disabled-expected.txt b/LayoutTests/pointer-lock/pointerlock-interface-disabled-expected.txt
new file mode 100644 (file)
index 0000000..9305cbd
--- /dev/null
@@ -0,0 +1,7 @@
+
+PASS Document.prototype.exitPointerLock does not exist 
+PASS Document.prototype.pointerLockElement does not exist 
+PASS Document.prototype.onpointerlockchange does not exist 
+PASS Document.prototype.onpointerlockerror does not exist 
+PASS Element.prototype.requestPointerLock does not exist 
+
diff --git a/LayoutTests/pointer-lock/pointerlock-interface-disabled.html b/LayoutTests/pointer-lock/pointerlock-interface-disabled.html
new file mode 100644 (file)
index 0000000..cb0ada6
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enablePointerLock=false ] -->
+<head>
+    <title>PointerLock interface tests.</title>
+    <link rel="help" href="https://w3c.github.io/pointerlock/">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+    assert_false('exitPointerLock' in Document.prototype);
+},'Document.prototype.exitPointerLock does not exist');
+
+test(function() {
+    assert_false('pointerLockElement' in Document.prototype);
+},'Document.prototype.pointerLockElement does not exist');
+
+test(function() {
+    assert_false('onpointerlockchange' in Document.prototype);
+},'Document.prototype.onpointerlockchange does not exist');
+
+test(function() {
+    assert_false('onpointerlockerror' in Document.prototype);
+},'Document.prototype.onpointerlockerror does not exist');
+
+test(function() {
+    assert_false('requestPointerLock' in Element.prototype);
+},'Element.prototype.requestPointerLock does not exist');
+</script>
+</body>
+</html>
diff --git a/LayoutTests/pointer-lock/pointerlock-interface-expected.txt b/LayoutTests/pointer-lock/pointerlock-interface-expected.txt
new file mode 100644 (file)
index 0000000..316c085
--- /dev/null
@@ -0,0 +1,7 @@
+
+PASS Document.prototype.exitPointerLock exists 
+PASS Document.prototype.pointerLockElement exists 
+PASS Document.prototype.onpointerlockchange exists 
+PASS Document.prototype.onpointerlockerror exists 
+PASS Element.prototype.requestPointerLock exists 
+
diff --git a/LayoutTests/pointer-lock/pointerlock-interface.html b/LayoutTests/pointer-lock/pointerlock-interface.html
new file mode 100644 (file)
index 0000000..ef8d913
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enablePointerLock=true ] -->
+<head>
+    <title>PointerLock interface tests.</title>
+    <link rel="help" href="https://w3c.github.io/pointerlock/">
+    <script src="../resources/testharness.js"></script>
+    <script src="../resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+test(function() {
+    assert_true('exitPointerLock' in Document.prototype);
+},'Document.prototype.exitPointerLock exists');
+
+test(function() {
+    assert_true('pointerLockElement' in Document.prototype);
+},'Document.prototype.pointerLockElement exists');
+
+test(function() {
+    assert_true('onpointerlockchange' in Document.prototype);
+},'Document.prototype.onpointerlockchange exists');
+
+test(function() {
+    assert_true('onpointerlockerror' in Document.prototype);
+},'Document.prototype.onpointerlockerror exists');
+
+test(function() {
+    assert_true('requestPointerLock' in Element.prototype);
+},'Element.prototype.requestPointerLock exists');
+</script>
+</body>
+</html>
index 564e615..b3451e4 100644 (file)
@@ -1,3 +1,30 @@
+2016-12-05  Dean Jackson  <dino@apple.com>
+
+        pointer lock needs to be feature detectable
+        https://bugs.webkit.org/show_bug.cgi?id=165426
+        <rdar://problem/29486715>
+
+        Reviewed by Antoine Quint.
+
+        Annotate the public-facing API for pointer-lock, so
+        that it is hidden when not available.
+
+        Also move the Setting to a RuntimeEnabledFeature, since
+        pointer-lock is exposed from WebKit as a feature.
+
+        Tests: pointer-lock/pointerlock-interface-disabled.html
+               pointer-lock/pointerlock-interface.html
+
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setPointerLockEnabled):
+        (WebCore::RuntimeEnabledFeatures::pointerLockEnabled):
+        * dom/Document.idl:
+        * dom/Element.idl:
+        * page/PointerLockController.cpp:
+        (WebCore::PointerLockController::requestPointerLock):
+        (WebCore::PointerLockController::requestPointerUnlock):
+        * page/Settings.in:
+
 2016-12-05  Keith Rollin  <krollin@apple.com>
 
         Reduce number of platformMemoryUsage calls
index 9ba0825..5a64ca8 100644 (file)
@@ -212,6 +212,11 @@ public:
     bool webGL2Enabled() const { return m_isWebGL2Enabled; }
 #endif
 
+#if ENABLE(POINTER_LOCK)
+    void setPointerLockEnabled(bool isEnabled) { m_isPointerLockEnabled = isEnabled; }
+    bool pointerLockEnabled() const { return m_isPointerLockEnabled; }
+#endif
+
 #if ENABLE(FETCH_API)
     void setFetchAPIEnabled(bool isEnabled) { m_isFetchAPIEnabled = isEnabled; }
     bool fetchAPIEnabled() const { return m_isFetchAPIEnabled; }
@@ -347,6 +352,10 @@ private:
     bool m_isWebGL2Enabled;
 #endif
 
+#if ENABLE(POINTER_LOCK)
+    bool m_isPointerLockEnabled;
+#endif
+
 #if ENABLE(FETCH_API)
     bool m_isFetchAPIEnabled { false };
 #endif
index 0bcc6e6..4c21b9f 100644 (file)
     void webkitExitFullscreen();
 #endif
 
-    [Conditional=POINTER_LOCK] void exitPointerLock();
-    [Conditional=POINTER_LOCK] readonly attribute Element? pointerLockElement;
+    [Conditional=POINTER_LOCK, EnabledAtRuntime=PointerLock] void exitPointerLock();
+    [Conditional=POINTER_LOCK, EnabledAtRuntime=PointerLock] readonly attribute Element? pointerLockElement;
 
     [Conditional=CSS_REGIONS] DOMNamedFlowCollection webkitGetNamedFlows();
 
     // Unique to Document
     [LenientThis] attribute EventHandler onreadystatechange;
     [NotEnumerable, Conditional=CSP_NEXT] attribute EventHandler onsecuritypolicyviolation;
-    [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockchange;
-    [NotEnumerable, Conditional=POINTER_LOCK] attribute EventHandler onpointerlockerror;
+    [NotEnumerable, Conditional=POINTER_LOCK, EnabledAtRuntime=PointerLock] attribute EventHandler onpointerlockchange;
+    [NotEnumerable, Conditional=POINTER_LOCK, EnabledAtRuntime=PointerLock] attribute EventHandler onpointerlockerror;
 };
 
 Document implements ParentNode;
index 8197515..3e93c75 100644 (file)
     [CEReactions, MayThrowException] void insertAdjacentHTML(DOMString where, DOMString html);
     [MayThrowException] void insertAdjacentText(DOMString where, DOMString text);
 
-    [Conditional=POINTER_LOCK] void requestPointerLock();
+    [Conditional=POINTER_LOCK, EnabledAtRuntime=PointerLock] void requestPointerLock();
 
     // CSS Regions API
     [Conditional=CSS_REGIONS] readonly attribute DOMString webkitRegionOverset;
index 8ea62d3..bbf6704 100644 (file)
@@ -34,6 +34,7 @@
 #include "EventNames.h"
 #include "Page.h"
 #include "PlatformMouseEvent.h"
+#include "RuntimeEnabledFeatures.h"
 #include "ScriptController.h"
 #include "Settings.h"
 #include "VoidCallback.h"
@@ -49,7 +50,7 @@ PointerLockController::PointerLockController(Page& page)
 
 void PointerLockController::requestPointerLock(Element* target)
 {
-    if (!m_page.settings().pointerLockEnabled())
+    if (!RuntimeEnabledFeatures::sharedFeatures().pointerLockEnabled())
         return;
 
     if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) {
@@ -92,7 +93,7 @@ void PointerLockController::requestPointerUnlock()
     if (!m_element)
         return;
 
-    if (!m_page.settings().pointerLockEnabled())
+    if (!RuntimeEnabledFeatures::sharedFeatures().pointerLockEnabled())
         return;
 
     m_page.chrome().client().requestPointerUnlock();
index cf2056c..b2e81a1 100644 (file)
@@ -293,4 +293,3 @@ largeImageAsyncDecodingEnabled initial=true
 animatedImageAsyncDecodingEnabled initial=true
 
 es6ModulesEnabled initial=false
-pointerLockEnabled initial=false
index 4ded13c..b0023ed 100644 (file)
@@ -1,3 +1,17 @@
+2016-12-05  Dean Jackson  <dino@apple.com>
+
+        pointer lock needs to be feature detectable
+        https://bugs.webkit.org/show_bug.cgi?id=165426
+        <rdar://problem/29486715>
+
+        Reviewed by Antoine Quint.
+
+        Set the RuntimeEnabledFeature as preferences
+        change.
+
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2016-12-05  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r209299.
index 1522893..5e6b8df 100644 (file)
@@ -2650,10 +2650,6 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings.setXSSAuditorEnabled([preferences isXSSAuditorEnabled]);
     settings.setDNSPrefetchingEnabled([preferences isDNSPrefetchingEnabled]);
 
-#if ENABLE(POINTER_LOCK)
-    settings.setPointerLockEnabled([preferences pointerLockEnabled]);
-#endif
-
     settings.setAcceleratedCompositingEnabled([preferences acceleratedCompositingEnabled]);
     settings.setAcceleratedDrawingEnabled([preferences acceleratedDrawingEnabled]);
     settings.setDisplayListDrawingEnabled([preferences displayListDrawingEnabled]);
@@ -2846,6 +2842,10 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
     RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled([preferences customElementsEnabled]);
 
+#if ENABLE(POINTER_LOCK)
+    RuntimeEnabledFeatures::sharedFeatures().setPointerLockEnabled([preferences pointerLockEnabled]);
+#endif
+
 #if ENABLE(FETCH_API)
     RuntimeEnabledFeatures::sharedFeatures().setFetchAPIEnabled([preferences fetchAPIEnabled]);
 #endif
index 3508f4e..7b327ba 100644 (file)
@@ -1,3 +1,21 @@
+2016-12-05  Dean Jackson  <dino@apple.com>
+
+        pointer lock needs to be feature detectable
+        https://bugs.webkit.org/show_bug.cgi?id=165426
+        <rdar://problem/29486715>
+
+        Reviewed by Antoine Quint.
+
+        Set the RuntimeEnabledFeature as preferences
+        change.
+
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetPointerLockEnabled):
+        (WKPreferencesGetPointerLockEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-12-05  Andreas Kling  <akling@apple.com>
 
         [Cocoa] Add some memory usage related information to sysdiagnose state dumps
index bdfbd76..9c32841 100644 (file)
@@ -832,6 +832,16 @@ bool WKPreferencesGetModernMediaControlsEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->modernMediaControlsEnabled();
 }
 
+void WKPreferencesSetPointerLockEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setPointerLockEnabled(flag);
+}
+
+bool WKPreferencesGetPointerLockEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->pointerLockEnabled();
+}
+
 void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setShowsToolTipOverTruncatedText(flag);
index 4940b20..e8e5c38 100644 (file)
@@ -209,6 +209,10 @@ WK_EXPORT void WKPreferencesSetModernMediaControlsEnabled(WKPreferencesRef prefe
 WK_EXPORT bool WKPreferencesGetModernMediaControlsEnabled(WKPreferencesRef preferencesRef);
 
 // Defaults to false.
+WK_EXPORT void WKPreferencesSetPointerLockEnabled(WKPreferencesRef preferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetPointerLockEnabled(WKPreferencesRef preferencesRef);
+
+// Defaults to false.
 WK_EXPORT void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef);
 
index e8bc889..6def4fc 100644 (file)
@@ -2992,9 +2992,6 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 #if ENABLE(ATTACHMENT_ELEMENT)
     settings.setAttachmentElementEnabled(store.getBoolValueForKey(WebPreferencesKey::attachmentElementEnabledKey()));
 #endif
-#if ENABLE(POINTER_LOCK)
-    settings.setPointerLockEnabled(store.getBoolValueForKey(WebPreferencesKey::pointerLockEnabledKey()));
-#endif
     settings.setAllowsPictureInPictureMediaPlayback(store.getBoolValueForKey(WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey()));
     settings.setMediaControlsScaleWithPageZoom(store.getBoolValueForKey(WebPreferencesKey::mediaControlsScaleWithPageZoomKey()));
     settings.setMockScrollbarsEnabled(store.getBoolValueForKey(WebPreferencesKey::mockScrollbarsEnabledKey()));
@@ -3188,6 +3185,10 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(store.getBoolValueForKey(WebPreferencesKey::webGL2EnabledKey()));
 #endif
 
+#if ENABLE(POINTER_LOCK)
+    RuntimeEnabledFeatures::sharedFeatures().setPointerLockEnabled(store.getBoolValueForKey(WebPreferencesKey::pointerLockEnabledKey()));
+#endif
+
     settings.setSpringTimingFunctionEnabled(store.getBoolValueForKey(WebPreferencesKey::springTimingFunctionEnabledKey()));
 
     settings.setVisualViewportEnabled(store.getBoolValueForKey(WebPreferencesKey::visualViewportEnabledKey()));
index 59bdd71..5dc4ca2 100644 (file)
@@ -1,3 +1,27 @@
+2016-12-05  Dean Jackson  <dino@apple.com>
+
+        pointer lock needs to be feature detectable
+        https://bugs.webkit.org/show_bug.cgi?id=165426
+        <rdar://problem/29486715>
+
+        Reviewed by Antoine Quint.
+
+        Expose the comment line to turn on/off pointer lock.
+
+        * DumpRenderTree/TestOptions.h:
+        * DumpRenderTree/TestOptions.mm:
+        (TestOptions::TestOptions):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+        (WTR::updateTestOptionsFromTestHeader):
+        * WebKitTestRunner/TestOptions.h:
+        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+        (WTR::PlatformWebView::viewSupportsOptions):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::viewSupportsOptions):
+
 2016-12-05  Jonathan Bedard  <jbedard@apple.com>
 
         Make it possible to use an existing simulator instance for one-off testing
index d68dab1..e6574bb 100644 (file)
@@ -30,6 +30,7 @@
 struct TestOptions {
     bool enableIntersectionObserver { false };
     bool enableModernMediaControls { false };
+    bool enablePointerLock { false };
 
     TestOptions(NSURL *testURL);
 };
index e05a4bf..c5acacb 100644 (file)
@@ -80,6 +80,8 @@ TestOptions::TestOptions(NSURL *testURL)
             this->enableIntersectionObserver = parseBooleanTestHeaderValue(value);
         else if (key == "enableModernMediaControls")
             this->enableModernMediaControls = parseBooleanTestHeaderValue(value);
+        else if (key == "enablePointerLock")
+            this->enablePointerLock = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }
index dc5817e..fbc522a 100644 (file)
@@ -1000,6 +1000,7 @@ static void resetWebPreferencesToConsistentValues(const TestOptions& options)
 
     preferences.intersectionObserverEnabled = options.enableIntersectionObserver;
     preferences.modernMediaControlsEnabled = options.enableModernMediaControls;
+    preferences.pointerLockEnabled = options.enablePointerLock;
 
     [preferences setSubtleCryptoEnabled:YES];
 
index 1210076..71fc1ad 100644 (file)
@@ -652,6 +652,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     WKPreferencesSetNeedsSiteSpecificQuirks(preferences, options.needsSiteSpecificQuirks);
     WKPreferencesSetIntersectionObserverEnabled(preferences, options.enableIntersectionObserver);
     WKPreferencesSetModernMediaControlsEnabled(preferences, options.enableModernMediaControls);
+    WKPreferencesSetPointerLockEnabled(preferences, options.enablePointerLock);
 
     static WKStringRef defaultTextEncoding = WKStringCreateWithUTF8CString("ISO-8859-1");
     WKPreferencesSetDefaultTextEncodingName(preferences, defaultTextEncoding);
@@ -963,6 +964,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std:
             testOptions.enableIntersectionObserver = parseBooleanTestHeaderValue(value);
         if (key == "enableModernMediaControls")
             testOptions.enableModernMediaControls = parseBooleanTestHeaderValue(value);
+        if (key == "enablePointerLock")
+            testOptions.enablePointerLock = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;
     }
 }
index d06f817..f318ded 100644 (file)
@@ -45,6 +45,7 @@ struct TestOptions {
     bool useCharacterSelectionGranularity { false };
     bool enableIntersectionObserver { false };
     bool enableModernMediaControls { false };
+    bool enablePointerLock { false };
 
     float deviceScaleFactor { 1 };
     Vector<String> overrideLanguages;
index 860e7a1..72c4f3d 100644 (file)
@@ -282,7 +282,8 @@ bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
         || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks
         || m_options.useCharacterSelectionGranularity != options.useCharacterSelectionGranularity
         || m_options.enableIntersectionObserver != options.enableIntersectionObserver
-        || m_options.enableModernMediaControls != options.enableModernMediaControls)
+        || m_options.enableModernMediaControls != options.enableModernMediaControls
+        || m_options.enablePointerLock != options.enablePointerLock)
         return false;
 
     return true;
index e31d823..f98d316 100644 (file)
@@ -278,7 +278,8 @@ bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
         || m_options.useMockScrollbars != options.useMockScrollbars
         || m_options.needsSiteSpecificQuirks != options.needsSiteSpecificQuirks
         || m_options.enableIntersectionObserver != options.enableIntersectionObserver
-        || m_options.enableModernMediaControls != options.enableModernMediaControls)
+        || m_options.enableModernMediaControls != options.enableModernMediaControls
+        || m_options.enablePointerLock != options.enablePointerLock)
         return false;
 
     return true;
index 79185b7..ad01653 100644 (file)
@@ -1,3 +1,15 @@
+2016-12-05  Dean Jackson  <dino@apple.com>
+
+        pointer lock needs to be feature detectable
+        https://bugs.webkit.org/show_bug.cgi?id=165426
+        <rdar://problem/29486715>
+
+        Reviewed by Antoine Quint.
+
+        We can now accurately detect pointer-lock.
+
+        * experimental-features.html:
+
 2016-12-02  Dean Jackson  <dino@apple.com>
 
         Make a public facing page to check for WebKit features
index 2185819..c4553c9 100644 (file)
@@ -126,8 +126,7 @@ window.addEventListener("load", function () {
         <div class="test" id="CSSGrid"><p>CSS Grid</p></div>
         <div class="test" id="Gamepad"><p>Gamepad API</p></div>
         <div class="test" id="VariationFonts"><p>Variation Fonts</p></div>
-        <!-- Remove "-unknown" when WebKit can do live feature detection for pointer lock -->
-        <div class="test" id="PointerLock-unknown"><p>Mouse Pointer Lock</p></div>
+        <div class="test" id="PointerLock"><p>Mouse Pointer Lock</p></div>
         <div class="test" id="WebGL2"><p>WebGL 2.0</p></div>
         <div class="test" id="FormValidation"><p>HTML Form Validation</p></div>
         <div class="test" id="InputEvents"><p>HTML Input Events</p></div>