Skip to content

Commit 0ce03df

Browse files
committed
[css-will-change] Rearrange some examples and notes.
1 parent 6977a23 commit 0ce03df

2 files changed

Lines changed: 77 additions & 81 deletions

File tree

css-will-change/Overview.bs

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ Hinting at Future Behavior: the 'will-change' property</h2>
5757
This allows the user agent to perform ahead-of-time any optimizations necessary for rendering those changes smoothly,
5858
avoiding “jank” when the author does begin changing or animating that feature.
5959

60+
<div class='note'>
61+
Different browsers can use the information from 'will-change' in different ways,
62+
and even a single browser might use it in different ways at different time.
63+
For example, a browser that promotes elements to their own “GPU layer”
64+
when they have ''will-change: transform'' specified
65+
might avoid doing that when there are <em>too many</em> elements declaring that,
66+
to avoid exhausting GPU memory.
67+
68+
Authors should avoid overusing this property,
69+
and shouldn't apply it to an element unless it is known (or expected)
70+
that the element will change in the indicated way soon.
71+
For example, applying 'will-change' to an element from a static CSS stylesheet
72+
is probably an error;
73+
most of the time,
74+
'will-change' should be applied by scripting,
75+
some time shortly before starting an animation or other change,
76+
and should be promptly reset to its initial value of ''auto''
77+
when the element stops changing.
78+
</div>
79+
6080
Values have the following meanings:
6181

6282
<dl dfn-for="will-change" dfn-type="value">
@@ -101,6 +121,15 @@ Hinting at Future Behavior: the 'will-change' property</h2>
101121
It is still <em>safe</em> to specify them, though;
102122
it'll simply have no effect.
103123

124+
<p class='example'>
125+
For example, browsers often handle elements with 'transform' set to a non-initial value very differently from normal elements,
126+
perhaps rendering them to their own “GPU layer”
127+
or using other mechanisms to make it easier to quickly make the sort of transformations that 'transform' can produce.
128+
A browser might take a value of 'transform' as a signal
129+
that it should go ahead and promote the element to its own layer immediately,
130+
before the element starts to be transformed,
131+
to avoid any delay involved in rerendering the old and new layers.
132+
104133
If any non-initial value of a property would create a stacking context on the element,
105134
specifying that property in 'will-change' must create a stacking context on the element.
106135

@@ -113,44 +142,13 @@ Hinting at Future Behavior: the 'will-change' property</h2>
113142
to avoid sudden rendering differences when the property is eventually changed.
114143

115144
<p class='example'>
116-
For example, browsers often handle elements with 'transform' set to a non-initial value very differently from normal elements,
117-
perhaps rendering them to their own “GPU layer”
118-
or using other mechanisms to make it easier to quickly make the sort of transformations that 'transform' can produce.
119-
A browser might take a value of 'transform' as a signal
120-
that it should go ahead and promote the element to its own layer immediately,
121-
before the element starts to be transformed,
122-
to avoid any delay involved in rerendering the old and new layers.
145+
For example, setting 'opacity' to any value other than ''1'' creates a stacking context on the element.
146+
Thus, setting ''will-change: opacity'' also creates a stacking context,
147+
even if 'opacity' is <em>currently</em> still equal to ''1''.
123148
</dl>
124149

125-
126-
<div class='example'>
127-
For example, setting 'opacity' to any value other than ''1'' creates a stacking context on the element.
128-
Thus, setting ''will-change: opacity'' also creates a stacking context,
129-
even if 'opacity' is <em>currently</em> still equal to ''1''.
130-
</div>
131-
132150
The 'will-change' property has no <em>direct</em> effect on the element it is specified on,
133151
beyond the creation of stacking contexts and containing blocks as specified above.
134152
It is solely a rendering hint to the user agent,
135153
allowing it set up potentially-expensive optimizations for certain types of changes
136154
before the changes actually start occurring.
137-
138-
<div class='note'>
139-
Different browsers can use the information from 'will-change' in different ways,
140-
and even a single browser might use it in different ways at different time.
141-
For example, a browser that promotes elements to their own “GPU layer”
142-
when they have ''will-change: transform'' specified
143-
might avoid doing that when there are <em>too many</em> elements declaring that,
144-
to avoid exhausting GPU memory.
145-
146-
Authors should avoid overusing this property,
147-
and shouldn't apply it to an element unless it is known (or expected)
148-
that the element will change in the indicated way soon.
149-
For example, applying 'will-change' to an element from a static CSS stylesheet
150-
is probably an error;
151-
most of the time,
152-
'will-change' should be applied by scripting,
153-
some time shortly before starting an animation or other change,
154-
and should be promptly reset to its initial value of ''auto''
155-
when the element stops changing.
156-
</div>

