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