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;
18 interface nsIStreamListener;
20 [NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
21 interface HTMLImageElement : HTMLElement {
23 attribute DOMString alt;
25 attribute DOMString src;
26 [SetterThrows, Pref="dom.image.srcset.enabled"]
27 attribute DOMString srcset;
29 attribute DOMString? crossOrigin;
31 attribute DOMString useMap;
33 attribute boolean isMap;
35 attribute unsigned long width;
37 attribute unsigned long height;
38 readonly attribute unsigned long naturalWidth;
39 readonly attribute unsigned long naturalHeight;
40 readonly attribute boolean complete;
43 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
44 partial interface HTMLImageElement {
46 attribute DOMString name;
48 attribute DOMString align;
50 attribute unsigned long hspace;
52 attribute unsigned long vspace;
54 attribute DOMString longDesc;
56 [TreatNullAs=EmptyString,SetterThrows] attribute DOMString border;
59 // [Update me: not in whatwg spec yet]
60 // http://picture.responsiveimages.org/#the-img-element
61 partial interface HTMLImageElement {
62 [SetterThrows, Pref="dom.image.picture.enabled"]
63 attribute DOMString sizes;
64 [Pref="dom.image.srcset.enabled"]
65 readonly attribute DOMString? currentSrc;
68 // Mozilla extensions.
69 partial interface HTMLImageElement {
70 attribute DOMString lowsrc;
72 // These attributes are offsets from the closest view (to mimic
73 // NS4's "offset-from-layer" behavior).
74 readonly attribute long x;
75 readonly attribute long y;
79 interface MozImageLoadingContent {
80 // Mirrored chrome-only nsIImageLoadingContent methods. Please make sure
81 // to update this list if nsIImageLoadingContent changes.
83 const long UNKNOWN_REQUEST = -1;
85 const long CURRENT_REQUEST = 0;
87 const long PENDING_REQUEST = 1;
90 attribute boolean loadingEnabled;
92 readonly attribute short imageBlockingStatus;
94 void addObserver(imgINotificationObserver aObserver);
96 void removeObserver(imgINotificationObserver aObserver);
98 imgIRequest? getRequest(long aRequestType);
100 long getRequestType(imgIRequest aRequest);
102 readonly attribute URI? currentURI;
104 nsIStreamListener? loadImageWithChannel(MozChannel aChannel);
106 void forceReload(optional boolean aNotify);
108 void forceImageState(boolean aForce, unsigned long long aState);
111 HTMLImageElement implements MozImageLoadingContent;