css-will-change/Overview.html

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
</p>
1414
<h1 class="p-name no-ref" id=title>CSS Will Change Module Level 1</h1>
1515
<h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>W3C First Public Working Draft,
16-
<span class=dt-updated><span class=value-title title=20140422>22 April 2014</span></span></span></h2>
17-
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://www.w3.org/TR/2014/WD-css-will-change-1-20140422/>http://www.w3.org/TR/2014/WD-css-will-change-1-20140422/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-will-change/>http://www.w3.org/TR/css-will-change/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-will-change/>http://dev.w3.org/csswg/css-will-change/</a>
16+
<span class=dt-updated><span class=value-title title=20140505>5 May 2014</span></span></span></h2>
17+
<div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://www.w3.org/TR/2014/WD-css-will-change-1-20140505/>http://www.w3.org/TR/2014/WD-css-will-change-1-20140505/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-will-change/>http://www.w3.org/TR/css-will-change/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-will-change/>http://dev.w3.org/csswg/css-will-change/</a>
1818
<dt>Feedback:</dt>
1919
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-will-change%5D%20feedback">www-style@w3.org</a>
2020
with subject line
@@ -90,7 +90,7 @@ <h2 class="no-num no-toc no-ref heading settled heading" id=contents><span class
9090
<h2 class="heading settled heading" data-level=1 id=intro><span class=secno>1 </span><span class=content>
9191
Introduction</span><a class=self-link href=#intro></a></h2>
9292

93-
<p> Modern CSS renderers perform a number of complex optimizations in order to render webpages quickly and efficiently.
93+
<p>Modern CSS renderers perform a number of complex optimizations in order to render webpages quickly and efficiently.
9494
Unfortunately, employing these optimizations often has a non-trivial start-up cost,
9595
which can have a negative impact on the responsiveness of a page.
9696

@@ -102,11 +102,11 @@ <h2 class="heading settled heading" data-level=1 id=intro><span class=secno>1 </
102102
if the element’s transform is the only thing that changes between frames,
103103
and often provides significant speed benefits.
104104

105-
<p> However, setting up the element in a fresh layer is a relatively expensive operation,
105+
<p>However, setting up the element in a fresh layer is a relatively expensive operation,
106106
which can delay the start of a <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-transforms/#propdef-transform title=transform>transform</a> animation by a noticeable fraction of a second.
107107
</div>
108108

109-
<p> The <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> property defined in this specification allows an author to declare ahead-of-time what properties are likely to change in the future,
109+
<p>The <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> property defined in this specification allows an author to declare ahead-of-time what properties are likely to change in the future,
110110
so the UA can set up the appropriate optimizations some time before they’re needed.
111111
This way, when the actual change happens,
112112
the page updates in a snappy manner.
@@ -116,12 +116,32 @@ <h2 class="heading settled heading" data-level=2 id=will-change><span class=secn
116116

117117
<table class="definition propdef"><tr><th>Name:<td><dfn class=css-code data-dfn-type=property data-export="" id=propdef-will-change>will-change<a class=self-link href=#propdef-will-change></a></dfn><tr><th>Value:<td class=prod>auto | <a class="production css-code" data-link-type=type href=#typedef-animateable-feature title="<animateable-feature>">&lt;animateable-feature&gt;</a>#<tr><th>Initial:<td>auto<tr><th>Applies to:<td>all elements<tr><th>Inherited:<td>no<tr><th>Media:<td>all<tr><th>Computed value:<td>specified value<tr><th>Percentages:<td>n/a</table>
118118
<pre class=prod><dfn class=css-code data-dfn-type=type data-export="" id=typedef-animateable-feature>&lt;animateable-feature&gt;<a class=self-link href=#typedef-animateable-feature></a></dfn> = scroll-position | contents | <a class="production css-code" data-link-type=type href=http://www.w3.org/TR/css3-values/#identifier-value title="<custom-ident>">&lt;custom-ident&gt;</a></pre>
119-
<p> The <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> property provides a rendering hint to the user agent,
119+
<p>The <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> property provides a rendering hint to the user agent,
120120
stating what kinds of changes the author expects to perform on the element.
121121
This allows the user agent to perform ahead-of-time any optimizations necessary for rendering those changes smoothly,
122122
avoiding “jank” when the author does begin changing or animating that feature.
123123

