Skip to content

Commit

Permalink
Update for Shadow DOM
Browse files Browse the repository at this point in the history
See discussion about this change at:
WICG/webcomponents#192

Splits Document.pointerLockElement into Document.pointerLockElement and
ShadowRoot.pointerLockElement and encapsulates shadow tree from
document.

Other than split, replaces document to 'shadow-including document' where
necessary.
  • Loading branch information
TakayoshiKochi committed Jun 30, 2016
1 parent a56c669 commit aff3835
Showing 1 changed file with 49 additions and 19 deletions.
68 changes: 49 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ <h2>Extensions to the <a>Element</a> Interface</h2>
active sandboxing flag set</a> does not have the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/origin-0.html#sandboxed-pointer-lock-browsing-context-flag">
sandboxed pointer lock browsing context flag</a> set.

<p>Pointer lock must succeed only if the <a>target</a> is
<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#in-a-document">in</a>
the
<p>Pointer lock must succeed only if the <a>target</a>'s
<a href="https://dom.spec.whatwg.org/#concept-shadow-including-root">shadow-including root</a>
is the
<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#active-document">active document</a>
of a
<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#browsing-context">browsing context</a>
Expand Down Expand Up @@ -275,12 +275,15 @@ <h2>Extensions to the <a>Element</a> Interface</h2>
for a subsequent requestPointerLock.
</p>

<p>If any element (including this one) in the same document
is already locked (or pending lock) the pointer
lock <a>target</a> must be updated to this element and a
<a>pointerlockchange</a> event sent.</p>
<p>If any element (including this one), whose
<a href="https://dom.spec.whatwg.org/#concept-shadow-including-root">shadow-including root</a>
is same as this element's
<a href="https://dom.spec.whatwg.org/#concept-shadow-including-root">shadow-including root</a>,
is already locked (or pending lock) the pointer lock <a>target</a> must be updated
to this element and a <a>pointerlockchange</a> event sent.</p>

<p>If any element in another document is already locked the request
<p>If any element, whose <a href="https://dom.spec.whatwg.org/#concept-shadow-including-root">shadow-including root</a> is a different document,
is already locked the request
must fail and a <a>pointerlockerror</a> event be sent.</p>

<p>Once in the locked state the <a>user agent</a> must fire all relevant
Expand Down Expand Up @@ -322,21 +325,12 @@ <h2>Extensions to the <a>Document</a> Interface</h2>
for <a>pointerlockerror</a> events.</p>
</dd>

<dt>readonly attribute Element? pointerLockElement</dt>
<dd>
<dfn title="pointerLockElement"></dfn>

<p>Returns the element set as the <a>target</a> for mouse events
while the pointer is locked. Null if lock is pending, pointer is
unlocked, or if the target is in another document.</p>
</dd>

<dt>void exitPointerLock ()</dt>
<dd>
<dfn title="exitPointerLock"></dfn>

<p>Initiates an exit from pointer lock state if currently locked
to a target in this document,
to a target whose <a href="https://dom.spec.whatwg.org/#concept-shadow-including-root">shadow-including root</a> is this document,
and sends a <a>pointerlockchange</a> event when the lock state
has been exited.</p>

Expand All @@ -348,6 +342,41 @@ <h2>Extensions to the <a>Document</a> Interface</h2>
</dl>
</section>

<section>
<h2>Extensions to the <a>DocumentOrShadowRoot</a> Mixin</h2>

<dl title='partial interface DocumentOrShadowRoot' class='idl'>
<dt>readonly attribute Element? pointerLockElement</dt>
<dd>
<dfn title="pointerLockElement"></dfn>

<p>If the element, which is set as the target for mouse events while the pointer is
locked, is a
<a href="https://dom.spec.whatwg.org/#concept-shadow-including-descendant">shadow-including descendant</a> of the
<a href="http://dom.spec.whatwg.org/#context-object">context object</a>,
return the result of the following algorithm:
<ol>
<li>Let <var>target</var> be the target for mouse events while the pointer is locked.
<li>If <var>target</var> is in the same tree as the
<a href="http://dom.spec.whatwg.org/#context-object">context object</a>,
let <var>adjusted-target</var> be <var>target</var></li>
<li>Otherwise: let <var>adjusted-target</var> be the shadow host which is a
<a href="https://dom.spec.whatwg.org/#concept-shadow-including-ancestor">shadow-including ancestor</a> of
<var>target</var> and is in the same tree as the
<a href="http://dom.spec.whatwg.org/#context-object">context object</a>.</li>
<li>Return <var>adjusted-target</var>
</ol>
</p>

<p>Returns null if lock is pending, if pointer is unlocked,
or if the target is not a
<a href="https://dom.spec.whatwg.org/#concept-shadow-including-descendant">shadow-including descendant</a> of the
<a href="http://dom.spec.whatwg.org/#context-object">context object</a>.
</p>
</dd>
</dl>
</section>

<section>
<h2>Extensions to the <a>MouseEvent</a> Interface</h2>

Expand Down Expand Up @@ -430,7 +459,8 @@ <h2>Requirements</h2>
[[FULLSCREEN]].</p>

<p>Pointer lock must be exited if the
<a>target</a> is removed from its document, or the <a>user agent</a>,
<a>target</a> <a href="https://html.spec.whatwg.org/#node-is-disconnected">is disconnected</a>,
or the <a>user agent</a>,
window, or tab loses focus. Moving focus between elements of
<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#active-document">active documents</a>,
including between
Expand Down

0 comments on commit aff3835

Please sign in to comment.