From eb7f6bb658434489d0f81b5f3f82f967e8aac3fc Mon Sep 17 00:00:00 2001 From: Siye Liu Date: Thu, 4 Apr 2024 09:35:15 -0700 Subject: [PATCH 1/6] Update Overview.bs Per https://github.com/w3c/csswg-drafts/issues/9932, add `shadowRoots` parameter to `caretPositionFromPoint` API. --- cssom-view-1/Overview.bs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/cssom-view-1/Overview.bs b/cssom-view-1/Overview.bs index dd1275bf7b8..1373630dee8 100644 --- a/cssom-view-1/Overview.bs +++ b/cssom-view-1/Overview.bs @@ -1011,7 +1011,7 @@ Note: Some non-conforming implementations are known to return 32 instead of 24. partial interface Document { Element? elementFromPoint(double x, double y); sequence<Element> elementsFromPoint(double x, double y); - CaretPosition? caretPositionFromPoint(double x, double y); + CaretPosition? caretPositionFromPoint(double x, double y, ShadowRoot... shadowRoots); readonly attribute Element? scrollingElement; }; @@ -1042,7 +1042,7 @@ instance, an element can be excluded from being a target for hit testing by usin 1. If the document has a [=root element=], and the last item in sequence is not the [=root element=], append the [=root element=] to sequence. 1. Return sequence. -The caretPositionFromPoint(x, y) method must return the +The caretPositionFromPoint(x, y, ...shadowRoots) method must return the result of running these steps: 1. If there is no viewport associated with the document, return null. @@ -1074,17 +1074,12 @@ result of running these steps: caret range is a collapsed {{Range}} object for the position where the text insertion point indicator would have been inserted when applying the transforms that apply to the descendants of the - viewport, and the other properties are set as follows: - -
-
caret node -
The [=range/start node=] - of the caret range. - -
caret offset -
The [=range/start offset=] of - the caret range. -
+ viewport, and the other properties are set after running these steps: + 1. Let startNode be the [=range/start node=] of the caret range, and let startOffset be the [=range/start offset=] of the caret range. + 1. While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], and startNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of shadowRoots, repeat these steps: + 1. Set startOffset to [=tree/index=] of startNode's [=tree/root=]'s [=host=]. + 1. Set startNode to startNode's [=tree/root=]'s [=host=]'s [=tree/parent=]. + 1. Set caret node in caret position to startNode, and set caret offset in caret position to startOffset. Note: The specifics of hit testing are out of scope of this specification and therefore the exact details of From b7ce1b58dc8bcf704485e4c696eecfefffa8730d Mon Sep 17 00:00:00 2001 From: Siye Liu Date: Tue, 16 Apr 2024 14:34:12 -0700 Subject: [PATCH 2/6] Update Overview.bs Bubble `caret range` out of the shadow roots. --- cssom-view-1/Overview.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cssom-view-1/Overview.bs b/cssom-view-1/Overview.bs index 1373630dee8..dcca3d78421 100644 --- a/cssom-view-1/Overview.bs +++ b/cssom-view-1/Overview.bs @@ -1070,16 +1070,16 @@ result of running these steps:
caret range
null -1. Otherwise, return a caret position where the - caret range is a collapsed - {{Range}} object for the position - where the text insertion point indicator would have been inserted when applying the transforms that apply to the descendants of the - viewport, and the other properties are set after running these steps: +1. Otherwise, return a caret position where its properties are set after running these steps: + + 1. Let caret range to be a collapsed {{Range}} object for the position where the text insertion point indicator whould have been inserted when applying + the transforms that apply to the descendants of the viewport. 1. Let startNode be the [=range/start node=] of the caret range, and let startOffset be the [=range/start offset=] of the caret range. 1. While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], and startNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of shadowRoots, repeat these steps: 1. Set startOffset to [=tree/index=] of startNode's [=tree/root=]'s [=host=]. 1. Set startNode to startNode's [=tree/root=]'s [=host=]'s [=tree/parent=]. 1. Set caret node in caret position to startNode, and set caret offset in caret position to startOffset. + 1. Set caret range's [=range/start node=] and [=range/end node=] to startNode, and set caret range's [=range/start offset=] and [=range/end offset=] to startOffset. Note: The specifics of hit testing are out of scope of this specification and therefore the exact details of From 745d1ee8e1e4d32af89371f3d691c0b1d9c73523 Mon Sep 17 00:00:00 2001 From: Siye Liu Date: Wed, 17 Apr 2024 11:15:09 -0700 Subject: [PATCH 3/6] Update Overview.bs Address PR comments. --- cssom-view-1/Overview.bs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cssom-view-1/Overview.bs b/cssom-view-1/Overview.bs index dcca3d78421..72a11b34393 100644 --- a/cssom-view-1/Overview.bs +++ b/cssom-view-1/Overview.bs @@ -1070,16 +1070,16 @@ result of running these steps:
caret range
null -1. Otherwise, return a caret position where its properties are set after running these steps: +1. Otherwise: - 1. Let caret range to be a collapsed {{Range}} object for the position where the text insertion point indicator whould have been inserted when applying + 1. Let caretRange to be a collapsed {{Range}} object for the position where the text insertion point indicator would have been inserted when applying the transforms that apply to the descendants of the viewport. - 1. Let startNode be the [=range/start node=] of the caret range, and let startOffset be the [=range/start offset=] of the caret range. + 1. Let startNode be the [=range/start node=] of the caretRange, and let startOffset be the [=range/start offset=] of the caretRange. 1. While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], and startNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of shadowRoots, repeat these steps: 1. Set startOffset to [=tree/index=] of startNode's [=tree/root=]'s [=host=]. 1. Set startNode to startNode's [=tree/root=]'s [=host=]'s [=tree/parent=]. - 1. Set caret node in caret position to startNode, and set caret offset in caret position to startOffset. - 1. Set caret range's [=range/start node=] and [=range/end node=] to startNode, and set caret range's [=range/start offset=] and [=range/end offset=] to startOffset. + 1. Set caretRange's [=range/start node=] and [=range/end node=] to startNode, and set caret range's [=range/start offset=] and [=range/end offset=] to startOffset. + 1. Return a caret position whose caret node is set to startNode, caret offset is set to startOffset, and caret range is set to caretRange. Note: The specifics of hit testing are out of scope of this specification and therefore the exact details of From 5ad82d8d553accdd232ea2475b4968818ca3df14 Mon Sep 17 00:00:00 2001 From: Siye Liu Date: Thu, 18 Apr 2024 14:43:16 -0700 Subject: [PATCH 4/6] Update Overview.bs Address PR comment. --- cssom-view-1/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cssom-view-1/Overview.bs b/cssom-view-1/Overview.bs index 72a11b34393..d49d66994cc 100644 --- a/cssom-view-1/Overview.bs +++ b/cssom-view-1/Overview.bs @@ -1072,7 +1072,7 @@ result of running these steps: 1. Otherwise: - 1. Let caretRange to be a collapsed {{Range}} object for the position where the text insertion point indicator would have been inserted when applying + 1. Let caretRange to be a collapsed [=range=] object for the position where the text insertion point indicator would have been inserted when applying the transforms that apply to the descendants of the viewport. 1. Let startNode be the [=range/start node=] of the caretRange, and let startOffset be the [=range/start offset=] of the caretRange. 1. While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], and startNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of shadowRoots, repeat these steps: From bd00fe842b4dadbcef02694b37e64e41eb1ad170 Mon Sep 17 00:00:00 2001 From: Siye Liu Date: Thu, 18 Apr 2024 18:49:05 -0700 Subject: [PATCH 5/6] Update Overview.bs Address PR comment. --- cssom-view-1/Overview.bs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cssom-view-1/Overview.bs b/cssom-view-1/Overview.bs index d49d66994cc..b57f5daa6c4 100644 --- a/cssom-view-1/Overview.bs +++ b/cssom-view-1/Overview.bs @@ -1072,14 +1072,16 @@ result of running these steps: 1. Otherwise: - 1. Let caretRange to be a collapsed [=range=] object for the position where the text insertion point indicator would have been inserted when applying + 1. Let caretPosition be a tuple consisting of a caretPositionNode (a node) and a caretPositionOffset (a non-negative integer) for the position where the text insertion point indicator would have been inserted when applying the transforms that apply to the descendants of the viewport. - 1. Let startNode be the [=range/start node=] of the caretRange, and let startOffset be the [=range/start offset=] of the caretRange. + 1. Let startNode be the caretPositionNode of the caretPosition, and let startOffset be the caretPositionOffset of the caretPosition. 1. While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], and startNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of shadowRoots, repeat these steps: 1. Set startOffset to [=tree/index=] of startNode's [=tree/root=]'s [=host=]. 1. Set startNode to startNode's [=tree/root=]'s [=host=]'s [=tree/parent=]. - 1. Set caretRange's [=range/start node=] and [=range/end node=] to startNode, and set caret range's [=range/start offset=] and [=range/end offset=] to startOffset. - 1. Return a caret position whose caret node is set to startNode, caret offset is set to startOffset, and caret range is set to caretRange. + 1. Return a caret position with its properties set as follows: + 1. caret node is set to startNode. + 1. caret offset is set to startOffset. + 1. caret range is set to a collapsed {{Range}} object which [=range/start node=] and [=range/end node=] are startNode, and which [=range/start offset=] and [=range/end offset=] are startOffset. Note: The specifics of hit testing are out of scope of this specification and therefore the exact details of From 548b0a070e6f7d230c5edca6268bce01cb70d4f9 Mon Sep 17 00:00:00 2001 From: Siye Liu Date: Fri, 19 Apr 2024 14:28:14 -0700 Subject: [PATCH 6/6] Update Overview.bs linked created issue(10230) to the spec. --- cssom-view-1/Overview.bs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cssom-view-1/Overview.bs b/cssom-view-1/Overview.bs index b57f5daa6c4..e3688d9286e 100644 --- a/cssom-view-1/Overview.bs +++ b/cssom-view-1/Overview.bs @@ -1145,6 +1145,8 @@ aborting on the first step that returns a value: Note: This {{DOMRect}} object is not live. +Issue(10230): Consider removing caret range concept from caret position interface. +

Extensions to the {{Element}} Interface