webidl 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,11 +11,12 @@ module WebIDL
11
11
  rule Definition
12
12
  Module
13
13
  / Interface
14
- / PartialInterface
15
14
  / Dictionary
15
+ / Partial
16
16
  / Exception
17
17
  / TypeDef
18
18
  / ImplementsStatement
19
+ / Enum
19
20
  end
20
21
 
21
22
  rule Module
@@ -26,8 +27,17 @@ module WebIDL
26
27
  "interface" ws name:identifier ws inherits:Inheritance ws "{" ws members:InterfaceMembers ws "}" ws ";" <ParseTree::Interface>
27
28
  end
28
29
 
30
+ rule Partial
31
+ "partial" ws defn:PartialDefinition { def build(parent) defn.build(parent) end }
32
+ end
33
+
34
+ rule PartialDefinition
35
+ PartialInterface / PartialDictionary
36
+ end
37
+
38
+ # like an interface, but no inheritance
29
39
  rule PartialInterface
30
- "partial" ws "interface" ws name:identifier ws inherits:Inheritance ws "{" ws members:InterfaceMembers ws "}" ws ";" <ParseTree::PartialInterface>
40
+ "interface" ws name:identifier ws "{" ws members:InterfaceMembers ws "}" ws ";" <ParseTree::PartialInterface>
31
41
  end
32
42
 
33
43
  rule Inheritance
@@ -48,21 +58,27 @@ module WebIDL
48
58
  "dictionary" ws name:identifier ws inherits:Inheritance ws "{" ws members:DictionaryMembers ws "}" ws ";" <ParseTree::Dictionary>
49
59
  end
50
60
 
61
+ # Like a dictionary, but no inheritance
62
+ rule PartialDictionary
63
+ "dictionary" ws name:identifier ws "{" ws members:DictionaryMembers ws "}" ws ";" <ParseTree::PartialDictionary>
64
+ end
65
+
51
66
  # [11] DictionaryMembers → ExtendedAttributeList DictionaryMember DictionaryMembers
52
67
  # | ε
53
68
  rule DictionaryMembers
54
69
  (eal:ExtendedAttributeList ws member:DictionaryMember ws members:DictionaryMembers <ParseTree::DictionaryMembers>)?
55
70
  end
56
71
 
57
- # [12] DictionaryMember → Type identifier DefaultValue ";"
58
72
  rule DictionaryMember
59
- type:Type ws name:identifier ws default:DefaultValue ws ";" <ParseTree::DictionaryMember>
73
+ type:Type ws name:identifier ws default:Default ws ";" <ParseTree::DictionaryMember>
74
+ end
75
+
76
+ rule Default
77
+ ("=" ws val:DefaultValue { def build() val.build end })?
60
78
  end
61
79
 
62
- # [13] DefaultValue → "=" ConstValue
63
- # | ε
64
80
  rule DefaultValue
65
- ("=" ws const:ConstValue { def build() const.build end })?
81
+ string / ConstValue
66
82
  end
67
83
 
68
84
  rule Exception
@@ -87,13 +103,52 @@ module WebIDL
87
103
  end
88
104
 
89
105
  rule ConstValue
90
- BooleanLiteral / integer / float
106
+ "null" { def build() nil end }
107
+ / BooleanLiteral
108
+ / FloatLiteral
109
+ / integer
91
110
  end
92
111
 
93
112
  rule BooleanLiteral
94
113
  ("true" / "false") { def build() text_value == "true" end }
95
114
  end
96
115
 
116
+ rule FloatLiteral
117
+ float
118
+ / "-" "Infinity" { def build() -1.0/0 end }
119
+ / "Infinity" { def build() 1.0/0 end }
120
+ / "NaN" { def build() Float::NAN end }
121
+ end
122
+
123
+ rule Enum
124
+ "enum" ws id:identifier ws "{" ws values:EnumValueList ws "}" ws ";" <ParseTree::Enum>
125
+ end
126
+
127
+ rule EnumValueList
128
+ name:string ws
129
+ vals:EnumValues
130
+ ws ","? # trailing commas actually not allowed, but in use
131
+ {
132
+ def build()
133
+ res = [name.build]
134
+ res += vals.build if vals.any?
135
+
136
+ res
137
+ end
138
+ }
139
+ end
140
+
141
+ rule EnumValues
142
+ ("," ws name:string ws vals:EnumValues {
143
+ def build()
144
+ res = [name.build]
145
+ res += vals.build if vals.any?
146
+
147
+ res
148
+ end
149
+ })?
150
+ end
151
+
97
152
  rule AttributeOrOperation
98
153
  StringifierAttributeOrOperation / Attribute / Operation
99
154
  end
@@ -163,15 +218,39 @@ module WebIDL
163
218
  end
164
219
 
165
220
  rule Argument
166
- eal:ExtendedAttributeList ws In ws optional:Optional ws type:Type ws variadic:Ellipsis ws id:identifier <ParseTree::Argument>
221
+ eal:ExtendedAttributeList ws "in"? ws arg:OptionalOrRequiredArgument <ParseTree::Argument>
222
+ end
223
+
224
+ rule OptionalOrRequiredArgument
225
+ optional:"optional" ws type:Type ws name:ArgumentName ws default:Default
226
+ / type:Type ws variadic:Ellipsis ws name:ArgumentName
167
227
  end
168
228
 
