Skip to content

Commit f9c2de2

Browse files
committed
[css-highlight-api] Rename HighlightRangeGroup to just Highlight
Since it's responsibilities have increased to being more than just a group, a more generic name makes sense. Part of w3c#4590
1 parent 5aee27c commit f9c2de2

2 files changed

Lines changed: 38 additions & 37 deletions

File tree

css-highlight-api-1/Overview.bs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ Introduction</h2>
8383
<div id=intro-ex class=example>
8484
The following code uses the ''::highlight()'' pseudo-element
8585
to apply a yellow background and blue foreground color to the text <q>One two</q>.
86-
It does so by adding a {{HighlightRangeGroup}} to the {{HighlightsRegister}}
86+
It does so by adding a {{Highlight}} to the {{HighlightsRegister}}
8787
(both of these are new concepts introduced by this specification).
88-
The {{HighlightRangeGroup}} will contain a {{Range}} whose boundary points surround the text <q>One two</q>.
88+
The {{Highlight}} will contain a {{Range}} whose boundary points surround the text <q>One two</q>.
8989

9090
<xmp highlight=html>
9191
<style>
@@ -100,7 +100,7 @@ Introduction</h2>
100100
r.setStart(document.body, 0);
101101
r.setEnd(document.body, 2);
102102

103-
CSS.highlights.add(new HighlightRangeGroup("example-highlight", [r]));
103+
CSS.highlights.add(new Highlight("example-highlight", [r]));
104104
</script>
105105
</xmp>
106106

