Title: [208903] trunk
Revision
208903
Author
[email protected]
Date
2016-11-18 15:33:05 -0800 (Fri, 18 Nov 2016)

Log Message

Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
https://bugs.webkit.org/show_bug.cgi?id=163801

Patch by Jeremy Jones <[email protected]> on 2016-11-18
Reviewed by Simon Fraser.

Source/_javascript_Core:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

These tests now pass with DumpRenderTree.
LayoutTests/pointer-lock/lock-already-locked.html
LayoutTests/pointer-lock/lock-element-not-in-dom.html
LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html
LayoutTests/pointer-lock/mouse-event-api.html

PointerLockController::requestPointerLock now protects against synchronous callback
to allowPointerLock().

Add pointerLockEnabled setting.

* Configurations/FeatureDefines.xcconfig:
* dom/Document.cpp:
(WebCore::Document::exitPointerLock): Fix existing typo.
(WebCore::Document::pointerLockElement):
* features.json:
* page/EventHandler.cpp:
* page/PointerLockController.cpp:
(WebCore::PointerLockController::requestPointerLock):
(WebCore::PointerLockController::requestPointerUnlock):
* page/Settings.in:

Source/WebKit/mac:

Plumb through PointerLockEnabled setting.

* Configurations/FeatureDefines.xcconfig:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::requestPointerUnlock):
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences pointerLockEnabled]):
(-[WebPreferences setPointerLockEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Add SPI to notify client of pointer lock and for client to allow or deny.
Unlock pointer when view is not longer active.

* Configurations/FeatureDefines.xcconfig:
* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/APIUIClient.h:
(API::UIClient::requestPointerLock):
(API::UIClient::didLosePointerLock):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
(WKPageDidAllowPointerLock):
(WKPageDidDenyPointerLock):
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/API/C/WKPageUIClient.h:
* UIProcess/API/C/WKPreferences.cpp:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::requestPointerLock):
(WebKit::UIDelegate::UIClient::didLosePointerLock):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::dispatchActivityStateChange):
(WebKit::WebPageProxy::resetStateAfterProcessExited):
(WebKit::WebPageProxy::requestPointerLock):
(WebKit::WebPageProxy::didAllowPointerLock):
(WebKit::WebPageProxy::didDenyPointerLock):
(WebKit::WebPageProxy::requestPointerUnlock):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WTF:

* wtf/FeatureDefines.h: ENABLE_POINTER_LOCK true for Mac.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (208902 => 208903)


--- trunk/Source/_javascript_Core/ChangeLog	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1,3 +1,12 @@
+2016-11-18  Jeremy Jones  <[email protected]>
+
+        Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
+        https://bugs.webkit.org/show_bug.cgi?id=163801
+
+        Reviewed by Simon Fraser.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2016-11-18  Filip Pizlo  <[email protected]>
 
         Unreviewed, fix cloop.

Modified: trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig (208902 => 208903)


--- trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2016-11-18 23:33:05 UTC (rev 208903)
@@ -150,7 +150,7 @@
 ENABLE_NOSNIFF = ;
 ENABLE_NOTIFICATIONS[sdk=macosx*] = ENABLE_NOTIFICATIONS;
 ENABLE_PDFKIT_PLUGIN[sdk=macosx*] = ENABLE_PDFKIT_PLUGIN;
-ENABLE_POINTER_LOCK = ;
+ENABLE_POINTER_LOCK[sdk=macosx*] = ENABLE_POINTER_LOCK;
 ENABLE_PROXIMITY_EVENTS = ;
 ENABLE_PUBLIC_SUFFIX_LIST = ENABLE_PUBLIC_SUFFIX_LIST;
 ENABLE_QUOTA = ;

Modified: trunk/Source/WTF/ChangeLog (208902 => 208903)


--- trunk/Source/WTF/ChangeLog	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WTF/ChangeLog	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1,3 +1,12 @@
+2016-11-18  Jeremy Jones  <[email protected]>
+
+        Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
+        https://bugs.webkit.org/show_bug.cgi?id=163801
+
+        Reviewed by Simon Fraser.
+
+        * wtf/FeatureDefines.h: ENABLE_POINTER_LOCK true for Mac.
+
 2016-11-17  Saam Barati  <[email protected]>
 
         Remove async/await compile time flag and enable tests

Modified: trunk/Source/WTF/wtf/FeatureDefines.h (208902 => 208903)


--- trunk/Source/WTF/wtf/FeatureDefines.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WTF/wtf/FeatureDefines.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -630,7 +630,7 @@
 #endif
 
 #if !defined(ENABLE_POINTER_LOCK)
-#define ENABLE_POINTER_LOCK 0
+#define ENABLE_POINTER_LOCK 1
 #endif
 
 #if !defined(ENABLE_PROXIMITY_EVENTS)

