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;
20 NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
21 interface HTMLImageElement : HTMLElement {
22 [CEReactions, SetterThrows]
23 attribute DOMString alt;
24 [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows]
25 attribute DOMString src;
26 [CEReactions, SetterNeedsSubjectPrincipal=NonSystem, SetterThrows]
27 attribute DOMString srcset;
28 [CEReactions, SetterThrows]
29 attribute DOMString? crossOrigin;
30 [CEReactions, SetterThrows]
31 attribute DOMString useMap;
32 [CEReactions, SetterThrows]
33 attribute DOMString referrerPolicy;
34 [CEReactions, SetterThrows]
35 attribute boolean isMap;
36 [CEReactions, SetterThrows]
37 attribute unsigned long width;
38 [CEReactions, SetterThrows]
39 attribute unsigned long height;
40 [CEReactions, SetterThrows]
41 attribute DOMString decoding;
42 readonly attribute unsigned long naturalWidth;
43 readonly attribute unsigned long naturalHeight;
44 readonly attribute boolean complete;
47 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
48 partial interface HTMLImageElement {
49 [CEReactions, SetterThrows]
50 attribute DOMString name;
51 [CEReactions, SetterThrows]
52 attribute DOMString align;
53 [CEReactions, SetterThrows]
54 attribute unsigned long hspace;
55 [CEReactions, SetterThrows]
56 attribute unsigned long vspace;
57 [CEReactions, SetterThrows]
58 attribute DOMString longDesc;
60 [CEReactions, TreatNullAs=EmptyString,SetterThrows] attribute DOMString border;
63 // [Update me: not in whatwg spec yet]
64 // http://picture.responsiveimages.org/#the-img-element
65 partial interface HTMLImageElement {
66 [CEReactions, SetterThrows]
67 attribute DOMString sizes;
68 readonly attribute DOMString currentSrc;
71 // Mozilla extensions.
72 partial interface HTMLImageElement {
73 [CEReactions, SetterThrows]
74 attribute DOMString lowsrc;
76 // These attributes are offsets from the closest view (to mimic
77 // NS4's "offset-from-layer" behavior).
78 readonly attribute long x;
79 readonly attribute long y;
83 interface MozImageLoadingContent {
84 // Mirrored chrome-only nsIImageLoadingContent methods. Please make sure
85 // to update this list if nsIImageLoadingContent changes.
87 const long UNKNOWN_REQUEST = -1;
89 const long CURRENT_REQUEST = 0;
91 const long PENDING_REQUEST = 1;
94 attribute boolean loadingEnabled;
96 readonly attribute short imageBlockingStatus;
98 * Same as addNativeObserver but intended for scripted observers or observers
99 * from another or without a document.
102 void addObserver(imgINotificationObserver aObserver);
104 * Same as removeNativeObserver but intended for scripted observers or
105 * observers from another or without a document.
108 void removeObserver(imgINotificationObserver aObserver);
110 imgIRequest? getRequest(long aRequestType);
112 long getRequestType(imgIRequest aRequest);
114 readonly attribute URI? currentURI;
115 // Gets the final URI of the current request, if available.
116 // Otherwise, returns null.
118 readonly attribute URI? currentRequestFinalURI;
120 * forceReload forces reloading of the image pointed to by currentURI
122 * @param aNotify request should notify
123 * @throws NS_ERROR_NOT_AVAILABLE if there is no current URI to reload
126 void forceReload(optional boolean aNotify = true);
128 void forceImageState(boolean aForce, unsigned long long aState);
131 HTMLImageElement implements MozImageLoadingContent;