169
- rule In
170
- "in"?
229
+
230
+ rule ArgumentName
231
+ ArgumentNameKeyword { def build() text_value end } / identifier
171
232
  end
172
233
 
173
- rule Optional
174
- "optional"?
234
+ rule ArgumentNameKeyword
235
+ "attribute"
236
+ / "callback"
237
+ / "const"
238
+ / "creator"
239
+ / "deleter"
240
+ / "dictionary"
241
+ / "enum"
242
+ / "exception"
243
+ / "getter"
244
+ / "implements"
245
+ / "inherit"
246
+ / "interface"
247
+ / "legacycaller"
248
+ / "partial"
249
+ / "setter"
250
+ / "static"
251
+ / "stringifier"
252
+ / "typedef"
253
+ / "unrestricted"
175
254
  end
176
255
 
177
256
  rule Ellipsis
@@ -304,36 +383,61 @@ module WebIDL
304
383
  end
305
384
 
306
385
  rule Type
307
- ("sequence" ws "<" ws type:Type ws ">" null:Null <ParseTree::SequenceType> / AttributeType)
386
+ SingleType
387
+ / type:UnionType suffix:TypeSuffix <ParseTree::Type>
308
388
  end
309
389
 
310
- rule Null
311
- "?"?
390
+ rule SingleType
391
+ NonAnyType
392
+ / type:"any" suffix:TypeSuffixStartingWithArray <ParseTree::Type>
393
+ end
394
+
395
+ rule UnionType
396
+ "(" ws UnionMemberType ws "or" ws UnionMemberType ws UnionMemberTypes ws ")"
312
397
  end
313
398
 
314
- rule AttributeType
315
- type:PrimitiveOrStringType suffix:TypeSuffix <ParseTree::Type>
316
- / type:ScopedName suffix:TypeSuffix <ParseTree::Type>
399
+ rule UnionMemberType
400
+ NonAnyType
401
+ / type:UnionType suffix:TypeSuffix <ParseTree::Type>
402
+ / type:"any" suffix:TypeSuffixStartingWithArray <ParseTree::Type>
403
+ end
404
+
405
+ rule UnionMemberTypes
406
+ ("or" ws UnionMemberType ws UnionMemberTypes)?
407
+ end
408
+
409
+ rule NonAnyType
410
+ type:PrimitiveType suffix:TypeSuffix <ParseTree::Type>
411
+ # added: cannot be followed by a NonSpace character, since e.g. DOMStringMap, DOMStringList or other identifiers would break parsing
412
+ / type:"DOMString" suffix:TypeSuffix !NonSpace <ParseTree::Type>
413
+ / "sequence" ws "<" ws type:Type ws ">" null:Null <ParseTree::SequenceType>
317
414
  / type:"object" suffix:TypeSuffix <ParseTree::Type>
318
415
  / type:"Date" suffix:TypeSuffix <ParseTree::Type>
319
- / type:"any" suffix:TypeSuffixStartingWithArray <ParseTree::Type>
416
+ / type:identifier suffix:TypeSuffix <ParseTree::Type>
417
+ end
418
+
419
+ rule ConstType
420
+ PrimitiveType Null
421
+ / identifier Null
320
422
  end
321
423
 
322
- # added: cannot be followed by a NonSpace character, since e.g. DOMStringMap, DOMStringList or other ScopedNames would break parsing
323
- rule PrimitiveOrStringType
424
+ # added: cannot be followed by a NonSpace character, since e.g. DOMStringMap, DOMStringList or other identifiers would break parsing
425
+ rule PrimitiveType
324
426
  (UnsignedIntegerType
325
- / "boolean" !NonSpace
326
- / "byte" !NonSpace
327
- / "octet" !NonSpace
328
- / "float" !NonSpace
329
- / "double" !NonSpace
330
- / "DOMString" !NonSpace) {
427
+ / UnrestrictedFloatType
428
+ / "boolean" !NonSpace
429
+ / "byte" !NonSpace
430
+ / "octet" !NonSpace) {
331
431
  def build(parent)
332
432
  Ast::Type.new(parent, text_value)
333
433
  end
334
434
  }
335
435
  end
336
436
 
437
+ rule Null
438
+ "?"?
439
+ end
440
+
337
441
  rule TypeSuffix
