Skip to content

Commit 55422c5

Browse files
frivoalfantasaizcorpanhoward-e
committed
[css-ui-4] Provide hooks for HTML to define rendering for widgets
Relates to #3526 This is part of an editorial rewrite of the prior work by Bocoup (@zcorpan and @howard-e): * whatwg/html#7004 * #6537 Co-authored-by: fantasai <fantasai.bugs@inkedblade.net> Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Howard Edwards <howarde.edwards@gmail.com>
1 parent aad71de commit 55422c5

File tree

1 file changed

+107
-29
lines changed

1 file changed

+107
-29
lines changed

css-ui-4/Overview.bs

Lines changed: 107 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ to match the control to platform conventions for the use of the accent color.
19991999

20002000
<pre class="propdef">
20012001
Name: appearance
2002-
Value: ''appearance/none'' | ''auto'' | ''textfield'' | ''menulist-button'' | <<compat-auto>>
2002+
Value: ''appearance/none'' | ''auto'' | <<compat-auto>> | <<compat-special>>
20032003
Initial: none
20042004
Applies To: all elements
20052005
Inherited: no
@@ -2020,7 +2020,8 @@ This specification introduces the 'appearance' property
20202020
to provide some control over this behavior.
20212021
In particular, using ''appearance: none'' allows authors
20222022
to suppress the <a>native appearance</a> of <a>widgets</a>,
2023-
so that CSS can be used to restyle them.
2023+
giving them a <dfn export>primitive appearance</dfn>
2024+
where CSS can be used to restyle them.
20242025

