Bug 1893155 - Part 6: Correct constant for minimum epoch day. r=spidermonkey-reviewer...
[gecko.git] / xpfe / appshell / nsIAppWindow.idl
blobd373043bac894740cfeaf7bb581611e661816303
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 /**
10 * The nsIAppWindow
12 * When the window is destroyed, it will fire a "xul-window-destroyed"
13 * notification through the global observer service.
16 %{C++
17 #include "LiveResizeListener.h"
18 #include "nsTArray.h"
21 interface nsIDocShell;
22 interface nsIDocShellTreeItem;
23 interface nsIXULBrowserWindow;
24 interface nsIRemoteTab;
25 interface mozIDOMWindowProxy;
26 interface nsIOpenWindowInfo;
27 webidl BrowsingContext;
29 native LiveResizeListenerArray(nsTArray<RefPtr<mozilla::LiveResizeListener>>);
31 [builtinclass, scriptable, uuid(d6d7a014-e28d-4c9d-8727-1cf6d870619b)]
32 interface nsIAppWindow : nsISupports
34 /**
35 * The docshell owning the XUL for this window.
37 readonly attribute nsIDocShell docShell;
39 /**
40 * Indicates if this window is instrinsically sized.
42 attribute boolean intrinsicallySized;
44 /**
45 * The primary content shell.
47 * Note that this is a docshell tree item and therefore can not be assured of
48 * what object it is. It could be an editor, a docshell, or a browser object.
49 * Or down the road any other object that supports being a DocShellTreeItem
50 * Query accordingly to determine the capabilities.
52 readonly attribute nsIDocShellTreeItem primaryContentShell;
54 /**
55 * In multiprocess case we may not have primaryContentShell but
56 * primaryRemoteTab.
58 readonly attribute nsIRemoteTab primaryRemoteTab;
60 /**
61 * Helper for getting the BrowsingContext from either `primaryContentShell` or
62 * `primaryRemoteTab` depending on which is available.
64 readonly attribute BrowsingContext primaryContentBrowsingContext;
66 void remoteTabAdded(in nsIRemoteTab aTab, in boolean aPrimary);
67 void remoteTabRemoved(in nsIRemoteTab aTab);
69 [noscript,notxpcom] LiveResizeListenerArray getLiveResizeListeners();
71 /**
72 * Returns the difference between the inner window size (client size) and the
73 * outer window size, in CSS pixels.
75 [infallible] readonly attribute unsigned long outerToInnerHeightDifferenceInCSSPixels;
76 [infallible] readonly attribute unsigned long outerToInnerWidthDifferenceInCSSPixels;
78 /**
79 * Move the window to a centered position.
80 * @param aRelative If not null, the window relative to which the window is
81 * moved. See aScreen parameter for details.
82 * @param aScreen PR_TRUE to center the window relative to the screen
83 * containing aRelative if aRelative is not null. If
84 * aRelative is null then relative to the screen of the
85 * opener window if it was initialized by passing it to
86 * nsWebShellWindow::Initialize. Failing that relative to
87 * the main screen.
88 * PR_FALSE to center it relative to aRelative itself.
89 * @param aAlert PR_TRUE to move the window to an alert position,
90 * generally centered horizontally and 1/3 down from the top.
92 void center(in nsIAppWindow aRelative, in boolean aScreen, in boolean aAlert);
94 /**
95 * Shows the window as a modal window. That is, ensures that it is visible
96 * and runs a local event loop, exiting only once the window has been closed.
98 void showModal();
101 * Locks the aspect ratio for a window.
102 * @param aShouldLock boolean
104 void lockAspectRatio(in boolean aShouldLock);
106 const unsigned long lowestZ = 0;
107 const unsigned long loweredZ = 4; /* "alwaysLowered" attribute */
108 const unsigned long normalZ = 5;
109 const unsigned long raisedZ = 6; /* "alwaysRaised" attribute */
110 const unsigned long highestZ = 9;
112 attribute unsigned long zLevel;
114 attribute uint32_t chromeFlags;
117 * Begin assuming |chromeFlags| don't change hereafter, and assert
118 * if they do change. The state change is one-way and idempotent.
120 void assumeChromeFlagsAreFrozen();
123 * Create a new window.
124 * @param aChromeFlags see nsIWebBrowserChrome
125 * @param aOpenWindowInfo information about the request for a content window
126 * to be opened. Will be null for non-content loads.
127 * @return the newly minted window
129 nsIAppWindow createNewWindow(in int32_t aChromeFlags,
130 in nsIOpenWindowInfo aOpenWindowInfo);
132 attribute nsIXULBrowserWindow XULBrowserWindow;
135 * Back-door method to make sure some stuff is done when the document is
136 * ready for layout, that would cause expensive computation otherwise later.
138 * Do NOT call this unless you know what you're doing! In particular,
139 * calling this when this XUL window doesn't yet have a document in its
140 * docshell could cause problems.
142 [noscript] void beforeStartLayout();
145 * If the window was opened as a content window, this will return the initial
146 * nsIOpenWindowInfo to use.
148 readonly attribute nsIOpenWindowInfo initialOpenWindowInfo;
151 * Request fast snapshot at RenderCompositor of WebRender.
152 * Since readback of Windows DirectComposition is very slow.
154 void needFastSnaphot();