124-
<p> Values have the following meanings:
124+
<div class=note>
125+
Different browsers can use the information from <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> in different ways,
126+
and even a single browser might use it in different ways at different time.
127+
For example, a browser that promotes elements to their own “GPU layer”
128+
when they have <a class=css data-link-type=propdesc href=#propdef-will-change title=will-change>will-change: transform</a> specified
129+
might avoid doing that when there are <em>too many</em> elements declaring that,
130+
to avoid exhausting GPU memory.
131+
132+
<p>Authors should avoid overusing this property,
133+
and shouldn’t apply it to an element unless it is known (or expected)
134+
that the element will change in the indicated way soon.
135+
For example, applying <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> to an element from a static CSS stylesheet
136+
is probably an error;
137+
most of the time,
138+
<a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> should be applied by scripting,
139+
some time shortly before starting an animation or other change,
140+
and should be promptly reset to its initial value of <a class=css data-link-type=maybe href=#valuedef-auto title=auto>auto</a>
141+
when the element stops changing.
142+
</div>
143+
144+
<p>Values have the following meanings:
125145

126146
<dl data-dfn-for=will-change data-dfn-type=value>
127147
<dt><dfn class=css-code data-dfn-for=will-change data-dfn-type=value data-export="" id=valuedef-auto>auto<a class=self-link href=#valuedef-auto></a></dfn>
@@ -157,25 +177,14 @@ <h2 class="heading settled heading" data-level=2 id=will-change><span class=secn
157177
<dd>
158178
Indicates that the author expects to animate or change the property with the given name on the element in the near future.
159179

160-
<p> The <a class="production css-code" data-link-type=type href=http://www.w3.org/TR/css3-values/#identifier-value title="<custom-ident>">&lt;custom-ident&gt;</a> production used here excludes the keywords <span class=css data-link-type=maybe title=will-change>will-change</span>, <span class=css data-link-type=maybe title=none>none</span>, <span class=css data-link-type=maybe title=all>all</span>, <a class=css data-link-type=maybe href=#valuedef-auto title=auto>auto</a>, <a class=css data-link-type=maybe href=#valuedef-scroll-position title=scroll-position>scroll-position</a>, and <a class=css data-link-type=maybe href=#valuedef-contents title=contents>contents</a>,
180+
<p>The <a class="production css-code" data-link-type=type href=http://www.w3.org/TR/css3-values/#identifier-value title="<custom-ident>">&lt;custom-ident&gt;</a> production used here excludes the keywords <span class=css data-link-type=maybe title=will-change>will-change</span>, <span class=css data-link-type=maybe title=none>none</span>, <span class=css data-link-type=maybe title=all>all</span>, <a class=css data-link-type=maybe href=#valuedef-auto title=auto>auto</a>, <a class=css data-link-type=maybe href=#valuedef-scroll-position title=scroll-position>scroll-position</a>, and <a class=css data-link-type=maybe href=#valuedef-contents title=contents>contents</a>,
161181
in addition to the keywords normally excluded from <a class="production css-code" data-link-type=type href=http://www.w3.org/TR/css3-values/#identifier-value title="<custom-ident>">&lt;custom-ident&gt;</a>.
162182

163-
<p class=note> Note: Note that most properties will have no effect when specified,
183+
<p class=note>Note: Note that most properties will have no effect when specified,
164184
as the user agent doesn’t perform any special optimizations for changes in most properties.
165185
It is still <em>safe</em> to specify them, though;
166186
it’ll simply have no effect.
167187

