-
Notifications
You must be signed in to change notification settings - Fork 35
/
compatibility.bs
822 lines (689 loc) · 33.6 KB
/
compatibility.bs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
<pre class="metadata">
Title: Compatibility Standard
Group: WHATWG
H1: Compatibility
Shortname: compat
Repository: whatwg/compat
Status: LS
No Editor: true
Abstract: This standard describes a collection of non-standard (and often vendor-prefixed) CSS properties and DOM APIs that web browsers need to support for compatibility with the de facto web.
Logo: https://resources.whatwg.org/logo-compat.svg
!Participate: <a href=https://github.com/whatwg/compat>GitHub whatwg/compat</a> (<a href=https://github.com/whatwg/compat/issues/new>new issue</a>, <a href=https://github.com/whatwg/compat/issues>open issues</a>)
!Participate: <a href=https://wiki.whatwg.org/wiki/IRC>IRC: #whatwg on Freenode</a>
!Commits: <a href="https://github.com/whatwg/compat/commits">GitHub whatwg/compat/commits</a>
!Commits: <a href="https://twitter.com/compatstandard">@compatstandard</a>
Indent: 2
Boilerplate: omit conformance
</pre>
<script src=https://resources.whatwg.org/file-issue.js async></script>
<pre class="anchors">
urlPrefix: https://drafts.fxtf.org/geometry/; spec: geometry-1
type: interface;
text: DOMMatrix; url: #dommatrix
text: DOMMatrixReadOnly; url: #dommatrixreadonly
type: attribute;
text: m11 element; url: #m11-element
text: m12 element; url: #m12-element
text: m13 element; url: #m13-element
text: m14 element; url: #m14-element
text: m21 element; url: #m21-element
text: m22 element; url: #m22-element
text: m23 element; url: #m23-element
text: m24 element; url: #m24-element
text: m31 element; url: #m31-element
text: m32 element; url: #m32-element
text: m33 element; url: #m33-element
text: m34 element; url: #m34-element
text: m41 element; url: #m41-element
text: m42 element; url: #m42-element
text: m43 element; url: #m43-element
text: m44 element; url: #m44-element
text: m11 attribute; url: #dom-dommatrixreadonly-m11
text: m12 attribute; url: #dom-dommatrixreadonly-m12
text: m13 attribute; url: #dom-dommatrixreadonly-m13
text: m14 attribute; url: #dom-dommatrixreadonly-m14
text: m21 attribute; url: #dom-dommatrixreadonly-m21
text: m22 attribute; url: #dom-dommatrixreadonly-m22
text: m23 attribute; url: #dom-dommatrixreadonly-m23
text: m24 attribute; url: #dom-dommatrixreadonly-m24
text: m31 attribute; url: #dom-dommatrixreadonly-m31
text: m32 attribute; url: #dom-dommatrixreadonly-m32
text: m33 attribute; url: #dom-dommatrixreadonly-m33
text: m34 attribute; url: #dom-dommatrixreadonly-m34
text: m41 attribute; url: #dom-dommatrixreadonly-m41
text: m42 attribute; url: #dom-dommatrixreadonly-m42
text: m43 attribute; url: #dom-dommatrixreadonly-m43
text: m44 attribute; url: #dom-dommatrixreadonly-m44
text: a attribute; url: #dom-dommatrixreadonly-a
text: b attribute; url: #dom-dommatrixreadonly-b
text: c attribute; url: #dom-dommatrixreadonly-c
text: d attribute; url: #dom-dommatrixreadonly-d
text: e attribute; url: #dom-dommatrixreadonly-e
text: f attribute; url: #dom-dommatrixreadonly-f
text: is2d; url: #dommatrixreadonly-is2d
type: method;
text: fromString; url: #dom-dommatrixreadonly-fromstring0
urlPrefix: https://heycam.github.io/webidl/
type: dfn
text: NotSupportedError; url: #notsupportederror
text: DOMException; url: #idl-DOMException
urlPrefix: https://html.spec.whatwg.org/multipage/; spec: HTML
type: interface
urlPrefix: browsers.html
text: Window; url: #window
type: element
urlPrefix: semantics.html
text: body; url: #the-body-element
type: dfn
urlPrefix: webappapis.html
text: event handler; url: #event-handlers
text: event handler event type; url: #event-handler-event-type
text: responsible document; url: #responsible-document
urlPrefix: browsers.html
text: active document; url: #active-document
urlPrefix: https://dom.spec.whatwg.org/; spec: WHATWG-DOM
type: interface
text: Document; url: #document
type: interface
text: Event; url: #event
type: method
text: createEvent; url: #dom-document-createevent
type: attribute
text: type; url: #dom-event-type
type: dfn; url: #concept-event-fire
text: fire an event
urlPrefix: https://w3c.github.io/screen-orientation/;
type: interface
text: ScreenOrientation; url: #screenorientation-interface
type: dfn
text: update the orientation information; url: #dfn-update-the-orientation-information
urlPrefix: http://www.w3.org/TR/CSS/; spec: CSS22
type: dfn
text: vendor prefix; url: #vendor-prefix
urlPrefix: http://www.w3.org/TR/mediaqueries-4/; spec: mediaqueries-4
type: dfn
text: media query; url: #media-query
text: media feature; url: #media-feature
text: resolution; url: #descdef-resolution
text: min-resolution; url: #descdef-resolution
text: max-resolution; url: #descdef-resolution
text: prefixes on range features; url: #mq-min-max
urlPrefix: http://www.w3.org/TR/2011/WD-css3-images-20110217/; spec: css3-images-20110217
type: dfn
text: linear-gradient; url: #ltlinear-gradient
text: radial-gradient; url: #ltradial-gradient
text: repeating-linear-gradient; url: #ltrepeating-linear-gradient
text: repeating-radial-gradient; url: #ltrepeating-radial-gradient
</pre>
<pre class=link-defaults>
spec:css-transforms-1; type:property; text:backface-visibility
spec:css-transforms-1; type:property; text:perspective
spec:css-transforms-1; type:property; text:perspective-origin
spec:css-transforms-1; type:property; text:transform-origin
spec:css-transforms-1; type:property; text:transform-style
spec:css-transforms-1; type:property; text:transform
</pre>
<pre class=biblio>
{
"CSS22": {
"authors": [
"Bert Bos"
],
"href": "https://drafts.csswg.org/css2/",
"title": "Cascading Style Sheets Level 2 Revision 2 (CSS 2.2) Specification",
"status": "Draft",
"publisher": "W3C",
"deliveredBy": [
"http://www.w3.org/Style/CSS/"
]
},
"CSS3-BG4": {
"authors": [
"Bert Bos", "Elika J. Etemad", "Lea Verou"
],
"href": "https://drafts.csswg.org/css-backgrounds-4/",
"title": "CSS Backgrounds and Borders Module Level 4",
"status": "Draft",
"publisher": "W3C",
"deliveredBy": [
"http://www.w3.org/Style/CSS/"
]
}
}
</pre>
<!-- Commented out until we know what the heck to put here:
<h2 id='goals'>Goals</h2> -->
<h2 id='introduction'>Introduction</h2>
<em>This section is non-normative.</em>
There exists an increasingly large corpus of web content that depends on web browsers supporting a number of <code>webkit</code>-prefixed CSS properties and DOM APIs for functionality or layout. This holds especially true for mobile-optimized web content.
This specification aims to describe the minimal set of <code>webkit</code>-prefixed CSS properties and DOM APIs that user agents are required to support for web compatibility.
<div class="XXX">
The <a href="https://wiki.mozilla.org/Compatibility/Mobile/Non_Standard_Compatibility">Non-Standard Compatibility</a> wiki page will serve as a rough guide for what this specification intends to cover.
</div>
<h2 id='conformance'>Conformance</h2>
All diagrams, examples, and notes in this specification are
non-normative, as are all sections explicitly marked non-normative.
Everything else in this specification is normative.
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in RFC 2119.
For readability, these words do not appear in all uppercase letters in this
specification. [[!RFC2119]]
Requirements phrased in the imperative as part of algorithms
(such as "strip any leading space characters" or "return false and
terminate these steps") are to be interpreted with the meaning of the
keyword ("must", "should", "may", etc.) used in introducing the
algorithm.
Conformance requirements phrased as algorithms or specific steps
may be implemented in any manner, so long as the end result is
equivalent. (In particular, the algorithms defined in this
specification are intended to be easy to follow, and not intended to
be performant.)
<h2 id="css-compat-section">CSS Compatibility</h2>
<h3 id="css-at-rules">CSS At-rules</h3>
The following <code>-webkit-</code> <a>vendor prefixed</a> at-rules must be supported as aliases of the corresponding unprefixed at-rules:
<table>
<thead>
<tr>
<th><code>-webkit-</code> prefixed at-rule alias</th>
<th>unprefixed at-rule</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><dfn type=at-rule>@-webkit-keyframes</dfn></code></td>
<td><code><a>@keyframes</a></code></td>
</tr>
</tbody>
</table>
<h3 id="css-media-queries">CSS Media Queries</h3>
<h4 id="css-media-queries-webkit-device-pixel-ratio">
<code>'-webkit-device-pixel-ratio'</code>
</h4>
<pre class='descdef mq'>
Name: -webkit-device-pixel-ratio
Value: <<number>>
For: @media
Type: range
</pre>
<code>'-webkit-device-pixel-ratio'</code> must be treated as an alias of the <code><a>resolution</a></code> range type <a>media feature</a>, with its value interpreted as a <a>dppx</a> unit.
The <code>min-</code> or <code>max-</code> <a>prefixes on range features</a> must not apply to <code>'-webkit-device-pixel-ratio'</code>, instead the following aliases must be used:
<table>
<thead>
<tr>
<th>legacy <code>-webkit-</code> prefixed range <a>media feature</a> alias</th>
<th>standard prefixed range <a>media feature</a></th>
</tr>
</thead>
<tbody>
<tr>
<td><code><dfn descriptor for="@media">-webkit-min-device-pixel-ratio</dfn></code></td>
<td><code><a>min-resolution</a></code></td>
</tr>
<tr>
<td><code><dfn descriptor for="@media">-webkit-max-device-pixel-ratio</dfn></code></td>
<td><code><a>max-resolution</a></code></td>
</tr>
</tbody>
</table>
<h4 id="css-media-queries-webkit-transform-3d">
<code>'-webkit-transform-3d'</code>
</h4>
<pre class='descdef mq'>
Name: -webkit-transform-3d
Value: <<mq-boolean>>
For: @media
Accepts min/max prefixes: no
</pre>
The <code>'-webkit-transform-3d'</code> media feature is used to query whether the user agent supports CSS 3D transforms. [[css-transforms-1]]
If the user agent supports 3D transforms, the value will be 1. Otherwise the value is 0.
<h3 id="css-<image>-type">CSS Gradients</h3>
<!-- Uncomment when I add -webkit-gradient()
Both the [[css3-images-20110217]] draft <code>-webkit-</code> prefixed <<image>> gradient functions and the 2008 <code>-webkit-gradient()</code> (<a href="https://webkit.org/blog/175/introducing-css-gradients/">blog post</a>, <a href="https://developer.apple.com/library/safari/documentation/InternetWeb/Conceptual/SafariVisualEffectsProgGuide/Gradients/Gradient.html#//apple_ref/doc/uid/TP40008032-CH10-SW34">Safari developer documentation</a>) must be supported for compatibility.
-->
<h4 id="css-gradients-webkit-linear-gradient">
<code>''-webkit-linear-gradient()''</code>
</h4>
<code><dfn>-webkit-linear-gradient()</dfn></code> must be treated as an alias of <a>linear-gradient</a> as defined in [[css3-images-20110217]].
<!-- The stupid parens outside of the ref link are a hack because bikeshed hates me and my attempts to link to http://www.w3.org/TR/2011/WD-css3-images-20110217/#ltlinear-gradient. Pull requests welcome? -->
<h4 id="css-gradients-webkit-radial-gradient">
<code>''-webkit-radial-gradient()''</code>
</h4>
<code><dfn>-webkit-radial-gradient()</dfn></code> must be treated as an alias of <a>radial-gradient</a> as defined in [[css3-images-20110217]].
<h4 id="css-gradients-repeating-webkit-linear-gradient">
<code>''-webkit-repeating-linear-gradient()''</code>
</h4>
<code><dfn>-webkit-repeating-linear-gradient()</dfn></code> must be treated as an alias of <a>repeating-linear-gradient</a> as defined in [[css3-images-20110217]].
<h4 id="css-gradients-repeating-webkit-radial-gradient">
<code>''-webkit-repeating-radial-gradient()''</code>
</h4>
<code><dfn>-webkit-repeating-radial-gradient()</dfn></code> must be treated as an alias of <a>repeating-radial-gradient</a> as defined in [[css3-images-20110217]].
<!--
<h4 id="css-gradients-webkit-gradient">
<code>-webkit-gradient()</code>
</h4>
<div class="XXX">TODO</div> -->
<h3 id="css-properties">CSS Properties</h3>
<h4 id="css-simple-aliases">Simple property aliases</h4>
The following <code>-webkit-</code> <a>vendor prefixed</a> properties must be supported as aliases of the corresponding unprefixed property:
<table>
<thead>
<tr>
<th><code>-webkit-</code> prefixed property alias</th>
<th>unprefixed property</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><dfn type=property>-webkit-animation-name</dfn></code></td>
<td><code>'animation-name'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation-duration</dfn></code></td>
<td><code>'animation-duration'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation-timing-function</dfn></code></td>
<td><code>'animation-timing-function'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation-iteration-count</dfn></code></td>
<td><code>'animation-iteration-count'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation-direction</dfn></code></td>
<td><code>'animation-direction'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation-play-state</dfn></code></td>
<td><code>'animation-play-state'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation-delay</dfn></code></td>
<td><code>'animation-delay'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation-fill-mode</dfn></code></td>
<td><code>'animation-fill-mode'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-animation</dfn></code></td>
<td><code>'animation'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-backface-visibility</dfn></code></td>
<td><code>'backface-visibility'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-background-clip</dfn></code></td>
<td><code>'background-clip'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-background-origin</dfn></code></td>
<td><code>'background-origin'</code></td>
</tr>
<tr>
<td>
<code><dfn type=property>-webkit-background-size</dfn></code>
<p class="XXX">
Not simple. See <a href="https://github.com/whatwg/compat/issues/28">issue #28</a>.
</p>
</td>
<td><code>'background-size'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-border-bottom-left-radius</dfn></code></td>
<td><code>'border-bottom-left-radius'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-border-bottom-right-radius</dfn></code></td>
<td><code>'border-bottom-right-radius'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-border-top-left-radius</dfn></code></td>
<td><code>'border-top-right-radius'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-border-top-right-radius</dfn></code></td>
<td><code>'border-top-right-radius'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-border-radius</dfn></code></td>
<td><code>'border-radius'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-box-shadow</dfn></code></td>
<td><code>'box-shadow'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-box-sizing</dfn></code></td>
<td><code>'box-sizing'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-filter</dfn></code></td>
<td><code>'filter'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-perspective</dfn></code></td>
<td><code>'perspective'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-perspective-origin</dfn></code></td>
<td><code>'perspective-origin'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transform-origin</dfn></code></td>
<td><code>'transform-origin'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transform-style</dfn></code></td>
<td><code>'transform-style'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transform</dfn></code></td>
<td><code>'transform'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transition-delay</dfn></code></td>
<td><code>'transition-delay'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transition-duration</dfn></code></td>
<td><code>'transition-duration'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transition-property</dfn></code></td>
<td><code>'transition-property'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transition-timing-function</dfn></code></td>
<td><code>'transition-timing-function'</code></td>
</tr>
<tr>
<td><code><dfn type=property>-webkit-transition</dfn></code></td>
<td><code>'transition'</code></td>
</tr>
</tbody>
</table>
<h4 id="css-prefixed-aliases">Prefixed property aliases</h4>
The following <code>-webkit-</code> <a>vendor prefixed</a> properties must be supported as aliases of the corresponding unprefixed properties. If the user agent does not ship the unprefixed equivalent, the <code>-webkit-</code> prefixed property must be treated as an alias of the user agent's own vendor prefixed property.
<table>
<thead>
<tr>
<th><code>-webkit-</code> prefixed property alias</th>
<th>(vendor prefixed) property</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><dfn type=property>-webkit-text-size-adjust</dfn></code></td>
<td><code>(-prefix-)'text-size-adjust'</code></td>
</tr>
</tbody>
</table>
<br>
<div class="note"> As soon as https://drafts.csswg.org/css-size-adjust/#text-size-adjust is unprefixable it can be defined as a "simple" alias.</div>
<h4 id="css-property-mappings">Property mappings</h4>
The following <code>-webkit-</code> <a>vendor prefixed</a> properties must be supported as mappings to the corresponding unprefixed property:
<table>
<thead>
<tr>
<th><code>-webkit-</code> prefixed property</th>
<th>unprefixed property</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><dfn type=property>-webkit-box-flex</dfn></code></td>
<td><code>'flex-grow'</code></td>
</tr>
<td><code><dfn type=property>-webkit-box-ordinal-group</dfn></code></td>
<td><code>'order'</code></td>
</tr>
<td><code><dfn type=property>-webkit-box-align</dfn></code></td>
<td><code>'align-items'</code></td>
</tr>
<td><code><dfn type=property>-webkit-box-pack</dfn></code></td>
<td><code>'justify-content'</code></td>
</tr>
</tbody>
</table>
<h4 id="css-keyword-mappings">Keyword mappings</h4>
The following <code>-webkit-</code> <a>vendor prefixed</a> keywords must be supported as mappings to the corresponding unprefixed keyword:
<table>
<thead>
<tr>
<th><code>-webkit-</code> prefixed keyword</th>
<th>unprefixed property keyword</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><dfn type=property>-webkit-box</dfn></code></td>
<td><code>''flex''</code></td>
</tr>
</tbody>
</table>
<h2 id="dom-compat-section">DOM Compatibility</h2>
<h3 id="webkitcssmatrix-interface">The {{WebKitCSSMatrix}} interface</h3>
<!-- cf. https://github.com/WebKit/webkit/blob/master/Source/WebCore/css/WebKitCSSMatrix.idl -->
<pre class="idl">
[Constructor,
Constructor(DOMString transformList),
Exposed=Window]
interface WebKitCSSMatrix : DOMMatrix {
// Mutable transform methods
WebKitCSSMatrix setMatrixValue(DOMString transformList);
// Immutable transform methods
WebKitCSSMatrix multiply(WebKitCSSMatrix other);
WebKitCSSMatrix inverse();
WebKitCSSMatrix translate(optional unrestricted double tx = 0,
optional unrestricted double ty = 0,
optional unrestricted double tz = 0);
WebKitCSSMatrix scale(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY,
optional unrestricted double scaleZ = 1);
WebKitCSSMatrix rotate(optional unrestricted double rotX = 0,
optional unrestricted double rotY,
optional unrestricted double rotZ);
WebKitCSSMatrix rotateAxisAngle(optional unrestricted double x = 0,
optional unrestricted double y = 0,
optional unrestricted double z = 0,
optional unrestricted double angle = 0);
WebKitCSSMatrix skewX(optional unrestricted double sx = 0);
WebKitCSSMatrix skewY(optional unrestricted double sy = 0);
};
</pre>
The {{WebKitCSSMatrix}} interface represents a 4×4 homogeneous matrix with methods useful for 2D and 3D transform operations.
The {{WebKitCSSMatrix}} interface may be implemented as a subclass of the {{DOMMatrix}} and {{DOMMatrixReadOnly}} interfaces, defined in Geometry Interfaces Module Level 1 [[!geometry-1]], with key differences noted below.
<h4 id="webkitcssmatrix-constructors">Constructors</h4>
<dl class=domintro>
<dt>
<code><var>matrix</var> = new <a constructor
lt="WebKitCSSMatrix()">WebKitCSSMatrix()</a></code>
</dt>
<dd>
Returns a new {{WebKitCSSMatrix}} object.
</dd>
</dl>
The <dfn constructor dfn-for="WebKitCSSMatrix" lt="WebKitCSSMatrix()">WebKitCSSMatrix()</dfn>
constructor, when invoked, must run these steps:
<ol>
<li>
Let <var>m</var> be a new {{WebKitCSSMatrix}} object.
</li>
<li>For m, set the
<a attribute spec="geometry-1">m11 element</a>,
<a attribute spec="geometry-1">m22 element</a>,
<a attribute spec="geometry-1">m33 element</a>,
<a attribute spec="geometry-1">m44 element</a> to 1. Set the
<a attribute spec="geometry-1">m12 element</a>,
<a attribute spec="geometry-1">m13 element</a>,
<a attribute spec="geometry-1">m14 element</a>,
<a attribute spec="geometry-1">m21 element</a>,
<a attribute spec="geometry-1">m23 element</a>,
<a attribute spec="geometry-1">m24 element</a>,
<a attribute spec="geometry-1">m31 element</a>,
<a attribute spec="geometry-1">m32 element</a>,
<a attribute spec="geometry-1">m34 element</a>,
<a attribute spec="geometry-1">m41 element</a>,
<a attribute spec="geometry-1">m42 element</a>,
<a attribute spec="geometry-1">m43 element</a> to 0.</li>
<li>
Return <var>m</var>.
</li>
</ol>
<dl class=domintro>
<dt>
<code><var>matrix</var> = new <a constructor
lt="WebKitCSSMatrix(transformList)">WebKitCSSMatrix</a>(transformList)</code>
</dt>
<dd>
Returns a new {{WebKitCSSMatrix}} object.
</dd>
</dl>
The
<dfn constructor dfn-for="WebKitCSSMatrix" lt="WebKitCSSMatrix(transformList)">WebKitCSSMatrix(transformList)</dfn>
constructor, when invoked, must run these steps:
<ol>
<li>
Let <var>m</var> be a new {{WebKitCSSMatrix}} object.
</li>
<li>Return the result of the algorithm for the static {{DOMMatrixReadOnly}} <a method for=DOMMatrixReadOnly spec="geometry-1">fromString(transformList)</a> method, as <var>m</var>.
</li>
</ol>
<h4 id="webkitcssmatrix-attributes">{{WebKitCSSMatrix}} attributes</h4>
{{WebKitCSSMatrix}} objects must inherit the following attributes from {{DOMMatrixReadOnly}}:
<a attribute spec="geometry-1">m11 attribute</a>,
<a attribute spec="geometry-1">m22 attribute</a>,
<a attribute spec="geometry-1">m33 attribute</a>,
<a attribute spec="geometry-1">m44 attribute</a>,
<a attribute spec="geometry-1">m12 attribute</a>,
<a attribute spec="geometry-1">m13 attribute</a>,
<a attribute spec="geometry-1">m14 attribute</a>,
<a attribute spec="geometry-1">m21 attribute</a>,
<a attribute spec="geometry-1">m23 attribute</a>,
<a attribute spec="geometry-1">m24 attribute</a>,
<a attribute spec="geometry-1">m31 attribute</a>,
<a attribute spec="geometry-1">m32 attribute</a>,
<a attribute spec="geometry-1">m34 attribute</a>,
<a attribute spec="geometry-1">m41 attribute</a>,
<a attribute spec="geometry-1">m42 attribute</a>,
<a attribute spec="geometry-1">m43 attribute</a>,
<a attribute spec="geometry-1">a attribute</a>,
<a attribute spec="geometry-1">b attribute</a>,
<a attribute spec="geometry-1">c attribute</a>,
<a attribute spec="geometry-1">d attribute</a>,
<a attribute spec="geometry-1">e attribute</a>,
<a attribute spec="geometry-1">f attribute</a>.
<h4 id="webkitcssmatrix-mutable-methods">{{WebKitCSSMatrix}} mutable methods</h4>
The following method modifies the current matrix, returning the matrix it was invoked on.
When the <dfn method for="WebKitCSSMatrix"><code>setMatrixValue(transformList)</code></dfn>
method is invoked, the user agent must run the following steps:
1. Return the result of the algorithm for the {{DOMMatrix}} <a method for="DOMMatrix" spec="geometry-1">setMatrixValue(transformList)</a> method.
<h4 id="webkitcssmatrix-immutable-methods">{{WebKitCSSMatrix}} immutable methods</h4>
The following methods do not modify the current matrix and return a new {{WebKitCSSMatrix}} object.
When the <code>{{multiply(other)}}</code> method is invoked, the user agent must run the following steps:
1. Return the result of the algorithm for the {{DOMMatrixReadOnly}} <a method for="DOMMatrixReadOnly" spec="geometry-1">multiply(other)</a> method as a new {{WebKitCSSMatrix}} object.
When the <code>{{inverse()}}</code> method is invoked, the user agent must run the following steps:
1. Let <var>result</var> be the resulting matrix initialized to the value of the current matrix.
2. Invert the matrix <var>result</var>.
3. If the matrix <var>result</var> is not invertable, throw a <a>NotSupportedError</a> <a>DOMException</a>.
4. Return <var>result</var> as a new {{WebKitCSSMatrix}} object.
When the <code>{{translate(tx, ty, tz)}}</code> method is invoked, the user agent must run the following steps:
1. Return the result of the algorithm for the {{DOMMatrixReadOnly}} <a method for="DOMMatrixReadOnly" spec="geometry-1">translate(x, y, z)</a> method as a new {{WebKitCSSMatrix}} object.
When the <code>{{scale(scaleX, scaleY, scaleZ)}}</code> method is invoked, the user agent must run the following steps:
1. If <var>scaleY</var> is undefined, let <var>scaleY</var> be the value of <var>scaleX</var>.
2. Return the result of the algorithm for the {{DOMMatrixReadOnly}} <a method for="DOMMatrixReadOnly" spec="geometry-1">scaleNonUniform(scaleX, scaleY, scaleZ)</a> method as a new {{WebKitCSSMatrix}} object.
When the <code>{{rotate(rotX, rotY, rotZ)}}</code> method is invoked, the user agent must run the following steps:
1. Let <var>result</var> be the resulting matrix initialized to the values of the current matrix.
2. If <var>rotY</var> and <var>rotZ</var> are undefined, let <var>rotZ</var> be the value of <var>rotX</var> and let <var>rotX</var> and <var>rotY</var> be 0.
3. Else, if any of <var>rotX</var>, <var>rotY</var> or <var>rotZ</var> are undefined, let the undefined argument be 0.
4. If <var>rotX</var> or <var>rotY</var> are non-zero, set the <a attribute spec="geometry-1">is2d</a> flag to false.
5. Post-multiply <var>result</var> by each of its 3 rotation matrices about the major axes, first Z using <var>rotZ</var>, then Y using <var>rotY</var>, then X using <var>rotX</var>.
6. Return the result as a new {{WebKitCSSMatrix}} object.
The current matrix is not modified.
When the <code>{{rotateAxisAngle(x, y, z, angle)}}</code> method is invoked, the user agent must run the following steps:
1. Return the result of the algorithm for the {{DOMMatrixReadOnly}} <a method for="DOMMatrixReadOnly" spec="geometry-1">rotateAxisAngle(x, y, z, angle)</a> method as a new {{WebKitCSSMatrix}} object.
When the <code>{{skewX(sx)}}</code> method is invoked, the user agent must run the following steps:
1. Return the result of the algorithm for the {{DOMMatrixReadOnly}} <a method for="DOMMatrixReadOnly" spec="geometry-1">skewX(sx)</a> method as a new {{WebKitCSSMatrix}} object.
<!--
open question: is https://github.com/WebKit/webkit/blob/d055853e59dd6cc4cfd835b143e79258bb13c552/Source/WebCore/css/WebKitCSSMatrix.h#L138 needed for compat?
-->
When the <code>{{skewY(sy)}}</code> method is invoked, the user agent must run the following steps:
1. Return the result of {{DOMMatrixReadOnly}} <a method for="DOMMatrixReadOnly" spec="geometry-1">skewY(sy)</a> as a new {{WebKitCSSMatrix}} object.
<!--
open question: is https://github.com/WebKit/webkit/blob/d055853e59dd6cc4cfd835b143e79258bb13c552/Source/WebCore/css/WebKitCSSMatrix.h#L144 needed for compat?
-->
<!-- TODO: add note about common usage that requires support for webkitTransform, etc.
var box = document.getElementById('box');
var tranString = window.getComputedStyle(box).webkitTransform;
var m = new WebKitCSSMatrix(tranString);
box.style.webkitTransform = m.rotateAxisAngle(3,1,2,1);
-->
<h3 id="windoworientation-interface"><a attribute lt="orientation"><code>window.orientation</code></a> API</h3>
<pre class="idl">
partial interface Window {
readonly attribute short orientation;
attribute EventHandler onorientationchange;
};
partial interface HTMLBodyElement {
attribute EventHandler onorientationchange;
};
</pre>
When getting the <dfn attribute for="Window">orientation</dfn> attribute, the user agent must run the following steps:
1. Return the <a>responsible document</a>'s current <a href="#dfn-window-orientation-angle"><code>window.orientation</code> angle</a>.
Whenever the viewport is drawn at a different angle compared to the device's natural orientation, the user agent must run the following steps:
1. <a lt="fire an event">Fire an event</a> named <code><dfn id="event-orientationchange" lt="orientationchange">orientationchange</dfn></code> at the {{Window}} object of the <a>active document</a>.
User agents implementing the <a attribute lt="orientation"><code>window.orientation</code></a> attribute and its associated <a>orientationchange</a> event must not expose them on Desktop platforms.
<div class="note">iOS Safari also fires an <code>orientationchange</code> event on the <code><{body}></code> element, but other implementations do not, suggesting it's not required for compability with the web.</div>
<h4 id="dfn-window-orientation-angle"><a attribute lt="orientation"><code>window.orientation</code></a> angle</h4>
The possible values for the <a attribute lt="orientation"><code>window.orientation</code></a> angle are: <code>-90</code>, <code>0</code>, <code>90</code>, <code>180</code>. User agents must support the <code>-90</code>, <code>0</code> and <code>90</code> values and may optionally support <code>180</code>.
<p class="note"><code>0</code> represents the natural orientation. <code>-90</code> represents a rotation 90 degrees clockwise from the natural orientation. <code>90</code> represents a rotation 90 degrees counterclockwise from the natural orientation. <code>180</code> represents a rotation 180 degrees from the natural orientation.
</p>
In order to determine the current <a attribute lt="orientation"><code>window.orientation</code></a> angle, the user agent must run the following steps:
<ol>
<li>Return the result of step 3 of the {{ScreenOrientation}}'s <a>update the orientation information</a> algorithm with the following changes:
<ol>
<li>If the orientation angle is less than or equal to 180, return the orientation angle
<li>If the orientation angle is greater than 180, return the orientation angle - 360.
<li>If the resulting orientation angle is 180 and the user agent does not support that value, return 0.
<!-- This is what Windows phone, some iPhones running various iOSes, and Chrome Mobile do on some of my test Androids. It's possible something else happens! -->
</ol>
</li>
</ol>
<h4 id="event-handlers">Event Handlers on {{Window}} objects and <code><{body}></code> elements</h4>
The following are the event handlers and their corresponding event handler event types that must be supported on all {{Window}} objects and <code><{body}></code> elements as attributes:
<table>
<thead>
<tr>
<th><a>event handler</a></th>
<th><a>event handler event type</a></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>{{onorientationchange}}</code>
</td>
<td>
<code><a lt="orientationchange">orientationchange</a></code>
</td>
</tr>
</tbody>
</table>
<div class="XXX">
WebKit also has this on <a href="https://github.com/WebKit/webkit/blob/e455672f9e6861ced85d8be01cb7bc03a30a0555/LayoutTests/fast/dom/event-handler-attributes.html#L335">HTMLFrameSetElement</a>. It's unclear if this is needed for compatibility.
</div>
<h2 id="acknowledgements" class="no-num">Acknowledgements</h2>
Thanks to Alan Cutter, Chris Rebert, Daniel Holbert, hexalys, Jacob Rossi, Philip Jägenstedt, Simon Pieters, Stanley Stuart, William Chen and Your Name Here for feedback and contributions to this standard.
Thanks to Simon Pieters, Dirk Schulze and Rik Cabanier for defining the {{DOMMatrix}} and {{DOMMatrixReadOnly}} interfaces. [[!geometry-1]]
Thanks to Mounir Lamouri and Marcos Cáceres for defining the {{ScreenOrientation}} interface. [[!screen-orientation]]
This standard is written by
<a href="https://miketaylr.com/">Mike Taylor</a>
(<a href="https://www.mozilla.org/">Mozilla</a>,
<a href=mailto:miket@mozilla.com>miket@mozilla.com</a>).
Per <a rel="license" href="//creativecommons.org/publicdomain/zero/1.0/">CC0</a>, to
the extent possible under law, the editors have waived all copyright and related or
neighboring rights to this work.
<script id="head" src="https://resources.whatwg.org/dfn.js"></script>