This file is indexed.

/usr/share/idl/firefox/nsIDOMCanvasRenderingContext2D.idl is in firefox-dev 11.0+build1-0ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 *   Vladimir Vukicevic <vladimir@pobox.com>
 * Portions created by the Initial Developer are Copyright (C) 2005
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either of the GNU General Public License Version 2 or later (the "GPL"),
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"
#include "nsIVariant.idl"

interface nsIDOMWindow;
interface nsIDOMElement;
interface nsIDOMHTMLElement;
interface nsIDOMHTMLImageElement;
interface nsIDOMHTMLCanvasElement;
interface nsIDOMXULElement;

[scriptable, uuid(bbb20a59-524e-4662-981e-5e142814b20c)]
interface nsIDOMCanvasGradient : nsISupports
{
  void addColorStop(in float offset, in DOMString color);
};

[scriptable, uuid(21dea65c-5c08-4eb1-ac82-81fe95be77b8)]
interface nsIDOMCanvasPattern : nsISupports
{
};

[scriptable, uuid(2d01715c-ec7d-424a-ab85-e0fd70c8665c)]
interface nsIDOMTextMetrics : nsISupports
{
  readonly attribute float width;
};

[scriptable, uuid(274213a8-df51-4b52-bfad-d306a1d5f642)]
interface nsIDOMCanvasRenderingContext2D : nsISupports
{
  // back-reference to the canvas element for which
  // this context was created
  readonly attribute nsIDOMHTMLCanvasElement canvas;

  // state
  void save();
  void restore();

  // transformations
  void scale(in float x, in float y);
  void rotate(in float angle);
  void translate(in float x, in float y);
  void transform(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy);
  void setTransform(in float m11, in float m12, in float m21, in float m22, in float dx, in float dy);
  [implicit_jscontext]
  attribute jsval mozCurrentTransform; // [ m11, m12, m21, m22, dx, dy ], i.e. row major
  [implicit_jscontext]
  attribute jsval mozCurrentTransformInverse;

  // compositing
  attribute float globalAlpha; /* default 1.0 -- opaque */
  attribute DOMString globalCompositeOperation; /* default "over" */

  // Colors and Styles

  // These attributes work, but are quickstubbed for JS code.  Native
  // code should use the _multi variants below.
  attribute nsIVariant strokeStyle;
  attribute nsIVariant fillStyle;

  // These do the actual work.  Use these from c++ -- only one of str or iface
  // should be specified; the one that's not null/void is used.  For the getter,
  // ifaceType is 0 if it's a string, 1 if it's a pattern, or 2 if it's a gradient
%{C++
enum CanvasMultiGetterType {
      CMG_STYLE_STRING = 0,
      CMG_STYLE_PATTERN = 1,
      CMG_STYLE_GRADIENT = 2
};
%}
  [noscript] void setStrokeStyle_multi(in DOMString str, in nsISupports iface);
  [noscript] void getStrokeStyle_multi(out DOMString str, out nsISupports iface, out long type);
  [noscript] void setFillStyle_multi(in DOMString str, in nsISupports iface);
  [noscript] void getFillStyle_multi(out DOMString str, out nsISupports iface, out long type);

  //attribute DOMString fillRule;
  attribute DOMString mozFillRule; /* "evenodd", "nonzero" (default) */

  nsIDOMCanvasGradient createLinearGradient (in float x0, in float y0, in float x1, in float y1);
  nsIDOMCanvasGradient createRadialGradient(in float x0, in float y0, in float r0, in float x1, in float y1, in float r1);
  nsIDOMCanvasPattern createPattern(in nsIDOMHTMLElement image, in DOMString repetition);
  attribute float lineWidth; /* default 1 */
  attribute DOMString lineCap; /* "butt", "round", "square" (default) */
  attribute DOMString lineJoin; /* "round", "bevel", "miter" (default) */
  attribute float miterLimit; /* default 10 */

  [implicit_jscontext]
  attribute jsval mozDash; /* default |null| */
  attribute float mozDashOffset; /* default 0.0 */

  // shadows
  attribute float shadowOffsetX;
  attribute float shadowOffsetY;
  attribute float shadowBlur;
  attribute DOMString shadowColor;

  // rects
  void clearRect(in float x, in float y, in float w, in float h);
  void fillRect(in float x, in float y, in float w, in float h);
  void strokeRect(in float x, in float y, in float w, in float h);

  // path API
  void beginPath();
  void closePath();

  void moveTo(in float x, in float y);
  void lineTo(in float x, in float y);
  void quadraticCurveTo(in float cpx, in float cpy, in float x, in float y);
  void bezierCurveTo(in float cp1x, in float cp1y, in float cp2x, in float cp2y, in float x, in float y);
  void arcTo(in float x1, in float y1, in float x2, in float y2, in float radius);
  void arc(in float x, in float y, in float r, in float startAngle, in float endAngle, [optional] in boolean anticlockwise);
  void rect(in float x, in float y, in float w, in float h);

