<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209648] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209648">209648</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-09 21:18:33 -0800 (Fri, 09 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>document.pointerLockElement exposes a node inside a shadow tree
https://bugs.webkit.org/show_bug.cgi?id=165702
Reviewed by Simon Fraser.
Source/WebCore:
Expose pointerLockElement on ShadowRoot as spec'ed (DocumentOrShadowRoot):
https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin
Use ancestorElementInThisScope to find the correct node in pointerLockElement.
Tests: fast/shadow-dom/pointerlockelement-in-shadow-tree.html
fast/shadow-dom/pointerlockelement-in-slot.html
* dom/Document.cpp:
(WebCore::Document::pointerLockElement): Moved to TreeScope.
* dom/Document.h:
* dom/Document.idl: Moved ointerLockElement to DocumentOrShadowRoot.idl.
* dom/DocumentOrShadowRoot.idl: Ditto.
* dom/TreeScope.cpp:
(WebCore::TreeScope::focusedElementInScope): Use documentScope instead of acessing it via m_rootNode.
(WebCore::TreeScope::pointerLockElement): Moved from Document.
* dom/TreeScope.h:
LayoutTests:
Added tests for pointer locks inside a shadow root as well as one assigned to a slot.
* fast/shadow-dom/pointerlockelement-in-shadow-tree-expected.txt: Added.
* fast/shadow-dom/pointerlockelement-in-shadow-tree.html: Added.
* fast/shadow-dom/pointerlockelement-in-slot-expected.txt: Added.
* fast/shadow-dom/pointerlockelement-in-slot.html: Added.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-simulator/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformeflTestExpectations">trunk/LayoutTests/platform/efl/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformgtkTestExpectations">trunk/LayoutTests/platform/gtk/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorTestExpectations">trunk/LayoutTests/platform/ios-simulator/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
<li><a href="#trunkSourceWebCoredomDocumentOrShadowRootidl">trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopecpp">trunk/Source/WebCore/dom/TreeScope.cpp</a></li>
<li><a href="#trunkSourceWebCoredomTreeScopeh">trunk/Source/WebCore/dom/TreeScope.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastshadowdompointerlockelementinshadowtreeexpectedtxt">trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastshadowdompointerlockelementinshadowtreehtml">trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree.html</a></li>
<li><a href="#trunkLayoutTestsfastshadowdompointerlockelementinslotexpectedtxt">trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastshadowdompointerlockelementinslothtml">trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/LayoutTests/ChangeLog        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-12-09 Ryosuke Niwa <rniwa@webkit.org>
+
+ document.pointerLockElement exposes a node inside a shadow tree
+ https://bugs.webkit.org/show_bug.cgi?id=165702
+
+ Reviewed by Simon Fraser.
+
+ Added tests for pointer locks inside a shadow root as well as one assigned to a slot.
+
+ * fast/shadow-dom/pointerlockelement-in-shadow-tree-expected.txt: Added.
+ * fast/shadow-dom/pointerlockelement-in-shadow-tree.html: Added.
+ * fast/shadow-dom/pointerlockelement-in-slot-expected.txt: Added.
+ * fast/shadow-dom/pointerlockelement-in-slot.html: Added.
+ * platform/efl/TestExpectations:
+ * platform/gtk/TestExpectations:
+ * platform/ios-simulator/TestExpectations:
+
</ins><span class="cx"> 2016-12-09 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> Add reflected nonce attribute to HTML Link element IDL
</span></span></pre></div>
<a id="trunkLayoutTestsfastshadowdompointerlockelementinshadowtreeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree-expected.txt (0 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree-expected.txt        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Test pointerLockElement is the node in the same tree as the context object.
+To manually test, click on "Click here" below.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.pointerLockElement is null
+PASS shadowRoot.pointerLockElement is null
+PASS document.pointerLockElement is shadowHost
+PASS shadowRoot.pointerLockElement is target
+PASS document.pointerLockElement is null
+PASS shadowRoot.pointerLockElement is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshadowdompointerlockelementinshadowtreehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree.html (0 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree.html         (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-shadow-tree.html        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="host"></div>
+<script>
+description('Test pointerLockElement is the node in the same tree as the context object.<br>'
+ + 'To manually test, click on "Click here" below.');
+window.jsTestIsAsync = true;
+
+shadowHost = document.getElementById('host');
+shadowRoot = shadowHost.attachShadow({mode: 'closed'});
+shadowRoot.innerHTML = '<span tabindex=0>Click here</span>';
+target = shadowRoot.firstChild;
+
+target.onclick = function () {
+ shouldBe("document.pointerLockElement", "null");
+ shouldBe("shadowRoot.pointerLockElement", "null");
+ target.requestPointerLock();
+}
+
+function clickElement(element) {
+ eventSender.mouseMoveTo(element.offsetLeft + 5, element.offsetTop + 5);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+if (window.eventSender)
+ clickElement(target);
+
+let state = 0;
+document.addEventListener('pointerlockchange', function () {
+ switch (state) {
+ case 0:
+ shouldBe("document.pointerLockElement", "shadowHost");
+ shouldBe("shadowRoot.pointerLockElement", "target");
+ document.exitPointerLock();
+ break;
+ case 1:
+ shouldBe("document.pointerLockElement", "null");
+ shouldBe("shadowRoot.pointerLockElement", "null");
+ finishJSTest();
+ break;
+ }
+ state++;
+});
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshadowdompointerlockelementinslotexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot-expected.txt (0 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot-expected.txt        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+Test pointerLockElement is the node in the same tree as the context object.
+To manually test, click on "Click here" below.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.pointerLockElement is null
+PASS shadowRoot.pointerLockElement is null
+PASS document.pointerLockElement is target
+PASS shadowRoot.pointerLockElement is null
+PASS anotherShadowRoot.pointerLockElement is null
+PASS document.pointerLockElement is null
+PASS shadowRoot.pointerLockElement is null
+PASS anotherShadowRoot.pointerLockElement is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Click here
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshadowdompointerlockelementinslothtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot.html (0 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot.html         (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/pointerlockelement-in-slot.html        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="host"><span id="target" tabindex=0>Click here</span></div>
+<div id="anotherHost"></div>
+<script>
+description('Test pointerLockElement is the node in the same tree as the context object.<br>'
+ + 'To manually test, click on "Click here" below.');
+window.jsTestIsAsync = true;
+
+shadowHost = document.getElementById('host');
+shadowRoot = shadowHost.attachShadow({mode: 'closed'});
+shadowRoot.innerHTML = '<slot></slot>';
+
+target = document.getElementById('target');
+anotherShadowRoot = document.getElementById('anotherHost').attachShadow({mode: 'closed'});
+
+target.onclick = function () {
+ shouldBe("document.pointerLockElement", "null");
+ shouldBe("shadowRoot.pointerLockElement", "null");
+ target.requestPointerLock();
+}
+
+function clickElement(element) {
+ eventSender.mouseMoveTo(element.offsetLeft + 5, element.offsetTop + 5);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+if (window.eventSender)
+ clickElement(target);
+
+let state = 0;
+document.addEventListener('pointerlockchange', function () {
+ switch (state) {
+ case 0:
+ shouldBe("document.pointerLockElement", "target");
+ shouldBe("shadowRoot.pointerLockElement", "null");
+ shouldBe("anotherShadowRoot.pointerLockElement", "null");
+ document.exitPointerLock();
+ break;
+ case 1:
+ shouldBe("document.pointerLockElement", "null");
+ shouldBe("shadowRoot.pointerLockElement", "null");
+ shouldBe("anotherShadowRoot.pointerLockElement", "null");
+ finishJSTest();
+ break;
+ }
+ state++;
+});
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformeflTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/TestExpectations (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/TestExpectations        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/LayoutTests/platform/efl/TestExpectations        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -1523,6 +1523,8 @@
</span><span class="cx"> # Requires POINTER_LOCK support.
</span><span class="cx"> webkit.org/b/88080 pointer-lock [ Skip ]
</span><span class="cx"> webkit.org/b/88080 http/tests/pointer-lock [ Skip ]
</span><ins>+webkit.org/b/88080 fast/shadow-dom/pointerlockelement-in-shadow-tree.html [ Skip ]
+webkit.org/b/88080 fast/shadow-dom/pointerlockelement-in-slot.html [ Skip ]
</ins><span class="cx">
</span><span class="cx"> # Requires INDIE_UI support
</span><span class="cx"> webkit.org/b/111446 indieui [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/TestExpectations (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/TestExpectations        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/LayoutTests/platform/gtk/TestExpectations        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -281,7 +281,10 @@
</span><span class="cx"> # As well as testing fullscreen functionality, these tests also utilize the pointer lock feature.
</span><span class="cx"> webkit.org/b/99036 http/tests/fullscreen [ Skip ]
</span><span class="cx"> webkit.org/b/99036 http/tests/pointer-lock [ Skip ]
</span><ins>+webkit.org/b/99036 fast/shadow-dom/pointerlockelement-in-shadow-tree.html [ Skip ]
+webkit.org/b/99036 fast/shadow-dom/pointerlockelement-in-slot.html [ Skip ]
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> # IETC flexbox failures
</span><span class="cx"> webkit.org/b/85211 ietestcenter/css3/flexbox/flexbox-align-stretch-001.htm [ ImageOnlyFailure ]
</span><span class="cx"> webkit.org/b/85212 ietestcenter/css3/flexbox/flexbox-layout-002.htm [ ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -129,6 +129,8 @@
</span><span class="cx"> # Pointer-lock not supported on iOS
</span><span class="cx"> pointer-lock
</span><span class="cx"> http/tests/pointer-lock
</span><ins>+fast/shadow-dom/pointerlockelement-in-shadow-tree.html
+fast/shadow-dom/pointerlockelement-in-slot.html
</ins><span class="cx">
</span><span class="cx"> # FIXME: Media tests not supported on iOS
</span><span class="cx"> http/tests/media
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/Source/WebCore/ChangeLog        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-12-09 Ryosuke Niwa <rniwa@webkit.org>
+
+ document.pointerLockElement exposes a node inside a shadow tree
+ https://bugs.webkit.org/show_bug.cgi?id=165702
+
+ Reviewed by Simon Fraser.
+
+ Expose pointerLockElement on ShadowRoot as spec'ed (DocumentOrShadowRoot):
+ https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin
+
+ Use ancestorElementInThisScope to find the correct node in pointerLockElement.
+
+ Tests: fast/shadow-dom/pointerlockelement-in-shadow-tree.html
+ fast/shadow-dom/pointerlockelement-in-slot.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::pointerLockElement): Moved to TreeScope.
+ * dom/Document.h:
+ * dom/Document.idl: Moved ointerLockElement to DocumentOrShadowRoot.idl.
+ * dom/DocumentOrShadowRoot.idl: Ditto.
+ * dom/TreeScope.cpp:
+ (WebCore::TreeScope::focusedElementInScope): Use documentScope instead of acessing it via m_rootNode.
+ (WebCore::TreeScope::pointerLockElement): Moved from Document.
+ * dom/TreeScope.h:
+
</ins><span class="cx"> 2016-12-09 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> Add reflected nonce attribute to HTML Link element IDL
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -6040,17 +6040,6 @@
</span><span class="cx"> page->pointerLockController().requestPointerUnlock();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Element* Document::pointerLockElement() const
-{
- Page* page = this->page();
- if (!page || page->pointerLockController().lockPending())
- return nullptr;
- auto* element = page->pointerLockController().element();
- if (!element || &element->document() != this)
- return nullptr;
- return element;
-}
-
</del><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> void Document::decrementLoadEventDelayCount()
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/Source/WebCore/dom/Document.h        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -1122,7 +1122,6 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(POINTER_LOCK)
</span><span class="cx"> WEBCORE_EXPORT void exitPointerLock();
</span><del>- WEBCORE_EXPORT Element* pointerLockElement() const;
</del><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // Used to allow element that loads data without going through a FrameLoader to delay the 'load' event.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/Source/WebCore/dom/Document.idl        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -153,7 +153,6 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> [Conditional=POINTER_LOCK] void exitPointerLock();
</span><del>- [Conditional=POINTER_LOCK] readonly attribute Element? pointerLockElement;
</del><span class="cx">
</span><span class="cx"> [Conditional=CSS_REGIONS] DOMNamedFlowCollection webkitGetNamedFlows();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentOrShadowRootidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -31,4 +31,5 @@
</span><span class="cx"> ] interface DocumentOrShadowRoot {
</span><span class="cx"> Element? elementFromPoint(optional long x = 0, optional long y = 0); // FIXME: x and y should be double and not be optional.
</span><span class="cx"> readonly attribute Element? activeElement;
</span><ins>+ [Conditional=POINTER_LOCK] readonly attribute Element? pointerLockElement;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.cpp (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.cpp        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/Source/WebCore/dom/TreeScope.cpp        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include "HitTestResult.h"
</span><span class="cx"> #include "IdTargetObserverRegistry.h"
</span><span class="cx"> #include "Page.h"
</span><ins>+#include "PointerLockController.h"
</ins><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><span class="lines">@@ -377,7 +378,7 @@
</span><span class="cx">
</span><span class="cx"> Element* TreeScope::focusedElementInScope()
</span><span class="cx"> {
</span><del>- Document& document = m_rootNode.document();
</del><ins>+ Document& document = documentScope();
</ins><span class="cx"> Element* element = document.focusedElement();
</span><span class="cx">
</span><span class="cx"> if (!element && document.page())
</span><span class="lines">@@ -386,6 +387,22 @@
</span><span class="cx"> return ancestorElementInThisScope(element);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if ENABLE(POINTER_LOCK)
+
+Element* TreeScope::pointerLockElement() const
+{
+ Document& document = documentScope();
+ Page* page = document.page();
+ if (!page || page->pointerLockController().lockPending())
+ return nullptr;
+ auto* element = page->pointerLockController().element();
+ if (!element || &element->document() != &document)
+ return nullptr;
+ return ancestorElementInThisScope(element);
+}
+
+#endif
+
</ins><span class="cx"> static void listTreeScopes(Node* node, Vector<TreeScope*, 5>& treeScopes)
</span><span class="cx"> {
</span><span class="cx"> while (true) {
</span></span></pre></div>
<a id="trunkSourceWebCoredomTreeScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/TreeScope.h (209647 => 209648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/TreeScope.h        2016-12-10 04:27:26 UTC (rev 209647)
+++ trunk/Source/WebCore/dom/TreeScope.h        2016-12-10 05:18:33 UTC (rev 209648)
</span><span class="lines">@@ -52,6 +52,8 @@
</span><span class="cx"> void setParentTreeScope(TreeScope&);
</span><span class="cx">
</span><span class="cx"> Element* focusedElementInScope();
</span><ins>+ Element* pointerLockElement() const;
+
</ins><span class="cx"> WEBCORE_EXPORT Element* getElementById(const AtomicString&) const;
</span><span class="cx"> WEBCORE_EXPORT Element* getElementById(const String&) const;
</span><span class="cx"> const Vector<Element*>* getAllElementsById(const AtomicString&) const;
</span></span></pre>
</div>
</div>
</body>
</html>