• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * This externs file prevents the Closure JS compiler from minifying away
3 * names of objects created by Emscripten.
4 * Basically, by defining empty objects and functions here, Closure will
5 * know not to rename them.  This is needed because of our pre-js files,
6 * that is, the JS we hand-write to bundle into the output. That JS will be
7 * hit by the closure compiler and thus needs to know about what functions
8 * have special names and should not be minified.
9 *
10 * Emscripten does not support automatically generating an externs file, so we
11 * do it by hand. The general process is to write some JS code, and then put any
12 * calls to CanvasKit or related things in here. Running ./compile.sh and then
13 * looking at the minified results or running the Release trybot should
14 * verify nothing was missed. Optionally, looking directly at the minified
15 * pathkit.js can be useful when developing locally.
16 *
17 * Docs:
18 *   https://github.com/cljsjs/packages/wiki/Creating-Externs
19 *   https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System
20 *
21 * Example externs:
22 *   https://github.com/google/closure-compiler/tree/master/externs
23 */
24
25var CanvasKit = {
26  // public API (i.e. things we declare in the pre-js file or in the cpp bindings)
27  Color: function() {},
28  Color4f: function() {},
29  ColorAsInt: function() {},
30  LTRBRect: function() {},
31  XYWHRect: function() {},
32  LTRBiRect: function() {},
33  XYWHiRect: function() {},
34  RRectXY: function() {},
35  /** @return {ImageData} */
36  ImageData: function() {},
37
38  GetWebGLContext: function() {},
39  MakeCanvas: function() {},
40  MakeCanvasSurface: function() {},
41  MakeGrContext: function() {},
42  /** @return {CanvasKit.AnimatedImage} */
43  MakeAnimatedImageFromEncoded: function() {},
44  /** @return {CanvasKit.Image} */
45  MakeImage: function() {},
46  /** @return {CanvasKit.Image} */
47  MakeImageFromEncoded: function() {},
48  MakeImageFromCanvasImageSource: function() {},
49  MakeOnScreenGLSurface: function() {},
50  MakeRenderTarget: function() {},
51  MakePicture: function() {},
52  MakeSWCanvasSurface: function() {},
53  MakeManagedAnimation: function() {},
54  MakeParticles: function() {},
55  MakeVertices: function() {},
56  MakeSurface: function() {},
57  MakeRasterDirectSurface: function() {},
58  MakeWebGLCanvasSurface: function() {},
59  Malloc: function() {},
60  MallocGlyphIDs: function() {},
61  Free: function() {},
62  computeTonalColors: function() {},
63  currentContext: function() {},
64  deleteContext: function() {},
65  getColorComponents: function() {},
66  getDecodeCacheLimitBytes: function() {},
67  getDecodeCacheUsageBytes: function() {},
68  multiplyByAlpha: function() {},
69  parseColorString: function() {},
70  setCurrentContext: function() {},
71  setDecodeCacheLimitBytes: function() {},
72  getShadowLocalBounds: function() {},
73  // Defined by emscripten.
74  createContext: function() {},
75
76  // private API (i.e. things declared in the bindings that we use
77  // in the pre-js file)
78  _computeTonalColors: function() {},
79  _MakeImage: function() {},
80  _MakeManagedAnimation: function() {},
81  _MakeParticles: function() {},
82  _MakePicture: function() {},
83  _decodeAnimatedImage: function() {},
84  _decodeImage: function() {},
85  _getShadowLocalBounds: function() {},
86
87  // The testing object is meant to expose internal functions
88  // for more fine-grained testing, e.g. parseColor
89  _testing: {},
90
91  // Objects and properties on CanvasKit
92
93  Animation: {
94    prototype: {
95      render: function() {},
96      size: function() {},
97    },
98    _render: function() {},
99    _size: function() {},
100  },
101
102  GrContext: {
103    // public API (from C++ bindings)
104    getResourceCacheLimitBytes: function() {},
105    getResourceCacheUsageBytes: function() {},
106    releaseResourcesAndAbandonContext: function() {},
107    setResourceCacheLimitBytes: function() {},
108  },
109
110  ManagedAnimation: {
111    prototype: {
112      render: function() {},
113      seek: function() {},
114      seekFrame: function() {},
115      setColor: function() {},
116      size: function() {},
117    },
118    _render: function() {},
119    _seek: function() {},
120    _seekFrame: function() {},
121    _size: function() {},
122  },
123
124  Paragraph: {
125    // public API (from C++ bindings)
126    didExceedMaxLines: function() {},
127    getAlphabeticBaseline: function() {},
128    getGlyphPositionAtCoordinate: function() {},
129    getHeight: function() {},
130    getIdeographicBaseline: function() {},
131    getLineMetrics: function() {},
132    getLongestLine: function() {},
133    getMaxIntrinsicWidth: function() {},
134    getMaxWidth: function() {},
135    getMinIntrinsicWidth: function() {},
136    getWordBoundary: function() {},
137    getShapedLines: function() {},
138    layout: function() {},
139
140    // private API
141    /** @return {Float32Array} */
142    _getRectsForRange: function() {},
143    _getRectsForPlaceholders: function() {},
144  },
145
146  ParagraphBuilder: {
147    Make: function() {},
148    MakeFromFontProvider: function() {},
149    ShapeText: function() {},
150    addText: function() {},
151    build: function() {},
152    pop: function() {},
153
154    prototype: {
155      pushStyle: function() {},
156      pushPaintStyle: function() {},
157      addPlaceholder: function() {},
158    },
159
160    // private API
161    _Make: function() {},
162    _MakeFromFontProvider: function() {},
163    _ShapeText: function() {},
164    _pushStyle: function() {},
165    _pushPaintStyle: function() {},
166    _addPlaceholder: function() {},
167  },
168
169  RuntimeEffect: {
170    // public API (from JS bindings)
171    Make: function() {},
172    getUniform: function() {},
173    getUniformCount: function() {},
174    getUniformFloatCount: function() {},
175    getUniformName: function() {},
176    prototype: {
177      makeShader: function() {},
178      makeShaderWithChildren: function() {},
179    },
180    // private API (from C++ bindings)
181    _Make: function() {},
182    _makeShader: function() {},
183    _makeShaderWithChildren: function() {},
184  },
185
186  ParagraphStyle: function() {},
187  RSXFormBuilder: function() {},
188  ColorBuilder: function() {},
189  RectBuilder: function() {},
190
191  AnimatedImage: {
192    // public API (from C++ bindings)
193    decodeNextFrame: function() {},
194    getFrameCount: function() {},
195    getRepetitionCount: function() {},
196    height: function() {},
197    reset: function() {},
198    width: function() {},
199  },
200
201  Canvas: {
202    // public API (from C++ bindings)
203    clipPath: function() {},
204    drawCircle: function() {},
205    drawColorInt: function() {},
206    drawImage: function() {},
207    drawImageCubic: function() {},
208    drawImageOptions: function() {},
209    drawImageAtCurrentFrame: function() {},
210    drawLine: function() {},
211    drawPaint: function() {},
212    drawParagraph: function() {},
213    drawPath: function() {},
214    drawPicture: function() {},
215    drawRect4f: function() {},
216    drawText: function() {},
217    drawTextBlob: function() {},
218    drawVertices: function() {},
219    flush: function() {},
220    getSaveCount: function() {},
221    makeSurface: function() {},
222    markCTM: function() {},
223    findMarkedCTM: function() {},
224    restore: function() {},
225    restoreToCount: function() {},
226    rotate: function() {},
227    save: function() {},
228    saveLayerPaint: function() {},
229    scale: function() {},
230    skew: function() {},
231    translate: function() {},
232
233    prototype: {
234      clear: function() {},
235      clipRRect: function() {},
236      clipRect: function() {},
237      concat: function() {},
238      drawArc: function() {},
239      drawAtlas: function() {},
240      drawColor: function() {},
241      drawColorComponents: function() {},
242      drawDRRect: function() {},
243      drawGlyphs: function() {},
244      drawImageNine: function() {},
245      drawImageRect: function() {},
246      drawImageRectCubic: function() {},
247      drawImageRectOptions: function() {},
248      drawOval: function() {},
249      drawPatch: function() {},
250      drawPoints: function() {},
251      drawRect: function() {},
252      drawRRect:  function() {},
253      drawShadow: function() {},
254      drawText: function() {},
255      findMarkedCTM: function() {},
256      getLocalToDevice: function() {},
257      getTotalMatrix: function() {},
258      readPixels: function() {},
259      saveLayer: function() {},
260      writePixels : function() {},
261    },
262
263    // private API
264    _clear: function() {},
265    _clipRRect: function() {},
266    _clipRect: function() {},
267    _concat: function() {},
268    _drawArc: function() {},
269    _drawAtlasOptions: function() {},
270    _drawAtlasCubic: function() {},
271    _drawColor: function() {},
272    _drawDRRect:  function() {},
273    _drawGlyphs: function() {},
274    _drawImageNine: function() {},
275    _drawImageRect: function() {},
276    _drawImageRectCubic: function() {},
277    _drawImageRectOptions: function() {},
278    _drawOval: function() {},
279    _drawPatch: function() {},
280    _drawPoints: function() {},
281    _drawRect: function() {},
282    _drawRRect:  function() {},
283    _drawShadow: function() {},
284    _drawSimpleText: function() {},
285    _findMarkedCTM: function() {},
286    _getLocalToDevice: function() {},
287    _getTotalMatrix: function() {},
288    _readPixels: function() {},
289    _saveLayer: function() {},
290    _writePixels: function() {},
291    delete: function() {},
292  },
293
294  ColorFilter: {
295    // public API (from C++ bindings and JS interface)
296    MakeBlend: function() {},
297    MakeCompose: function() {},
298    MakeLerp: function() {},
299    MakeLinearToSRGBGamma: function() {},
300    MakeMatrix: function() {},
301    MakeSRGBToLinearGamma: function() {},
302    // private API (from C++ bindings)
303    _MakeBlend: function() {},
304    _makeMatrix: function() {},
305  },
306
307  ColorMatrix: {
308    concat: function() {},
309    identity: function() {},
310    postTranslate: function() {},
311    rotated: function() {},
312    scaled: function() {},
313  },
314
315  ColorSpace: {
316    Equals: function() {},
317    SRGB: {},
318    DISPLAY_P3: {},
319    ADOBE_RGB: {},
320    // private API (from C++ bindings)
321    _MakeSRGB: function() {},
322    _MakeDisplayP3: function() {},
323    _MakeAdobeRGB: function() {},
324  },
325
326  ContourMeasureIter: {
327    next: function() {},
328  },
329
330  ContourMeasure: {
331    getSegment: function() {},
332    isClosed: function() {},
333    length: function() {},
334    prototype: {
335      getPosTan: function() {},
336    },
337    _getPosTan: function() {},
338  },
339
340  Font: {
341    // public API (from C++ bindings)
342    getMetrics: function() {},
343    getScaleX: function() {},
344    getSize: function() {},
345    getSkewX: function() {},
346    isEmbolden: function() {},
347    getTypeface: function() {},
348    setHinting: function() {},
349    setLinearMetrics: function() {},
350    setScaleX: function() {},
351    setSize: function() {},
352    setSkewX: function() {},
353    setEmbolden: function() {},
354    setSubpixel: function() {},
355    setTypeface: function() {},
356
357    prototype: {
358      getGlyphBounds: function() {},
359      getGlyphIDs: function() {},
360      getGlyphWidths: function() {},
361    },
362
363    // private API (from C++ bindings)
364    _getGlyphIDs: function() {},
365    _getGlyphWidthBounds: function() {},
366  },
367
368  FontMgr: {
369    // public API (from C++ and JS bindings)
370    FromData: function() {},
371    RefDefault: function() {},
372    countFamilies: function() {},
373    getFamilyName: function() {},
374
375    // private API
376    _makeTypefaceFromData: function() {},
377    _fromData: function() {},
378  },
379
380  TypefaceFontProvider: {
381    // public API (from C++ and JS bindings)
382    Make: function() {},
383    registerFont: function() {},
384
385    // private API
386    _registerFont: function() {},
387  },
388
389  Image: {
390    // public API (from C++ bindings)
391    encodeToBytes: function() {},
392    getColorSpace: function() {},
393    getImageInfo: function() {},
394    makeCopyWithDefaultMipmaps: function() {},
395    height: function() {},
396    width: function() {},
397
398    prototype: {
399      makeShaderCubic: function() {},
400      makeShaderOptions: function() {},
401    },
402    // private API
403    _makeShaderCubic: function() {},
404    _makeShaderOptions: function() {},
405  },
406
407  ImageFilter: {
408    MakeBlur: function() {},
409    MakeColorFilter: function() {},
410    MakeCompose: function() {},
411    MakeMatrixTransform: function() {},
412
413    // private API
414    _MakeMatrixTransform: function() {},
415  },
416
417  // These are defined in interface.js
418  M44: {
419    identity: function() {},
420    invert: function() {},
421    mustInvert: function() {},
422    multiply: function() {},
423    rotatedUnitSinCos: function() {},
424    rotated: function() {},
425    scaled: function() {},
426    translated: function() {},
427    lookat: function() {},
428    perspective: function() {},
429    rc: function() {},
430    transpose: function() {},
431    setupCamera: function() {},
432  },
433
434  Matrix: {
435    identity: function() {},
436    invert: function() {},
437    mapPoints: function() {},
438    multiply: function() {},
439    rotated: function() {},
440    scaled: function() {},
441    skewed: function() {},
442    translated: function() {},
443  },
444
445  MaskFilter: {
446    MakeBlur: function() {},
447  },
448
449  MipmapMode: {
450    None: {},
451    Nearest: {},
452    Linear: {},
453  },
454
455  Paint: {
456    // public API (from C++ bindings)
457    /** @return {CanvasKit.Paint} */
458    copy: function() {},
459    getBlendMode: function() {},
460    getFilterQuality: function() {},
461    getStrokeCap: function() {},
462    getStrokeJoin: function() {},
463    getStrokeMiter: function() {},
464    getStrokeWidth: function() {},
465    setAntiAlias: function() {},
466    setBlendMode: function() {},
467    setColorInt: function() {},
468    setFilterQuality: function() {},
469    setImageFilter: function() {},
470    setMaskFilter: function() {},
471    setPathEffect: function() {},
472    setShader: function() {},
473    setStrokeCap: function() {},
474    setStrokeJoin: function() {},
475    setStrokeMiter: function() {},
476    setStrokeWidth: function() {},
477    setStyle: function() {},
478
479    prototype: {
480      getColor: function() {},
481      setColor: function() {},
482      setColorComponents: function() {},
483      setColorInt: function() {},
484    },
485
486    // Private API
487    delete: function() {},
488    _getColor: function() {},
489    _setColor: function() {},
490  },
491
492  PathEffect: {
493    MakeCorner: function() {},
494    MakeDash: function() {},
495    MakeDiscrete: function() {},
496
497    // Private C++ API
498    _MakeDash: function() {},
499  },
500
501  ParticleEffect: {
502    // public API (from C++ bindings)
503    draw: function() {},
504    getUniform: function() {},
505    getUniformCount: function() {},
506    getUniformFloatCount: function() {},
507    getUniformName: function() {},
508    setRate: function() {},
509    start: function() {},
510    update: function() {},
511
512    prototype: {
513      setPosition: function() {},
514      uniforms: function() {},
515    },
516
517    // private API (from C++ bindings)
518    _uniformPtr: function() {},
519    _setPosition: function() {},
520  },
521
522  Path: {
523    // public API (from C++ and JS bindings)
524    MakeFromCmds: function() {},
525    MakeFromSVGString: function() {},
526    MakeFromOp: function() {},
527    MakeFromVerbsPointsWeights: function() {},
528    contains: function() {},
529    /** @return {CanvasKit.Path} */
530    copy: function() {},
531    countPoints: function() {},
532    equals: function() {},
533    getFillType: function() {},
534    isEmpty: function() {},
535    isVolatile: function() {},
536    reset: function() {},
537    rewind: function() {},
538    setFillType: function() {},
539    setIsVolatile: function() {},
540    toCmds: function() {},
541    toSVGString: function() {},
542
543    prototype: {
544      addArc: function() {},
545      addOval: function() {},
546      addPath: function() {},
547      addPoly: function() {},
548      addRect: function() {},
549      addRRect: function() {},
550      addVerbsPointsWeights: function() {},
551      arc: function() {},
552      arcToOval: function() {},
553      arcToRotated: function() {},
554      arcToTangent: function() {},
555      close: function() {},
556      conicTo: function() {},
557      computeTightBounds: function() {},
558      cubicTo: function() {},
559      dash: function() {},
560      getBounds: function() {},
561      getPoint: function() {},
562      lineTo: function() {},
563      moveTo: function() {},
564      offset: function() {},
565      op: function() {},
566      quadTo: function() {},
567      rArcTo: function() {},
568      rConicTo: function() {},
569      rCubicTo: function() {},
570      rLineTo: function() {},
571      rMoveTo: function() {},
572      rQuadTo: function() {},
573      simplify: function() {},
574      stroke: function() {},
575      transform: function() {},
576      trim: function() {},
577    },
578
579    // private API
580    _MakeFromCmds: function() {},
581    _MakeFromVerbsPointsWeights: function() {},
582    _addArc: function() {},
583    _addOval: function() {},
584    _addPath: function() {},
585    _addPoly: function() {},
586    _addRect: function() {},
587    _addRRect: function() {},
588    _addVerbsPointsWeights: function() {},
589    _arcToOval: function() {},
590    _arcToRotated: function() {},
591    _arcToTangent: function() {},
592    _close: function() {},
593    _conicTo: function() {},
594    _computeTightBounds: function() {},
595    _cubicTo: function() {},
596    _dash: function() {},
597    _getBounds: function() {},
598    _getPoint: function() {},
599    _lineTo: function() {},
600    _moveTo: function() {},
601    _op: function() {},
602    _quadTo: function() {},
603    _rArcTo: function() {},
604    _rConicTo: function() {},
605    _rCubicTo: function() {},
606    _rect: function() {},
607    _rLineTo: function() {},
608    _rMoveTo: function() {},
609    _rQuadTo: function() {},
610    _simplify: function() {},
611    _stroke: function() {},
612    _transform: function() {},
613    _trim: function() {},
614    delete: function() {},
615    dump: function() {},
616    dumpHex: function() {},
617  },
618
619  Picture: {
620    serialize: function() {},
621  },
622
623  PictureRecorder: {
624    finishRecordingAsPicture: function() {},
625    prototype: {
626      beginRecording: function() {},
627    },
628    _beginRecording: function() {},
629  },
630
631  Shader: {
632    // Deprecated names
633    Blend: function() {},
634    Color: function() {},
635    Lerp: function() {},
636    // public API (from JS / C++ bindings)
637    MakeBlend: function() {},
638    MakeColor: function() {},
639    MakeFractalNoise: function() {},
640    MakeLerp: function() {},
641    MakeLinearGradient: function() {},
642    MakeRadialGradient: function() {},
643    MakeSweepGradient: function() {},
644    MakeTurbulence: function() {},
645    MakeTwoPointConicalGradient: function() {},
646
647    // private API (from C++ bindings)
648    _MakeColor: function() {},
649    _MakeLinearGradient: function() {},
650    _MakeRadialGradient: function() {},
651    _MakeSweepGradient: function() {},
652    _MakeTwoPointConicalGradient: function() {},
653  },
654
655  Surface: {
656    // public API (from C++ bindings)
657    /** @return {CanvasKit.Canvas} */
658    getCanvas: function() {},
659    imageInfo: function() {},
660
661    makeSurface: function() {},
662    sampleCnt: function() {},
663    reportBackendTypeIsGPU: function() {},
664    grContext: {},
665    openGLversion: {},
666
667    prototype: {
668      /** @return {CanvasKit.Image} */
669      makeImageSnapshot: function() {},
670    },
671
672    // private API
673    _flush: function() {},
674    _makeImageSnapshot: function() {},
675    _makeRasterDirect: function() {},
676    delete: function() {},
677  },
678
679  TextBlob: {
680    // public API (both C++ and JS bindings)
681    MakeFromGlyphs: function() {},
682    MakeFromRSXform: function() {},
683    MakeFromRSXformGlyphs: function() {},
684    MakeFromText: function() {},
685    MakeOnPath: function() {},
686    // private API (from C++ bindings)
687    _MakeFromGlyphs: function() {},
688    _MakeFromRSXform: function() {},
689    _MakeFromRSXformGlyphs: function() {},
690    _MakeFromText: function() {},
691  },
692
693  // These are defined in interface.js
694  Vector: {
695    add: function() {},
696    sub: function() {},
697    dot: function() {},
698    cross: function() {},
699    normalize: function() {},
700    mulScalar: function() {},
701    length: function() {},
702    lengthSquared: function() {},
703    dist: function() {},
704  },
705
706  Vertices: {
707    // public API (from C++ bindings)
708    uniqueID: function() {},
709
710    prototype: {
711      bounds: function() {},
712    },
713    // private API (from C++ bindings)
714
715    _bounds: function() {},
716  },
717
718  _VerticesBuilder: {
719    colors: function() {},
720    detach: function() {},
721    indices: function() {},
722    positions: function() {},
723    texCoords: function() {},
724  },
725
726  TextStyle: function() {},
727
728  // Constants and Enums
729  gpu: {},
730  skottie: {},
731
732  TRANSPARENT: {},
733  BLACK: {},
734  WHITE: {},
735  RED: {},
736  GREEN: {},
737  BLUE: {},
738  YELLOW: {},
739  CYAN: {},
740  MAGENTA: {},
741
742  MOVE_VERB: {},
743  LINE_VERB: {},
744  QUAD_VERB: {},
745  CONIC_VERB: {},
746  CUBIC_VERB: {},
747  CLOSE_VERB: {},
748
749  NoDecoration: {},
750  UnderlineDecoration: {},
751  OverlineDecoration: {},
752  LineThroughDecoration: {},
753
754  SaveLayerInitWithPrevious: {},
755  SaveLayerF16ColorType: {},
756
757  Affinity: {
758    Upstream: {},
759    Downstream: {},
760  },
761
762  AlphaType: {
763    Opaque: {},
764    Premul: {},
765    Unpremul: {},
766  },
767
768  BlendMode: {
769    Clear: {},
770    Src: {},
771    Dst: {},
772    SrcOver: {},
773    DstOver: {},
774    SrcIn: {},
775    DstIn: {},
776    SrcOut: {},
777    DstOut: {},
778    SrcATop: {},
779    DstATop: {},
780    Xor: {},
781    Plus: {},
782    Modulate: {},
783    Screen: {},
784    Overlay: {},
785    Darken: {},
786    Lighten: {},
787    ColorDodge: {},
788    ColorBurn: {},
789    HardLight: {},
790    SoftLight: {},
791    Difference: {},
792    Exclusion: {},
793    Multiply: {},
794    Hue: {},
795    Saturation: {},
796    Color: {},
797    Luminosity: {},
798  },
799
800  BlurStyle: {
801    Normal: {},
802    Solid: {},
803    Outer: {},
804    Inner: {},
805  },
806
807  ClipOp: {
808    Difference: {},
809    Intersect: {},
810  },
811
812  ColorType: {
813    Alpha_8: {},
814    RGB_565: {},
815    ARGB_4444: {},
816    RGBA_8888: {},
817    RGB_888x: {},
818    BGRA_8888: {},
819    RGBA_1010102: {},
820    RGB_101010x: {},
821    Gray_8: {},
822    RGBA_F16: {},
823    RGBA_F32: {},
824  },
825
826  FillType: {
827    Winding: {},
828    EvenOdd: {},
829  },
830
831  FilterMode: {
832    Linear: {},
833    Nearest: {},
834  },
835
836  FilterQuality: {
837    None: {},
838    Low: {},
839    Medium: {},
840    High: {},
841  },
842
843  FontSlant: {
844    Upright: {},
845    Italic: {},
846    Oblique: {},
847  },
848
849  FontHinting: {
850    None: {},
851    Slight: {},
852    Normal: {},
853    Full: {},
854  },
855
856  FontWeight: {
857    Invisible: {},
858    Thin: {},
859    ExtraLight: {},
860    Light: {},
861    Normal: {},
862    Medium: {},
863    SemiBold: {},
864    Bold: {},
865    ExtraBold: {},
866    Black: {},
867    ExtraBlack: {},
868  },
869
870  FontWidth: {
871    UltraCondensed: {},
872    ExtraCondensed: {},
873    Condensed: {},
874    SemiCondensed: {},
875    Normal: {},
876    SemiExpanded: {},
877    Expanded: {},
878    ExtraExpanded: {},
879    UltraExpanded: {},
880  },
881
882  GlyphRunFlags: {
883    IsWhiteSpace: {},
884  },
885
886  ImageFormat: {
887    PNG: {},
888    JPEG: {},
889  },
890
891  PaintStyle: {
892    Fill: {},
893    Stroke: {},
894  },
895
896  PathOp: {
897    Difference: {},
898    Intersect: {},
899    Union: {},
900    XOR: {},
901    ReverseDifference: {},
902  },
903
904  PointMode: {
905    Points: {},
906    Lines: {},
907    Polygon: {},
908  },
909
910  RectHeightStyle: {
911    Tight: {},
912    Max: {},
913    IncludeLineSpacingMiddle: {},
914    IncludeLineSpacingTop: {},
915    IncludeLineSpacingBottom: {},
916    Strut: {},
917  },
918
919  RectWidthStyle: {
920    Tight: {},
921    Max: {},
922  },
923
924  StrokeCap: {
925    Butt: {},
926    Round: {},
927    Square: {},
928  },
929
930  StrokeJoin: {
931    Miter: {},
932    Round: {},
933    Bevel: {},
934  },
935
936  TextAlign: {
937    Left: {},
938    Right: {},
939    Center: {},
940    Justify: {},
941    Start: {},
942    End: {},
943  },
944
945  TextDirection: {
946    LTR: {},
947    RTL: {},
948  },
949
950  TextHeightBehavior: {
951    All: {},
952    DisableFirstAscent: {},
953    DisableLastDescent: {},
954    DisableAll: {},
955  },
956
957  DecorationStyle: {
958    Solid: {},
959    Double: {},
960    Dotted: {},
961    Dashed: {},
962    Wavy: {},
963  },
964
965  PlaceholderAlignment: {
966    Baseline: {},
967    AboveBaseline: {},
968    BelowBaseline: {},
969    Top: {},
970    Bottom: {},
971    Middle: {},
972  },
973
974  TextBaseline: {
975    Alphabetic: {},
976    Ideographic: {},
977  },
978
979  TileMode: {
980    Clamp: {},
981    Repeat: {},
982    Mirror: {},
983    Decal: {},
984  },
985
986  VertexMode: {
987    Triangles: {},
988    TrianglesStrip: {},
989    TriangleFan: {},
990  },
991
992  // Things Enscriptem adds for us
993
994  /**
995   * @type {Float32Array}
996   */
997  HEAPF32: {},
998  /**
999   * @type {Float64Array}
1000   */
1001  HEAPF64: {},
1002  /**
1003   * @type {Uint8Array}
1004   */
1005  HEAPU8: {},
1006  /**
1007   * @type {Uint16Array}
1008   */
1009  HEAPU16: {},
1010  /**
1011   * @type {Uint32Array}
1012   */
1013  HEAPU32: {},
1014  /**
1015   * @type {Int8Array}
1016   */
1017  HEAP8: {},
1018  /**
1019   * @type {Int16Array}
1020   */
1021  HEAP16: {},
1022  /**
1023   * @type {Int32Array}
1024   */
1025  HEAP32: {},
1026
1027  _malloc: function() {},
1028  _free: function() {},
1029  onRuntimeInitialized: function() {},
1030};
1031
1032// Public API things that are newly declared in the JS should go here.
1033// It's not enough to declare them above, because closure can still erase them
1034// unless they go on the prototype.
1035CanvasKit.Paragraph.prototype.getRectsForRange = function() {};
1036CanvasKit.Paragraph.prototype.getRectsForPlaceholders = function() {};
1037
1038CanvasKit.Surface.prototype.dispose = function() {};
1039CanvasKit.Surface.prototype.flush = function() {};
1040CanvasKit.Surface.prototype.requestAnimationFrame = function() {};
1041CanvasKit.Surface.prototype.drawOnce = function() {};
1042
1043CanvasKit.FontMgr.prototype.MakeTypefaceFromData = function() {};
1044
1045CanvasKit.RSXFormBuilder.prototype.build = function() {};
1046CanvasKit.RSXFormBuilder.prototype.delete = function() {};
1047CanvasKit.RSXFormBuilder.prototype.push = function() {};
1048CanvasKit.RSXFormBuilder.prototype.set = function() {};
1049
1050CanvasKit.ColorBuilder.prototype.build = function() {};
1051CanvasKit.ColorBuilder.prototype.delete = function() {};
1052CanvasKit.ColorBuilder.prototype.push = function() {};
1053CanvasKit.ColorBuilder.prototype.set = function() {};
1054
1055CanvasKit.RuntimeEffect.prototype.makeShader = function() {};
1056CanvasKit.RuntimeEffect.prototype.makeShaderWithChildren = function() {};
1057
1058// Define StrokeOpts object
1059var StrokeOpts = {};
1060StrokeOpts.prototype.width;
1061StrokeOpts.prototype.miter_limit;
1062StrokeOpts.prototype.cap;
1063StrokeOpts.prototype.join;
1064StrokeOpts.prototype.precision;
1065
1066// Define everything created in the canvas2d spec here
1067var HTMLCanvas = {};
1068HTMLCanvas.prototype.decodeImage = function() {};
1069HTMLCanvas.prototype.dispose = function() {};
1070HTMLCanvas.prototype.getContext = function() {};
1071HTMLCanvas.prototype.loadFont = function() {};
1072HTMLCanvas.prototype.makePath2D = function() {};
1073HTMLCanvas.prototype.toDataURL = function() {};
1074
1075var ImageBitmapRenderingContext = {};
1076ImageBitmapRenderingContext.prototype.transferFromImageBitmap = function() {};
1077
1078var CanvasRenderingContext2D = {};
1079CanvasRenderingContext2D.prototype.addHitRegion = function() {};
1080CanvasRenderingContext2D.prototype.arc = function() {};
1081CanvasRenderingContext2D.prototype.arcTo = function() {};
1082CanvasRenderingContext2D.prototype.beginPath = function() {};
1083CanvasRenderingContext2D.prototype.bezierCurveTo = function() {};
1084CanvasRenderingContext2D.prototype.clearHitRegions = function() {};
1085CanvasRenderingContext2D.prototype.clearRect = function() {};
1086CanvasRenderingContext2D.prototype.clip = function() {};
1087CanvasRenderingContext2D.prototype.closePath = function() {};
1088CanvasRenderingContext2D.prototype.createImageData = function() {};
1089CanvasRenderingContext2D.prototype.createLinearGradient = function() {};
1090CanvasRenderingContext2D.prototype.createPattern = function() {};
1091CanvasRenderingContext2D.prototype.createRadialGradient = function() {};
1092CanvasRenderingContext2D.prototype.drawFocusIfNeeded = function() {};
1093CanvasRenderingContext2D.prototype.drawImage = function() {};
1094CanvasRenderingContext2D.prototype.ellipse = function() {};
1095CanvasRenderingContext2D.prototype.fill = function() {};
1096CanvasRenderingContext2D.prototype.fillRect = function() {};
1097CanvasRenderingContext2D.prototype.fillText = function() {};
1098CanvasRenderingContext2D.prototype.getImageData = function() {};
1099CanvasRenderingContext2D.prototype.getLineDash = function() {};
1100CanvasRenderingContext2D.prototype.isPointInPath = function() {};
1101CanvasRenderingContext2D.prototype.isPointInStroke = function() {};
1102CanvasRenderingContext2D.prototype.lineTo = function() {};
1103CanvasRenderingContext2D.prototype.measureText = function() {};
1104CanvasRenderingContext2D.prototype.moveTo = function() {};
1105CanvasRenderingContext2D.prototype.putImageData = function() {};
1106CanvasRenderingContext2D.prototype.quadraticCurveTo = function() {};
1107CanvasRenderingContext2D.prototype.rect = function() {};
1108CanvasRenderingContext2D.prototype.removeHitRegion = function() {};
1109CanvasRenderingContext2D.prototype.resetTransform = function() {};
1110CanvasRenderingContext2D.prototype.restore = function() {};
1111CanvasRenderingContext2D.prototype.rotate = function() {};
1112CanvasRenderingContext2D.prototype.save = function() {};
1113CanvasRenderingContext2D.prototype.scale = function() {};
1114CanvasRenderingContext2D.prototype.scrollPathIntoView = function() {};
1115CanvasRenderingContext2D.prototype.setLineDash = function() {};
1116CanvasRenderingContext2D.prototype.setTransform = function() {};
1117CanvasRenderingContext2D.prototype.stroke = function() {};
1118CanvasRenderingContext2D.prototype.strokeRect = function() {};
1119CanvasRenderingContext2D.prototype.strokeText = function() {};
1120CanvasRenderingContext2D.prototype.transform = function() {};
1121CanvasRenderingContext2D.prototype.translate = function() {};
1122
1123var Path2D = {};
1124Path2D.prototype.addPath = function() {};
1125Path2D.prototype.arc = function() {};
1126Path2D.prototype.arcTo = function() {};
1127Path2D.prototype.bezierCurveTo = function() {};
1128Path2D.prototype.closePath = function() {};
1129Path2D.prototype.ellipse = function() {};
1130Path2D.prototype.lineTo = function() {};
1131Path2D.prototype.moveTo = function() {};
1132Path2D.prototype.quadraticCurveTo = function() {};
1133Path2D.prototype.rect = function() {};
1134
1135var LinearCanvasGradient = {};
1136LinearCanvasGradient.prototype.addColorStop = function() {};
1137var RadialCanvasGradient = {};
1138RadialCanvasGradient.prototype.addColorStop = function() {};
1139var CanvasPattern = {};
1140CanvasPattern.prototype.setTransform = function() {};
1141
1142var ImageData = {
1143  /**
1144   * @type {Uint8ClampedArray}
1145   */
1146  data: {},
1147  height: {},
1148  width: {},
1149};
1150
1151var DOMMatrix = {
1152  a: {},
1153  b: {},
1154  c: {},
1155  d: {},
1156  e: {},
1157  f: {},
1158};
1159
1160// Not sure why this is needed - might be a bug in emsdk that this isn't properly declared.
1161function loadWebAssemblyModule() {};
1162
1163// This is a part of emscripten's webgl glue code. Preserving this attribute is necessary
1164// to override it in the puppeteer tests
1165var LibraryEGL = {
1166  contextAttributes: {
1167    majorVersion: {}
1168  }
1169}
1170