Skip to content

Commit dcf8246

Browse files
authored
Add client coordinate definition and note on usage during scroll (#85)
There are ReSpec errors because "client coordinate system" is used but not defined. I didn't find a good definition from another spec, so I've added a definition here. Per #39, add a note on the fact that authors may want to adjust coordinates during scroll if they want to the IME window position to move with the content. Closes #39.
1 parent 01d8a77 commit dcf8246

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

index.html

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ <h4>EditContext state</h4>
113113
<li><dfn>composition start</dfn> which refers to the offset in [=text=] representing the start position of the text being actively composed. The initial value is 0.</p></li>
114114
<li><dfn>composition end</dfn> which refers to the offset in [=text=] representing the end position of the text being actively composed. The initial value is 0. [=composition end=] must always be greater than or equal to [=composition start=].</li>
115115
<li><dfn>text formats</dfn> which is an array of [=text format=]. The array is initially empty.</li>
116-
<li><dfn>control bounds</dfn> is a rectangle describing the area of the screen in which [=text=] is displayed. It is in the [=client coordinate=] system and the initial x, y, width, and height all 0.</li>
117-
<li><dfn>selection bounds</dfn> is the rectangle describing the position of selection. It is in the [=client coordinate=] system and the initial x, y, width, and height are all 0.</li>
116+
<li><dfn>control bounds</dfn> is a {{DOMRect}} describing the area of the viewport in which [=text=] is displayed. It is in the [=client coordinate system=] and the initial x, y, width, and height are all 0.</li>
117+
<li><dfn>selection bounds</dfn> is a {{DOMRect}} describing the position of selection. It is in the [=client coordinate system=] and the initial x, y, width, and height are all 0.</li>
118118
<li><dfn>codepoint rects start index</dfn> which is an offset into [=text=] that respresents the position before the first codepoint whose location is reported by the first member of [=codepoint rects=] array.</li>
119119
<li><dfn>codepoint rects</dfn> is an array of {{DOMRect}} defining the bounding box of each codepoint. The array is initially empty.</li>
120120
</ul>
@@ -135,6 +135,36 @@ <h4>EditContext state</h4>
135135
from the [=Text Input Service=]. The user agent will indicate which positions are
136136
required by firing {{CharacterBoundsUpdateEvent}}.
137137
</p>
138+
<p>
139+
[=Control bounds=], [=selection bounds=], and [=codepoint rects=] are given in the
140+
<dfn>client coordinate system</dfn>, which is defined as a two-dimensional Cartesian
141+
coordinate system (x, y) where the origin is the top-left corner of the
142+
<a href="https://drafts.csswg.org/cssom-view/#layout-viewport">layout viewport</a>,
143+
the x-axis points towards the top-right of the
144+
<a href="https://drafts.csswg.org/cssom-view/#layout-viewport">layout viewport</a>,
145+
and the y-axis points towards the bottom-left of the
146+
<a href="https://drafts.csswg.org/cssom-view/#layout-viewport">layout viewport</a>.
147+
The units of the client coordinate system are
148+
<a href="https://drafts.csswg.org/css-values/#px">CSS pixels</a>.
149+
</p>
150+
<div class="note">
151+
<p>
152+
Since EditContext bounds are defined in
153+
<a data-lt="client coordinate system">client coordinates</a>, the coordinates
154+
indicating a given piece of content on a page will change as the user scrolls the
155+
document even if the content itself does not change position in the document. A
156+
scenario where authors may want to take this into account is the case where the user
157+
scrolls the page where the user has an active composition. If the author does not
158+
update the EditContext's bounds information (e.g. during a scroll event listener),
159+
the IME window may no longer line up with the text being composed for the duration
160+
of the composition.
161+
</p>
162+
<p>
163+
However, some platforms do not adjust IME windows during an active composition,
164+
so updating bounds information mid-composition does not guarantee that the IME
165+
window will be repositioned until it's closed and reopened.
166+
</p>
167+
</div>
138168
<h4>Association and activation</h4>
139169
<p>
140170
An {{EditContext}} has an <dfn data-for="edit-context">associated element</dfn>, an {{HTMLElement}}.

0 commit comments

Comments
 (0)