168-
<p> If any non-initial value of a property would create a stacking context on the element,
169-
specifying that property in <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> must create a stacking context on the element.
170-
171-
<p> If any non-initial value of a property would cause the element to generate a containing block for fixed-position elements,
172-
specifying that property in <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> must cause the element to generate a containing block for fixed-position elements.
173-
174-
<p> If a non-initial value of a property would cause rendering differences on the element
175-
(such as using a different anti-aliasing strategy for text),
176-
the user agent should use that alternate rendering when the property is specified in <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a>,
177-
to avoid sudden rendering differences when the property is eventually changed.
178-
179188
<p class=example>
180189
For example, browsers often handle elements with <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-transforms/#propdef-transform title=transform>transform</a> set to a non-initial value very differently from normal elements,
181190
perhaps rendering them to their own “GPU layer”
@@ -184,41 +193,30 @@ <h2 class="heading settled heading" data-level=2 id=will-change><span class=secn
184193
that it should go ahead and promote the element to its own layer immediately,
185194
before the element starts to be transformed,
186195
to avoid any delay involved in rerendering the old and new layers.
187-
</dl>
188196

197+
<p>If any non-initial value of a property would create a stacking context on the element,
198+
specifying that property in <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> must create a stacking context on the element.
199+
200+
<p>If any non-initial value of a property would cause the element to generate a containing block for fixed-position elements,
201+
specifying that property in <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> must cause the element to generate a containing block for fixed-position elements.
189202

190-
<div class=example>
191-
For example, setting <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-color/#opacity title=opacity>opacity</a> to any value other than <span class=css data-link-type=maybe title=1>1</span> creates a stacking context on the element.
192-
Thus, setting <a class=css data-link-type=propdesc href=#propdef-will-change title=will-change>will-change: opacity</a> also creates a stacking context,
193-
even if <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-color/#opacity title=opacity>opacity</a> is <em>currently</em> still equal to <span class=css data-link-type=maybe title=1>1</span>.
194-
</div>
203+
<p>If a non-initial value of a property would cause rendering differences on the element
204+
(such as using a different anti-aliasing strategy for text),
205+
the user agent should use that alternate rendering when the property is specified in <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a>,
206+
to avoid sudden rendering differences when the property is eventually changed.
195207

196-
<p> The <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> property has no <em>direct</em> effect on the element it is specified on,
208+
<p class=example>
209+
For example, setting <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-color/#opacity title=opacity>opacity</a> to any value other than <span class=css data-link-type=maybe title=1>1</span> creates a stacking context on the element.
210+
Thus, setting <a class=css data-link-type=propdesc href=#propdef-will-change title=will-change>will-change: opacity</a> also creates a stacking context,
211+
even if <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css3-color/#opacity title=opacity>opacity</a> is <em>currently</em> still equal to <span class=css data-link-type=maybe title=1>1</span>.
212+
</dl>
213+
214+
<p>The <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> property has no <em>direct</em> effect on the element it is specified on,
197215
beyond the creation of stacking contexts and containing blocks as specified above.
198216
It is solely a rendering hint to the user agent,
199217
allowing it set up potentially-expensive optimizations for certain types of changes
200218
before the changes actually start occurring.
201219

202-
<div class=note>
203-
Different browsers can use the information from <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> in different ways,
204-
and even a single browser might use it in different ways at different time.
205-
For example, a browser that promotes elements to their own “GPU layer”
206-
when they have <a class=css data-link-type=propdesc href=#propdef-will-change title=will-change>will-change: transform</a> specified
207-
might avoid doing that when there are <em>too many</em> elements declaring that,
208-
to avoid exhausting GPU memory.
209-
210-
<p> Authors should avoid overusing this property,
211-
and shouldn’t apply it to an element unless it is known (or expected)
212-
that the element will change in the indicated way soon.
213-
For example, applying <a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> to an element from a static CSS stylesheet
214-
is probably an error;
215-
most of the time,
216-
<a class=property data-link-type=propdesc href=#propdef-will-change title=will-change>will-change</a> should be applied by scripting,
217-
some time shortly before starting an animation or other change,
218-
and should be promptly reset to its initial value of <a class=css data-link-type=maybe href=#valuedef-auto title=auto>auto</a>
219-
when the element stops changing.
220-
</div>
221-
222220
<h2 class="no-ref no-num heading settled heading" id=conformance><span class=content>
223221
Conformance</span><a class=self-link href=#conformance></a></h2>
224222

0 commit comments

Comments
 (0)