Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input events dispatch to top-level frame #1847

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 67 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2212,8 +2212,8 @@ <h2>Sessions</h2>
browsing context</dfn>, which is set to the parent of the <a>current
browsing context</a> when changing browsing contexts, and an
associated <dfn>current top-level browsing context</dfn>, which is
set to the top-browsing context ancestor of the <a>current browsing
context</a>, when changing browsing contexts.</p>
set to the [=browsing context/top-level browsing context=] of the
<a>current browsing context</a>, when changing browsing contexts.</p>

<p>An <a>HTTP session</a> has an associated <dfn>session
timeouts</dfn> which is a <a>timeouts configuration</a>. This is
Expand Down Expand Up @@ -8286,11 +8286,12 @@ <h3>Ticks</h3>
content observable effects that must be consistent across
implementations. To accommodate this, the specification requires
that <a>remote ends</a> <dfn>perform implementation-specific action
dispatch steps</dfn> on a <a>browsing context</a> <var>context</var>,
and a <var>list of events</var> and their properties. These steps
must be equivalent to performing the given input device manipulations
on <var>context</var>, such that trusted events corresponding to the
entries in <var>list of events</var>are dispatched.
dispatch steps</dfn> on a <var>context</var>, and a <var>list of events</var>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep browsing context indicating the context var type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I missed it.

and their properties. These steps must be equivalent to performing the given
input device manipulations on the
[=browsing context/top-level browsing context=] of the <var>context</var>,
such that trusted events corresponding to the entries in
<var>list of events</var> are dispatched.
Comment on lines +8293 to +8294
Copy link
Contributor Author

@sadym-chromium sadym-chromium Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we can "hand-wave" hear like "These steps must be equivalent to user trying to perform the given input device manipulations on context through the top-level browsing context."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@sadym-chromium sadym-chromium Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OrKoN @whimboo we can keep specification implementation-specific, just clarify the events are dispatched via top-level browsing context. I'm not sure if that approach would work with the events intercepted by the top-level frame.


<aside class=note>
<p>The list of events is not comprehensive; in particular the default
Expand Down Expand Up @@ -8338,13 +8339,58 @@ <h3>Processing actions</h3>
input JSON, such that the actions to be performed in a single <a>tick</a>
are grouped together.

