Skip to content
Draft
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
52 changes: 52 additions & 0 deletions cssom-view-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ spec:css-borders-4; type:property; text:border-top-width
spec:css-borders-4; type:property; text:border-left-width
spec:cssom-view-1; type:dictionary; text:MouseEventInit
spec:cssom-view-1; type:dfn; for:MediaQueryList; text:media
spec:dom; type:interface; text:PlainTextRange
spec:dom; type:method; for:PlainTextRange; text:getClientRects()
spec:dom; type:method; for:PlainTextRange; text:getBoundingClientRect()
spec:dom; type:dfn; for:PlainTextRange; text:plain text range string
</pre>

<style>
Expand Down Expand Up @@ -2044,6 +2048,54 @@ Note: The {{DOMRect}} object returned by {{Range/getBoundingClientRect()}} is no
range-bounding-client-rect-with-display-contents.html
</wpt>

<h2 id=extensions-to-the-plaintextrange-interface>
Extensions to the {{PlainTextRange}} Interface
</h2>

This section defines {{PlainTextRange/getClientRects()}} and
{{PlainTextRange/getBoundingClientRect()}} for {{PlainTextRange}}. These mirror {{Range}}’s
{{Range/getClientRects()}} and {{Range/getBoundingClientRect()}}, but operate over the portion of
the host’s <a for=PlainTextRange>plain text range string</a> selected by the range.

<div algorithm="getClientRects() for PlainTextRange">
The steps for {{PlainTextRange/getClientRects()}} are the same as {{Range/getClientRects()}},
except that the rectangles are computed relative to the rendered text of the range’s
<a for=PlainTextRange>host</a>.
<ol>
<li>If <a for=PlainTextRange>host</a> is null, not <a>connected</a>, or its computed
<code>display</code> is <code>none</code>, return an empty {{DOMRectList}}.</li>
<li>Update style and layout for <a for=PlainTextRange>host</a>.</li>
<li>Let <var>string</var> be <a for=PlainTextRange>host</a>’s
<a for=PlainTextRange>plain text range string</a>, and let <var>len</var> be
<var>string</var>’s <a for=string>length</a>.</li>
<li>Let <var>start</var> be min(<a>this</a>.{{AbstractRange/startOffset}}, <var>len</var>) and let
<var>end</var> be min(<a>this</a>.{{AbstractRange/endOffset}}, <var>len</var>).</li>
<li>If <var>start</var> = <var>end</var>, return an empty {{DOMRectList}}.</li>
<li>Let <var>textNode</var> be the single {{Text}} node representing the rendered value of
<a for=PlainTextRange>host</a>. If none exists, return an empty {{DOMRectList}}.</li>
<li>Create a {{Range}} <var>r</var> whose start is (<var>textNode</var>, <var>start</var>) and
whose end is (<var>textNode</var>, <var>end</var>).</li>
<li>Return <var>r</var>.{{Range/getClientRects()}}.</li>
</ol>
</div>

<div algorithm="getBoundingClientRect() for PlainTextRange">
The steps for {{PlainTextRange/getBoundingClientRect()}} are the same as
{{Range/getBoundingClientRect()}}, except that the union of rectangles is computed relative to
the rendered text of the range’s <a for=PlainTextRange>host</a>.
<ol>
<li>Let <var>rects</var> be the result of {{PlainTextRange/getClientRects()}}.</li>
<li>If <var>rects</var> is empty, return a {{DOMRect}} whose {{DOMRect/x}}, {{DOMRect/y}},
{{DOMRect/width}}, and {{DOMRect/height}} are zero.</li>
<li>Otherwise, return a {{DOMRect}} representing the smallest rectangle that encloses all
rectangles in <var>rects</var>.</li>
</ol>
</div>

<wpt>
PlainTextRange-geometry.html
</wpt>

<h2 id=extensions-to-the-mouseevent-interface>Extensions to the {{MouseEvent}} Interface</h2>

Issue: The object IDL fragment redefines some members. Can we resolve this somehow?
Expand Down