Modified: trunk/Source/WebCore/ChangeLog (208902 => 208903)


--- trunk/Source/WebCore/ChangeLog	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebCore/ChangeLog	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1,3 +1,32 @@
+2016-11-18  Jeremy Jones  <[email protected]>
+
+        Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
+        https://bugs.webkit.org/show_bug.cgi?id=163801
+
+        Reviewed by Simon Fraser.
+
+        These tests now pass with DumpRenderTree.
+        LayoutTests/pointer-lock/lock-already-locked.html
+        LayoutTests/pointer-lock/lock-element-not-in-dom.html
+        LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html
+        LayoutTests/pointer-lock/mouse-event-api.html
+
+        PointerLockController::requestPointerLock now protects against synchronous callback
+        to allowPointerLock().
+
+        Add pointerLockEnabled setting.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * dom/Document.cpp:
+        (WebCore::Document::exitPointerLock): Fix existing typo.
+        (WebCore::Document::pointerLockElement):
+        * features.json:
+        * page/EventHandler.cpp:
+        * page/PointerLockController.cpp:
+        (WebCore::PointerLockController::requestPointerLock):
+        (WebCore::PointerLockController::requestPointerUnlock):
+        * page/Settings.in:
+
 2016-11-17  Alex Christensen  <[email protected]>
 
         Support IDN2008 with UTS #46 instead of IDN2003

Modified: trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig (208902 => 208903)


--- trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2016-11-18 23:33:05 UTC (rev 208903)
@@ -150,7 +150,7 @@
 ENABLE_NOSNIFF = ;
 ENABLE_NOTIFICATIONS[sdk=macosx*] = ENABLE_NOTIFICATIONS;
 ENABLE_PDFKIT_PLUGIN[sdk=macosx*] = ENABLE_PDFKIT_PLUGIN;
-ENABLE_POINTER_LOCK = ;
+ENABLE_POINTER_LOCK[sdk=macosx*] = ENABLE_POINTER_LOCK;
 ENABLE_PROXIMITY_EVENTS = ;
 ENABLE_PUBLIC_SUFFIX_LIST = ENABLE_PUBLIC_SUFFIX_LIST;
 ENABLE_QUOTA = ;

Modified: trunk/Source/WebCore/dom/Document.cpp (208902 => 208903)


