Bug 1704628 Part 1: Make selectContextMenuItem use .activateItem() semantics. r=ochameau
[gecko.git] / image / imgIContainer.idl
blobf5fb097ee55de1d67267cb956b6486180a20825b
1 /** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 webidl Document;
11 %{C++
12 #include "ImgDrawResult.h"
13 #include "gfxPoint.h"
14 #include "mozilla/gfx/Types.h"
15 #include "mozilla/AspectRatio.h"
16 #include "mozilla/Maybe.h"
17 #include "mozilla/RefPtr.h"
18 #include "nsRect.h"
19 #include "nsSize.h"
20 #include "nsTArray.h"
21 #include "limits.h"
23 class gfxContext;
25 namespace mozilla {
26 struct AspectRatio;
28 namespace gfx {
29 class SourceSurface;
32 namespace layers {
33 class LayerManager;
34 class ImageContainer;
38 class nsIFrame;
40 namespace mozilla {
41 class TimeStamp;
42 class SVGImageContext;
43 struct MediaFeatureChange;
46 namespace mozilla {
47 namespace image {
49 class ImageRegion;
50 struct Orientation;
57 native MaybeAspectRatio(mozilla::Maybe<mozilla::AspectRatio>);
58 native ImgDrawResult(mozilla::image::ImgDrawResult);
59 [ptr] native gfxContext(gfxContext);
60 [ref] native gfxMatrix(gfxMatrix);
61 [ref] native gfxRect(gfxRect);
62 [ref] native gfxSize(gfxSize);
63 native SamplingFilter(mozilla::gfx::SamplingFilter);
64 [ref] native nsIntRect(nsIntRect);
65 native nsIntRectByVal(nsIntRect);
66 [ref] native nsIntSize(nsIntSize);
67 native nsSize(nsSize);
68 [ptr] native nsIFrame(nsIFrame);
69 native TempRefImageContainer(already_AddRefed<mozilla::layers::ImageContainer>);
70 [ptr] native ImageContainer(mozilla::layers::ImageContainer);
71 [ref] native ImageRegion(mozilla::image::ImageRegion);
72 [ptr] native LayerManager(mozilla::layers::LayerManager);
73 native Orientation(mozilla::image::Orientation);
74 [ref] native TimeStamp(mozilla::TimeStamp);
75 [ref] native MaybeSVGImageContext(mozilla::Maybe<mozilla::SVGImageContext>);
76 native TempRefSourceSurface(already_AddRefed<mozilla::gfx::SourceSurface>);
77 native TempRefImgIContainer(already_AddRefed<imgIContainer>);
78 native nsIntSizeByVal(nsIntSize);
81 /**
82 * imgIContainer is the interface that represents an image. It allows
83 * access to frames as Thebes surfaces. It also allows drawing of images
84 * onto Thebes contexts.
86 * Internally, imgIContainer also manages animation of images.
88 [scriptable, builtinclass, uuid(a8dbee24-ff86-4755-b40e-51175caf31af)]
89 interface imgIContainer : nsISupports
91 /**
92 * The width of the container rectangle. In the case of any error,
93 * zero is returned, and an exception will be thrown.
95 readonly attribute int32_t width;
97 /**
98 * The height of the container rectangle. In the case of any error,
99 * zero is returned, and an exception will be thrown.
101 readonly attribute int32_t height;
104 * The intrinsic size of this image in appunits. If the image has no intrinsic
105 * size in a dimension, -1 will be returned for that dimension. In the case of
106 * any error, an exception will be thrown.
108 [noscript] readonly attribute nsSize intrinsicSize;
111 * The (dimensionless) intrinsic ratio of this image. In the case of any
112 * error, Nothing() will be returned.
114 [notxpcom, nostdcall] readonly attribute MaybeAspectRatio intrinsicRatio;
117 * The x coordinate of the image's hotspot, or 0 if there is no hotspot.
119 readonly attribute int32_t hotspotX;
122 * The y coordinate of the image's hotspot, or 0 if there is no hotspot.
124 readonly attribute int32_t hotspotY;
127 * Given a size at which this image will be displayed, and the drawing
128 * parameters affecting how it will be drawn, returns the image size which
129 * should be used to draw to produce the highest quality result. This is the
130 * appropriate size, for example, to use as an input to the pixel snapping
131 * algorithm.
133 * For best results the size returned by this method should not be cached. It
134 * can change over time due to changes in the internal state of the image.
136 * @param aDest The size of the destination rect into which this image will be
137 * drawn, in device pixels.
138 * @param aWhichFrame Frame specifier of the FRAME_* variety.
139 * @param aSamplingFilter The filter to be used if we're scaling the image.
140 * @param aFlags Flags of the FLAG_* variety
142 [notxpcom, nostdcall] nsIntSizeByVal
143 optimalImageSizeForDest([const] in gfxSize aDest, in uint32_t aWhichFrame,
144 in SamplingFilter aSamplingFilter, in uint32_t aFlags);
147 * Enumerated values for the 'type' attribute (below).
149 const unsigned short TYPE_RASTER = 0;
150 const unsigned short TYPE_VECTOR = 1;
151 const unsigned short TYPE_REQUEST = 2;
154 * The type of this image (one of the TYPE_* values above).
156 [infallible] readonly attribute unsigned short type;
159 * Whether this image is animated. You can only be guaranteed that querying
160 * this will not throw if STATUS_DECODE_COMPLETE is set on the imgIRequest.
162 * @throws NS_ERROR_NOT_AVAILABLE if the animated state cannot be determined.
164 readonly attribute boolean animated;
167 * Producer ID for image containers created by this image.
169 [infallible] readonly attribute unsigned long producerId;
172 * Flags for imgIContainer operations.
174 * Meanings:
176 * FLAG_NONE: Lack of flags.
178 * FLAG_SYNC_DECODE: Forces synchronous/non-progressive decode of all
179 * available data before the call returns.
181 * FLAG_SYNC_DECODE_IF_FAST: Like FLAG_SYNC_DECODE, but requests a sync decode
182 * be performed only if ImageLib estimates it can be completed very quickly.
184 * FLAG_ASYNC_NOTIFY: Send notifications asynchronously, even if we decode
185 * synchronously because of FLAG_SYNC_DECODE or FLAG_SYNC_DECODE_IF_FAST.
187 * FLAG_DECODE_NO_PREMULTIPLY_ALPHA: Do not premultiply alpha if
188 * it's not already premultiplied in the image data.
190 * FLAG_DECODE_NO_COLORSPACE_CONVERSION: Do not do any colorspace conversion;
191 * ignore any embedded profiles, and don't convert to any particular
192 * destination space.
194 * FLAG_CLAMP: Extend the image to the fill area by clamping image sample
195 * coordinates instead of by tiling. This only affects 'draw'.
197 * FLAG_HIGH_QUALITY_SCALING: A hint as to whether this image should be
198 * scaled using the high quality scaler. Do not set this if not drawing to
199 * a window or not listening to invalidations. Passing this flag will do two
200 * things: 1) request a decode of the image at the size asked for by the
201 * caller if one isn't already started or complete, and 2) allows a decoded
202 * frame of any size (it could be neither the requested size, nor the
203 * intrinsic size) to be substituted.
205 * FLAG_WANT_DATA_SURFACE: Can be passed to GetFrame when the caller wants a
206 * DataSourceSurface instead of a hardware accelerated surface. This can be
207 * important for performance (by avoiding an upload to/readback from the GPU)
208 * when the caller knows they want a SourceSurface of type DATA.
210 * FLAG_BYPASS_SURFACE_CACHE: Forces drawing to happen rather than taking
211 * cached rendering from the surface cache. This is used when we are printing,
212 * for example, where we want the vector commands from VectorImages to end up
213 * in the PDF output rather than a cached rendering at screen resolution.
215 * FLAG_FORCE_PRESERVEASPECTRATIO_NONE: Force scaling this image
216 * non-uniformly if necessary. This flag is for vector image only. A raster
217 * image should ignore this flag. While drawing a vector image with this
218 * flag, do not force uniform scaling even if its root <svg> node has a
219 * preserveAspectRatio attribute that would otherwise require uniform
220 * scaling , such as xMinYMin/ xMidYMin. Always scale the graphic content of
221 * the given image non-uniformly if necessary such that the image's
222 * viewBox (if specified or implied by height/width attributes) exactly
223 * matches the viewport rectangle.
225 * FLAG_FORCE_UNIFORM_SCALING: Signal to ClippedImage::OptimalSizeForDest that
226 * its returned size can only scale the image's size *uniformly* (by the same
227 * factor in each dimension). We need this flag when painting border-image
228 * section with SVG image source-data, if the SVG image has no viewBox and no
229 * intrinsic size. In such a case, we synthesize a viewport for the SVG image
230 * (a "window into SVG space") based on the border image area, and we need to
231 * be sure we don't subsequently scale that viewport in a way that distorts
232 * its contents by stretching them more in one dimension than the other.
234 * FLAG_AVOID_REDECODE_FOR_SIZE: If there is already a raster surface
235 * available for this image, but it is not the same size as requested, skip
236 * starting a new decode for said size.
238 * FLAG_DECODE_TO_SRGB_COLORSPACE: Instead of converting the colorspace to
239 * the display's colorspace, use sRGB.
241 const unsigned long FLAG_NONE = 0x0;
242 const unsigned long FLAG_SYNC_DECODE = 0x1;
243 const unsigned long FLAG_SYNC_DECODE_IF_FAST = 0x2;
244 const unsigned long FLAG_ASYNC_NOTIFY = 0x4;
245 const unsigned long FLAG_DECODE_NO_PREMULTIPLY_ALPHA = 0x8;
246 const unsigned long FLAG_DECODE_NO_COLORSPACE_CONVERSION = 0x10;
247 const unsigned long FLAG_CLAMP = 0x20;
248 const unsigned long FLAG_HIGH_QUALITY_SCALING = 0x40;
249 const unsigned long FLAG_WANT_DATA_SURFACE = 0x80;
250 const unsigned long FLAG_BYPASS_SURFACE_CACHE = 0x100;
251 const unsigned long FLAG_FORCE_PRESERVEASPECTRATIO_NONE = 0x200;
252 const unsigned long FLAG_FORCE_UNIFORM_SCALING = 0x400;
253 const unsigned long FLAG_AVOID_REDECODE_FOR_SIZE = 0x800;
254 const unsigned long FLAG_DECODE_TO_SRGB_COLORSPACE = 0x1000;
257 * A constant specifying the default set of decode flags (i.e., the default
258 * values for FLAG_DECODE_*).
260 const unsigned long DECODE_FLAGS_DEFAULT = 0;
263 * A constant specifying the decode flags recommended to be used when
264 * re-encoding an image, or with the clipboard.
266 const unsigned long DECODE_FLAGS_FOR_REENCODE =
267 FLAG_DECODE_NO_PREMULTIPLY_ALPHA | FLAG_DECODE_TO_SRGB_COLORSPACE;
270 * Constants for specifying various "special" frames.
272 * FRAME_FIRST: The first frame
273 * FRAME_CURRENT: The current frame
275 * FRAME_MAX_VALUE should be set to the value of the maximum constant above,
276 * as it is used for ensuring that a valid value was passed in.
278 const unsigned long FRAME_FIRST = 0;
279 const unsigned long FRAME_CURRENT = 1;
280 const unsigned long FRAME_MAX_VALUE = 1;
283 * Get a surface for the given frame. This may be a platform-native,
284 * optimized surface, so you cannot inspect its pixel data. If you
285 * need that, use SourceSurface::GetDataSurface.
287 * @param aWhichFrame Frame specifier of the FRAME_* variety.
288 * @param aFlags Flags of the FLAG_* variety
290 [noscript, notxpcom] TempRefSourceSurface getFrame(in uint32_t aWhichFrame,
291 in uint32_t aFlags);
294 * Get a surface for the given frame at the specified size. Matching the
295 * requested size is best effort; it's not guaranteed that the surface you get
296 * will be a perfect match. (Some reasons you may get a surface of a different
297 * size include: if you requested upscaling, if downscale-during-decode is
298 * disabled, or if you didn't request the first frame.)
300 * @param aSize The desired size.
301 * @param aWhichFrame Frame specifier of the FRAME_* variety.
302 * @param aFlags Flags of the FLAG_* variety
304 [noscript, notxpcom] TempRefSourceSurface getFrameAtSize([const] in nsIntSize aSize,
305 in uint32_t aWhichFrame,
306 in uint32_t aFlags);
309 * Returns true if this image will draw opaquely right now if asked to draw
310 * with FLAG_HIGH_QUALITY_SCALING and otherwise default flags. If this image
311 * (when decoded) is opaque but no decoded frames are available then
312 * willDrawOpaqueNow will return false.
314 [noscript, notxpcom] boolean willDrawOpaqueNow();
317 * @return true if getImageContainer() is expected to return a valid
318 * ImageContainer when passed the given @Manager and @Flags
319 * parameters.
321 [noscript, notxpcom] boolean isImageContainerAvailable(in LayerManager aManager,
322 in uint32_t aFlags);
324 * Attempts to create an ImageContainer (and Image) containing the current
325 * frame at its native size.
327 * Avoid calling this unless you're actually going to layerize this image.
329 * @param aManager The LayerManager which will be used to create the
330 * ImageContainer.
331 * @param aFlags Decoding / drawing flags (in other words, FLAG_* flags).
332 * Currently only FLAG_SYNC_DECODE and FLAG_SYNC_DECODE_IF_FAST
333 * are supported.
334 * @return An ImageContainer for the current frame, or nullptr if one could
335 * not be created.
337 [noscript, notxpcom] TempRefImageContainer getImageContainer(in LayerManager aManager,
338 in uint32_t aFlags);
341 * Attempts to create an ImageContainer (and Image) containing the current
342 * frame at the given size. Match the requested size is best effort; it's
343 * not guaranteed that the surface you get will be a perfect match. (Some
344 * reasons you may get a surface of a different size include: if you
345 * requested upscaling, or if downscale-during-decode is disabled.)
347 * Avoid calling this unless you're actually going to layerize this image.
349 * @param aManager The LayerManager which will be used to create the
350 * ImageContainer.
351 * @param aSVGContext If specified, SVG-related rendering context, such as
352 * overridden attributes on the image document's root <svg>
353 * node, and the size of the viewport that the full image
354 * would occupy. Ignored for raster images.
355 * @param aFlags Decoding / drawing flags (in other words, FLAG_* flags).
356 * Currently only FLAG_SYNC_DECODE and FLAG_SYNC_DECODE_IF_FAST
357 * are supported.
358 * @param aContainer Return value for ImageContainer for the current frame.
359 * May be null depending on the draw result.
360 * @return The draw result for the current frame.
362 [noscript, notxpcom] ImgDrawResult getImageContainerAtSize(in LayerManager aManager,
363 [const] in nsIntSize aSize,
364 [const] in MaybeSVGImageContext aSVGContext,
365 in uint32_t aFlags,
366 out ImageContainer aOutContainer);
369 * @return true if getImageContainer() is expected to return a valid
370 * ImageContainer when passed the given @Manager, @Size and @Flags
371 * parameters.
373 [noscript, notxpcom] boolean isImageContainerAvailableAtSize(in LayerManager aManager,
374 [const] in nsIntSize aSize,
375 in uint32_t aFlags);
378 * Draw the requested frame of this image onto the context specified.
380 * Drawing an image involves scaling it to a certain size (which may be
381 * implemented as a "smart" scale by substituting an HQ-scaled frame or
382 * rendering at a high DPI), and then selecting a region of that image to
383 * draw. That region is drawn onto the graphics context and in the process
384 * transformed by the context matrix, which determines the final area that is
385 * filled. The basic process looks like this:
387 * +------------------+
388 * | Image |
389 * | |
390 * | intrinsic width |
391 * | X |
392 * | intrinsic height |
393 * +------------------+
394 * / \
395 * / \
396 * / (scale to aSize) \
397 * / \
398 * +----------------------------+
399 * | |
400 * | Scaled Image |
401 * | aSize.width X aSize.height |
402 * | |
403 * | +---------+ |
404 * | | aRegion | |
405 * | +---------+ |
406 * +-------(---------(----------+
407 * | |
408 * / \
409 * | (transform |
410 * / by aContext \
411 * | matrix) |
412 * / \
413 * +---------------------+
414 * | |
415 * | Fill Rect |
416 * | |
417 * +---------------------+
419 * The region may extend outside of the scaled image's boundaries. It's
420 * actually a region in tiled image space, which is formed by tiling the
421 * scaled image infinitely in every direction. Drawing with a region larger
422 * than the scaled image thus causes the filled area to contain multiple tiled
423 * copies of the image, which looks like this:
425 * ....................................................
426 * : : : :
427 * : Tile : Tile : Tile :
428 * : +------------[aRegion]------------+ :
429 * :........|.......:................:........|.......:
430 * : | : : | :
431 * : Ti|le : Scaled Image : Ti|le :
432 * : | : : | :
433 * :........|.......:................:........|.......:
434 * : +---------------------------------+ :
435 * : Ti|le : Tile : Ti|le :
436 * : / : : \ :
437 * :......(.........:................:..........).....:
438 * | |
439 * / \
440 * | (transform by aContext matrix) |
441 * / \
442 * +---------------------------------------------+
443 * | : : |
444 * |.....:.................................:.....|
445 * | : : |
446 * | : Tiled Fill : |
447 * | : : |
448 * |.....:.................................:.....|
449 * | : : |
450 * +---------------------------------------------+
453 * @param aContext The Thebes context to draw the image to.
454 * @param aSize The size to which the image should be scaled before drawing.
455 * This requirement may be satisfied using HQ scaled frames,
456 * selecting from different resolution layers, drawing at a
457 * higher DPI, or just performing additional scaling on the
458 * graphics context. Callers can use optimalImageSizeForDest()
459 * to determine the best choice for this parameter if they have
460 * no special size requirements.
461 * @param aRegion The region in tiled image space which will be drawn onto the
462 * graphics context. aRegion is in the coordinate space of the
463 * image after it has been scaled to aSize - that is, the image
464 * is scaled first, and then aRegion is applied. When aFlags
465 * includes FLAG_CLAMP, the image will be extended to this area
466 * by clamping image sample coordinates. Otherwise, the image
467 * will be automatically tiled as necessary. aRegion can also
468 * optionally contain a second region which restricts the set
469 * of pixels we're allowed to sample from when drawing; this
470 * is only of use to callers which need to draw with pixel
471 * snapping.
472 * @param aWhichFrame Frame specifier of the FRAME_* variety.
473 * @param aSamplingFilter The filter to be used if we're scaling the image.
474 * @param aSVGContext If specified, SVG-related rendering context, such as
475 * overridden attributes on the image document's root <svg>
476 * node, and the size of the viewport that the full image
477 * would occupy. Ignored for raster images.
478 * @param aFlags Flags of the FLAG_* variety
479 * @return A ImgDrawResult value indicating whether and to what degree the
480 * drawing operation was successful.
482 [noscript, notxpcom] ImgDrawResult
483 draw(in gfxContext aContext,
484 [const] in nsIntSize aSize,
485 [const] in ImageRegion aRegion,
486 in uint32_t aWhichFrame,
487 in SamplingFilter aSamplingFilter,
488 [const] in MaybeSVGImageContext aSVGContext,
489 in uint32_t aFlags,
490 in float aOpacity);
493 * Ensures that an image is decoding. Calling this function guarantees that
494 * the image will at some point fire off decode notifications. Images that
495 * can be decoded "quickly" according to some heuristic will be decoded
496 * synchronously.
498 * @param aFlags Flags of the FLAG_* variety. Only FLAG_ASYNC_NOTIFY
499 * is accepted; all others are ignored.
500 * @param aWhichFrame Frame specifier of the FRAME_* variety.
502 [noscript] void startDecoding(in uint32_t aFlags, in uint32_t aWhichFrame);
504 %{C++
505 nsresult StartDecoding(uint32_t aFlags) {
506 return StartDecoding(aFlags, FRAME_CURRENT);
511 * Exactly like startDecoding above except returns whether the current frame
512 * of the image is complete or not.
514 * @param aFlags Flags of the FLAG_* variety. Only FLAG_ASYNC_NOTIFY
515 * is accepted; all others are ignored.
516 * @param aWhichFrame Frame specifier of the FRAME_* variety.
518 [noscript, notxpcom] boolean startDecodingWithResult(in uint32_t aFlags, in uint32_t aWhichFrame);
520 %{C++
521 bool StartDecodingWithResult(uint32_t aFlags) {
522 return StartDecodingWithResult(aFlags, FRAME_CURRENT);
527 * This method triggers decoding for an image, but unlike startDecoding() it
528 * enables the caller to provide more detailed information about the decode
529 * request.
531 * @param aFlags Flags of the FLAG_* variety.
532 * @param aWhichFrame Frame specifier of the FRAME_* variety.
533 * @return DECODE_SURFACE_AVAILABLE if is a surface that satisfies the
534 * request and it is fully decoded.
535 * DECODE_REQUESTED if we requested a decode.
536 * DECODE_REQUEST_FAILED if we failed to request a decode. This means
537 * that either there is an error in the image or we cannot allocate a
538 * surface that big.
540 cenum DecodeResult : 8 {
541 DECODE_SURFACE_AVAILABLE = 0,
542 DECODE_REQUESTED = 1,
543 DECODE_REQUEST_FAILED = 2
545 [noscript, notxpcom] imgIContainer_DecodeResult requestDecodeWithResult(in uint32_t aFlags, in uint32_t aWhichFrame);
547 %{C++
548 DecodeResult RequestDecodeWithResult(uint32_t aFlags) {
549 return RequestDecodeWithResult(aFlags, FRAME_CURRENT);
554 * This method triggers decoding for an image, but unlike startDecoding() it
555 * enables the caller to provide more detailed information about the decode
556 * request.
558 * @param aSize The size to which the image should be scaled while decoding,
559 * if possible. If the image cannot be scaled to this size while
560 * being decoded, it will be decoded at its intrinsic size.
561 * @param aFlags Flags of the FLAG_* variety.
562 * @param aWhichFrame Frame specifier of the FRAME_* variety.
564 [noscript] void requestDecodeForSize([const] in nsIntSize aSize,
565 in uint32_t aFlags,
566 in uint32_t aWhichFrame);
568 %{C++
569 nsresult RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags) {
570 return RequestDecodeForSize(aSize, aFlags, FRAME_CURRENT);
575 * Increments the lock count on the image. An image will not be discarded
576 * as long as the lock count is nonzero. Note that it is still possible for
577 * the image to be undecoded if decode-on-draw is enabled and the image
578 * was never drawn.
580 * Upon instantiation images have a lock count of zero.
582 void lockImage();
585 * Decreases the lock count on the image. If the lock count drops to zero,
586 * the image is allowed to discard its frame data to save memory.
588 * Upon instantiation images have a lock count of zero. It is an error to
589 * call this method without first having made a matching lockImage() call.
590 * In other words, the lock count is not allowed to be negative.
592 void unlockImage();
595 * If this image is unlocked, discard its decoded data. If the image is
596 * locked or has already been discarded, do nothing.
598 void requestDiscard();
601 * Indicates that this imgIContainer has been triggered to update
602 * its internal animation state. Likely this should only be called
603 * from within nsImageFrame or objects of similar type.
605 [notxpcom] void requestRefresh([const] in TimeStamp aTime);
608 * Animation mode Constants
609 * 0 = normal
610 * 1 = don't animate
611 * 2 = loop once
613 const short kNormalAnimMode = 0;
614 const short kDontAnimMode = 1;
615 const short kLoopOnceAnimMode = 2;
617 attribute unsigned short animationMode;
619 /* Methods to control animation */
620 void resetAnimation();
623 * Returns an index for the requested animation frame (either FRAME_FIRST or
624 * FRAME_CURRENT).
626 * The units of the index aren't specified, and may vary between different
627 * types of images. What you can rely on is that on all occasions when
628 * getFrameIndex(FRAME_CURRENT) returns a certain value,
629 * draw(..FRAME_CURRENT..) will draw the same frame. The same holds for
630 * FRAME_FIRST as well.
632 * @param aWhichFrame Frame specifier of the FRAME_* variety.
634 [notxpcom] float getFrameIndex(in uint32_t aWhichFrame);
637 * Returns the inherent orientation of the image, as described in the image's
638 * metadata (e.g. EXIF).
640 [notxpcom] Orientation getOrientation();
643 * Returns the delay, in ms, between the first and second frame. If this
644 * returns 0, there is no delay between first and second frame (i.e., this
645 * image could render differently whenever it draws).
647 * If this image is not animated, or not known to be animated (see attribute
648 * animated), returns -1.
650 [notxpcom] int32_t getFirstFrameDelay();
653 * If this is an animated image that hasn't started animating already, this
654 * sets the animation's start time to the indicated time.
656 * This has no effect if the image isn't animated or it has started animating
657 * already; it also has no effect if the image format doesn't care about
658 * animation start time.
660 * In all cases, animation does not actually begin until startAnimation(),
661 * resetAnimation(), or requestRefresh() is called for the first time.
663 [notxpcom] void setAnimationStartTime([const] in TimeStamp aTime);
666 * Given an invalidation rect in the coordinate system used by the decoder,
667 * returns an invalidation rect in image space.
669 * This is the identity transformation in most cases, but the result can
670 * differ if the image is wrapped by an ImageWrapper that changes its size
671 * or orientation.
673 [notxpcom] nsIntRectByVal
674 getImageSpaceInvalidationRect([const] in nsIntRect aRect);
677 * Removes any ImageWrappers and returns the unwrapped base image.
679 [notxpcom, nostdcall] TempRefImgIContainer unwrap();
682 * Propagate the use counters (if any) from this container to the passed in
683 * document.
685 [noscript, notxpcom] void propagateUseCounters(in Document aReferencingDocument);
687 %{C++
689 * Called when media feature values that apply to all documents (such as
690 * those based on system metrics) have changed. If this image is a type
691 * that can respond to media queries (i.e., an SVG image), this function
692 * is overridden to handle restyling and invalidating the image.
694 virtual void MediaFeatureValuesChangedAllDocuments(const mozilla::MediaFeatureChange& aChange) {}
697 * Get the set of sizes the image can decode to natively.
699 virtual nsresult GetNativeSizes(nsTArray<nsIntSize>& aNativeSizes) const = 0;
701 virtual size_t GetNativeSizesLength() const = 0;