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