@@ -146,7 +146,7 @@ Creating Custom Highlights</h3>
146146
(see [[#events]]).
147147

148148
[=Custom highlights=] are represented by
149-
<dfn interface>HighlightRangeGroup</dfn> objects,
149+
<dfn interface>Highlight</dfn> objects,
150150
[=setlike=] objects whose [=set entries=] are {{AbstractRange}} objects.
151151
[=Ranges=] can be added to a [=custom highlight=]
152152
either by passing a [=sequence=] of them to its constructor,
@@ -158,12 +158,12 @@ Creating Custom Highlights</h3>
158158
See [[#range-invalidation]] for more details about this choice and its implications.
159159

160160
The <dfn for="custom highlight">name</dfn> of a [=custom highlight=]
161-
is represented by its {{HighlightRangeGroup/name}} attribute,
161+
is represented by its {{Highlight/name}} attribute,
162162
which must must be a valid <<ident-token>>.
163163

164164
<xmp class="idl">
165165
[Exposed=Window]
166-
interface HighlightRangeGroup {
166+
interface Highlight {
167167
constructor(CSSOMString name, optional sequence<AbstractRange> initialRanges = []);
168168
setlike<AbstractRange>;
169169
attribute CSSStyleDeclaration style;
@@ -172,26 +172,26 @@ Creating Custom Highlights</h3>
172172
};
173173
</xmp>
174174

175-
See [[#priorities]] for more information on the {{HighlightRangeGroup/priority}} attribute,
176-
and [[#style-attr]] for more information on the {{HighlightRangeGroup/style}} attribute.
175+
See [[#priorities]] for more information on the {{Highlight/priority}} attribute,
176+
and [[#style-attr]] for more information on the {{Highlight/style}} attribute.
177177

178178
<div algorithm="to create a custom highlight">
179-
When the <dfn for=HighlightRangeGroup constructor>HighlightRangeGroup(CSSOMString name, optional sequence<AbstractRange> initialRanges = [])</dfn> constructor is invoked,
179+
When the <dfn for=Highlight constructor>Highlight(CSSOMString name, optional sequence<AbstractRange> initialRanges = [])</dfn> constructor is invoked,
180180
run the following steps:
181181

182182
<ol>
183183
<li>
184-
Let |highlightRangeGroup| be the new {{HighlightRangeGroup}} object.
184+
Let |highlight| be the new {{Highlight}} object.
185185
<li>
186186
If {{name!!argument}} does not [=CSS/parse=] as an <<ident-token>>, then [=throw=] a {{"SyntaxError"}}.
187187
<li>
188188
Let |nameArg| be the result of [=converted to an ECMAScript value|converting=] {{name!!argument}} to an ECMAScript value.
189189
<li>
190-
Set |highlightRangeGroup|'s {{HighlightRangeGroup/name}} to |nameArg|
190+
Set |highlight|'s {{Highlight/name}} to |nameArg|
191191
<li>
192-
Set |highlightRangeGroup|'s {{HighlightRangeGroup/priority}} to <code>0</code>.
192+
Set |highlight|'s {{Highlight/priority}} to <code>0</code>.
193193
<li>
194-
Set |highlightRangeGroup|'s {{HighlightRangeGroup/style}}
194+
Set |highlight|'s {{Highlight/style}}
195195
to a [=CSS declaration block=] object
196196
whose [=readonly flag=] is unset,
197197
whose [=parent CSS rule=] is <code>null</code>,
@@ -201,10 +201,10 @@ Creating Custom Highlights</h3>
201201
For each |range| of {{initialRanges}},
202202
let |rangeArg| be the result of [=converted to an ECMAScript value|converting=] |range| to an ECMAScript value,
203203
then run [[webidl#es-add-delete|the steps for a built-in setlike add function]],
204-
with |highlightRangeGroup| as the <code>this</code> value,
204+
with |highlight| as the <code>this</code> value,
205205
and |rangeArg| as the argument.
206206
<li>
207-
Return |highlightRangeGroup|.
207+
Return |highlight|.
208208
</ol>
209209
</div>
210210

@@ -231,8 +231,8 @@ Registering Custom Highlights</h3>
231231

232232
[Exposed=Window]
233233
interface HighlightsRegister {
234-
setlike<HighlightRangeGroup>;
235-
HighlightsRegister add(HighlightRangeGroup value);
234+
setlike<Highlight>;
235+
HighlightsRegister add(Highlight value);
236236
};
237237
</xmp>
238238

@@ -242,9 +242,9 @@ Registering Custom Highlights</h3>
242242
with the [=custom highlight=] as the argument.
243243

244244
When invoked,
245-
the <dfn method for=HighlightsRegister>add(HighlightRangeGroup value)</dfn> method must run these steps:
245+
the <dfn method for=HighlightsRegister>add(Highlight value)</dfn> method must run these steps:
246246

247-
1. If there is already a [=set entry=] with the same {{HighlightRangeGroup/name}} as the {{HighlightRangeGroup/name}} of {{value}},
247+
1. If there is already a [=set entry=] with the same {{Highlight/name}} as the {{Highlight/name}} of {{value}},
248248
then [=throw=] an {{"OperationError"}}.
249249
3. Let |valueArg| be the result of [=converted to an ECMAScript value|converting=] {{value}} to an ECMAScript value.
250250
4. Let |result| be the result of running [[webidl#es-add-delete|the steps for a built-in setlike add function]],
@@ -272,7 +272,7 @@ The Custom Highlight Pseudo-element: ''::highlight()''</h3>
272272
<h3 id=style-attr>
273273
Default Styling of a Custom Highlight</h3>
274274

275-
A [=custom highlight=]'s {{HighlightRangeGroup/style}} attribute
275+
A [=custom highlight=]'s {{Highlight/style}} attribute
276276
is a [=CSS declaration block=] object
277277
which authors can use to define
278278
the [=custom highlight=]'s <dfn>default style</dfn>.
@@ -292,15 +292,15 @@ Default Styling of a Custom Highlight</h3>
292292
<xmp highlight=html>
293293
<body><span>One </span><span>two </span><span>three...</span>
294294
<script>
295-
let highlightsRange = new Range();
296-
highlightsRange.setStart(document.body, 0);
297-
highlightsRange.setEnd(document.body, 2);
295+
let r = new Range();
296+
r.setStart(document.body, 0);
297+
r.setEnd(document.body, 2);
298298

299-
let highlightRangeGroup = new HighlightRangeGroup("inline-highlight", [highlightsRange]);
300-
highlightRangeGroup.style.backgroundColor = "yellow";
301-
highlightRangeGroup.style.color = "blue";
299+
let h = new Highlight("inline-highlight", [r]);
300+
h.style.backgroundColor = "yellow";
301+
h.style.color = "blue";
302302

303-
CSS.highlights.add(highlightRangeGroup);
303+
CSS.highlights.add(h);
304304
</script>
305305
</xmp>
306306

@@ -325,7 +325,7 @@ Applicable Properties</h4>
325325
like the built-in [=highlight pseudo-elements=],
326326
can only be styled with a limited set of properties.
327327
See [[css-pseudo-4#highlight-styling]] for the full list.
328-
The same limitation applies to the {{HighlightRangeGroup/style}} attribute of [=custom highlights=].
328+
The same limitation applies to the {{Highlight/style}} attribute of [=custom highlights=].
329329

330330
<h4 id=c-and-h>
331331
Cascading and Inheritance</h4>
@@ -338,7 +338,7 @@ Cascading and Inheritance</h4>
338338
the User Agent is expected to use the OS-default highlight colors for ''::selection''
339339
when neither 'color' nor 'background-color' have been specified,
340340
the User Agent must use the styles provided in
341-
the {{HighlightRangeGroup/style}} attribute of the corresponding [=custom highlight=]
341+
the {{Highlight/style}} attribute of the corresponding [=custom highlight=]
342342
when no applicable property has been specified via ''::highlight()''.
343343

344344
<h4 id=painting>
@@ -376,7 +376,7 @@ Painting</h4>
376376
r2.setStart(document.body, 3);
377377
r2.setEnd(document.body, 7);
378378

379-
CSS.highlights.add(new HighlightRangeGroup("sample", [r1, r2]));
379+
CSS.highlights.add(new Highlight("sample", [r1, r2]));
380380
</script>
381381
</xmp>
382382

@@ -406,7 +406,7 @@ Painting</h4>
406406
<h4 id=priorities>
407407
Priority of Overlapping Highlights</h4>
408408

409-
A [=custom highlight=]'s {{HighlightRangeGroup/priority}} attribute
409+
A [=custom highlight=]'s {{Highlight/priority}} attribute
410410
defines its <dfn>priority</dfn>.
411411
This is used to determine the stacking order of the corresponding [=highlight overlay=]
412412
during painting operations (see [[#painting]]).
@@ -436,7 +436,7 @@ Priority of Overlapping Highlights</h4>
436436
so that they too can be reordered,
437437
and so that they can be interleaved with custom ones freely?
438438

439-
<div class=example id=overlap-group-ex>
439+
<div class=example id=overlap-highlight-ex>
440440
<xmp highlight=html>
441441
<style>
442442
p::highlight(foo) {
@@ -457,8 +457,8 @@ Priority of Overlapping Highlights</h4>
457457
r2.setStart(document.body, 3);
458458
r2.setEnd(document.body, 9);
459459

460-
CSS.highlights.add(new HighlightRangeGroup("foo", [r1]));
461-
CSS.highlights.add(new HighlightRangeGroup("bar", [r2]));
460+
CSS.highlights.add(new Highlight("foo", [r1]));
461+
CSS.highlights.add(new Highlight("bar", [r2]));
462462
</script>
463463
</xmp>
464464

@@ -498,8 +498,8 @@ Repaints</h3>
498498

499499
The User Agent must also repaint highlights as needed
500500
in response to changes by the author
501-
to the {{HighlightRangeGroup/priority}},
502-
to the {{HighlightRangeGroup/style}},
501+
to the {{Highlight/priority}},
502+
to the {{Highlight/style}},
503503
or to the [=boundary points=] of {{Range}}s
504504
of a [=registered=] [=custom highlight=].
505505

css-ui-4/Overview.bs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Previous Version: https://www.w3.org/TR/2015/WD-css-ui-4-20150922/
2424
Shortname: css-ui
2525
Level: 4
2626
Group: csswg
27-
Status: ED
27+
Status: WD
28+
Date: 2019-12-18
2829
Work Status: Revising
2930
Editor: Florian Rivoal, On behalf of Bloomberg, https://florian.rivoal.net/, w3cid 43241
3031
Abstract: This specification describes user interface related

0 commit comments

Comments
 (0)