1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * http://www.whatwg.org/specs/web-apps/current-work/#htmlimageelement
8 * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
9 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
10 * Opera Software ASA. You are granted a license to use, reproduce
11 * and create derivative works of this document.
14 interface imgINotificationObserver;
15 interface imgIRequest;
17 interface nsIStreamListener;
19 [LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height),
21 interface HTMLImageElement : HTMLElement {
22 [HTMLConstructor] constructor();
24 [CEReactions, SetterThrows]
25 attribute DOMString alt;
26 [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows]
27 attribute DOMString src;
28 [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows]
29 attribute DOMString srcset;
30 [CEReactions, SetterThrows]
31 attribute DOMString? crossOrigin;
32 [CEReactions, SetterThrows]
33 attribute DOMString useMap;
34 [CEReactions, SetterThrows]
35 attribute DOMString referrerPolicy;
36 [CEReactions, SetterThrows]
37 attribute boolean isMap;
38 [CEReactions, SetterThrows]
39 attribute unsigned long width;
40 [CEReactions, SetterThrows]
41 attribute unsigned long height;
42 [CEReactions, SetterThrows]
43 attribute DOMString decoding;
44 [CEReactions, SetterThrows, Pref="dom.image-lazy-loading.enabled"]
45 attribute DOMString loading;
46 readonly attribute unsigned long naturalWidth;
47 readonly attribute unsigned long naturalHeight;
48 readonly attribute boolean complete;
50 Promise<undefined> decode();
51 [NewObject, ChromeOnly]
52 Promise<sequence<ImageText>> recognizeCurrentImageText();
55 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
56 partial interface HTMLImageElement {
57 [CEReactions, SetterThrows]
58 attribute DOMString name;
59 [CEReactions, SetterThrows]
60 attribute DOMString align;
61 [CEReactions, SetterThrows]
62 attribute unsigned long hspace;
63 [CEReactions, SetterThrows]
64 attribute unsigned long vspace;
65 [CEReactions, SetterThrows]
66 attribute DOMString longDesc;
68 [CEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString border;
71 // [Update me: not in whatwg spec yet]
72 // http://picture.responsiveimages.org/#the-img-element
73 partial interface HTMLImageElement {
74 [CEReactions, SetterThrows]
75 attribute DOMString sizes;
76 readonly attribute DOMString currentSrc;
79 // Mozilla extensions.
80 partial interface HTMLImageElement {
81 [CEReactions, SetterThrows]
82 attribute DOMString lowsrc;
84 // These attributes are offsets from the closest view (to mimic
85 // NS4's "offset-from-layer" behavior).
86 readonly attribute long x;
87 readonly attribute long y;
90 interface mixin MozImageLoadingContent {
91 // Mirrored chrome-only nsIImageLoadingContent methods. Please make sure
92 // to update this list if nsIImageLoadingContent changes.
94 const long UNKNOWN_REQUEST = -1;
96 const long CURRENT_REQUEST = 0;
98 const long PENDING_REQUEST = 1;
101 attribute boolean loadingEnabled;
103 * Same as addNativeObserver but intended for scripted observers or observers
104 * from another or without a document.
107 undefined addObserver(imgINotificationObserver aObserver);
109 * Same as removeNativeObserver but intended for scripted observers or
110 * observers from another or without a document.
113 undefined removeObserver(imgINotificationObserver aObserver);
115 imgIRequest? getRequest(long aRequestType);
117 long getRequestType(imgIRequest aRequest);
119 readonly attribute URI? currentURI;
120 // Gets the final URI of the current request, if available.
121 // Otherwise, returns null.
123 readonly attribute URI? currentRequestFinalURI;
125 * forceReload forces reloading of the image pointed to by currentURI
127 * @param aNotify request should notify
128 * @throws NS_ERROR_NOT_AVAILABLE if there is no current URI to reload
131 undefined forceReload(optional boolean aNotify = true);
134 HTMLImageElement includes MozImageLoadingContent;