<p>To <dfn>get parent offset</dfn> of <var>context</var>:
<ol class="algorithm">
<li>Let <var>offsetLeft</var> equal to 0 and <var>offsetTop</var> equal to 0.
</li>
<li>
Let <var>navigable</var> be <var>context</var>'s <a>active document</a>'s
[=navigable/parent=].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[=navigable/parent=] is a property of a navigable and not the document. Did you mean to get the current navigable instead of a parent (e.g., https://html.spec.whatwg.org/#node-navigable)?

</li>
<li>Let <var>parent navigable</var> be <var>navigable</var>'s parent.</li>
<li>If <var>parent navigable</var> is not null:
<ol>
<li> Let <var>parent context</var> be <var>parent navigable</var>'s
[=navigable/document=]'s [=document/browsing context=].
</li>
<li>Let <code>(parentOffsetLeft, parentOffsetTop)</code> be the result of
[=get parent offset=] of <var>parent context</var>.
</li>
<li>Add <code>parentOffsetLeft</code> to <code>offsetLeft</code>.</li>
<li>Add <code>parentOffsetTop</code> to <code>offsetTop</code>.</li>
<li>Let <var>containerElement</var> be an <a>element</a> which <a>navigable
container</a> presents <var>parent navigable</var>.
</li>
<li>Let <code>containerRect</code> be the result of calling
{{Element/getBoundingClientRect()}} of <var>containerElement</var>.
</li>
<li>Let <code>borderLeftWidth</code> be the computed [=border-left-width=]
of <code>containerElement</code> in <a>CSS pixels</a>.
</li>
<li>Let <code>borderTopWidth</code> be the computed [=border-top-width=] of
<code>containerElement</code> in <a>CSS pixels</a>.
</li>
<li>Add <code>containerRect.left</code> + <code>borderLeftWidth</code> to
<code>offsetLeft</code>.
</li>
<li>Add <code>containerRect.top</code> + <code>borderTopWidth</code> to
<code>offsetTop</code>.
</li>
</ol>
</li>
<li>Return (<var>offsetLeft</var>, <var>offsetTop</var>).</li>
</ol>
<span class=issue>TODO: clarify if the algo respect transforms?</span>
<span class=issue>TODO: respect iframe's viewport's intersections</span>

<p>To <dfn>get coordinates relative to an origin</dfn>
given <var>source</var>, <var>x offset</var>, <var>y offset</var>,
<var>origin</var>, <var>browsing context</var>, and <var>actions
options</var>:

<ol class="algorithm">
<li>Let <code>(parentOffsetLeft, parentOffsetTop)</code> be the result of
[=get parent offset=] of <var>browsing context</var>.</li>
<li><p>Run the substeps of the first matching value
of <var>origin</var>
<dl>
Expand Down Expand Up @@ -8392,7 +8438,7 @@ <h3>Processing actions</h3>
</dd>
</dl>

<li><p>Return (<var>x</var>, <var>y</var>)
<li><p>Return (<var>x</var> + <var>parentOffsetLeft</var>, <var>y</var> + <var>parentOffsetTop</var>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the offset be applied to all origins or only the viewport? I think the origin pointer might already be in the top level context coordinates and not sure if the element origin does some adjustments already.

Copy link
Contributor Author

@sadym-chromium sadym-chromium Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the origin "pointer" to be relative to "context" param of "PerformActionsParameters" of the command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does not seem to follow from the spec text since input sources are per top-level browsing context.

</ol>

<p>To <dfn>extract an action sequence</dfn> given
Expand Down Expand Up @@ -11714,6 +11760,7 @@ <h2>Index</h2>
<!-- Dirty value flag --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-fe-dirty>Dirty value flag</a></dfn>
<!-- Disabled --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-element-disabled>Actually disabled</a></dfn>
<!-- Document readiness --> <li><dfn><a href=https://html.spec.whatwg.org/#current-document-readiness>Document readiness</a></dfn>
<!-- Document's browsing context --> <li><dfn data-dfn-for="document"><a href=https://html.spec.whatwg.org/#concept-document-bc>Browsing context</a></dfn>
<!-- Element contexts --> <li><dfn data-lt="element context"><a href=https://html.spec.whatwg.org/#concept-element-contexts>Element contexts</a></dfn>
<!-- Enumerated attribute --> <li><dfn><a href=https://html.spec.whatwg.org/#enumerated-attribute>Enumerated attribute</a></dfn>
<!-- Event loop --> <li><dfn><a href=https://html.spec.whatwg.org/#event-loop>Event loop</a></dfn>
Expand All @@ -11725,6 +11772,8 @@ <h2>Index</h2>
<!-- Joint session history --> <li><dfn><a href=https://html.spec.whatwg.org/#joint-session-history>Joint session history</a></dfn>
<!-- Mature (navigation) --> <li><dfn data-lt="matured"><a href=https://html.spec.whatwg.org/#concept-navigate-mature>Mature</a></dfn> navigation.
<!-- Mutable --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-fe-mutable>Mutable</a></dfn>
<!-- Navigable's document --> <li><dfn data-dfn-for="navigable"><a href=https://html.spec.whatwg.org/#nav-document>Document</a></dfn>
<!-- Navigable's parent --> <li><dfn data-dfn-for="navigable"><a href=https://html.spec.whatwg.org/#nav-parent>Parent</a></dfn>
<!-- Navigate --> <li><dfn data-lt="navigating|navigation"><a href=https://html.spec.whatwg.org/#navigate>Navigate</a></dfn>
<!-- Origin-clean --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-canvas-origin-clean>Origin-clean</a></dfn>
<!-- Overridden reload --> <li><dfn><a href="https://html.spec.whatwg.org/multipage/dom.html#an-overridden-reload">An overridden reload</a></dfn>
Expand All @@ -11742,6 +11791,7 @@ <h2>Index</h2>
<!-- Simple dialogs --> <li><dfn data-lt="simple dialog"><a href=https://html.spec.whatwg.org/#simple-dialogs>Simple dialogs</a></dfn>
<!-- Steps to fire beforeunload --> <li><dfn><a href=https://html.spec.whatwg.org/#steps-to-fire-beforeunload>Steps to fire beforeunload</a></dfn>
<!-- Suffering from bad input --> <li><dfn><a href=https://html.spec.whatwg.org/#suffering-from-bad-input>Suffering from bad input</a></dfn>
<!-- Top-level browsing context --> <li><dfn data-dfn-for="browsing context"><a href=https://html.spec.whatwg.org/#bc-tlbc>Top-level browsing context</a></dfn>
<!-- Traverse the history by a delta --> <li><dfn><a href=https://html.spec.whatwg.org/#traverse-the-history-by-a-delta>Traverse the history by a delta</a></dfn>
<!-- Unfocusing steps --><li><dfn><a href=https://html.spec.whatwg.org/#unfocusing-steps>unfocusing steps</a></dfn>
<!-- User prompt --> <li><dfn data-lt="user prompts"><a href=https://html.spec.whatwg.org/#user-prompts>User prompt</a></dfn>
Expand Down Expand Up @@ -11869,6 +11919,15 @@ <h2>Index</h2>
<!-- CSS pixels --> <li><dfn><a href=https://www.w3.org/TR/css-values-3/#px>CSS pixels</a></dfn>
</ul>

<dd>The following properties are defined in
the CSS Backgrounds and Borders Module Level 3: [[CSS3-BACKGROUND]]
<ul>
<!-- border-left-width property --> <li>The <dfn><a href=https://drafts.csswg.org/css-backgrounds-3/#propdef-border-left-width><code>border-left-width</code></a></dfn> property
</ul>
<ul>
<!-- border-top-width property --> <li>The <dfn><a href=https://drafts.csswg.org/css-backgrounds-3/#propdef-border-left-width><code>border-top-width</code></a></dfn> property
</ul>

<dd>The following properties are defined in
the CSS Basic Box Model Level 3 specification: [[CSS3-BOX]]
<ul>
Expand Down
Loading