Bug 1892041 - Part 3: Update test exclusions. r=spidermonkey-reviewers,dminor
[gecko.git] / widget / DimensionRequest.h
blob75f5c96b45714a77c956339e02e9f70677f72966
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_DimensionRequest_h
6 #define mozilla_DimensionRequest_h
8 #include "Units.h"
9 #include "mozilla/Maybe.h"
11 class nsIBaseWindow;
12 class nsIDocShellTreeOwner;
14 namespace mozilla {
16 enum class DimensionKind { Inner, Outer };
18 /**
19 * DimensionRequest allows to request the change of some dimensions without
20 * having to specify the unchanged dimensions. This is specifically necessary
21 * when a change is initiated from a child process, which might not have an
22 * up-to-date view of its latest dimensions. Having to specify the missing
23 * dimensions with an outdated view can revert a previous change.
25 * The following series of changes `window.screenX = 10; window.screenY = 10;`
26 * essentially translates into two moveTo() calls. For the second call we want
27 * to account for changes made by the first call. From a child process we would
28 * end up crafting the second call without knowing the results of the first
29 * call. In the parent process we have access to results of the first call
30 * before crafting the second one. Although on Linux even the parent process
31 * doesn't have immediate access to the results of the last change.
33 * Note: The concept of an inner position is not present on
34 * nsIDocShellTreeOwner and nsIBaseWindow. A request specifying an inner
35 * position will return an NS_ERROR_NOT_IMPLEMENTED.
37 struct DimensionRequest {
38 DimensionKind mDimensionKind;
39 Maybe<LayoutDeviceIntCoord> mX;
40 Maybe<LayoutDeviceIntCoord> mY;
41 Maybe<LayoutDeviceIntCoord> mWidth;
42 Maybe<LayoutDeviceIntCoord> mHeight;
44 /**
45 * Fills the missing dimensions with values obtained from `aSource`. Whether
46 * inner dimensions are supported depends on the implementation of
47 * `nsIBaseWindow::GetDimensions` for `aSource`.
49 * @param aSource The source for the missing dimensions.
51 nsresult SupplementFrom(nsIBaseWindow* aSource);
53 /**
54 * Changes the outer size and or position of `aTarget`. Only outer dimensions
55 * are supported.
57 * @param aTarget The target whose size or position we want to change.
59 nsresult ApplyOuterTo(nsIBaseWindow* aTarget);
61 /**
62 * Changes the inner size of `aTarget`. Only inner dimensions are supported.
64 * @param aTarget The target whose size we want to change.
66 nsresult ApplyInnerTo(nsIDocShellTreeOwner* aTarget, bool aAsRootShell);
69 } // namespace mozilla
71 #endif // mozilla_DimensionRequest_h