Diff
Modified: branches/safari-603-branch/LayoutTests/ChangeLog (211511 => 211512)
--- branches/safari-603-branch/LayoutTests/ChangeLog 2017-02-01 21:26:17 UTC (rev 211511)
+++ branches/safari-603-branch/LayoutTests/ChangeLog 2017-02-01 21:26:21 UTC (rev 211512)
@@ -1,3 +1,20 @@
+2017-01-31 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r211249. rdar://problem/29539389
+
+ 2017-01-26 Jeremy Jones <jere...@apple.com>
+
+ Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture
+ https://bugs.webkit.org/show_bug.cgi?id=167126
+
+ Reviewed by Jon Lee.
+
+ Enable pointer-lock/locked-element-removed-from-dom.html for WK2 by enabling for Mac and disabling for WK1.
+ Not enable in WK1 becuase of https://bugs.webkit.org/show_bug.cgi?id=167127
+
+ * platform/mac-wk1/TestExpectations:
+ * platform/mac/TestExpectations:
+
2017-01-26 Matthew Hanson <matthew_han...@apple.com>
Merge r211235. rdar://problem/30058933
Modified: branches/safari-603-branch/LayoutTests/platform/mac/TestExpectations (211511 => 211512)
--- branches/safari-603-branch/LayoutTests/platform/mac/TestExpectations 2017-02-01 21:26:17 UTC (rev 211511)
+++ branches/safari-603-branch/LayoutTests/platform/mac/TestExpectations 2017-02-01 21:26:21 UTC (rev 211512)
@@ -281,7 +281,6 @@
# Pointer Lock can only check some of the API at the moment.
pointer-lock/bug90391-move-then-window-open-crash.html
pointer-lock/locked-element-iframe-removed-from-dom.html
-pointer-lock/locked-element-removed-from-dom.html
pointer-lock/pointerlockchange-event-on-lock-lost.html
pointer-lock/pointerlockchange-pointerlockerror-events.html
pointer-lock/pointerlockelement-null-when-pending.html
Modified: branches/safari-603-branch/LayoutTests/platform/mac-wk1/TestExpectations (211511 => 211512)
--- branches/safari-603-branch/LayoutTests/platform/mac-wk1/TestExpectations 2017-02-01 21:26:17 UTC (rev 211511)
+++ branches/safari-603-branch/LayoutTests/platform/mac-wk1/TestExpectations 2017-02-01 21:26:21 UTC (rev 211512)
@@ -293,3 +293,5 @@
webkit.org/b/165541 compositing/rtl/rtl-fixed-overflow.html [ Failure ]
webkit.org/b/165589 pointer-lock/lock-lost-on-esc-in-fullscreen.html [ Skip ]
+
+webkit.org/b/167127 pointer-lock/locked-element-removed-from-dom.html
Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211511 => 211512)
--- branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-01 21:26:17 UTC (rev 211511)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-01 21:26:21 UTC (rev 211512)
@@ -1,5 +1,43 @@
2017-01-31 Matthew Hanson <matthew_han...@apple.com>
+ Merge r211249. rdar://problem/29539389
+
+ 2017-01-26 Jeremy Jones <jere...@apple.com>
+
+ Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture
+ https://bugs.webkit.org/show_bug.cgi?id=167126
+
+ Reviewed by Jon Lee.
+
+ Enabled pointer-lock/locked-element-removed-from-dom.html for WK2.
+ Not enable in WK1 because of https://bugs.webkit.org/show_bug.cgi?id=167127
+
+ This change allows a page to lock the pointer again without a user gesture if it was unlocked by
+ the page and not by the user. See https://www.w3.org/TR/2016/REC-pointerlock-20161027/ 5.1 Methods
+
+ * page/PointerLockController.cpp:
+
+ When a document acquires pointer lock with a user gesture, that document is allowed to request pointer lock again
+ until the user takes an action to end pointer lock. We know it is a user action because user actions always
+ call requestPointerUnlockAndForceCursorVisible().
+
+ When the page requests a pointer unlock (via requestPointerUnlock), that document is allowed to continue to relock
+ the page. This continues until there is either an unlock request form the user
+ via requestPointerUnlockAndForceCursorVisible or a didLosePointerLock without a pointer unlock request.
+
+ (WebCore::PointerLockController::PointerLockController):
+ (WebCore::PointerLockController::requestPointerLock):
+ (WebCore::PointerLockController::requestPointerUnlock):
+ (WebCore::PointerLockController::requestPointerUnlockAndForceCursorVisible):
+ (WebCore::PointerLockController::elementRemoved):
+ (WebCore::PointerLockController::documentDetached):
+ (WebCore::PointerLockController::didAcquirePointerLock):
+ (WebCore::PointerLockController::didLosePointerLock):
+ (WebCore::PointerLockController::clearElement):
+ * page/PointerLockController.h:
+
+2017-01-31 Matthew Hanson <matthew_han...@apple.com>
+
Merge r211240. rdar://problem/30247467b
2017-01-26 Jer Noble <jer.no...@apple.com>
Modified: branches/safari-603-branch/Source/WebCore/page/PointerLockController.cpp (211511 => 211512)
--- branches/safari-603-branch/Source/WebCore/page/PointerLockController.cpp 2017-02-01 21:26:17 UTC (rev 211511)
+++ branches/safari-603-branch/Source/WebCore/page/PointerLockController.cpp 2017-02-01 21:26:21 UTC (rev 211512)
@@ -44,7 +44,6 @@
PointerLockController::PointerLockController(Page& page)
: m_page(page)
- , m_lockPending(false)
{
}
@@ -55,7 +54,7 @@
return;
}
- if (!ScriptController::processingUserGesture()) {
+ if (m_documentAllowedToRelockWithoutUserGesture != &target->document() && !ScriptController::processingUserGesture()) {
enqueueEvent(eventNames().pointerlockerrorEvent, target);
return;
}
@@ -78,8 +77,7 @@
m_lockPending = true;
m_element = target;
if (!m_page.chrome().client().requestPointerLock()) {
- m_element = nullptr;
- m_lockPending = false;
+ clearElement();
enqueueEvent(eventNames().pointerlockerrorEvent, target);
}
}
@@ -90,14 +88,18 @@
if (!m_element)
return;
+ m_unlockPending = true;
m_page.chrome().client().requestPointerUnlock();
}
void PointerLockController::requestPointerUnlockAndForceCursorVisible()
{
+ m_documentAllowedToRelockWithoutUserGesture = nullptr;
+
if (!m_element)
return;
+ m_unlockPending = true;
m_page.chrome().client().requestPointerUnlock();
m_forceCursorVisibleUponUnlock = true;
}
@@ -108,8 +110,8 @@
m_documentOfRemovedElementWhileWaitingForUnlock = &m_element->document();
// Set element null immediately to block any future interaction with it
// including mouse events received before the unlock completes.
+ requestPointerUnlock();
clearElement();
- requestPointerUnlock();
}
}
@@ -116,8 +118,9 @@
void PointerLockController::documentDetached(Document& document)
{
if (m_element && &m_element->document() == &document) {
+ m_documentOfRemovedElementWhileWaitingForUnlock = &m_element->document();
+ requestPointerUnlock();
clearElement();
- requestPointerUnlockAndForceCursorVisible();
}
}
@@ -140,6 +143,8 @@
{
enqueueEvent(eventNames().pointerlockchangeEvent, m_element.get());
m_lockPending = false;
+ m_forceCursorVisibleUponUnlock = false;
+ m_documentAllowedToRelockWithoutUserGesture = &m_element->document();
}
void PointerLockController::didNotAcquirePointerLock()
@@ -146,12 +151,17 @@
{
enqueueEvent(eventNames().pointerlockerrorEvent, m_element.get());
clearElement();
+ m_unlockPending = false;
}
void PointerLockController::didLosePointerLock()
{
+ if (!m_unlockPending)
+ m_documentAllowedToRelockWithoutUserGesture = nullptr;
+
enqueueEvent(eventNames().pointerlockchangeEvent, m_element ? &m_element->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get());
clearElement();
+ m_unlockPending = false;
m_documentOfRemovedElementWhileWaitingForUnlock = nullptr;
if (m_forceCursorVisibleUponUnlock) {
m_forceCursorVisibleUponUnlock = false;
Modified: branches/safari-603-branch/Source/WebCore/page/PointerLockController.h (211511 => 211512)
--- branches/safari-603-branch/Source/WebCore/page/PointerLockController.h 2017-02-01 21:26:17 UTC (rev 211511)
+++ branches/safari-603-branch/Source/WebCore/page/PointerLockController.h 2017-02-01 21:26:21 UTC (rev 211512)
@@ -64,10 +64,12 @@
void enqueueEvent(const AtomicString& type, Element*);
void enqueueEvent(const AtomicString& type, Document*);
Page& m_page;
- bool m_lockPending;
+ bool m_lockPending { false };
+ bool m_unlockPending { false };
bool m_forceCursorVisibleUponUnlock { false };
RefPtr<Element> m_element;
RefPtr<Document> m_documentOfRemovedElementWhileWaitingForUnlock;
+ RefPtr<Document> m_documentAllowedToRelockWithoutUserGesture;
};
} // namespace WebCore