1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/public/nsIFrameLoader.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,314 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsFrameLoader; 1.12 +interface nsIDocShell; 1.13 +interface nsIURI; 1.14 +interface nsIFrame; 1.15 +interface nsSubDocumentFrame; 1.16 +interface nsIMessageSender; 1.17 +interface nsIVariant; 1.18 +interface nsIDOMElement; 1.19 +interface nsITabParent; 1.20 +interface nsILoadContext; 1.21 + 1.22 +typedef unsigned long long nsContentViewId; 1.23 + 1.24 +/** 1.25 + * These interfaces do *not* scroll or scale the content document; 1.26 + * instead they set a "goal" scroll/scale wrt the current content 1.27 + * view. When the content document is painted, the scroll* 1.28 + * attributes are used to set a compensating transform. If the 1.29 + * metrics of the content document's current pixels don't match the 1.30 + * view config, the transform matrix may need to translate 1.31 + * content pixels and/or perform a "fuzzy-scale" that doesn't 1.32 + * re-rasterize fonts or intelligently resample images. 1.33 + * 1.34 + * The attrs are allowed to transform content pixels in 1.35 + * such a way that the <browser>'s visible rect encloses pixels that 1.36 + * the content document does not (yet) define. 1.37 + * 1.38 + * The view scroll values are in units of chrome-document CSS 1.39 + * pixels. 1.40 + * 1.41 + * These APIs are designed to be used with nsIDOMWindowUtils 1.42 + * setDisplayPort() and setResolution(). 1.43 + */ 1.44 +[scriptable, uuid(c04c5c40-fa2a-4e9c-94f5-b362a10a86cb)] 1.45 +interface nsIContentView : nsISupports 1.46 +{ 1.47 + /** 1.48 + * Scroll view to or by the given chrome-document CSS pixels. 1.49 + * Fails if the view is no longer valid. 1.50 + */ 1.51 + void scrollTo(in float xPx, in float yPx); 1.52 + void scrollBy(in float dxPx, in float dyPx); 1.53 + 1.54 + void setScale(in float xScale, in float yScale); 1.55 + 1.56 + /** 1.57 + * Scroll offset in chrome-document CSS pixels. 1.58 + * 1.59 + * When this view is active (i.e. it is being painted because it's in the 1.60 + * visible region of the screen), this value is at first lined up with the 1.61 + * content's scroll offset. 1.62 + * 1.63 + * Note that when this view becomes inactive, the new content view will have 1.64 + * scroll values that are reset to the default! 1.65 + */ 1.66 + readonly attribute float scrollX; 1.67 + readonly attribute float scrollY; 1.68 + 1.69 + /** 1.70 + * Dimensions of the viewport in chrome-document CSS pixels. 1.71 + */ 1.72 + readonly attribute float viewportWidth; 1.73 + readonly attribute float viewportHeight; 1.74 + 1.75 + /** 1.76 + * Dimensions of scrolled content in chrome-document CSS pixels. 1.77 + */ 1.78 + readonly attribute float contentWidth; 1.79 + readonly attribute float contentHeight; 1.80 + 1.81 + /** 1.82 + * ID that can be used in conjunction with nsIDOMWindowUtils to change 1.83 + * the actual document, instead of just how it is transformed. 1.84 + */ 1.85 + readonly attribute nsContentViewId id; 1.86 +}; 1.87 + 1.88 +[scriptable, uuid(ba5af90d-ece5-40b2-9a1d-a0154128db1c)] 1.89 +interface nsIContentViewManager : nsISupports 1.90 +{ 1.91 + /** 1.92 + * Retrieve view scrolling/scaling interfaces in a given area, 1.93 + * used to support asynchronous re-paints of content pixels. 1.94 + * These interfaces are only meaningful for <browser>. 1.95 + * 1.96 + * Pixels are in chrome device pixels and are relative to the browser 1.97 + * element. 1.98 + * 1.99 + * @param aX x coordinate that will be in target rectangle 1.100 + * @param aY y coordinate that will be in target rectangle 1.101 + * @param aTopSize How much to expand up the rectangle 1.102 + * @param aRightSize How much to expand right the rectangle 1.103 + * @param aBottomSize How much to expand down the rectangle 1.104 + * @param aLeftSize How much to expand left the rectangle 1.105 + */ 1.106 + void getContentViewsIn(in float aXPx, in float aYPx, 1.107 + in float aTopSize, in float aRightSize, 1.108 + in float aBottomSize, in float aLeftSize, 1.109 + [optional] out unsigned long aLength, 1.110 + [retval, array, size_is(aLength)] out nsIContentView aResult); 1.111 + 1.112 + /** 1.113 + * The root content view. 1.114 + */ 1.115 + readonly attribute nsIContentView rootContentView; 1.116 +}; 1.117 + 1.118 +[scriptable, builtinclass, uuid(a5cefcc8-551b-4901-83f3-7436b09ecaba)] 1.119 +interface nsIFrameLoader : nsISupports 1.120 +{ 1.121 + /** 1.122 + * Get the docshell from the frame loader. 1.123 + */ 1.124 + readonly attribute nsIDocShell docShell; 1.125 + 1.126 + /** 1.127 + * Get this frame loader's TabParent, if it has a remote frame. Otherwise, 1.128 + * returns null. 1.129 + */ 1.130 + readonly attribute nsITabParent tabParent; 1.131 + 1.132 + /** 1.133 + * Get an nsILoadContext for the top-level docshell. For remote 1.134 + * frames, a shim is returned that contains private browsing and app 1.135 + * information. 1.136 + */ 1.137 + readonly attribute nsILoadContext loadContext; 1.138 + 1.139 + /** 1.140 + * Start loading the frame. This method figures out what to load 1.141 + * from the owner content in the frame loader. 1.142 + */ 1.143 + void loadFrame(); 1.144 + 1.145 + /** 1.146 + * Loads the specified URI in this frame. Behaves identically to loadFrame, 1.147 + * except that this method allows specifying the URI to load. 1.148 + */ 1.149 + void loadURI(in nsIURI aURI); 1.150 + 1.151 + /** 1.152 + * Destroy the frame loader and everything inside it. This will 1.153 + * clear the weak owner content reference. 1.154 + */ 1.155 + void destroy(); 1.156 + 1.157 + /** 1.158 + * Find out whether the loader's frame is at too great a depth in 1.159 + * the frame tree. This can be used to decide what operations may 1.160 + * or may not be allowed on the loader's docshell. 1.161 + */ 1.162 + readonly attribute boolean depthTooGreat; 1.163 + 1.164 + /** 1.165 + * Updates the position and size of the subdocument loaded by this frameloader. 1.166 + * 1.167 + * @param aIFrame The nsIFrame for the content node that owns this frameloader 1.168 + */ 1.169 + [noscript] void updatePositionAndSize(in nsSubDocumentFrame aIFrame); 1.170 + 1.171 + /** 1.172 + * Activate remote frame. 1.173 + * Throws an exception with non-remote frames. 1.174 + */ 1.175 + void activateRemoteFrame(); 1.176 + 1.177 + /** 1.178 + * Deactivate remote frame. 1.179 + * Throws an exception with non-remote frames. 1.180 + */ 1.181 + void deactivateRemoteFrame(); 1.182 + 1.183 + /** 1.184 + * @see nsIDOMWindowUtils sendMouseEvent. 1.185 + */ 1.186 + void sendCrossProcessMouseEvent(in AString aType, 1.187 + in float aX, 1.188 + in float aY, 1.189 + in long aButton, 1.190 + in long aClickCount, 1.191 + in long aModifiers, 1.192 + [optional] in boolean aIgnoreRootScrollFrame); 1.193 + 1.194 + /** 1.195 + * Activate event forwarding from client (remote frame) to parent. 1.196 + */ 1.197 + void activateFrameEvent(in AString aType, in boolean capture); 1.198 + 1.199 + // Note, when frameloaders are swapped, also messageManagers are swapped. 1.200 + readonly attribute nsIMessageSender messageManager; 1.201 + 1.202 + /** 1.203 + * @see nsIDOMWindowUtils sendKeyEvent. 1.204 + */ 1.205 + void sendCrossProcessKeyEvent(in AString aType, 1.206 + in long aKeyCode, 1.207 + in long aCharCode, 1.208 + in long aModifiers, 1.209 + [optional] in boolean aPreventDefault); 1.210 + 1.211 + /** 1.212 + * The default rendering mode is synchronous scrolling. In this 1.213 + * mode, it's an error to try to set a target viewport. 1.214 + */ 1.215 + const unsigned long RENDER_MODE_DEFAULT = 0x00000000; 1.216 + 1.217 + /** 1.218 + * When asynchronous scrolling is enabled, a target viewport can be 1.219 + * set to transform content pixels wrt its CSS viewport. 1.220 + * 1.221 + * NB: when async scrolling is enabled, it's the *user's* 1.222 + * responsibility to update the target scroll offset. In effect, 1.223 + * the platform hands over control of scroll offset to the user. 1.224 + */ 1.225 + const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001; 1.226 + 1.227 + attribute unsigned long renderMode; 1.228 + 1.229 + /** 1.230 + * The default event mode automatically forwards the events 1.231 + * handled in EventStateManager::HandleCrossProcessEvent to 1.232 + * the child content process when these events are targeted to 1.233 + * the remote browser element. 1.234 + * 1.235 + * Used primarly for input events (mouse, keyboard) 1.236 + */ 1.237 + const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000; 1.238 + 1.239 + /** 1.240 + * With this event mode, it's the application's responsability to 1.241 + * convert and forward events to the content process 1.242 + */ 1.243 + const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001; 1.244 + 1.245 + attribute unsigned long eventMode; 1.246 + 1.247 + /** 1.248 + * If false, then the subdocument is not clipped to its CSS viewport, and the 1.249 + * subdocument's viewport scrollbar(s) are not rendered. 1.250 + * Defaults to true. 1.251 + */ 1.252 + attribute boolean clipSubdocument; 1.253 + 1.254 + /** 1.255 + * If false, then the subdocument's scroll coordinates will not be clamped 1.256 + * to their scroll boundaries. 1.257 + * Defaults to true. 1.258 + */ 1.259 + attribute boolean clampScrollPosition; 1.260 + 1.261 + /** 1.262 + * The element which owns this frame loader. 1.263 + * 1.264 + * For example, if this is a frame loader for an <iframe>, this attribute 1.265 + * returns the iframe element. 1.266 + */ 1.267 + readonly attribute nsIDOMElement ownerElement; 1.268 + 1.269 + 1.270 + /** 1.271 + * Cached childID of the ContentParent owning the TabParent in this frame 1.272 + * loader. This can be used to obtain the childID after the TabParent died. 1.273 + */ 1.274 + readonly attribute unsigned long long childID; 1.275 + 1.276 + /** 1.277 + * Get or set this frame loader's visibility. 1.278 + * 1.279 + * The notion of "visibility" here is separate from the notion of a 1.280 + * window/docshell's visibility. This field is mostly here so that we can 1.281 + * have a notion of visibility in the parent process when frames are OOP. 1.282 + */ 1.283 + [infallible] attribute boolean visible; 1.284 + 1.285 + /** 1.286 + * Find out whether the owner content really is a browser or app frame 1.287 + */ 1.288 + readonly attribute boolean ownerIsBrowserOrAppFrame; 1.289 +}; 1.290 + 1.291 +%{C++ 1.292 +class nsFrameLoader; 1.293 +%} 1.294 + 1.295 +native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>); 1.296 + 1.297 +[scriptable, uuid(5879040e-83e9-40e3-b2bb-5ddf43b76e47)] 1.298 +interface nsIFrameLoaderOwner : nsISupports 1.299 +{ 1.300 + /** 1.301 + * The frame loader owned by this nsIFrameLoaderOwner 1.302 + */ 1.303 + readonly attribute nsIFrameLoader frameLoader; 1.304 + [noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader(); 1.305 + 1.306 + /** 1.307 + * Swap frame loaders with the given nsIFrameLoaderOwner. This may 1.308 + * only be posible in a very limited range of circumstances, or 1.309 + * never, depending on the object implementing this interface. 1.310 + * 1.311 + * @throws NS_ERROR_NOT_IMPLEMENTED if the swapping logic is not 1.312 + * implemented for the two given frame loader owners. 1.313 + * @throws NS_ERROR_DOM_SECURITY_ERR if the swap is not allowed on 1.314 + * security grounds. 1.315 + */ 1.316 + void swapFrameLoaders(in nsIFrameLoaderOwner aOtherOwner); 1.317 +};