Diff
Modified: trunk/LayoutTests/ChangeLog (209524 => 209525)
--- trunk/LayoutTests/ChangeLog 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/LayoutTests/ChangeLog 2016-12-08 06:19:57 UTC (rev 209525)
@@ -1,3 +1,16 @@
+2016-12-07 Jeremy Jones <jere...@apple.com>
+
+ Exit pointer lock when page goes into page cache.
+ https://bugs.webkit.org/show_bug.cgi?id=165425
+ rdar://problem/29430834
+
+ Reviewed by Jer Noble.
+
+ * platform/mac/TestExpectations:
+ * pointer-lock/lock-lost-on-navigation-expected.txt: Added.
+ * pointer-lock/lock-lost-on-navigation.html: Added.
+ * pointer-lock/resources/lock-lost-on-navigation2.html: Added.
+
2016-12-07 Dave Hyatt <hy...@apple.com>
[CSS Parser] Unskip calc() tests
Modified: trunk/LayoutTests/platform/mac/TestExpectations (209524 => 209525)
--- trunk/LayoutTests/platform/mac/TestExpectations 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2016-12-08 06:19:57 UTC (rev 209525)
@@ -288,6 +288,7 @@
pointer-lock/pointerlockchange-event-on-lock-lost.html
pointer-lock/pointerlockchange-pointerlockerror-events.html
pointer-lock/pointerlockelement-null-when-pending.html
+pointer-lock/lock-lost-on-navigation.html [ Pass ]
http/tests/pointer-lock/
webkit.org/b/82763 fast/forms/textarea-placeholder-set-attribute.html
Added: trunk/LayoutTests/pointer-lock/lock-lost-on-navigation-expected.txt (0 => 209525)
--- trunk/LayoutTests/pointer-lock/lock-lost-on-navigation-expected.txt (rev 0)
+++ trunk/LayoutTests/pointer-lock/lock-lost-on-navigation-expected.txt 2016-12-08 06:19:57 UTC (rev 209525)
@@ -0,0 +1,12 @@
+Test that pointer lock is lost after navigation.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.testRunner is defined.
+PASS internals.pageHasPendingPointerLock() is false
+PASS internals.pageHasPointerLock() is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/pointer-lock/lock-lost-on-navigation.html (0 => 209525)
--- trunk/LayoutTests/pointer-lock/lock-lost-on-navigation.html (rev 0)
+++ trunk/LayoutTests/pointer-lock/lock-lost-on-navigation.html 2016-12-08 06:19:57 UTC (rev 209525)
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<div>
+ <div id="target1"></div>
+</div>
+<script>
+ description("Test that pointerlockchange event is dispatched when lock is lost.")
+ window.jsTestIsAsync = true;
+ shouldBeDefined("window.testRunner");
+
+ targetDiv1 = document.getElementById("target1");
+
+ todo = [
+ function () {
+ expectOnlyChangeEvent("Lock targetDiv1.");
+ targetDiv1.requestPointerLock();
+ // doNextStep called by event handler.
+ },
+ function () {
+ shouldBe("document.pointerLockElement", "targetDiv1");
+ setTimeout(() => {
+ window.location.href = ""
+ }, 0);
+ },
+ ];
+ doNextStepWithUserGesture();
+</script>
+<script src=""
+</body>
+</html>
+
Added: trunk/LayoutTests/pointer-lock/resources/lock-lost-on-navigation2.html (0 => 209525)
--- trunk/LayoutTests/pointer-lock/resources/lock-lost-on-navigation2.html (rev 0)
+++ trunk/LayoutTests/pointer-lock/resources/lock-lost-on-navigation2.html 2016-12-08 06:19:57 UTC (rev 209525)
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<div>
+ <div id="target1"></div>
+</div>
+<script>
+ description("Test that pointer lock is lost after navigation.")
+ window.jsTestIsAsync = true;
+ shouldBeDefined("window.testRunner");
+
+ shouldBe("internals.pageHasPendingPointerLock()", "false");
+ shouldBe("internals.pageHasPointerLock()", "false");
+ finishJSTest();
+</script>
+<script src=""
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (209524 => 209525)
--- trunk/Source/WebCore/ChangeLog 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/Source/WebCore/ChangeLog 2016-12-08 06:19:57 UTC (rev 209525)
@@ -1,3 +1,25 @@
+2016-12-07 Jeremy Jones <jere...@apple.com>
+
+ Exit pointer lock when page goes into page cache.
+ https://bugs.webkit.org/show_bug.cgi?id=165425
+ rdar://problem/29430834
+
+ Reviewed by Jer Noble.
+
+ Test: pointer-lock/lock-lost-on-navigation.html
+
+ Cancel pointer lock when page goes into page cache and add methods to Internals
+ so it can be tested.
+
+ * dom/Document.cpp:
+ (WebCore::Document::setPageCacheState):
+ * page/PointerLockController.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::pageHasPendingPointerLock):
+ (WebCore::Internals::pageHasPointerLock):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2016-12-07 Antoine Quint <grao...@apple.com>
[Modern Media Controls] Tracks panel does not display in the right location in fullscreen and cannot be dismissed
Modified: trunk/Source/WebCore/dom/Document.cpp (209524 => 209525)
--- trunk/Source/WebCore/dom/Document.cpp 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/Source/WebCore/dom/Document.cpp 2016-12-08 06:19:57 UTC (rev 209525)
@@ -4544,6 +4544,10 @@
v->resetScrollbars();
}
+#if ENABLE(POINTER_LOCK)
+ exitPointerLock();
+#endif
+
styleScope().clearResolver();
clearSelectorQueryCache();
m_styleRecalcTimer.stop();
Modified: trunk/Source/WebCore/page/PointerLockController.h (209524 => 209525)
--- trunk/Source/WebCore/page/PointerLockController.h 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/Source/WebCore/page/PointerLockController.h 2016-12-08 06:19:57 UTC (rev 209525)
@@ -48,8 +48,8 @@
void requestPointerUnlockAndForceCursorVisible();
void elementRemoved(Element&);
void documentDetached(Document&);
- bool lockPending() const;
- Element* element() const;
+ WEBCORE_EXPORT bool lockPending() const;
+ WEBCORE_EXPORT Element* element() const;
WEBCORE_EXPORT void didAcquirePointerLock();
WEBCORE_EXPORT void didNotAcquirePointerLock();
Modified: trunk/Source/WebCore/testing/Internals.cpp (209524 => 209525)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-12-08 06:19:57 UTC (rev 209525)
@@ -212,6 +212,10 @@
#include "MediaPlaybackTargetContext.h"
#endif
+#if ENABLE(POINTER_LOCK)
+#include "PointerLockController.h"
+#endif
+
using JSC::CallData;
using JSC::CallType;
using JSC::CodeBlock;
@@ -3405,4 +3409,34 @@
WTFReportBacktrace();
}
+#if ENABLE(POINTER_LOCK)
+bool Internals::pageHasPendingPointerLock() const
+{
+ Document* document = contextDocument();
+ if (!document)
+ return false;
+
+ Page* page = document->page();
+ if (!page)
+ return false;
+
+ return page->pointerLockController().lockPending();
+}
+
+bool Internals::pageHasPointerLock() const
+{
+ Document* document = contextDocument();
+ if (!document)
+ return false;
+
+ Page* page = document->page();
+ if (!page)
+ return false;
+
+ auto& controller = page->pointerLockController();
+ return controller.element() && !controller.lockPending();
+}
+#endif
+
+
} // namespace WebCore
Modified: trunk/Source/WebCore/testing/Internals.h (209524 => 209525)
--- trunk/Source/WebCore/testing/Internals.h 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/Source/WebCore/testing/Internals.h 2016-12-08 06:19:57 UTC (rev 209525)
@@ -508,6 +508,11 @@
void reportBacktrace();
+#if ENABLE(POINTER_LOCK)
+ bool pageHasPendingPointerLock() const;
+ bool pageHasPointerLock() const;
+#endif
+
private:
explicit Internals(Document&);
Document* contextDocument() const;
Modified: trunk/Source/WebCore/testing/Internals.idl (209524 => 209525)
--- trunk/Source/WebCore/testing/Internals.idl 2016-12-08 06:14:07 UTC (rev 209524)
+++ trunk/Source/WebCore/testing/Internals.idl 2016-12-08 06:19:57 UTC (rev 209525)
@@ -483,4 +483,7 @@
boolean userPrefersReducedMotion();
void reportBacktrace();
+
+ [Conditional=POINTER_LOCK] boolean pageHasPendingPointerLock();
+ [Conditional=POINTER_LOCK] boolean pageHasPointerLock();
};