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