20252026
<details class=note>
20262027
<summary>Note on the history of this feature</summary>
@@ -2071,35 +2072,23 @@ so that CSS can be used to restyle them.
20712072
The element is rendered following the usual rules of CSS.
20722073
Replaced elements other than <a>widgets</a> are not affected by this
20732074
and remain replaced elements.
2074-
<a>Widgets</a> must not have their <a>native appearance</a>.
2075+
<a>Widgets</a> must not have their <a>native appearance</a>,
2076+
and instead must have their <a>primitive appearance</a>.
20752077
See [[#appearance-decorative]] and [[#appearance-semantics]] for details.
20762078

20772079
<dt><dfn>auto</dfn>
20782080
<dd>
2079-
<a>Widgets</a> may have their <a>native appearance</a>.
2081+
Elements representing <a>widgets</a> should have the <a>native appearance</a> of that widget,
2082+
if the <a>properties that disable native appearance for widgets</a> are not in effect.
2083+
See [[#appearance-disabling-properties]].
20802084

2081-
Elements other than <a>widgets</a> must be rendered as if ''appearance/none'' had been specified.
2085+
The host language is responsible for defining
2086+
which elements represent which <a>widgets</a>.
20822087

2083-
<dt><dfn>textfield</dfn>
2084-
<dd>
2085-
For <{input}> elements where the <{input/type}> attribute is in the Search state,
2086-
the element is rendered as a "normal" text entry widget,
2087-
similar to an <{input}> element where the <{input/type}> attribute is in the Text state.
2088-
2089-
For all other elements, this value has the same effect as ''appearance/auto''.
2090-
2091-
<dt><dfn>menulist-button</dfn>
2092-
<dd>
2093-
For <a spec="html">drop-down box</a> <{select}> elements,
2094-
the element is rendered as a drop-down box, including a "drop-down button",
2095-
but not necessarily using a native control of the host operating system.
2096-
For such elements, CSS properties such as 'color', 'background-color', and 'border'
2097-
(that can be disregarded for ''appearance/auto'') should not be disregarded.
2088+
Elements other than <a>widgets</a> must be rendered as for ''appearance/none''.
20982089

2099-
For all other elements, this value has the same effect as ''appearance/auto''.
2100-
2101-
<dt><dfn type="">&lt;compat-auto></dfn>
2102-
<dd>
2090+
<dt><dfn type="">&lt;compat-auto></dfn>
2091+
<dd>
21032092
These values exist for compatibility of content developed
21042093
for earlier non-standard versions of this property.
21052094
They all have the same effect as ''appearance/auto''.
@@ -2119,6 +2108,27 @@ so that CSS can be used to restyle them.
21192108
or that
21202109
some of these values need to have some side effects on some <a>widgets</a>.
21212110

2111+
<dt><dfn type="">&lt;compat-special></dfn>
2112+
<dd>
2113+
These values exist for compatibility of content developed
2114+
for earlier non-standard versions of this property.
2115+
For the purpose of this specification,
2116+
they all have the same effect as ''appearance/auto''.
2117+
However, the host language may also take these values into account
2118+
when defining the <a>native appearance</a> of the element.
2119+
2120+
<pre class=prod style="white-space: normal"><<compat-special>> = <dfn>textfield</dfn> | <dfn>menulist-button</dfn> </pre>
2121+
2122+
<div class=example>
2123+
For instance, in [[HTML]]:
2124+
* The native appearance of <{input}> elements with a <code>"search"</code> <{input/type}> attribute changes
2125+
to match the appearance of <{input}> elements with a <code>"text"</code> <{input/type}> attribute
2126+
when 'appearance' is ''textfield''.
2127+
* The native appearance of drop-down box <{select}> elements changes
2128+
to match that of its <a>devolved</a> state
2129+
when 'appearance' is ''menulist-button''.
2130+
</div>
2131+
21222132
</dl>
21232133

21242134
<div class=issue>
@@ -2156,11 +2166,8 @@ so that CSS can be used to restyle them.
21562166
and activating (for example by clicking) the element would toggle the state as usual.
21572167
</div>
21582168

2159-
On <a>widgets</a> where the computed value is ''appearance/auto'',
2160-
''appearance/textfield'',
2161-
''appearance/menulist-button'',
2162-
or one of the <<compat-auto>> values,
2163-
UAs may disregard some CSS properties
2169+
User agents may disregard some CSS properties
2170+
on [=widgets=] rendered with their [=native appearance=]
21642171
to ensure that the intended appearance is preserved,
21652172
or because these properties may not be meaningful for the chosen appearance.
21662173
However, the following properties must not be disregarded:
@@ -2193,6 +2200,77 @@ so this specification needs to say something about this.
21932200
For compatibility with legacy content, UAs must also support <dfn property export>-webkit-appearance</dfn>
21942201
as a [=legacy name alias=] of 'appearance'.
21952202

2203+
2204+
<h4 id="appearance-disabling-properties">
2205+
Properties Disabling Native Appearance</h4>
2206+
2207+
Certain properties, when declared in the [=Author Origin=] or [=Animation Origin=],
2208+
will disable the [=native appearance=] of certain [=widgets=].
2209+
Specifically,
2210+
if all the declarations of the [=Author Origin=] and [=Animation Origin=]
2211+
pertaining to such a [=widget=] are cascaded
2212+
and a [=cascaded value=] exists--
2213+
and is not ''revert'' or ''revert-level''--
2214+
for any <a>property that disables native appearance for widgets</a>,
2215+
then that [=widget=] is rendered as a <a>devolved widget</a>.
2216+
The rendering of a <dfn export lt="devolved|devolved widget">devolved widget</dfn>
2217+
is identical to that of the [=widget=] in its [=primitive appearance=],
2218+
except when specified otherwise by the host language.
2219+
2220+
The host language defines
2221+
which elements represent <dfn export lt="devolvable|devolvable widget">devolvable widgets</dfn>.
2222+
Widgets whose appearance remains native
2223+
regardless of any <a>properties that disable native appearance for widgets</a>
2224+
are called <dfn export lt="non-devolvable|non-devolvable widget">non-devolvable widgets</dfn>.
2225+
2226+
The <dfn lt="property that disables native appearance for widgets|properties that disable native appearance for widgets">properties that disable native appearance for widgets</dfn> are:
2227+
<ul>
2228+
<li>'background-color'
2229+
<li>'border-top-color'
2230+
<li>'border-top-style'
2231+
<li>'border-top-width'
2232+
<li>'border-right-color'
2233+
<li>'border-right-style'
2234+
<li>'border-right-width'
2235+
<li>'border-bottom-color'
2236+
<li>'border-bottom-style'
2237+
<li>'border-bottom-width'
2238+
<li>'border-left-color'
2239+
<li>'border-left-style'
2240+
<li>'border-left-width'
2241+
<li>'border-block-start-color'
2242+
<li>'border-block-end-color'
2243+
<li>'border-inline-start-color'
2244+
<li>'border-inline-end-color'
2245+
<li>'border-block-start-style'
2246+
<li>'border-block-end-style'
2247+
<li>'border-inline-start-style'
2248+
<li>'border-inline-end-style'
2249+
<li>'border-block-start-width'
2250+
<li>'border-block-end-width'
2251+
<li>'border-inline-start-width'
2252+
<li>'border-inline-end-width'
2253+
<li>'background-image'
2254+
<li>'background-attachment'
2255+
<li>'background-position'
2256+
<li>'background-clip'
2257+
<li>'background-origin'
2258+
<li>'background-size'
2259+
<li>'border-image-source'
2260+
<li>'border-image-slice'
2261+
<li>'border-image-width'
2262+
<li>'border-image-outset'
2263+
<li>'border-image-repeat'
2264+
<li>'border-top-left-radius'
2265+
<li>'border-top-right-radius'
2266+
<li>'border-bottom-right-radius'
2267+
<li>'border-bottom-left-radius'
2268+
<li>'border-start-start-radius'
2269+
<li>'border-start-end-radius'
2270+
<li>'border-end-start-radius'
2271+
<li>'border-end-end-radius'
2272+
</ul>
2273+
21962274
<h4 id=appearance-decorative>
21972275
Effects of 'appearance' on Decorative Aspects of Elements</h4>
21982276

0 commit comments

Comments
 (0)