Bug 1824753 [wpt PR 39216] - [FLEDGE] Add WPT test that FLEDGE is not allowed in...
[gecko.git] / dom / ipc / EffectsInfo.h
blob71f82177973c9ffd51641abf00468b82213e9cca
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 #ifndef mozilla_dom_EffectsInfo_h
8 #define mozilla_dom_EffectsInfo_h
10 #include "nsRect.h"
12 namespace mozilla::dom {
14 /**
15 * An EffectsInfo contains information for a remote browser about the graphical
16 * effects that are being applied to it by ancestor browsers in different
17 * processes.
19 class EffectsInfo {
20 public:
21 EffectsInfo() { *this = EffectsInfo::FullyHidden(); }
23 static EffectsInfo VisibleWithinRect(
24 const nsRect& aVisibleRect, const Scale2D& aRasterScale,
25 const ParentLayerToScreenScale2D& aTransformToAncestorScale) {
26 return EffectsInfo{aVisibleRect, aRasterScale, aTransformToAncestorScale};
28 static EffectsInfo FullyHidden() {
29 return EffectsInfo{nsRect(), Scale2D(), ParentLayerToScreenScale2D()};
32 bool operator==(const EffectsInfo& aOther) {
33 return mVisibleRect == aOther.mVisibleRect &&
34 mRasterScale == aOther.mRasterScale &&
35 mTransformToAncestorScale == aOther.mTransformToAncestorScale;
37 bool operator!=(const EffectsInfo& aOther) { return !(*this == aOther); }
39 bool IsVisible() const { return !mVisibleRect.IsEmpty(); }
41 // The visible rect of this browser relative to the root frame. If this is
42 // empty then the browser can be considered invisible.
43 nsRect mVisibleRect;
44 // The desired scale factors to apply to rasterized content to match
45 // transforms applied in ancestor browsers. This gets propagated into the
46 // scale in StackingContextHelper.
47 Scale2D mRasterScale;
48 // TransformToAncestorScale to be set on FrameMetrics. It includes CSS
49 // transform scales and cumulative presshell resolution.
50 ParentLayerToScreenScale2D mTransformToAncestorScale;
51 // The difference between mScaleX/Y and mTransformToAncestorScale is the way
52 // that CSS transforms contribute to the scale. mTransformToAncestorScale
53 // includes the exact scale factors of the combined CSS transform whereas
54 // mScaleX/Y tries to take into account animating transform scales by picking
55 // a larger scale so that we don't have to re-rasterize every frame but rather
56 // we can just scale down content rasterized on a previous frame.
58 // If you add new fields here, you must also update operator== and
59 // TabMessageUtils.
61 private:
62 EffectsInfo(const nsRect& aVisibleRect, const Scale2D& aRasterScale,
63 const ParentLayerToScreenScale2D& aTransformToAncestorScale)
64 : mVisibleRect(aVisibleRect),
65 mRasterScale(aRasterScale),
66 mTransformToAncestorScale(aTransformToAncestorScale) {}
69 } // namespace mozilla::dom
71 #endif // mozilla_dom_EffectsInfo_h