--- trunk/Source/WebCore/dom/Document.cpp	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-11-18 23:33:05 UTC (rev 208903)
@@ -6028,7 +6028,7 @@
 
 void Document::exitPointerLock()
 {
-    Page* page = this>page();
+    Page* page = this->page();
     if (!page)
         return;
     if (auto* target = page->pointerLockController().element()) {
@@ -6040,10 +6040,10 @@
 
 Element* Document::pointerLockElement() const
 {
-    Page* page = this>page();
+    Page* page = this->page();
     if (!page || page->pointerLockController().lockPending())
         return nullptr;
-    auto* element = page()->pointerLockController().element();
+    auto* element = page->pointerLockController().element();
     if (!element || &element->document() != this)
         return nullptr;
     return element;

Modified: trunk/Source/WebCore/features.json (208902 => 208903)


--- trunk/Source/WebCore/features.json	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebCore/features.json	2016-11-18 23:33:05 UTC (rev 208903)
@@ -297,6 +297,17 @@
         "description": "An API that can be used to understand the visibility and position of DOM elements relative to a containing element or to the top-level viewport."
     },
     {
+        "name": "Pointer Lock",
+        "status": {
+            "status": "In Development",
+            "enabled-by-default": false
+        },
+        "url": "https://www.w3.org/TR/pointerlock/",
+        "webkit-url": "https://bugs.webkit.org/show_bug.cgi?id=164652",
+        "keywords": ["pointer", "pointer lock"],
+        "description": "Provides scripted access to raw mouse movement data while locking the target of mouse events to a single element and removing the cursor from view."
+    },
+    {
         "name": "Preload",
         "status": {
             "status": "In Development",

Modified: trunk/Source/WebCore/page/EventHandler.cpp (208902 => 208903)


--- trunk/Source/WebCore/page/EventHandler.cpp	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2016-11-18 23:33:05 UTC (rev 208903)
@@ -72,7 +72,6 @@
 #include "PlatformKeyboardEvent.h"
 #include "PlatformWheelEvent.h"
 #include "PluginDocument.h"
-#include "PointerLockController.h"
 #include "RenderFrameSet.h"
 #include "RenderLayer.h"
 #include "RenderListBox.h"
@@ -120,6 +119,10 @@
 #include "PlatformGestureEventMac.h"
 #endif
 
+#if ENABLE(POINTER_LOCK)
+#include "PointerLockController.h"
+#endif
+
 namespace WebCore {
 
 using namespace HTMLNames;

Modified: trunk/Source/WebCore/page/PointerLockController.cpp (208902 => 208903)


--- trunk/Source/WebCore/page/PointerLockController.cpp	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebCore/page/PointerLockController.cpp	2016-11-18 23:33:05 UTC (rev 208903)
@@ -34,6 +34,8 @@
 #include "EventNames.h"
 #include "Page.h"
 #include "PlatformMouseEvent.h"
+#include "ScriptController.h"
+#include "Settings.h"
 #include "VoidCallback.h"
 
 
@@ -47,11 +49,19 @@
 
 void PointerLockController::requestPointerLock(Element* target)
 {
+    if (!m_page.settings().pointerLockEnabled())
+        return;
+
     if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) {
         enqueueEvent(eventNames().pointerlockerrorEvent, target);
         return;
     }
 
+    if (!ScriptController::processingUserGesture()) {
+        enqueueEvent(eventNames().pointerlockerrorEvent, target);
+        return;
+    }
+
     if (target->document().isSandboxed(SandboxPointerLock)) {
         // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
         target->document().addConsoleMessage(MessageSource::Security, MessageLevel::Error, ASCIILiteral("Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set."));
@@ -79,7 +89,13 @@
 
 void PointerLockController::requestPointerUnlock()
 {
-    return m_page.chrome().client().requestPointerUnlock();
+    if (!m_element)
+        return;
+
+    if (!m_page.settings().pointerLockEnabled())
+        return;
+
+    m_page.chrome().client().requestPointerUnlock();
 }
 
 void PointerLockController::elementRemoved(Element* element)

Modified: trunk/Source/WebCore/page/Settings.in (208902 => 208903)


--- trunk/Source/WebCore/page/Settings.in	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebCore/page/Settings.in	2016-11-18 23:33:05 UTC (rev 208903)
@@ -293,3 +293,4 @@
 asyncImageDecodingEnabled initial=true
 
 es6ModulesEnabled initial=false
+pointerLockEnabled initial=false

Modified: trunk/Source/WebKit/mac/ChangeLog (208902 => 208903)


--- trunk/Source/WebKit/mac/ChangeLog	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1,3 +1,23 @@
+2016-11-18  Jeremy Jones  <[email protected]>
+
+        Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
+        https://bugs.webkit.org/show_bug.cgi?id=163801
+
+        Reviewed by Simon Fraser.
+
+        Plumb through PointerLockEnabled setting.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::requestPointerUnlock):
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences pointerLockEnabled]):
+        (-[WebPreferences setPointerLockEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2016-11-17  Dan Bernstein  <[email protected]>
 
         Try to fix some non-macOS builds.

Modified: trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig (208902 => 208903)


--- trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig	2016-11-18 23:33:05 UTC (rev 208903)
@@ -150,7 +150,7 @@
 ENABLE_NOSNIFF = ;
 ENABLE_NOTIFICATIONS[sdk=macosx*] = ENABLE_NOTIFICATIONS;
 ENABLE_PDFKIT_PLUGIN[sdk=macosx*] = ENABLE_PDFKIT_PLUGIN;
-ENABLE_POINTER_LOCK = ;
+ENABLE_POINTER_LOCK[sdk=macosx*] = ENABLE_POINTER_LOCK;
 ENABLE_PROXIMITY_EVENTS = ;
 ENABLE_PUBLIC_SUFFIX_LIST = ENABLE_PUBLIC_SUFFIX_LIST;
 ENABLE_QUOTA = ;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (208902 => 208903)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2016-11-18 23:33:05 UTC (rev 208903)
@@ -77,7 +77,6 @@
 #import <WebCore/NotImplemented.h>
 #import <WebCore/Page.h>
 #import <WebCore/PlatformScreen.h>
-#import <WebCore/PointerLockController.h>
 #import <WebCore/ResourceRequest.h>
 #import <WebCore/SerializedCryptoKeyWrap.h>
 #import <WebCore/Widget.h>
@@ -95,6 +94,10 @@
 #import <WebCore/Geolocation.h>
 #endif
 
+#if ENABLE(POINTER_LOCK)
+#import <WebCore/PointerLockController.h>
+#endif
+
 #if PLATFORM(IOS)
 #import <WebCore/WAKClipView.h>
 #import <WebCore/WAKWindow.h>
@@ -730,8 +733,8 @@
 void WebChromeClient::requestPointerUnlock()
 {
 #if PLATFORM(MAC)
+    CGAssociateMouseAndMouseCursorPosition(true);
     CGDisplayShowCursor(CGMainDisplayID());
-    CGAssociateMouseAndMouseCursorPosition(true);
     if ([m_webView page])
         [m_webView page]->pointerLockController().didLosePointerLock();
 #endif

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (208902 => 208903)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -171,6 +171,7 @@
 #define WebKitCSSGridLayoutEnabledPreferenceKey @"WebKitCSSGridLayoutEnabled"
 #define WebKitVisualViewportEnabledPreferenceKey @"WebKitVisualViewportEnabled"
 #define WebKitModernMediaControlsEnabledPreferenceKey @"WebKitModernMediaControlsEnabled"
+#define WebKitPointerLockEnabledPreferenceKey @"WebKitPointerLockEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (208902 => 208903)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-11-18 23:33:05 UTC (rev 208903)
@@ -2360,6 +2360,16 @@
     [self _setBoolValue:flag forKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
 }
 
+- (BOOL)pointerLockEnabled
+{
+    return [self _boolValueForKey:WebKitPointerLockEnabledPreferenceKey];
+}
+
+- (void)setPointerLockEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitPointerLockEnabledPreferenceKey];
+}
+
 - (BOOL)mockScrollbarsEnabled
 {
     return [self _boolValueForKey:WebKitMockScrollbarsEnabledPreferenceKey];

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (208902 => 208903)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -281,6 +281,9 @@
 - (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag;
 - (BOOL)allowsPictureInPictureMediaPlayback;
 
+- (void)setPointerLockEnabled:(BOOL)flag;
+- (BOOL)pointerLockEnabled;
+
 - (NSString *)pictographFontFamily;
 - (void)setPictographFontFamily:(NSString *)family;
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (208902 => 208903)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2016-11-18 23:33:05 UTC (rev 208903)
@@ -2643,7 +2643,11 @@
     settings.setJavaScriptCanAccessClipboard([preferences _javascript_CanAccessClipboard]);
     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]);

Modified: trunk/Source/WebKit2/ChangeLog (208902 => 208903)


--- trunk/Source/WebKit2/ChangeLog	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1,3 +1,42 @@
+2016-11-18  Jeremy Jones  <[email protected]>
+
+        Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
+        https://bugs.webkit.org/show_bug.cgi?id=163801
+
+        Reviewed by Simon Fraser.
+
+        Add SPI to notify client of pointer lock and for client to allow or deny.
+        Unlock pointer when view is not longer active.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/APIUIClient.h:
+        (API::UIClient::requestPointerLock):
+        (API::UIClient::didLosePointerLock):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageUIClient):
+        (WKPageDidAllowPointerLock):
+        (WKPageDidDenyPointerLock):
+        * UIProcess/API/C/WKPagePrivate.h:
+        * UIProcess/API/C/WKPageUIClient.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+        * UIProcess/Cocoa/UIDelegate.h:
+        * UIProcess/Cocoa/UIDelegate.mm:
+        (WebKit::UIDelegate::setDelegate):
+        (WebKit::UIDelegate::UIClient::requestPointerLock):
+        (WebKit::UIDelegate::UIClient::didLosePointerLock):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::dispatchActivityStateChange):
+        (WebKit::WebPageProxy::resetStateAfterProcessExited):
+        (WebKit::WebPageProxy::requestPointerLock):
+        (WebKit::WebPageProxy::didAllowPointerLock):
+        (WebKit::WebPageProxy::didDenyPointerLock):
+        (WebKit::WebPageProxy::requestPointerUnlock):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-11-17  Carlos Garcia Campos  <[email protected]>
 
         Downloads started by context menu actions should also have a web view associated

Modified: trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig (208902 => 208903)


--- trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig	2016-11-18 23:33:05 UTC (rev 208903)
@@ -150,7 +150,7 @@
 ENABLE_NOSNIFF = ;
 ENABLE_NOTIFICATIONS[sdk=macosx*] = ENABLE_NOTIFICATIONS;
 ENABLE_PDFKIT_PLUGIN[sdk=macosx*] = ENABLE_PDFKIT_PLUGIN;
-ENABLE_POINTER_LOCK = ;
+ENABLE_POINTER_LOCK[sdk=macosx*] = ENABLE_POINTER_LOCK;
 ENABLE_PROXIMITY_EVENTS = ;
 ENABLE_PUBLIC_SUFFIX_LIST = ENABLE_PUBLIC_SUFFIX_LIST;
 ENABLE_QUOTA = ;

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (208902 => 208903)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -310,6 +310,7 @@
     macro(InputEventsEnabled, inputEventsEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "Input Events", "Enable InputEvents support") \
     macro(WebGL2Enabled, webGL2Enabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "WebGL 2.0", "WebGL 2 prototype") \
     macro(ES6ModulesEnabled, es6ModulesEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "ES6 Modules", "Enable ES6 Modules support") \
+    macro(PointerLockEnabled, pointerLockEnabled, Bool, bool, DEFAULT_EXPERIMENTAL_FEATURES_ENABLED, "PointerLock", "Pointer Lock API support") \
     \
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -167,6 +167,11 @@
     virtual NSDictionary *dataDetectionContext() { return nullptr; }
 #endif
 
+#if ENABLE(POINTER_LOCK)
+    virtual void requestPointerLock(WebKit::WebPageProxy*) { }
+    virtual void didLosePointerLock(WebKit::WebPageProxy*) { }
+#endif
+
     virtual void didClickAutoFillButton(WebKit::WebPageProxy&, API::Object*) { }
 
     virtual void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) { }

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2016-11-18 23:33:05 UTC (rev 208903)
@@ -109,7 +109,7 @@
 };
 
 template<> struct ClientTraits<WKPageUIClientBase> {
-    typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7> Versions;
+    typedef std::tuple<WKPageUIClientV0, WKPageUIClientV1, WKPageUIClientV2, WKPageUIClientV3, WKPageUIClientV4, WKPageUIClientV5, WKPageUIClientV6, WKPageUIClientV7, WKPageUIClientV8> Versions;
 };
 
 #if ENABLE(CONTEXT_MENUS)