338
442
  (
339
443
  array:("[" ws "]") suffix:TypeSuffix <ParseTree::TypeSuffix>
@@ -349,6 +453,15 @@ module WebIDL
349
453
  "unsigned" ws IntegerType / IntegerType
350
454
  end
351
455
 
456
+ rule UnrestrictedFloatType
457
+ "unrestricted" ws FloatType
458
+ / FloatType
459
+ end
460
+
461
+ rule FloatType
462
+ "float" / "double"
463
+ end
464
+
352
465
  rule IntegerType
353
466
  ("short" / "long" ws OptionalLong)
354
467
  end
@@ -357,10 +470,6 @@ module WebIDL
357
470
  "long"?
358
471
  end
359
472
 
360
- rule Nullable
361
- "?"?
362
- end
363
-
364
473
  rule Array
365
474
  ("[" ws "]")?
366
475
  end
@@ -418,11 +527,20 @@ module WebIDL
418
527
  end
419
528
 
420
529
  rule identifier
421
- [A-Z_a-z] [0-9A-Z_a-z]* { def build() text_value[/^_?(.+)/, 1] end }
530
+ [A-Z_a-z] [0-9A-Z_a-z]* { def build(parent = nil) text_value[/^_?(.+)/, 1] end }
422
531
  end
423
532
 
424
533
  rule string
425
- "\"" [^"]* "\""
534
+ # spec only allows double quotes, but single quotes are used in the HTML spec
535
+ double_quoted_string / single_quoted_string
536
+ end
537
+
538
+ rule double_quoted_string
539
+ "\"" data:[^"]* "\"" { def build() data.text_value end }
540
+ end
541
+
542
+ rule single_quoted_string
543
+ "'" data:[^']* "'" { def build() data.text_value end }
426
544
  end
427
545
 
428
546
  rule ws
@@ -1,3 +1,3 @@
1
1
  module WebIDL
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -1,6 +1,10 @@
1
+ interface Example {
2
+ // this is an IDL definition
3
+ };
1
4
 
2
5
  interface HTMLAllCollection : HTMLCollection {
3
- // inherits length and item()
6
+ // inherits length and item(unsigned long index)
7
+ object? item(DOMString name);
4
8
  legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem()
5
9
  HTMLAllCollection tags(DOMString tagName);
6
10
  };
@@ -19,10 +23,7 @@ interface HTMLOptionsCollection : HTMLCollection {
19
23
  attribute unsigned long length; // overrides inherited length
20
24
  legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem()
21
25
  setter creator void (unsigned long index, HTMLOptionElement option);
22
- void add(HTMLOptionElement element, optional HTMLElement? before);
23
- void add(HTMLOptGroupElement element, optional HTMLElement? before);
24
- void add(HTMLOptionElement element, long before);
25
- void add(HTMLOptGroupElement element, long before);
26
+ void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
26
27
  void remove(long index);
27
28
  attribute long selectedIndex;
28
29
  };
@@ -108,10 +109,12 @@ partial interface Document {
108
109
  // event handler IDL attributes
109
110
  [TreatNonCallableAsNull] attribute Function? onabort;
110
111
  [TreatNonCallableAsNull] attribute Function? onblur;
112
+ [TreatNonCallableAsNull] attribute Function? oncancel;
111
113
  [TreatNonCallableAsNull] attribute Function? oncanplay;
112
114
  [TreatNonCallableAsNull] attribute Function? oncanplaythrough;
113
115
  [TreatNonCallableAsNull] attribute Function? onchange;
114
116
  [TreatNonCallableAsNull] attribute Function? onclick;
117
+ [TreatNonCallableAsNull] attribute Function? onclose;
115
118
  [TreatNonCallableAsNull] attribute Function? oncontextmenu;
116
119
  [TreatNonCallableAsNull] attribute Function? oncuechange;
117
120
  [TreatNonCallableAsNull] attribute Function? ondblclick;
@@ -172,6 +175,7 @@ interface HTMLElement : Element {
172
175
  // metadata attributes
173
176
  attribute DOMString title;
174
177
  attribute DOMString lang;
178
+ attribute boolean translate;
175
179
  attribute DOMString dir;
176
180
  attribute DOMString className;
177
181
  readonly attribute DOMTokenList classList;
@@ -215,10 +219,12 @@ interface HTMLElement : Element {
215
219
  // event handler IDL attributes
216
220
  [TreatNonCallableAsNull] attribute Function? onabort;
217
221
  [TreatNonCallableAsNull] attribute Function? onblur;
222
+ [TreatNonCallableAsNull] attribute Function? oncancel;
218
223
  [TreatNonCallableAsNull] attribute Function? oncanplay;
219
224
  [TreatNonCallableAsNull] attribute Function? oncanplaythrough;
220
225
  [TreatNonCallableAsNull] attribute Function? onchange;
221
226
  [TreatNonCallableAsNull] attribute Function? onclick;
227
+ [TreatNonCallableAsNull] attribute Function? onclose;
222
228
  [TreatNonCallableAsNull] attribute Function? oncontextmenu;
223
229
  [TreatNonCallableAsNull] attribute Function? oncuechange;
224
230
  [TreatNonCallableAsNull] attribute Function? ondblclick;
@@ -396,6 +402,10 @@ interface HTMLDataElement : HTMLElement {
396
402
  attribute DOMString value;
397
403
  };
398
404
 
405
+ interface HTMLTimeElement : HTMLElement {
406
+ attribute DOMString datetime;
407
+ };
408
+
399
409
  interface HTMLSpanElement : HTMLElement {};
400
410
 
401
411
  interface HTMLBRElement : HTMLElement {};
@@ -438,6 +448,7 @@ interface HTMLEmbedElement : HTMLElement {
438
448
  attribute DOMString type;
439
449
  attribute DOMString width;
440
450
  attribute DOMString height;
451
+ legacycaller any (any... arguments);
441
452
  };
442
453
 
443
454
  interface HTMLObjectElement : HTMLElement {
@@ -457,6 +468,8 @@ interface HTMLObjectElement : HTMLElement {
457
468
  readonly attribute DOMString validationMessage;
458
469
  boolean checkValidity();
459
470
  void setCustomValidity(DOMString error);
471
+
472
+ legacycaller any (any... arguments);
460
473
  };
461
474
 
462
475
  interface HTMLParamElement : HTMLElement {
@@ -528,9 +541,8 @@ interface HTMLMediaElement : HTMLElement {
528
541
 
529
542
  // playback state
530
543
  attribute double currentTime;
531
- readonly attribute double initialTime;
532
544
  readonly attribute double duration;
533
- readonly attribute Date startOffsetTime;
545
+ readonly attribute Date startDate;
534
546
  readonly attribute boolean paused;
535
547
  attribute double defaultPlaybackRate;
536
548
  attribute double playbackRate;
@@ -567,7 +579,7 @@ interface MediaError {
567
579
  readonly attribute unsigned short code;
568
580
  };
569
581
 
570
- interface AudioTrackList {
582
+ interface AudioTrackList : EventTarget {
571
583
  readonly attribute unsigned long length;
572
584
  getter AudioTrack (unsigned long index);
573
585
  AudioTrack? getTrackById(DOMString id);
@@ -584,7 +596,7 @@ interface AudioTrack {
584
596
  attribute boolean enabled;
585
597
  };
586
598
 
587
- interface VideoTrackList {
599
+ interface VideoTrackList : EventTarget {
588
600
  readonly attribute unsigned long length;
589
601
  getter VideoTrack (unsigned long index);
590
602
  VideoTrack? getTrackById(DOMString id);
@@ -637,22 +649,20 @@ interface MediaController {
637
649
  [TreatNonCallableAsNull] attribute Function? onvolumechange;
638
650
  };
639
651
 
640
- interface TextTrackList {
652
+ interface TextTrackList : EventTarget {
641
653
  readonly attribute unsigned long length;
642
654
  getter TextTrack (unsigned long index);
643
655
 
644
656
  [TreatNonCallableAsNull] attribute Function? onaddtrack;
645
657
  };
646
658
 
659
+ enum TextTrackMode { "disabled", "hidden", "showing" };
647
660
  interface TextTrack : EventTarget {
648
661
  readonly attribute DOMString kind;
649
662
  readonly attribute DOMString label;
650
663
  readonly attribute DOMString language;
651
664
 
652
- const unsigned short DISABLED = 0;
653
- const unsigned short HIDDEN = 1;
654
- const unsigned short SHOWING = 2;
655
- attribute unsigned short mode;
665
+ attribute TextTrackMode mode;
656
666
 
657
667
  readonly attribute TextTrackCueList? cues;
658
668
  readonly attribute TextTrackCueList? activeCues;
@@ -678,13 +688,13 @@ interface TextTrackCue : EventTarget {
678
688
  attribute double startTime;
679
689
  attribute double endTime;
680
690
  attribute boolean pauseOnExit;
681
- attribute DOMString direction;
691
+ attribute DOMString vertical;
682
692
  attribute boolean snapToLines;
683
- attribute long linePosition;
684
- attribute long textPosition;
693
+ attribute long line;
694
+ attribute long position;
685
695
  attribute long size;
686
- attribute DOMString alignment;
687
- attribute DOMString cueAsSource;
696
+ attribute DOMString align;
697
+ attribute DOMString text;
688
698
  DocumentFragment getCueAsHTML();
689
699
 
690
700
  [TreatNonCallableAsNull] attribute Function? onenter;
@@ -703,7 +713,7 @@ interface TrackEvent : Event {
703
713
  };
704
714
 
705
715
  dictionary TrackEventInit : EventInit {
706
- object? Track;
716
+ object? track;
707
717
  };
708
718
 
709
719
  interface HTMLCanvasElement : HTMLElement {
@@ -711,7 +721,7 @@ interface HTMLCanvasElement : HTMLElement {
711
721
  attribute unsigned long height;
712
722
 
713
723
  DOMString toDataURL(optional DOMString type, any... args);
714
- void toBlob(FileCallback? callback, optional DOMString type, any... args);
724
+ void toBlob(FileCallback? _callback, optional DOMString type, any... args);
715
725
 
716
726
  object? getContext(DOMString contextId, any... args);
717
727
  };
@@ -726,30 +736,24 @@ interface CanvasRenderingContext2D {
726
736
  void restore(); // pop state stack and restore state
727
737
 
728
738
  // transformations (default transform is the identity matrix)
739
+ attribute SVGMatrix currentTransform;
729
740
  void scale(double x, double y);
730
741
  void rotate(double angle);
731
742
  void translate(double x, double y);
732
743
  void transform(double a, double b, double c, double d, double e, double f);
733
744
  void setTransform(double a, double b, double c, double d, double e, double f);
745
+ void resetTransform();
734
746
 
735
747
  // compositing
736
748
  attribute double globalAlpha; // (default 1.0)
737
749
  attribute DOMString globalCompositeOperation; // (default source-over)
738
750
 
739
- // colors and styles
751
+ // colors and styles (see also the CanvasDrawingStyles interface)
740
752
  attribute any strokeStyle; // (default black)
741
753
  attribute any fillStyle; // (default black)
742
754
  CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
743
755
  CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
744
- CanvasPattern createPattern(HTMLImageElement image, DOMString repetition);
745
- CanvasPattern createPattern(HTMLCanvasElement image, DOMString repetition);
746
- CanvasPattern createPattern(HTMLVideoElement image, DOMString repetition);
747
-
748
- // line caps/joins
749
- attribute double lineWidth; // (default 1)
750
- attribute DOMString lineCap; // "butt", "round", "square" (default "butt")
751
- attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter")
752
- attribute double miterLimit; // (default 10)
756
+ CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString repetition);
753
757
 
754
758
  // shadows
755
759
  attribute double shadowOffsetX; // (default 0)
@@ -762,42 +766,37 @@ interface CanvasRenderingContext2D {
762
766
  void fillRect(double x, double y, double w, double h);
763
767
  void strokeRect(double x, double y, double w, double h);
764
768
 
765
- // path API
769
+ // path API (see also CanvasPathMethods)
766
770
  void beginPath();
767
- void closePath();
768
- void moveTo(double x, double y);
769
- void lineTo(double x, double y);
770
- void quadraticCurveTo(double cpx, double cpy, double x, double y);
771
- void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
772
- void arcTo(double x1, double y1, double x2, double y2, double radius);
773
- void rect(double x, double y, double w, double h);
774
- void arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise);
775
771
  void fill();
772
+ void fill(Path path);
776
773
  void stroke();
774
+ void stroke(Path path);
777
775
  void drawSystemFocusRing(Element element);
776
+ void drawSystemFocusRing(Path path, Element element);
778
777
  boolean drawCustomFocusRing(Element element);
778
+ boolean drawCustomFocusRing(Path path, Element element);
779
779
  void scrollPathIntoView();
780
+ void scrollPathIntoView(Path path);
780
781
  void clip();
782
+ void clip(Path path);
783
+ void resetClip();
781
784
  boolean isPointInPath(double x, double y);
785
+ boolean isPointInPath(Path path, double x, double y);
782
786
 
783
- // text
784
- attribute DOMString font; // (default 10px sans-serif)
785
- attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start")
786
- attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
787
+ // text (see also the CanvasDrawingStyles interface)
787
788
  void fillText(DOMString text, double x, double y, optional double maxWidth);
788
789
  void strokeText(DOMString text, double x, double y, optional double maxWidth);
789
790
  TextMetrics measureText(DOMString text);
790
791
 
791
792
  // drawing images
792
- void drawImage(HTMLImageElement image, double dx, double dy);
793
- void drawImage(HTMLImageElement image, double dx, double dy, double dw, double dh);
794
- void drawImage(HTMLImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
795
- void drawImage(HTMLCanvasElement image, double dx, double dy);
796
- void drawImage(HTMLCanvasElement image, double dx, double dy, double dw, double dh);
797
- void drawImage(HTMLCanvasElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
798
- void drawImage(HTMLVideoElement image, double dx, double dy);
799
- void drawImage(HTMLVideoElement image, double dx, double dy, double dw, double dh);
800
- void drawImage(HTMLVideoElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
793
+ attribute boolean imageSmoothingEnabled; // (default true)
794
+ void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, double dx, double dy);
795
+ void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, double dx, double dy, double dw, double dh);
796
+ void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
797
+
798
+ // hit regions
799
+ void addHitRegion(HitRegionOptions options);
801
800
 
802
801
  // pixel manipulation
803
802
  ImageData createImageData(double sw, double sh);
@@ -806,6 +805,42 @@ interface CanvasRenderingContext2D {
806
805
  void putImageData(ImageData imagedata, double dx, double dy);
807
806
  void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
808
807
  };
808
+ CanvasRenderingContext2D implements CanvasDrawingStyles;
809
+ CanvasRenderingContext2D implements CanvasPathMethods;
810
+
811
+ [NoInterfaceObject]
812
+ interface CanvasDrawingStyles {
813
+ // line caps/joins
814
+ attribute double lineWidth; // (default 1)
815
+ attribute DOMString lineCap; // "butt", "round", "square" (default "butt")
816
+ attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter")
817
+ attribute double miterLimit; // (default 10)
818
+
819
+ // dashed lines
820
+ void setLineDash(sequence<double> segments); // default empty
821
+ sequence<double> getLineDash();
822
+ attribute double lineDashOffset;
823
+
824
+ // text
825
+ attribute DOMString font; // (default 10px sans-serif)
826
+ attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start")
827
+ attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
828
+ };
829
+
830
+ [NoInterfaceObject]
831
+ interface CanvasPathMethods {
832
+ // shared path API methods
833
+ void closePath();
834
+ void moveTo(double x, double y);
835
+ void lineTo(double x, double y);
836
+ void quadraticCurveTo(double cpx, double cpy, double x, double y);
837
+ void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
838
+ void arcTo(double x1, double y1, double x2, double y2, double radius);
839
+ void arcTo(double x1, double y1, double x2, double y2, double radiusX, double radiusY, double rotation);
840
+ void rect(double x, double y, double w, double h);
841
+ void arc(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise = false);
842
+ void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, boolean anticlockwise);
843
+ };
809
844
 
810
845
  interface CanvasGradient {
811
846
  // opaque object
@@ -814,10 +849,37 @@ interface CanvasGradient {
814
849
 
815
850
  interface CanvasPattern {
816
851
  // opaque object
852
+ void setTransform(SVGMatrix transform);
817
853
  };
818
854
 
819
855
  interface TextMetrics {
820
- readonly attribute double width;
856
+ // x-direction
857
+ readonly attribute double width; // advance width
858
+ readonly attribute double actualBoundingBoxLeft;
859
+ readonly attribute double actualBoundingBoxRight;
860
+
861
+ // y-direction
862
+ readonly attribute double fontBoundingBoxAscent;
863
+ readonly attribute double fontBoundingBoxDescent;
864
+ readonly attribute double actualBoundingBoxAscent;
865
+ readonly attribute double actualBoundingBoxDescent;
866
+ readonly attribute double emHeightAscent;
867
+ readonly attribute double emHeightDescent;
868
+ readonly attribute double hangingBaseline;
869
+ readonly attribute double alphabeticBaseline;
870
+ readonly attribute double ideographicBaseline;
871
+ };
872
+
873
+ dictionary HitRegionOptions {
874
+ Path? path = null;
875
+ DOMString id = '';
876
+ DOMString? parentID = null;
877
+ DOMString cursor = 'inherit';
878
+ // for control-backed regions:
879
+ Element? control = null;
880
+ // for unbacked regions:
881
+ DOMString? label = null;
882
+ DOMString? role = null;
821
883
  };
822
884
 
823
885
  interface ImageData {
@@ -826,6 +888,31 @@ interface ImageData {
826
888
  readonly attribute Uint8ClampedArray data;
827
889
  };
828
890
 
891
+ [Constructor(optional Element scope)]
892
+ interface DrawingStyle { };
893
+ DrawingStyle implements CanvasDrawingStyles;
894
+
895
+ [Constructor,
896
+ Constructor(Path path),
897
+ Constructor(DOMString d)]
898
+ interface Path {
899
+ void addPath(Path path, SVGMatrix? transformation);
900
+ void addPathByStrokingPath(Path path, CanvasDrawingStyles styles, SVGMatrix? transformation);
901
+ void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, double x, double y, optional double maxWidth);
902
+ void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, double x, double y, optional double maxWidth);
903
+ void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path path, optional double maxWidth);
904
+ void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path path, optional double maxWidth);
905
+ };
906
+ Path implements CanvasPathMethods;
907
+
908
+ partial interface MouseEvent {
909
+ readonly attribute DOMString? region;
910
+ };
911
+
912
+ partial dictionary MouseEventInit {
913
+ DOMString? region;
914
+ };
915
+
829
916
  interface HTMLMapElement : HTMLElement {
830
917
  attribute DOMString name;
831
918
  readonly attribute HTMLCollection areas;
@@ -991,7 +1078,7 @@ interface HTMLInputElement : HTMLElement {
991
1078
  attribute DOMString type;
992
1079
  attribute DOMString defaultValue;
993
1080
  attribute DOMString value;
994
- attribute Date valueAsDate;
1081
+ attribute Date? valueAsDate;
995
1082
  attribute double valueAsNumber;
996
1083
  attribute unsigned long width;
997
1084
 
@@ -1010,6 +1097,10 @@ interface HTMLInputElement : HTMLElement {
1010
1097
  attribute unsigned long selectionStart;
1011
1098
  attribute unsigned long selectionEnd;
1012
1099
  attribute DOMString selectionDirection;
1100
+
1101
+ void setRangeText(DOMString replacement);
1102
+ void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode);
1103
+
1013
1104
  void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
1014
1105
  };
1015
1106
 
@@ -1050,10 +1141,7 @@ interface HTMLSelectElement : HTMLElement {
1050
1141
  attribute unsigned long length;
1051
1142
  getter Element item(unsigned long index);
1052
1143
  object namedItem(DOMString name);
1053
- void add(HTMLOptionElement element, optional HTMLElement? before);
1054
- void add(HTMLOptGroupElement element, optional HTMLElement? before);
1055
- void add(HTMLOptionElement element, long before);
1056
- void add(HTMLOptGroupElement element, long before);
1144
+ void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
1057
1145
  void remove(long index);
1058
1146
  setter creator void (unsigned long index, HTMLOptionElement option);
1059
1147
 
@@ -1127,6 +1215,10 @@ interface HTMLTextAreaElement : HTMLElement {
1127
1215
  attribute unsigned long selectionStart;
1128
1216
  attribute unsigned long selectionEnd;
1129
1217
  attribute DOMString selectionDirection;
1218
+
1219
+ void setRangeText(DOMString replacement);
1220
+ void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode);
1221
+
1130
1222
  void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
1131
1223
  };
1132
1224
 
@@ -1184,6 +1276,14 @@ interface HTMLMeterElement : HTMLElement {
1184
1276
  readonly attribute NodeList labels;
1185
1277
  };
1186
1278
 
1279
+
1280
+ enum SelectionMode {
1281
+ 'select',
1282
+ 'start',
1283
+ 'end',
1284
+ 'preserve',
1285
+ };
1286
+
1187
1287
  interface ValidityState {
1188
1288
  readonly attribute boolean valueMissing;
1189
1289
  readonly attribute boolean typeMismatch;
@@ -1207,6 +1307,7 @@ interface HTMLCommandElement : HTMLElement {
1207
1307
  attribute boolean disabled;
1208
1308
  attribute boolean checked;
1209
1309
  attribute DOMString radiogroup;
1310
+ readonly attribute HTMLElement? command;
1210
1311
  };
1211
1312
 
1212
1313
  interface HTMLMenuElement : HTMLElement {
@@ -1214,6 +1315,14 @@ interface HTMLMenuElement : HTMLElement {
1214
1315
  attribute DOMString label;
1215
1316
  };
1216
1317
 
1318
+ interface HTMLDialogElement : HTMLElement {
1319
+ attribute boolean open;
1320
+ attribute DOMString returnValue;
1321
+ void show(optional (MouseEvent or Element) anchor);
1322
+ void showModal(optional (MouseEvent or Element) anchor);
1323
+ void close(optional DOMString returnValue);
1324
+ };
1325
+
1217
1326
  [ReplaceableNamedProperties]
1218
1327
  interface Window : EventTarget {
1219
1328
  // the current browsing context
@@ -1242,7 +1351,7 @@ interface Window : EventTarget {
1242
1351
  [Replaceable] readonly attribute WindowProxy frames;
1243
1352
  [Replaceable] readonly attribute unsigned long length;
1244
1353
  [Unforgeable] readonly attribute WindowProxy top;
1245
- attribute WindowProxy opener;
1354
+ attribute WindowProxy? opener;
1246
1355
  readonly attribute WindowProxy parent;
1247
1356
  readonly attribute Element? frameElement;
1248
1357
  WindowProxy open(optional DOMString url, optional DOMString target, optional DOMString features, optional boolean replace);
@@ -1270,10 +1379,12 @@ interface Window : EventTarget {
1270
1379
  [TreatNonCallableAsNull] attribute Function? onbeforeprint;
1271
1380
  [TreatNonCallableAsNull] attribute Function? onbeforeunload;
1272
1381
  [TreatNonCallableAsNull] attribute Function? onblur;
1382
+ [TreatNonCallableAsNull] attribute Function? oncancel;
1273
1383
  [TreatNonCallableAsNull] attribute Function? oncanplay;
1274
1384
  [TreatNonCallableAsNull] attribute Function? oncanplaythrough;
1275
1385
  [TreatNonCallableAsNull] attribute Function? onchange;
1276
1386
  [TreatNonCallableAsNull] attribute Function? onclick;
1387
+ [TreatNonCallableAsNull] attribute Function? onclose;
1277
1388
  [TreatNonCallableAsNull] attribute Function? oncontextmenu;
1278
1389
  [TreatNonCallableAsNull] attribute Function? oncuechange;
1279
1390
  [TreatNonCallableAsNull] attribute Function? ondblclick;
@@ -1523,11 +1634,11 @@ interface DataTransferItemList {
1523
1634
  interface DataTransferItem {
1524
1635
  readonly attribute DOMString kind;
1525
1636
  readonly attribute DOMString type;
1526
- void getAsString(FunctionStringCallback? callback);
1637
+ void getAsString(FunctionStringCallback? _callback);
1527
1638
  File? getAsFile();
1528
1639
  };
1529
1640
 
1530
- [Callback=FunctionOnly, NoInterfaceObject]
1641
+ [Callback, NoInterfaceObject]
1531
1642
  interface FunctionStringCallback {
1532
1643
  void handleEvent(DOMString data);
1533
1644
  };
@@ -1541,104 +1652,6 @@ dictionary DragEventInit : MouseEventInit {
1541
1652
  DataTransfer? dataTransfer;
1542
1653
  };
1543
1654
 
1544
- [NoInterfaceObject]
1545
- interface NavigatorUserMedia {
1546
- void getUserMedia(DOMString options, NavigatorUserMediaSuccessCallback? successCallback, optional NavigatorUserMediaErrorCallback? errorCallback);
1547
- };
1548
- Navigator implements NavigatorUserMedia;
1549
-
1550
- [Callback=FunctionOnly, NoInterfaceObject]
1551
- interface NavigatorUserMediaSuccessCallback {
1552
- void handleEvent(LocalMediaStream stream);
1553
- };
1554
-
1555
- [NoInterfaceObject]
1556
- interface NavigatorUserMediaError {
1557
- const unsigned short PERMISSION_DENIED = 1;
1558
- readonly attribute unsigned short code;
1559
- };
1560
-
1561
- [Callback=FunctionOnly, NoInterfaceObject]
1562
- interface NavigatorUserMediaErrorCallback {
1563
- void handleEvent(NavigatorUserMediaError error);
1564
- };
1565
-
1566
- [Constructor(MediaStream parentStream)]
1567
- interface MediaStream : EventTarget {
1568
- readonly attribute DOMString label;
1569
- readonly attribute MediaStreamTrack[] tracks;
1570
-
1571
- MediaStreamRecorder record();
1572
-
1573
- const unsigned short LIVE = 1;
1574
- const unsigned short ENDED = 2;
1575
- readonly attribute unsigned short readyState;
1576
- [TreatNonCallableAsNull] attribute Function? onended;
1577
- };
1578
-
1579
- interface LocalMediaStream : MediaStream {
1580
- void stop();
1581
- };
1582
-
1583
- interface MediaStreamTrack {
1584
- readonly attribute DOMString kind;
1585
- readonly attribute DOMString label;
1586
- attribute boolean enabled;
1587
- };
1588
-
1589
- interface MediaStreamRecorder {
1590
- void getRecordedData(BlobCallback? callback);
1591
- };
1592
-
1593
- [Callback=FunctionOnly, NoInterfaceObject]
1594
- interface BlobCallback {
1595
- void handleEvent(Blob blob);
1596
- };
1597
-
1598
- partial interface URL {
1599
- static DOMString createObjectURL(MediaStream stream);
1600
- };
1601
-
1602
- [Constructor(DOMString serverConfiguration, SignalingCallback signalingCallback)]
1603
- interface PeerConnection : EventTarget {
1604
- void processSignalingMessage(DOMString message);
1605
-
1606
- const unsigned short NEW = 0;
1607
- const unsigned short NEGOTIATING = 1;
1608
- const unsigned short ACTIVE = 2;
1609
- const unsigned short CLOSED = 3;
1610
- readonly attribute unsigned short readyState;
1611
-
1612
- void send(DOMString text);
1613
- void addStream(MediaStream stream);
1614
- void removeStream(MediaStream stream);
1615
- readonly attribute MediaStream[] localStreams;
1616
- readonly attribute MediaStream[] remoteStreams;
1617
-
1618
- void close();
1619
-
1620
- // connection quality information
1621
- [TreatNonCallableAsNull] attribute Function? onconnecting;
1622
- [TreatNonCallableAsNull] attribute Function? onopen;
1623
- [TreatNonCallableAsNull] attribute Function? onmessage;
1624
- [TreatNonCallableAsNull] attribute Function? onaddstream;
1625
- [TreatNonCallableAsNull] attribute Function? onremovestream;
1626
- };
1627
-
1628
- [Callback=FunctionOnly, NoInterfaceObject]
1629
- interface SignalingCallback {
1630
- void handleEvent(DOMString message, PeerConnection source);
1631
- };
1632
-
1633
- [Constructor(DOMString type, optional MediaStreamEventInit eventInitDict)]
1634
- interface MediaStreamEvent : Event {
1635
- readonly attribute MediaStream? stream;
1636
- };
1637
-
1638
- dictionary MediaStreamEventInit : EventInit {
1639
- // DOMString MediaStream? stream;
1640
- };
1641
-
1642
1655
  interface WorkerGlobalScope : EventTarget {
1643
1656
  readonly attribute WorkerGlobalScope self;
1644
1657
  readonly attribute WorkerLocation location;
@@ -1650,13 +1663,11 @@ interface WorkerGlobalScope : EventTarget {
1650
1663
  };
1651
1664
  WorkerGlobalScope implements WorkerUtils;
1652
1665
 
1653
- [Supplemental, NoInterfaceObject]
1654
1666
  interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
1655
1667
  void postMessage(any message, optional sequence<Transferable> transfer);
1656
1668
  [TreatNonCallableAsNull] attribute Function? onmessage;
1657
1669
  };
1658
1670
 
1659
- [Supplemental, NoInterfaceObject]
1660
1671
  interface SharedWorkerGlobalScope : WorkerGlobalScope {
1661
1672
  readonly attribute DOMString name;
1662
1673
  readonly attribute ApplicationCache applicationCache;
@@ -1676,24 +1687,26 @@ dictionary ErrorEventInit : EventInit {
1676
1687
  unsigned long lineno;
1677
1688
  };
1678
1689
 
1679
- [Supplemental, NoInterfaceObject]
1680
- interface AbstractWorker : EventTarget {
1690
+ [NoInterfaceObject]
1691
+ interface AbstractWorker {
1681
1692
  [TreatNonCallableAsNull] attribute Function? onerror;
1682
1693
 
1683
1694
  };
1684
1695
 
1685
1696
  [Constructor(DOMString scriptURL)]
1686
- interface Worker : AbstractWorker {
1697
+ interface Worker : EventTarget {
1687
1698
  void terminate();
1688
1699
 
1689
1700
  void postMessage(any message, optional sequence<Transferable> transfer);
1690
1701
  [TreatNonCallableAsNull] attribute Function? onmessage;
1691
1702
  };
1703
+ Worker implements AbstractWorker;
1692
1704
 
1693
1705
  [Constructor(DOMString scriptURL, optional DOMString name)]
1694
- interface SharedWorker : AbstractWorker {
1706
+ interface SharedWorker : EventTarget {
1695
1707
  readonly attribute MessagePort port;
1696
1708
  };
1709
+ SharedWorker implements AbstractWorker;
1697
1710
 
1698
1711
  [NoInterfaceObject]
1699
1712
  interface WorkerUtils {
@@ -1758,8 +1771,7 @@ dictionary EventSourceInit {
1758
1771
  boolean withCredentials = false;
1759
1772
  };
1760
1773
 
1761
- [Constructor(DOMString url, optional DOMString protocols),
1762
- Constructor(DOMString url, optional DOMString[] protocols)]
1774
+ [Constructor(DOMString url, optional (DOMString or DOMString[]) protocols)]
1763
1775
  interface WebSocket : EventTarget {
1764
1776
  readonly attribute DOMString url;
1765
1777
 
@@ -1839,7 +1851,7 @@ Window implements WindowLocalStorage;
1839
1851
 
1840
1852
  [Constructor(DOMString type, optional StorageEventInit eventInitDict)]
1841
1853
  interface StorageEvent : Event {
1842
- readonly attribute DOMString key;
1854
+ readonly attribute DOMString? key;
1843
1855
  readonly attribute DOMString? oldValue;
1844
1856
  readonly attribute DOMString? newValue;
1845
1857
  readonly attribute DOMString url;
@@ -1847,7 +1859,7 @@ interface StorageEvent : Event {
1847
1859
  };
1848
1860
 
1849
1861
  dictionary StorageEventInit : EventInit {
1850
- DOMString key;
1862
+ DOMString? key;
1851
1863
  DOMString? oldValue;
1852
1864
  DOMString? newValue;
1853
1865
  DOMString url;