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]
45 attribute DOMString loading;
46 [Pref="network.fetchpriority.enabled", CEReactions]
47 attribute DOMString fetchPriority;
48 readonly attribute unsigned long naturalWidth;
49 readonly attribute unsigned long naturalHeight;
50 readonly attribute boolean complete;
52 Promise<undefined> decode();
53 [NewObject, ChromeOnly]
54 Promise<sequence<ImageText>> recognizeCurrentImageText();
57 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
58 partial interface HTMLImageElement {
59 [CEReactions, SetterThrows]
60 attribute DOMString name;
61 [CEReactions, SetterThrows]
62 attribute DOMString align;
63 [CEReactions, SetterThrows]
64 attribute unsigned long hspace;
65 [CEReactions, SetterThrows]
66 attribute unsigned long vspace;
67 [CEReactions, SetterThrows]
68 attribute DOMString longDesc;
70 [CEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString border;
73 // [Update me: not in whatwg spec yet]
74 // http://picture.responsiveimages.org/#the-img-element
75 partial interface HTMLImageElement {
76 [CEReactions, SetterThrows]
77 attribute DOMString sizes;
78 readonly attribute DOMString currentSrc;
81 // Mozilla extensions.
82 partial interface HTMLImageElement {
83 [CEReactions, SetterThrows]
84 attribute DOMString lowsrc;
86 // These attributes are offsets from the closest view (to mimic
87 // NS4's "offset-from-layer" behavior).
88 readonly attribute long x;
89 readonly attribute long y;
92 interface mixin MozImageLoadingContent {
93 // Mirrored chrome-only nsIImageLoadingContent methods. Please make sure
94 // to update this list if nsIImageLoadingContent changes.
96 const long UNKNOWN_REQUEST = -1;
98 const long CURRENT_REQUEST = 0;
100 const long PENDING_REQUEST = 1;
103 attribute boolean loadingEnabled;
105 * Same as addNativeObserver but intended for scripted observers or observers
106 * from another or without a document.
109 undefined addObserver(imgINotificationObserver aObserver);
111 * Same as removeNativeObserver but intended for scripted observers or
112 * observers from another or without a document.
115 undefined removeObserver(imgINotificationObserver aObserver);
117 imgIRequest? getRequest(long aRequestType);
119 long getRequestType(imgIRequest aRequest);
121 readonly attribute URI? currentURI;
122 // Gets the final URI of the current request, if available.
123 // Otherwise, returns null.
125 readonly attribute URI? currentRequestFinalURI;
127 * forceReload forces reloading of the image pointed to by currentURI
129 * @param aNotify request should notify
130 * @throws NS_ERROR_NOT_AVAILABLE if there is no current URI to reload
133 undefined forceReload(optional boolean aNotify = true);
136 HTMLImageElement includes MozImageLoadingContent;