@@ -2218,6 +2218,23 @@
             m_client.mediaSessionMetadataDidChange(toAPI(&page), toAPI(metadata), m_client.base.clientInfo);
         }
 #endif
+#if ENABLE(POINTER_LOCK)
+        void requestPointerLock(WebPageProxy* page) override
+        {
+            if (!m_client.requestPointerLock)
+                return;
+            
+            m_client.requestPointerLock(toAPI(page), m_client.base.clientInfo);
+        }
+
+        void didLosePointerLock(WebPageProxy* page) override
+        {
+            if (!m_client.requestPointerLock)
+                return;
+
+            m_client.didLosePointerLock(toAPI(page), m_client.base.clientInfo);
+        }
+#endif
     };
 
     toImpl(pageRef)->setUIClient(std::make_unique<UIClient>(wkClient));
@@ -2606,6 +2623,24 @@
     toImpl(page)->setMuted(muted);
 }
 
+void WKPageDidAllowPointerLock(WKPageRef page)
+{
+#if ENABLE(POINTER_LOCK)
+    toImpl(page)->didAllowPointerLock();
+#else
+    UNUSED_PARAM(page);
+#endif
+}
+
+void WKPageDidDenyPointerLock(WKPageRef page)
+{
+#if ENABLE(POINTER_LOCK)
+    toImpl(page)->didDenyPointerLock();
+#else
+    UNUSED_PARAM(page);
+#endif
+}
+
 bool WKPageHasMediaSessionWithActiveMediaElements(WKPageRef page)
 {
 #if ENABLE(MEDIA_SESSION)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -128,6 +128,9 @@
 };
 typedef uint32_t WKMediaMutedState;
 WK_EXPORT void WKPageSetMuted(WKPageRef page, WKMediaMutedState muted);
