HTMLImageElement.webidl (4995B)
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/. 5 * 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. 12 */ 13 14 interface imgINotificationObserver; 15 interface imgIRequest; 16 interface URI; 17 interface nsIStreamListener; 18 19 [LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height), 20 Exposed=Window] 21 interface HTMLImageElement : HTMLElement { 22 [HTMLConstructor] constructor(); 23 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; 51 [NewObject] 52 Promise<undefined> decode(); 53 [NewObject, ChromeOnly] 54 Promise<sequence<ImageText>> recognizeCurrentImageText(); 55 }; 56 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; 69 70 [CEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString border; 71 }; 72 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; 79 }; 80 81 // Mozilla extensions. 82 partial interface HTMLImageElement { 83 [CEReactions, SetterThrows] 84 attribute DOMString lowsrc; 85 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; 90 }; 91 92 interface mixin MozImageLoadingContent { 93 // Mirrored chrome-only nsIImageLoadingContent methods. Please make sure 94 // to update this list if nsIImageLoadingContent changes. 95 [ChromeOnly] 96 const long UNKNOWN_REQUEST = -1; 97 [ChromeOnly] 98 const long CURRENT_REQUEST = 0; 99 [ChromeOnly] 100 const long PENDING_REQUEST = 1; 101 102 [ChromeOnly] 103 attribute boolean loadingEnabled; 104 /** 105 * Same as addNativeObserver but intended for scripted observers or observers 106 * from another or without a document. 107 */ 108 [ChromeOnly] 109 undefined addObserver(imgINotificationObserver aObserver); 110 /** 111 * Same as removeNativeObserver but intended for scripted observers or 112 * observers from another or without a document. 113 */ 114 [ChromeOnly] 115 undefined removeObserver(imgINotificationObserver aObserver); 116 [ChromeOnly,Throws] 117 imgIRequest? getRequest(long aRequestType); 118 [ChromeOnly,Throws] 119 long getRequestType(imgIRequest aRequest); 120 [ChromeOnly] 121 readonly attribute URI? currentURI; 122 // Gets the final URI of the current request, if available. 123 // Otherwise, returns null. 124 [ChromeOnly] 125 readonly attribute URI? currentRequestFinalURI; 126 /** 127 * forceReload forces reloading of the image pointed to by currentURI 128 * 129 * @param aNotify request should notify 130 * @throws NS_ERROR_NOT_AVAILABLE if there is no current URI to reload 131 */ 132 [ChromeOnly,Throws] 133 undefined forceReload(optional boolean aNotify = true); 134 }; 135 136 HTMLImageElement includes MozImageLoadingContent;