You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if the element’s transform is the only thing that changes between frames,
103
103
and often provides significant speed benefits.
104
104
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,
106
106
which can delay the start of a <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/css3-transforms/#propdef-transformtitle=transform>transform</a> animation by a noticeable fraction of a second.
107
107
</div>
108
108
109
-
<p>The <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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,
110
110
so the UA can set up the appropriate optimizations some time before they’re needed.
<p>The <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a> property provides a rendering hint to the user agent,
119
+
<p>The <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a> property provides a rendering hint to the user agent,
120
120
stating what kinds of changes the author expects to perform on the element.
121
121
This allows the user agent to perform ahead-of-time any optimizations necessary for rendering those changes smoothly,
122
122
avoiding “jank” when the author does begin changing or animating that feature.
123
123
124
-
<p> Values have the following meanings:
124
+
<divclass=note>
125
+
Different browsers can use the information from <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=cssdata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a> to an element from a static CSS stylesheet
136
+
is probably an error;
137
+
most of the time,
138
+
<aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=cssdata-link-type=maybehref=#valuedef-autotitle=auto>auto</a>
Indicates that the author expects to animate or change the property with the given name on the element in the near future.
159
179
160
-
<p>The <aclass="production css-code" data-link-type=typehref=http://www.w3.org/TR/css3-values/#identifier-valuetitle="<custom-ident>"><custom-ident></a> production used here excludes the keywords <spanclass=cssdata-link-type=maybetitle=will-change>will-change</span>, <spanclass=cssdata-link-type=maybetitle=none>none</span>, <spanclass=cssdata-link-type=maybetitle=all>all</span>, <aclass=cssdata-link-type=maybehref=#valuedef-autotitle=auto>auto</a>, <aclass=cssdata-link-type=maybehref=#valuedef-scroll-positiontitle=scroll-position>scroll-position</a>, and <aclass=cssdata-link-type=maybehref=#valuedef-contentstitle=contents>contents</a>,
180
+
<p>The <aclass="production css-code" data-link-type=typehref=http://www.w3.org/TR/css3-values/#identifier-valuetitle="<custom-ident>"><custom-ident></a> production used here excludes the keywords <spanclass=cssdata-link-type=maybetitle=will-change>will-change</span>, <spanclass=cssdata-link-type=maybetitle=none>none</span>, <spanclass=cssdata-link-type=maybetitle=all>all</span>, <aclass=cssdata-link-type=maybehref=#valuedef-autotitle=auto>auto</a>, <aclass=cssdata-link-type=maybehref=#valuedef-scroll-positiontitle=scroll-position>scroll-position</a>, and <aclass=cssdata-link-type=maybehref=#valuedef-contentstitle=contents>contents</a>,
161
181
in addition to the keywords normally excluded from <aclass="production css-code" data-link-type=typehref=http://www.w3.org/TR/css3-values/#identifier-valuetitle="<custom-ident>"><custom-ident></a>.
162
182
163
-
<pclass=note>Note: Note that most properties will have no effect when specified,
183
+
<pclass=note>Note: Note that most properties will have no effect when specified,
164
184
as the user agent doesn’t perform any special optimizations for changes in most properties.
165
185
It is still <em>safe</em> to specify them, though;
166
186
it’ll simply have no effect.
167
187
168
-
<p> If any non-initial value of a property would create a stacking context on the element,
169
-
specifying that property in <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a>,
177
-
to avoid sudden rendering differences when the property is eventually changed.
178
-
179
188
<pclass=example>
180
189
For example, browsers often handle elements with <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/css3-transforms/#propdef-transformtitle=transform>transform</a> set to a non-initial value very differently from normal elements,
that it should go ahead and promote the element to its own layer immediately,
185
194
before the element starts to be transformed,
186
195
to avoid any delay involved in rerendering the old and new layers.
187
-
</dl>
188
196
197
+
<p>If any non-initial value of a property would create a stacking context on the element,
198
+
specifying that property in <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a> must cause the element to generate a containing block for fixed-position elements.
189
202
190
-
<divclass=example>
191
-
For example, setting <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/css3-color/#opacitytitle=opacity>opacity</a> to any value other than <spanclass=cssdata-link-type=maybetitle=1>1</span> creates a stacking context on the element.
192
-
Thus, setting <aclass=cssdata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change: opacity</a> also creates a stacking context,
193
-
even if <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/css3-color/#opacitytitle=opacity>opacity</a> is <em>currently</em> still equal to <spanclass=cssdata-link-type=maybetitle=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 <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a>,
206
+
to avoid sudden rendering differences when the property is eventually changed.
195
207
196
-
<p> The <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a> property has no <em>direct</em> effect on the element it is specified on,
208
+
<pclass=example>
209
+
For example, setting <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/css3-color/#opacitytitle=opacity>opacity</a> to any value other than <spanclass=cssdata-link-type=maybetitle=1>1</span> creates a stacking context on the element.
210
+
Thus, setting <aclass=cssdata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change: opacity</a> also creates a stacking context,
211
+
even if <aclass=propertydata-link-type=propdeschref=http://www.w3.org/TR/css3-color/#opacitytitle=opacity>opacity</a> is <em>currently</em> still equal to <spanclass=cssdata-link-type=maybetitle=1>1</span>.
212
+
</dl>
213
+
214
+
<p>The <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a> property has no <em>direct</em> effect on the element it is specified on,
197
215
beyond the creation of stacking contexts and containing blocks as specified above.
198
216
It is solely a rendering hint to the user agent,
199
217
allowing it set up potentially-expensive optimizations for certain types of changes
200
218
before the changes actually start occurring.
201
219
202
-
<divclass=note>
203
-
Different browsers can use the information from <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=cssdata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=will-change>will-change</a> to an element from a static CSS stylesheet
214
-
is probably an error;
215
-
most of the time,
216
-
<aclass=propertydata-link-type=propdeschref=#propdef-will-changetitle=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 <aclass=cssdata-link-type=maybehref=#valuedef-autotitle=auto>auto</a>
0 commit comments