+    
+WK_EXPORT void WKPageDidAllowPointerLock(WKPageRef page);
+WK_EXPORT void WKPageDidDenyPointerLock(WKPageRef page);
 
 enum {
     kWKMediaIsNotPlaying = 0,

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -104,6 +104,9 @@
 typedef void (*WKPageMediaSessionMetadataDidChangeCallback)(WKPageRef page, WKMediaSessionMetadataRef metadata, const void* clientInfo);
 typedef void (*WKFullscreenMayReturnToInlineCallback)(WKPageRef page, const void* clientInfo);
 
+typedef void (*WKRequestPointerLockCallback)(WKPageRef page, const void* clientInfo);
+typedef void (*WKDidLosePointerLockCallback)(WKPageRef page, const void* clientInfo);
+
 // Deprecated
 typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
 typedef void      (*WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo);
@@ -636,6 +639,94 @@
     WKFullscreenMayReturnToInlineCallback                               fullscreenMayReturnToInline;
 } WKPageUIClientV7;
 
+typedef struct WKPageUIClientV8 {
+    WKPageUIClientBase                                                  base;
+    
+    // Version 0.
+    WKPageCreateNewPageCallback_deprecatedForUseWithV0                  createNewPage_deprecatedForUseWithV0;
+    WKPageUIClientCallback                                              showPage;
+    WKPageUIClientCallback                                              close;
+    WKPageTakeFocusCallback                                             takeFocus;
+    WKPageFocusCallback                                                 focus;
+    WKPageUnfocusCallback                                               unfocus;
+    WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV0             runJavaScriptAlert_deprecatedForUseWithV0;
+    WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV0           runJavaScriptConfirm_deprecatedForUseWithV0;
+    WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV0            runJavaScriptPrompt_deprecatedForUseWithV0;
+    WKPageSetStatusTextCallback                                         setStatusText;
+    WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0        mouseDidMoveOverElement_deprecatedForUseWithV0;
+    WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0     missingPluginButtonClicked_deprecatedForUseWithV0;
+    WKPageDidNotHandleKeyEventCallback                                  didNotHandleKeyEvent;
+    WKPageDidNotHandleWheelEventCallback                                didNotHandleWheelEvent;
+    WKPageGetToolbarsAreVisibleCallback                                 toolbarsAreVisible;
+    WKPageSetToolbarsAreVisibleCallback                                 setToolbarsAreVisible;
+    WKPageGetMenuBarIsVisibleCallback                                   menuBarIsVisible;
+    WKPageSetMenuBarIsVisibleCallback                                   setMenuBarIsVisible;
+    WKPageGetStatusBarIsVisibleCallback                                 statusBarIsVisible;
+    WKPageSetStatusBarIsVisibleCallback                                 setStatusBarIsVisible;
+    WKPageGetIsResizableCallback                                        isResizable;
+    WKPageSetIsResizableCallback                                        setIsResizable;
+    WKPageGetWindowFrameCallback                                        getWindowFrame;
+    WKPageSetWindowFrameCallback                                        setWindowFrame;
+    WKPageRunBeforeUnloadConfirmPanelCallback_deprecatedForUseWithV6    runBeforeUnloadConfirmPanel_deprecatedForUseWithV6;
+    WKPageUIClientCallback                                              didDraw;
+    WKPageUIClientCallback                                              pageDidScroll;
+    WKPageExceededDatabaseQuotaCallback                                 exceededDatabaseQuota;
+    WKPageRunOpenPanelCallback                                          runOpenPanel;
+    WKPageDecidePolicyForGeolocationPermissionRequestCallback           decidePolicyForGeolocationPermissionRequest;
+    WKPageHeaderHeightCallback                                          headerHeight;
+    WKPageFooterHeightCallback                                          footerHeight;
+    WKPageDrawHeaderCallback                                            drawHeader;
+    WKPageDrawFooterCallback                                            drawFooter;
+    WKPagePrintFrameCallback                                            printFrame;
+    WKPageUIClientCallback                                              runModal;
+    void*                                                               unused1; // Used to be didCompleteRubberBandForMainFrame
+    WKPageSaveDataToFileInDownloadsFolderCallback                       saveDataToFileInDownloadsFolder;
+    void*                                                               shouldInterruptJavaScript_unavailable;
+    
+    // Version 1.
+    WKPageCreateNewPageCallback_deprecatedForUseWithV1                  createNewPage_deprecatedForUseWithV1;
+    WKPageMouseDidMoveOverElementCallback                               mouseDidMoveOverElement;
+    WKPageDecidePolicyForNotificationPermissionRequestCallback          decidePolicyForNotificationPermissionRequest;
+    WKPageUnavailablePluginButtonClickedCallback_deprecatedForUseWithV1 unavailablePluginButtonClicked_deprecatedForUseWithV1;
+    
+    // Version 2.
+    WKPageShowColorPickerCallback                                       showColorPicker;
+    WKPageHideColorPickerCallback                                       hideColorPicker;
+    WKPageUnavailablePluginButtonClickedCallback                        unavailablePluginButtonClicked;
+    
+    // Version 3.
+    WKPagePinnedStateDidChangeCallback                                  pinnedStateDidChange;
+    
+    // Version 4.
+    void*                                                               unused2; // Used to be didBeginTrackingPotentialLongMousePress.
+    void*                                                               unused3; // Used to be didRecognizeLongMousePress.
+    void*                                                               unused4; // Used to be didCancelTrackingPotentialLongMousePress.
+    WKPageIsPlayingAudioDidChangeCallback                               isPlayingAudioDidChange;
+    
+    // Version 5.
+    WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
+    WKPageDidClickAutoFillButtonCallback                                didClickAutoFillButton;
+    WKPageRunJavaScriptAlertCallback_deprecatedForUseWithV5             runJavaScriptAlert_deprecatedForUseWithV5;
+    WKPageRunJavaScriptConfirmCallback_deprecatedForUseWithV5           runJavaScriptConfirm_deprecatedForUseWithV5;
+    WKPageRunJavaScriptPromptCallback_deprecatedForUseWithV5            runJavaScriptPrompt_deprecatedForUseWithV5;
+    WKPageMediaSessionMetadataDidChangeCallback                         mediaSessionMetadataDidChange;
+    
+    // Version 6.
+    WKPageCreateNewPageCallback                                         createNewPage;
+    WKPageRunJavaScriptAlertCallback                                    runJavaScriptAlert;
+    WKPageRunJavaScriptConfirmCallback                                  runJavaScriptConfirm;
+    WKPageRunJavaScriptPromptCallback                                   runJavaScriptPrompt;
+    WKCheckUserMediaPermissionCallback                                  checkUserMediaPermissionForOrigin;
+    
+    // Version 7.
+    WKPageRunBeforeUnloadConfirmPanelCallback                           runBeforeUnloadConfirmPanel;
+    WKFullscreenMayReturnToInlineCallback                               fullscreenMayReturnToInline;
+    
+    // Version 8.
+    WKRequestPointerLockCallback                                        requestPointerLock;
+    WKDidLosePointerLockCallback                                        didLosePointerLock;
+} WKPageUIClientV8;
+    
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1590,3 +1590,4 @@
 {
     WebKit::toImpl(preferencesRef)->setApplePayCapabilityDisclosureAllowed(allowed);
 }
