Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsFrameLoader; |
michael@0 | 9 | interface nsIDocShell; |
michael@0 | 10 | interface nsIURI; |
michael@0 | 11 | interface nsIFrame; |
michael@0 | 12 | interface nsSubDocumentFrame; |
michael@0 | 13 | interface nsIMessageSender; |
michael@0 | 14 | interface nsIVariant; |
michael@0 | 15 | interface nsIDOMElement; |
michael@0 | 16 | interface nsITabParent; |
michael@0 | 17 | interface nsILoadContext; |
michael@0 | 18 | |
michael@0 | 19 | typedef unsigned long long nsContentViewId; |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * These interfaces do *not* scroll or scale the content document; |
michael@0 | 23 | * instead they set a "goal" scroll/scale wrt the current content |
michael@0 | 24 | * view. When the content document is painted, the scroll* |
michael@0 | 25 | * attributes are used to set a compensating transform. If the |
michael@0 | 26 | * metrics of the content document's current pixels don't match the |
michael@0 | 27 | * view config, the transform matrix may need to translate |
michael@0 | 28 | * content pixels and/or perform a "fuzzy-scale" that doesn't |
michael@0 | 29 | * re-rasterize fonts or intelligently resample images. |
michael@0 | 30 | * |
michael@0 | 31 | * The attrs are allowed to transform content pixels in |
michael@0 | 32 | * such a way that the <browser>'s visible rect encloses pixels that |
michael@0 | 33 | * the content document does not (yet) define. |
michael@0 | 34 | * |
michael@0 | 35 | * The view scroll values are in units of chrome-document CSS |
michael@0 | 36 | * pixels. |
michael@0 | 37 | * |
michael@0 | 38 | * These APIs are designed to be used with nsIDOMWindowUtils |
michael@0 | 39 | * setDisplayPort() and setResolution(). |
michael@0 | 40 | */ |
michael@0 | 41 | [scriptable, uuid(c04c5c40-fa2a-4e9c-94f5-b362a10a86cb)] |
michael@0 | 42 | interface nsIContentView : nsISupports |
michael@0 | 43 | { |
michael@0 | 44 | /** |
michael@0 | 45 | * Scroll view to or by the given chrome-document CSS pixels. |
michael@0 | 46 | * Fails if the view is no longer valid. |
michael@0 | 47 | */ |
michael@0 | 48 | void scrollTo(in float xPx, in float yPx); |
michael@0 | 49 | void scrollBy(in float dxPx, in float dyPx); |
michael@0 | 50 | |
michael@0 | 51 | void setScale(in float xScale, in float yScale); |
michael@0 | 52 | |
michael@0 | 53 | /** |
michael@0 | 54 | * Scroll offset in chrome-document CSS pixels. |
michael@0 | 55 | * |
michael@0 | 56 | * When this view is active (i.e. it is being painted because it's in the |
michael@0 | 57 | * visible region of the screen), this value is at first lined up with the |
michael@0 | 58 | * content's scroll offset. |
michael@0 | 59 | * |
michael@0 | 60 | * Note that when this view becomes inactive, the new content view will have |
michael@0 | 61 | * scroll values that are reset to the default! |
michael@0 | 62 | */ |
michael@0 | 63 | readonly attribute float scrollX; |
michael@0 | 64 | readonly attribute float scrollY; |
michael@0 | 65 | |
michael@0 | 66 | /** |
michael@0 | 67 | * Dimensions of the viewport in chrome-document CSS pixels. |
michael@0 | 68 | */ |
michael@0 | 69 | readonly attribute float viewportWidth; |
michael@0 | 70 | readonly attribute float viewportHeight; |
michael@0 | 71 | |
michael@0 | 72 | /** |
michael@0 | 73 | * Dimensions of scrolled content in chrome-document CSS pixels. |
michael@0 | 74 | */ |
michael@0 | 75 | readonly attribute float contentWidth; |
michael@0 | 76 | readonly attribute float contentHeight; |
michael@0 | 77 | |
michael@0 | 78 | /** |
michael@0 | 79 | * ID that can be used in conjunction with nsIDOMWindowUtils to change |
michael@0 | 80 | * the actual document, instead of just how it is transformed. |
michael@0 | 81 | */ |
michael@0 | 82 | readonly attribute nsContentViewId id; |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 | [scriptable, uuid(ba5af90d-ece5-40b2-9a1d-a0154128db1c)] |
michael@0 | 86 | interface nsIContentViewManager : nsISupports |
michael@0 | 87 | { |
michael@0 | 88 | /** |
michael@0 | 89 | * Retrieve view scrolling/scaling interfaces in a given area, |
michael@0 | 90 | * used to support asynchronous re-paints of content pixels. |
michael@0 | 91 | * These interfaces are only meaningful for <browser>. |
michael@0 | 92 | * |
michael@0 | 93 | * Pixels are in chrome device pixels and are relative to the browser |
michael@0 | 94 | * element. |
michael@0 | 95 | * |
michael@0 | 96 | * @param aX x coordinate that will be in target rectangle |
michael@0 | 97 | * @param aY y coordinate that will be in target rectangle |
michael@0 | 98 | * @param aTopSize How much to expand up the rectangle |
michael@0 | 99 | * @param aRightSize How much to expand right the rectangle |
michael@0 | 100 | * @param aBottomSize How much to expand down the rectangle |
michael@0 | 101 | * @param aLeftSize How much to expand left the rectangle |
michael@0 | 102 | */ |
michael@0 | 103 | void getContentViewsIn(in float aXPx, in float aYPx, |
michael@0 | 104 | in float aTopSize, in float aRightSize, |
michael@0 | 105 | in float aBottomSize, in float aLeftSize, |
michael@0 | 106 | [optional] out unsigned long aLength, |
michael@0 | 107 | [retval, array, size_is(aLength)] out nsIContentView aResult); |
michael@0 | 108 | |
michael@0 | 109 | /** |
michael@0 | 110 | * The root content view. |
michael@0 | 111 | */ |
michael@0 | 112 | readonly attribute nsIContentView rootContentView; |
michael@0 | 113 | }; |
michael@0 | 114 | |
michael@0 | 115 | [scriptable, builtinclass, uuid(a5cefcc8-551b-4901-83f3-7436b09ecaba)] |
michael@0 | 116 | interface nsIFrameLoader : nsISupports |
michael@0 | 117 | { |
michael@0 | 118 | /** |
michael@0 | 119 | * Get the docshell from the frame loader. |
michael@0 | 120 | */ |
michael@0 | 121 | readonly attribute nsIDocShell docShell; |
michael@0 | 122 | |
michael@0 | 123 | /** |
michael@0 | 124 | * Get this frame loader's TabParent, if it has a remote frame. Otherwise, |
michael@0 | 125 | * returns null. |
michael@0 | 126 | */ |
michael@0 | 127 | readonly attribute nsITabParent tabParent; |
michael@0 | 128 | |
michael@0 | 129 | /** |
michael@0 | 130 | * Get an nsILoadContext for the top-level docshell. For remote |
michael@0 | 131 | * frames, a shim is returned that contains private browsing and app |
michael@0 | 132 | * information. |
michael@0 | 133 | */ |
michael@0 | 134 | readonly attribute nsILoadContext loadContext; |
michael@0 | 135 | |
michael@0 | 136 | /** |
michael@0 | 137 | * Start loading the frame. This method figures out what to load |
michael@0 | 138 | * from the owner content in the frame loader. |
michael@0 | 139 | */ |
michael@0 | 140 | void loadFrame(); |
michael@0 | 141 | |
michael@0 | 142 | /** |
michael@0 | 143 | * Loads the specified URI in this frame. Behaves identically to loadFrame, |
michael@0 | 144 | * except that this method allows specifying the URI to load. |
michael@0 | 145 | */ |
michael@0 | 146 | void loadURI(in nsIURI aURI); |
michael@0 | 147 | |
michael@0 | 148 | /** |
michael@0 | 149 | * Destroy the frame loader and everything inside it. This will |
michael@0 | 150 | * clear the weak owner content reference. |
michael@0 | 151 | */ |
michael@0 | 152 | void destroy(); |
michael@0 | 153 | |
michael@0 | 154 | /** |
michael@0 | 155 | * Find out whether the loader's frame is at too great a depth in |
michael@0 | 156 | * the frame tree. This can be used to decide what operations may |
michael@0 | 157 | * or may not be allowed on the loader's docshell. |
michael@0 | 158 | */ |
michael@0 | 159 | readonly attribute boolean depthTooGreat; |
michael@0 | 160 | |
michael@0 | 161 | /** |
michael@0 | 162 | * Updates the position and size of the subdocument loaded by this frameloader. |
michael@0 | 163 | * |
michael@0 | 164 | * @param aIFrame The nsIFrame for the content node that owns this frameloader |
michael@0 | 165 | */ |
michael@0 | 166 | [noscript] void updatePositionAndSize(in nsSubDocumentFrame aIFrame); |
michael@0 | 167 | |
michael@0 | 168 | /** |
michael@0 | 169 | * Activate remote frame. |
michael@0 | 170 | * Throws an exception with non-remote frames. |
michael@0 | 171 | */ |
michael@0 | 172 | void activateRemoteFrame(); |
michael@0 | 173 | |
michael@0 | 174 | /** |
michael@0 | 175 | * Deactivate remote frame. |
michael@0 | 176 | * Throws an exception with non-remote frames. |
michael@0 | 177 | */ |
michael@0 | 178 | void deactivateRemoteFrame(); |
michael@0 | 179 | |
michael@0 | 180 | /** |
michael@0 | 181 | * @see nsIDOMWindowUtils sendMouseEvent. |
michael@0 | 182 | */ |
michael@0 | 183 | void sendCrossProcessMouseEvent(in AString aType, |
michael@0 | 184 | in float aX, |
michael@0 | 185 | in float aY, |
michael@0 | 186 | in long aButton, |
michael@0 | 187 | in long aClickCount, |
michael@0 | 188 | in long aModifiers, |
michael@0 | 189 | [optional] in boolean aIgnoreRootScrollFrame); |
michael@0 | 190 | |
michael@0 | 191 | /** |
michael@0 | 192 | * Activate event forwarding from client (remote frame) to parent. |
michael@0 | 193 | */ |
michael@0 | 194 | void activateFrameEvent(in AString aType, in boolean capture); |
michael@0 | 195 | |
michael@0 | 196 | // Note, when frameloaders are swapped, also messageManagers are swapped. |
michael@0 | 197 | readonly attribute nsIMessageSender messageManager; |
michael@0 | 198 | |
michael@0 | 199 | /** |
michael@0 | 200 | * @see nsIDOMWindowUtils sendKeyEvent. |
michael@0 | 201 | */ |
michael@0 | 202 | void sendCrossProcessKeyEvent(in AString aType, |
michael@0 | 203 | in long aKeyCode, |
michael@0 | 204 | in long aCharCode, |
michael@0 | 205 | in long aModifiers, |
michael@0 | 206 | [optional] in boolean aPreventDefault); |
michael@0 | 207 | |
michael@0 | 208 | /** |
michael@0 | 209 | * The default rendering mode is synchronous scrolling. In this |
michael@0 | 210 | * mode, it's an error to try to set a target viewport. |
michael@0 | 211 | */ |
michael@0 | 212 | const unsigned long RENDER_MODE_DEFAULT = 0x00000000; |
michael@0 | 213 | |
michael@0 | 214 | /** |
michael@0 | 215 | * When asynchronous scrolling is enabled, a target viewport can be |
michael@0 | 216 | * set to transform content pixels wrt its CSS viewport. |
michael@0 | 217 | * |
michael@0 | 218 | * NB: when async scrolling is enabled, it's the *user's* |
michael@0 | 219 | * responsibility to update the target scroll offset. In effect, |
michael@0 | 220 | * the platform hands over control of scroll offset to the user. |
michael@0 | 221 | */ |
michael@0 | 222 | const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001; |
michael@0 | 223 | |
michael@0 | 224 | attribute unsigned long renderMode; |
michael@0 | 225 | |
michael@0 | 226 | /** |
michael@0 | 227 | * The default event mode automatically forwards the events |
michael@0 | 228 | * handled in EventStateManager::HandleCrossProcessEvent to |
michael@0 | 229 | * the child content process when these events are targeted to |
michael@0 | 230 | * the remote browser element. |
michael@0 | 231 | * |
michael@0 | 232 | * Used primarly for input events (mouse, keyboard) |
michael@0 | 233 | */ |
michael@0 | 234 | const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000; |
michael@0 | 235 | |
michael@0 | 236 | /** |
michael@0 | 237 | * With this event mode, it's the application's responsability to |
michael@0 | 238 | * convert and forward events to the content process |
michael@0 | 239 | */ |
michael@0 | 240 | const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001; |
michael@0 | 241 | |
michael@0 | 242 | attribute unsigned long eventMode; |
michael@0 | 243 | |
michael@0 | 244 | /** |
michael@0 | 245 | * If false, then the subdocument is not clipped to its CSS viewport, and the |
michael@0 | 246 | * subdocument's viewport scrollbar(s) are not rendered. |
michael@0 | 247 | * Defaults to true. |
michael@0 | 248 | */ |
michael@0 | 249 | attribute boolean clipSubdocument; |
michael@0 | 250 | |
michael@0 | 251 | /** |
michael@0 | 252 | * If false, then the subdocument's scroll coordinates will not be clamped |
michael@0 | 253 | * to their scroll boundaries. |
michael@0 | 254 | * Defaults to true. |
michael@0 | 255 | */ |
michael@0 | 256 | attribute boolean clampScrollPosition; |
michael@0 | 257 | |
michael@0 | 258 | /** |
michael@0 | 259 | * The element which owns this frame loader. |
michael@0 | 260 | * |
michael@0 | 261 | * For example, if this is a frame loader for an <iframe>, this attribute |
michael@0 | 262 | * returns the iframe element. |
michael@0 | 263 | */ |
michael@0 | 264 | readonly attribute nsIDOMElement ownerElement; |
michael@0 | 265 | |
michael@0 | 266 | |
michael@0 | 267 | /** |
michael@0 | 268 | * Cached childID of the ContentParent owning the TabParent in this frame |
michael@0 | 269 | * loader. This can be used to obtain the childID after the TabParent died. |
michael@0 | 270 | */ |
michael@0 | 271 | readonly attribute unsigned long long childID; |
michael@0 | 272 | |
michael@0 | 273 | /** |
michael@0 | 274 | * Get or set this frame loader's visibility. |
michael@0 | 275 | * |
michael@0 | 276 | * The notion of "visibility" here is separate from the notion of a |
michael@0 | 277 | * window/docshell's visibility. This field is mostly here so that we can |
michael@0 | 278 | * have a notion of visibility in the parent process when frames are OOP. |
michael@0 | 279 | */ |
michael@0 | 280 | [infallible] attribute boolean visible; |
michael@0 | 281 | |
michael@0 | 282 | /** |
michael@0 | 283 | * Find out whether the owner content really is a browser or app frame |
michael@0 | 284 | */ |
michael@0 | 285 | readonly attribute boolean ownerIsBrowserOrAppFrame; |
michael@0 | 286 | }; |
michael@0 | 287 | |
michael@0 | 288 | %{C++ |
michael@0 | 289 | class nsFrameLoader; |
michael@0 | 290 | %} |
michael@0 | 291 | |
michael@0 | 292 | native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>); |
michael@0 | 293 | |
michael@0 | 294 | [scriptable, uuid(5879040e-83e9-40e3-b2bb-5ddf43b76e47)] |
michael@0 | 295 | interface nsIFrameLoaderOwner : nsISupports |
michael@0 | 296 | { |
michael@0 | 297 | /** |
michael@0 | 298 | * The frame loader owned by this nsIFrameLoaderOwner |
michael@0 | 299 | */ |
michael@0 | 300 | readonly attribute nsIFrameLoader frameLoader; |
michael@0 | 301 | [noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader(); |
michael@0 | 302 | |
michael@0 | 303 | /** |
michael@0 | 304 | * Swap frame loaders with the given nsIFrameLoaderOwner. This may |
michael@0 | 305 | * only be posible in a very limited range of circumstances, or |
michael@0 | 306 | * never, depending on the object implementing this interface. |
michael@0 | 307 | * |
michael@0 | 308 | * @throws NS_ERROR_NOT_IMPLEMENTED if the swapping logic is not |
michael@0 | 309 | * implemented for the two given frame loader owners. |
michael@0 | 310 | * @throws NS_ERROR_DOM_SECURITY_ERR if the swap is not allowed on |
michael@0 | 311 | * security grounds. |
michael@0 | 312 | */ |
michael@0 | 313 | void swapFrameLoaders(in nsIFrameLoaderOwner aOtherOwner); |
michael@0 | 314 | }; |