Skip to content

Commit f0de230

Browse files
authored
[cssom-view] add shadowRoots parameter to caretPositionFromPoint API. (w3c#10200)
* Update Overview.bs Per w3c#9932, add `shadowRoots` parameter to `caretPositionFromPoint` API. * Update Overview.bs Bubble `caret range` out of the shadow roots. * Update Overview.bs Address PR comments. * Update Overview.bs Address PR comment. * Update Overview.bs Address PR comment. * Update Overview.bs linked created issue(10230) to the spec.
1 parent 47c20c6 commit f0de230

1 file changed

Lines changed: 16 additions & 17 deletions

File tree

cssom-view-1/Overview.bs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ Note: Some non-conforming implementations are known to return 32 instead of 24.
10111011
partial interface Document {
10121012
Element? elementFromPoint(double x, double y);
10131013
sequence<Element> elementsFromPoint(double x, double y);
1014-
CaretPosition? caretPositionFromPoint(double x, double y);
1014+
CaretPosition? caretPositionFromPoint(double x, double y, ShadowRoot... shadowRoots);
10151015
readonly attribute Element? scrollingElement;
10161016
};
10171017
</pre>
@@ -1042,7 +1042,7 @@ instance, an element can be excluded from being a target for hit testing by usin
10421042
1. If the document has a [=root element=], and the last item in <var>sequence</var> is not the [=root element=], append the [=root element=] to <var>sequence</var>.
10431043
1. Return <var>sequence</var>.
10441044

1045-
The <dfn method for=Document>caretPositionFromPoint(<var>x</var>, <var>y</var>)</dfn> method must return the
1045+
The <dfn method for=Document>caretPositionFromPoint(<var>x</var>, <var>y</var>, ...<var>shadowRoots</var>)</dfn> method must return the
10461046
result of running these steps:
10471047

10481048
1. If there is no <a>viewport</a> associated with the document, return null.
@@ -1070,21 +1070,18 @@ result of running these steps:
10701070
<dt><a>caret range</a>
10711071
<dd>null
10721072
</dl>
1073-
1. Otherwise, return a <a>caret position</a> where the
1074-
<a>caret range</a> is a collapsed
1075-
{{Range}} object for the position
1076-
where the text insertion point indicator would have been inserted when applying the <a>transforms</a> that apply to the descendants of the
1077-
<a>viewport</a>, and the other properties are set as follows:
1078-
1079-
<dl>
1080-
<dt><a>caret node</a>
1081-
<dd>The [=range/start node=]
1082-
of the <a>caret range</a>.
1083-
1084-
<dt><a>caret offset</a>
1085-
<dd>The [=range/start offset=] of
1086-
the <a>caret range</a>.
1087-
</dl>
1073+
1. Otherwise:
1074+
1075+
1. Let <var>caretPosition</var> be a <a for=/>tuple</a> consisting of a <var>caretPositionNode</var> (a <a for=/>node</a>) and a <var>caretPositionOffset</var> (a non-negative integer) for the position where the text insertion point indicator would have been inserted when applying
1076+
the <a>transforms</a> that apply to the descendants of the <a>viewport</a>.
1077+
1. Let <var>startNode</var> be the <var>caretPositionNode</var> of the <var>caretPosition</var>, and let <var>startOffset</var> be the <var>caretPositionOffset</var> of the <var>caretPosition</var>.
1078+
1. While <var>startNode</var> is a [=node=], <var>startNode</var>'s [=tree/root=] is a [=shadow root=], and <var>startNode</var>'s [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of <var>shadowRoots</var>, repeat these steps:
1079+
1. Set <var>startOffset</var> to [=tree/index=] of <var>startNode</var>'s [=tree/root=]'s [=host=].
1080+
1. Set <var>startNode</var> to <var>startNode</var>'s [=tree/root=]'s [=host=]'s [=tree/parent=].</li>
1081+
1. Return a <a>caret position</a> with its properties set as follows:
1082+
1. <a>caret node</a> is set to <var>startNode</var>.
1083+
1. <a>caret offset</a> is set to <var>startOffset</var>.
1084+
1. <a>caret range</a> is set to a collapsed {{Range}} object which [=range/start node=] and [=range/end node=] are <var>startNode</var>, and which [=range/start offset=] and [=range/end offset=] are <var>startOffset</var>.
10881085

10891086
Note: The specifics of hit testing are out of scope of this
10901087
specification and therefore the exact details of
@@ -1148,6 +1145,8 @@ aborting on the first step that returns a value:
11481145

11491146
Note: This {{DOMRect}} object is not <a spec=html>live</a>.
11501147

1148+
Issue(10230): Consider removing <a>caret range</a> concept from <dfn>caret position</dfn> interface.
1149+
11511150
<h2 id=extension-to-the-element-interface caniuse="element-scroll-methods">
11521151
Extensions to the {{Element}} Interface</h2>
11531152

0 commit comments

Comments
 (0)