+

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -55,6 +55,8 @@
 - (void)_webViewFullscreenMayReturnToInline:(WKWebView *)webView;
 - (void)_webViewDidEnterFullscreen:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.11), ios(8.3));
 - (void)_webViewDidExitFullscreen:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.11), ios(8.3));
+- (void)_webViewRequestPointerLock:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.12));
+- (void)_webViewDidLosePointerLock:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.12));
 
 - (void)_webView:(WKWebView *)webView imageOrMediaDocumentSizeChanged:(CGSize)size WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 - (NSDictionary *)_dataDetectionContextForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.12), ios(10.0));

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -101,6 +101,11 @@
 
         NSDictionary *dataDetectionContext() override;
 
+#if ENABLE(POINTER_LOCK)
+        void requestPointerLock(WebKit::WebPageProxy*) override;
+        void didLosePointerLock(WebKit::WebPageProxy*) override;
+#endif
+
         void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) override;
 
         UIDelegate& m_uiDelegate;
@@ -135,7 +140,10 @@
 #endif
         bool dataDetectionContextForWebView : 1;
         bool webViewImageOrMediaDocumentSizeChanged : 1;
-
+#if ENABLE(POINTER_LOCK)
+        bool webViewRequestPointerLock : 1;
+        bool webViewDidLosePointerLock : 1;
+#endif
 #if ENABLE(CONTEXT_MENUS)
         bool webViewContextMenuForElement : 1;
         bool webViewContextMenuForElementUserInfo : 1;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm	2016-11-18 23:33:05 UTC (rev 208903)