  void fill();
  void stroke();
  void clip();

  // text api
  attribute DOMString font; /* default "10px sans-serif" */
  attribute DOMString textAlign; /* "start" (default), "end", "left", "right",
                                 "center" */
  attribute DOMString textBaseline; /* "alphabetic" (default), "top", "hanging",
                                    "middle", "ideographic", "bottom" */

  void fillText(in DOMString text, in float x, in float y, [optional] in float maxWidth);
  void strokeText(in DOMString text, in float x, in float y, [optional] in float maxWidth);
  nsIDOMTextMetrics measureText(in DOMString text);

  attribute DOMString mozTextStyle;

  // image api

  [optional_argc] void drawImage(in nsIDOMElement image,
                                 in float a1, in float a2,
                                 [optional] in float a3,
                                 [optional] in float a4,
                                 [optional] in float a5,
                                 [optional] in float a6,
                                 [optional] in float a7,
                                 [optional] in float a8);

/*
  void drawImage(in HTMLImageElement image, in float dx, in float dy);
  void drawImage(in HTMLImageElement image, in float dx, in float dy, in float sw, in float sh);
  void drawImage(in HTMLImageElement image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
*/

  // point-membership test
  boolean isPointInPath(in float x, in float y);

  // pixel manipulation
  // ImageData getImageData (in float x, in float y, in float width, in float height);
  // void putImageData (in ImageData d, in float x, in float y);
  // ImageData = { width: #, height: #, data: [r, g, b, a, ...] }

  // These are just dummy functions; for JS, they are implemented as quickstubs
  // that call the _explicit methods below.  Native callers should use the _explit
  // methods directly.
  void getImageData();
  void putImageData();

  // dataLen must be == width*height*4 in both of these calls
  [noscript] void getImageData_explicit(in long x, in long y, in unsigned long width, in unsigned long height,
                                        [array, size_is(dataLen)] in octet dataPtr, in unsigned long dataLen);
  [noscript] void putImageData_explicit(in long x, in long y, in unsigned long width, in unsigned long height,
                                        [array, size_is(dataLen)] in octet dataPtr, in unsigned long dataLen, in boolean hasDirtyRect,
                                        in long dirtyX, in long dirtyY, in long dirtyWidth, in long dirtyHeight);

  // ImageData createImageData(in float w, in float h);
  // Note: this is basically script-only (and really, quickstub-only).  Native callers
  // should just use the noscript 'explicit' get/put methods above, instead of using
  // a separate ImageData object.
  void createImageData();

  // image smoothing mode -- if disabled, images won't be smoothed
  // if scaled.
  attribute boolean mozImageSmoothingEnabled;

  // Show the caret if appropriate when drawing
  const unsigned long DRAWWINDOW_DRAW_CARET   = 0x01;
  // Don't flush pending layout notifications that could otherwise
  // be batched up
  const unsigned long DRAWWINDOW_DO_NOT_FLUSH = 0x02;
  // Draw scrollbars and scroll the viewport if they are present
  const unsigned long DRAWWINDOW_DRAW_VIEW    = 0x04;
  // Use the widget layer manager if available. This means hardware
  // acceleration may be used, but it might actually be slower or
  // lower quality than normal. It will however more accurately reflect
  // the pixels rendered to the screen.
  const unsigned long DRAWWINDOW_USE_WIDGET_LAYERS = 0x08;
  // Don't synchronously decode images - draw what we have
  const unsigned long DRAWWINDOW_ASYNC_DECODE_IMAGES = 0x10;

  /**
   * Renders a region of a window into the canvas.  The contents of
   * the window's viewport are rendered, ignoring viewport clipping
   * and scrolling.
   *
   * @param x
   * @param y
   * @param w
   * @param h specify the area of the window to render, in CSS
   * pixels.
   *
   * @param backgroundColor the canvas is filled with this color
   * before we render the window into it. This color may be
   * transparent/translucent. It is given as a CSS color string
   * (e.g., rgb() or rgba()).
   *
   * @param flags Uused to better control the drawWindow call.
   * Flags can be ORed together.
   *
   * Of course, the rendering obeys the current scale, transform and
   * globalAlpha values.
   *
   * Hints:
   * -- If 'rgba(0,0,0,0)' is used for the background color, the
   * drawing will be transparent wherever the window is transparent.
   * -- Top-level browsed documents are usually not transparent
   * because the user's background-color preference is applied,
   * but IFRAMEs are transparent if the page doesn't set a background.
   * -- If an opaque color is used for the background color, rendering
   * will be faster because we won't have to compute the window's
   * transparency.
   *
   * This API cannot currently be used by Web content. It is chrome
   * only.
   */
  void drawWindow(in nsIDOMWindow window, in float x, in float y,
                  in float w, in float h, in DOMString bgColor,
                  [optional] in unsigned long flags);
  void asyncDrawXULElement(in nsIDOMXULElement elem, in float x, in float y,
                  in float w, in float h, in DOMString bgColor,
                  [optional] in unsigned long flags);
};