Skip to content

Commit 78fb03b

Browse files
committed
[css-ui-4] Support cursors using a limited version of image-set()
The more generic <<image>> production continues to be allowed but not required. For clarity, since image-set() is a list of images, and since it would itself be used in a list of cursors, this commit rearranges the text editorially a little, in order to limit the confusion about which list we're talking about.
1 parent 42f9d17 commit 78fb03b

File tree

1 file changed

+117
-102
lines changed

1 file changed

+117
-102
lines changed

css-ui-4/Overview.bs

Lines changed: 117 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ user resizing of that element.
601601

602602
<pre class="propdef">
603603
Name: cursor
604-
Value: [ [<<url>> [&lt;x&gt; &lt;y&gt;]?,]* <br>
604+
Value: [ [ <<url>> | <<url-set>> ] [&lt;x&gt; &lt;y&gt;]? ]#? <br>
605605
[ auto | default | none |<br>
606606
context-menu | help | pointer | progress | wait | <br>
607607
cell | crosshair | text | vertical-text | <br>
@@ -611,7 +611,7 @@ Value: [ [<<url>> [&lt;x&gt; &lt;y&gt;]?,]* <br>
611611
col-resize | row-resize |
612612
all-scroll |<br>
613613
zoom-in | zoom-out <br>
614-
] ]
614+
]
615615
Initial: auto
616616
Applies to: all elements
617617
Inherited: yes
@@ -655,106 +655,116 @@ Values have the following meanings:
655655
<dl dfn-type=value dfn-for=cursor id=cursors>
656656
<dt>image cursors
657657
<dd>
658-
<dl>
659-
<dt><<url>>
660-
<dd>
661-
The user agent retrieves the cursor from the resource designated by the URI.
662-
If the user agent cannot handle the first cursor of a list of cursors,
663-
it must attempt to handle the second, etc.
664-
If the user agent cannot handle any user-defined cursor,
665-
it must use the cursor keyword at the end of the list.
666-
Conforming user agents may, instead of <<url>>, support <<image>> which is a superset.
667-
668-
The UA must support the following image file formats:
669-
670-
<ul>
671-
<li>
672-
PNG, as defined in [[!PNG]]
673-
674-
<li>
675-
SVG, as defined in [[!SVG11]],
676-
in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-static-mode">secure static mode</a> [[!SVG2]],
677-
if it has a [=natural size=].
678-
679-
<li>
680-
any other non-animated image file format that they support
681-
for <<image>> in other properties,
682-
such as the 'background-image' property
683-
</ul>
684-
685-
In addition, the UA should support the following image file formats:
686-
687-
<ul>
688-
<li>
689-
SVG, as defined in [[!SVG11]],
690-
in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-animated-mode">secure animated mode</a> [[!SVG2]],
691-
if it has a [=natural size=].
692-
693-
<li>
694-
any other animated image file format that they support
695-
for <<image>> in other properties,
696-
such as the 'background-image' property
697-
</ul>
698-
699-
The UA may also support additional file formats,
700-
including SVG, as defined in [[!SVG11]],
701-
in secure static mode or secure animated mode [[!SVG2]],
702-
even if it does not have a [=natural size=].
703-
704-
Note: The CSS Working Group initially intended support for all SVG,
705-
naturally sized or not.
706-
Support for non-naturally sized SVG was downgraded from mandatory to optional due
707-
to lack of implementations.
708-
709-
Note: At the time of writing this specification (spring 2015),
710-
the only file formats supported for cursors in common desktop browsers are
711-
the .ico and .cur file formats, as designed by Microsoft.
712-
For compatibility with legacy content,
713-
UAs are encouraged to support these,
714-
even though the lack of an open specification
715-
makes it impossible to have a normative requirement
716-
about these formats.
717-
Some information on these formats can be found
718-
<a href="https://en.wikipedia.org/wiki/ICO_%28file_format%29">on Wikipedia</a>.
719-
720-
The <a>default object size</a> for cursor images is
721-
a UA-defined size that should be based on
722-
the size of a typical cursor on the UA's operating system.
723-
724-
The <a>concrete object size</a> is determined using
725-
the <a>default sizing algorithm</a>.
726-
If an operating system is
727-
<strong>incapable</strong> of rendering a cursor above a given size,
728-
cursors larger than that size must be shrunk to within
729-
the OS-supported size bounds,
730-
while maintaining the cursor image's [=natural aspect ratio=], if any.
731-
732-
The optional &lt;x&gt; and &lt;y&gt; coordinates
733-
identify the exact position within the image which is the pointer position (i.e., the hotspot).
734-
735-
<dt>&lt;x&gt;
736-
<dt>&lt;y&gt;
737-
<dd>
738-
Each is a <<number>>.
739-
The x-coordinate and y-coordinate of the position
740-
in the cursor's coordinate system (left/top relative)
741-
which represents the precise position that is being pointed to.
742-
743-
Note: This specification does not define
744-
how the coordinate systems of the various types of <<image>> are established,
745-
and defers these definitions to [[CSS4-IMAGES]].
746-
747-
If the values are unspecified,
748-
then the natural hotspot defined inside the image resource itself is used.
749-
If both the values are unspecific and the referenced cursor has no defined hotspot,
750-
the effect is as if a value of "0 0" was specified.
751-
752-
If the coordinates of the hotspot,
753-
as specified either inside the image resource or
754-
by &lt;x&gt; and &lt;y&gt; values,
755-
fall outside of the cursor image,
756-
they must be clamped (independently) to fit.
757-
</dl>
658+
The first (optional) component of the 'cursor' property
659+
is a list of image-based cursors.
660+
If the user agent cannot handle the first cursor of a list of cursors,
661+
it must attempt to handle the second, etc.
662+
If the user agent cannot handle any of these author-defined cursors,
663+
it must use the keyword-based cursor at the end of the list.
664+
665+
Each author-defined image-based cursor is defined by the following values:
666+
667+
<dl>
668+
<dt><<url>> | <<url-set>>
669+
<dd>
670+
The user agent retrieves the cursor from the resource designated by the <<url>> or <<url-set>>.
671+
Conforming user agents may, instead of <<url>> and <<url-set>>,
672+
support <<image>> which is a superset.
673+
674+
<dfn type>&lt;url-set></dfn> is a limited version of ''image-set()'',
675+
where only <<url>> and <<url-set>> can be used
676+
in the part of the <<image-set-option>> sub-production which would normally allow <<image>>.
677+
678+
The UA must support the following image file formats:
679+
680+
<ul>
681+
<li>
682+
PNG, as defined in [[!PNG]]
683+
684+
<li>
685+
SVG, as defined in [[!SVG11]],
686+
in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-static-mode">secure static mode</a> [[!SVG2]],
687+
if it has a [=natural size=].
688+
689+
<li>
690+
any other non-animated image file format that they support
691+
for <<image>> in other properties,
692+
such as the 'background-image' property
693+
</ul>
694+
695+
In addition, the UA should support the following image file formats:
696+
697+
<ul>
698+
<li>
699+
SVG, as defined in [[!SVG11]],
700+
in <a href="https://www.w3.org/TR/SVG2/conform.html#secure-animated-mode">secure animated mode</a> [[!SVG2]],
701+
if it has a [=natural size=].
702+
703+
<li>
704+
any other animated image file format that they support
705+
for <<image>> in other properties,
706+
such as the 'background-image' property
707+
</ul>
708+
709+
The UA may also support additional file formats,
710+
including SVG, as defined in [[!SVG11]],
711+
in secure static mode or secure animated mode [[!SVG2]],
712+
even if it does not have a [=natural size=].
713+
714+
Note: The CSS Working Group initially intended support for all SVG,
715+
naturally sized or not.
716+
Support for non-naturally sized SVG was downgraded from mandatory to optional due
717+
to lack of implementations.
718+
719+
Note: At the time of writing this specification (spring 2015),
720+
the only file formats supported for cursors in common desktop browsers are
721+
the .ico and .cur file formats, as designed by Microsoft.
722+
For compatibility with legacy content,
723+
UAs are encouraged to support these,
724+
even though the lack of an open specification
725+
makes it impossible to have a normative requirement
726+
about these formats.
727+
Some information on these formats can be found
728+
<a href="https://en.wikipedia.org/wiki/ICO_%28file_format%29">on Wikipedia</a>.
729+
730+
The <a>default object size</a> for cursor images is
731+
a UA-defined size that should be based on
732+
the size of a typical cursor on the UA's operating system.
733+
734+
The <a>concrete object size</a> is determined using
735+
the <a>default sizing algorithm</a>.
736+
If an operating system is
737+
<strong>incapable</strong> of rendering a cursor above a given size,
738+
cursors larger than that size must be shrunk to within
739+
the OS-supported size bounds,
740+
while maintaining the cursor image's [=natural aspect ratio=], if any.
741+
742+
The optional &lt;x&gt; and &lt;y&gt; coordinates
743+
identify the exact position within the image which is the pointer position (i.e., the hotspot).
744+
745+
<dt>&lt;x&gt;
746+
<dt>&lt;y&gt;
747+
<dd>
748+
Each is a <<number>>.
749+
The x-coordinate and y-coordinate of the position
750+
in the cursor's coordinate system (left/top relative)
751+
which represents the precise position that is being pointed to.
752+
753+
Note: This specification does not define
754+
how the coordinate systems of the various types of <<image>> are established,
755+
and defers these definitions to [[CSS4-IMAGES]].
756+
757+
If the values are unspecified,
758+
then the natural hotspot defined inside the image resource itself is used.
759+
If both the values are unspecific and the referenced cursor has no defined hotspot,
760+
the effect is as if a value of "0 0" was specified.
761+
762+
If the coordinates of the hotspot,
763+
as specified either inside the image resource or
764+
by &lt;x&gt; and &lt;y&gt; values,
765+
fall outside of the cursor image,
766+
they must be clamped (independently) to fit.
767+
</dl>
758768

759769
<dt>general purpose cursors
760770
<dd>
@@ -2452,6 +2462,11 @@ the following normative changes have been made:
24522462
<ul>
24532463
<li>
24542464
Introduce a definition for the 'pointer-events' property.
2465+
2466+
<li>
2467+
Extend the image types required to be supported for the 'cursor' property
2468+
from just <<url>> to <<url>> and <<url-set>>.
2469+
(Support for the broader <<image>> type remains allowed but optional.)
24552470
</ul>
24562471

24572472
<h3 id=changes-24-1-2020 class=no-num>Changes from the

0 commit comments

Comments
 (0)