@@ -106,6 +106,10 @@
     m_delegateMethods.dataDetectionContextForWebView = [delegate respondsToSelector:@selector(_dataDetectionContextForWebView:)];
     m_delegateMethods.webViewImageOrMediaDocumentSizeChanged = [delegate respondsToSelector:@selector(_webView:imageOrMediaDocumentSizeChanged:)];
 
+#if ENABLE(POINTER_LOCK)
+    m_delegateMethods.webViewRequestPointerLock = [delegate respondsToSelector:@selector(_webViewRequestPointerLock:)];
+    m_delegateMethods.webViewDidLosePointerLock = [delegate respondsToSelector:@selector(_webViewDidLosePointerLock:)];
+#endif
 #if ENABLE(CONTEXT_MENUS)
     m_delegateMethods.webViewContextMenuForElement = [delegate respondsToSelector:@selector(_webView:contextMenu:forElement:)];
     m_delegateMethods.webViewContextMenuForElementUserInfo = [delegate respondsToSelector:@selector(_webView:contextMenu:forElement:userInfo:)];
@@ -457,6 +461,34 @@
     return [static_cast<id <WKUIDelegatePrivate>>(delegate) _dataDetectionContextForWebView:m_uiDelegate.m_webView];
 }
 
+#if ENABLE(POINTER_LOCK)
+
+void UIDelegate::UIClient::requestPointerLock(WebKit::WebPageProxy*)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewRequestPointerLock)
+        return;
+
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return;
+
+    [static_cast<id <WKUIDelegatePrivate>>(delegate) _webViewRequestPointerLock:m_uiDelegate.m_webView];
+}
+
+void UIDelegate::UIClient::didLosePointerLock(WebKit::WebPageProxy*)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewDidLosePointerLock)
+        return;
+
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return;
+
+    [static_cast<id <WKUIDelegatePrivate>>(delegate) _webViewDidLosePointerLock:m_uiDelegate.m_webView];
+}
+
+#endif
+
 void UIDelegate::UIClient::imageOrMediaDocumentSizeChanged(const WebCore::IntSize& newSize)
 {
     if (!m_uiDelegate.m_delegateMethods.webViewImageOrMediaDocumentSizeChanged)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1572,7 +1572,7 @@
         m_process->responsivenessTimer().stop();
 
 #if ENABLE(POINTER_LOCK)
-    if ((changed & ActivityState::IsVisible) && !isViewVisible())
+    if (((changed & ActivityState::IsVisible) && !isViewVisible()) || ((changed & ActivityState::WindowIsActive) && !m_pageClient.isViewWindowActive()))
         requestPointerUnlock();
 #endif
 
@@ -5493,6 +5493,10 @@
     m_pageClient.dismissContentRelativeChildWindows();
 #endif
 
+#if ENABLE(POINTER_LOCK)
+    requestPointerUnlock();
+#endif
+
     PageLoadState::Transaction transaction = m_pageLoadState.transaction();
     m_pageLoadState.reset(transaction);
 
@@ -6710,31 +6714,53 @@
 #if ENABLE(POINTER_LOCK)
 void WebPageProxy::requestPointerLock()
 {
+    ASSERT(!m_isPointerLockPending);
+    ASSERT(!m_isPointerLocked);
+    m_isPointerLockPending = true;
     if (!isViewVisible()) {
-        m_process->send(Messages::WebPage::DidNotAcquirePointerLock(), m_pageID);
+        didDenyPointerLock();
         return;
     }
-
-    didAllowPointerLock();
+    m_uiClient->requestPointerLock(this);
 }
     
 void WebPageProxy::didAllowPointerLock()
 {
+    ASSERT(m_isPointerLockPending && !m_isPointerLocked);
+    m_isPointerLocked = true;
+    m_isPointerLockPending = false;
+#if PLATFORM(MAC)
     CGDisplayHideCursor(CGMainDisplayID());
     CGAssociateMouseAndMouseCursorPosition(false);
+#endif
     m_process->send(Messages::WebPage::DidAcquirePointerLock(), m_pageID);
 }
     
 void WebPageProxy::didDenyPointerLock()
 {
+    ASSERT(m_isPointerLockPending && !m_isPointerLocked);
+    m_isPointerLockPending = false;
     m_process->send(Messages::WebPage::DidNotAcquirePointerLock(), m_pageID);
 }
 
 void WebPageProxy::requestPointerUnlock()
 {
-    CGDisplayShowCursor(CGMainDisplayID());
-    CGAssociateMouseAndMouseCursorPosition(true);
-    m_process->send(Messages::WebPage::DidLosePointerLock(), m_pageID);
+    if (m_isPointerLocked) {
+#if PLATFORM(MAC)
+        CGAssociateMouseAndMouseCursorPosition(true);
+        CGDisplayShowCursor(CGMainDisplayID());
+#endif
+        m_uiClient->didLosePointerLock(this);
+        m_process->send(Messages::WebPage::DidLosePointerLock(), m_pageID);
+    }
+
+    if (m_isPointerLockPending) {
+        m_uiClient->didLosePointerLock(this);
+        m_process->send(Messages::WebPage::DidNotAcquirePointerLock(), m_pageID);
+    }
+
+    m_isPointerLocked = false;
+    m_isPointerLockPending = false;
 }
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (208902 => 208903)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-11-18 23:33:05 UTC (rev 208903)
@@ -1945,6 +1945,11 @@
     bool m_forceAlwaysUserScalable { false };
 #endif
 
+#if ENABLE(POINTER_LOCK)
+    bool m_isPointerLockPending { false };
+    bool m_isPointerLocked { false };
+#endif
+
 #if ENABLE(DOWNLOAD_ATTRIBUTE)
     bool m_syncNavigationActionHasDownloadAttribute { false };
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (208902 => 208903)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-11-18 23:33:05 UTC (rev 208903)
@@ -151,7 +151,6 @@
 #include <WebCore/PageConfiguration.h>
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <WebCore/PluginDocument.h>
-#include <WebCore/PointerLockController.h>
 #include <WebCore/PrintContext.h>
 #include <WebCore/Range.h>
 #include <WebCore/RenderLayer.h>
@@ -199,6 +198,10 @@
 #include "WebVibrationClient.h"
 #endif
 
+#if ENABLE(POINTER_LOCK)
+#include <WebCore/PointerLockController.h>
+#endif
+
 #if ENABLE(PROXIMITY_EVENTS)
 #include "WebDeviceProximityClient.h"
 #endif
@@ -3027,6 +3030,9 @@
 #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()));

Modified: trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig (208902 => 208903)


--- trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2016-11-18 22:47:24 UTC (rev 208902)
+++ trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2016-11-18 23:33:05 UTC (rev 208903)
@@ -150,7 +150,7 @@
 ENABLE_NOSNIFF = ;
 ENABLE_NOTIFICATIONS[sdk=macosx*] = ENABLE_NOTIFICATIONS;
 ENABLE_PDFKIT_PLUGIN[sdk=macosx*] = ENABLE_PDFKIT_PLUGIN;
-ENABLE_POINTER_LOCK = ;
+ENABLE_POINTER_LOCK[sdk=macosx*] = ENABLE_POINTER_LOCK;
 ENABLE_PROXIMITY_EVENTS = ;
 ENABLE_PUBLIC_SUFFIX_LIST = ENABLE_PUBLIC_SUFFIX_LIST;
 ENABLE_QUOTA = ;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to