/work/obj-fuzz/dist/include/mozilla/layers/StackingContextHelper.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #ifndef GFX_STACKINGCONTEXTHELPER_H |
8 | | #define GFX_STACKINGCONTEXTHELPER_H |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "mozilla/gfx/MatrixFwd.h" |
12 | | #include "mozilla/webrender/WebRenderAPI.h" |
13 | | #include "mozilla/webrender/WebRenderTypes.h" |
14 | | #include "Units.h" |
15 | | |
16 | | class nsDisplayTransform; |
17 | | |
18 | | namespace mozilla { |
19 | | namespace layers { |
20 | | |
21 | | /** |
22 | | * This is a helper class that pushes/pops a stacking context, and manages |
23 | | * some of the coordinate space transformations needed. |
24 | | */ |
25 | | class MOZ_RAII StackingContextHelper |
26 | | { |
27 | | public: |
28 | | StackingContextHelper(const StackingContextHelper& aParentSC, |
29 | | wr::DisplayListBuilder& aBuilder, |
30 | | const nsTArray<wr::WrFilterOp>& aFilters = nsTArray<wr::WrFilterOp>(), |
31 | | const LayoutDeviceRect& aBounds = LayoutDeviceRect(), |
32 | | const gfx::Matrix4x4* aBoundTransform = nullptr, |
33 | | const wr::WrAnimationProperty* aAnimation = nullptr, |
34 | | const float* aOpacityPtr = nullptr, |
35 | | const gfx::Matrix4x4* aTransformPtr = nullptr, |
36 | | const gfx::Matrix4x4* aPerspectivePtr = nullptr, |
37 | | const gfx::CompositionOp& aMixBlendMode = gfx::CompositionOp::OP_OVER, |
38 | | bool aBackfaceVisible = true, |
39 | | bool aIsPreserve3D = false, |
40 | | const Maybe<nsDisplayTransform*>& aDeferredTransformItem = Nothing(), |
41 | | const wr::WrClipId* aClipNodeId = nullptr, |
42 | | bool aAnimated = false); |
43 | | // This version of the constructor should only be used at the root level |
44 | | // of the tree, so that we have a StackingContextHelper to pass down into |
45 | | // the RenderLayer traversal, but don't actually want it to push a stacking |
46 | | // context on the display list builder. |
47 | | StackingContextHelper(); |
48 | | |
49 | | // Pops the stacking context, if one was pushed during the constructor. |
50 | | ~StackingContextHelper(); |
51 | | |
52 | | // Export the inherited scale |
53 | 0 | gfx::Size GetInheritedScale() const { return mScale; } |
54 | | |
55 | | const gfx::Matrix& GetInheritedTransform() const |
56 | 0 | { |
57 | 0 | return mInheritedTransform; |
58 | 0 | } |
59 | | |
60 | | const gfx::Matrix& GetSnappingSurfaceTransform() const |
61 | 0 | { |
62 | 0 | return mSnappingSurfaceTransform; |
63 | 0 | } |
64 | | |
65 | | const Maybe<nsDisplayTransform*>& GetDeferredTransformItem() const; |
66 | | |
67 | 0 | bool AffectsClipPositioning() const { return mAffectsClipPositioning; } |
68 | 0 | Maybe<wr::WrClipId> ReferenceFrameId() const { return mReferenceFrameId; } |
69 | | |
70 | | private: |
71 | | wr::DisplayListBuilder* mBuilder; |
72 | | gfx::Size mScale; |
73 | | gfx::Matrix mInheritedTransform; |
74 | | |
75 | | // The "snapping surface" defines the space that we want to snap in. |
76 | | // You can think of it as the nearest physical surface. |
77 | | // Animated transforms create a new snapping surface, so that changes to their transform don't affect the snapping of their contents. |
78 | | // Non-animated transforms do *not* create a new snapping surface, |
79 | | // so that for example the existence of a non-animated identity transform does not affect snapping. |
80 | | gfx::Matrix mSnappingSurfaceTransform; |
81 | | bool mAffectsClipPositioning; |
82 | | Maybe<wr::WrClipId> mReferenceFrameId; |
83 | | Maybe<nsDisplayTransform*> mDeferredTransformItem; |
84 | | bool mIsPreserve3D; |
85 | | bool mRasterizeLocally; |
86 | | }; |
87 | | |
88 | | } // namespace layers |
89 | | } // namespace mozilla |
90 | | |
91 | | #endif /* GFX_STACKINGCONTEXTHELPER_H */ |