Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; 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 : #ifndef DISPLAYITEMCLIPCHAIN_H_
7 : #define DISPLAYITEMCLIPCHAIN_H_
8 :
9 : #include "mozilla/Assertions.h"
10 : #include "DisplayItemClip.h"
11 : #include "nsString.h"
12 :
13 : class nsIScrollableFrame;
14 :
15 : namespace mozilla {
16 :
17 : struct ActiveScrolledRoot;
18 :
19 : /**
20 : * A DisplayItemClipChain is a linked list of DisplayItemClips where each clip
21 : * is associated with an active scrolled root that describes what the clip
22 : * moves with.
23 : * We use a chain instead of just one intersected clip due to async scrolling:
24 : * A clip that moves along with a display item can be fused to the item's
25 : * contents when drawing the layer contents, but all other clips in the chain
26 : * need to be kept separate so that they can be applied at composition time,
27 : * after any async scroll offsets have been applied.
28 : * The clip chain is created during display list construction by the builder's
29 : * DisplayListClipState.
30 : * The clip chain order is determined by the active scrolled root order.
31 : * For every DisplayItemClipChain object |clipChain|, the following holds:
32 : * !clipChain->mParent || ActiveScrolledRoot::IsAncestor(clipChain->mParent->mASR, clipChain->mASR).
33 : * The clip chain can skip over active scrolled roots. That just means that
34 : * there is no clip that moves with the skipped ASR in this chain.
35 : */
36 12094 : struct DisplayItemClipChain {
37 :
38 : /**
39 : * Get the display item clip in this chain that moves with aASR, or nullptr
40 : * if no such clip exists. aClipChain can be null.
41 : */
42 : static const DisplayItemClip* ClipForASR(const DisplayItemClipChain* aClipChain,
43 : const ActiveScrolledRoot* aASR);
44 :
45 : static bool Equal(const DisplayItemClipChain* aClip1, const DisplayItemClipChain* aClip2);
46 :
47 : static nsCString ToString(const DisplayItemClipChain* aClipChain);
48 :
49 : bool HasRoundedCorners() const;
50 :
51 : DisplayItemClip mClip;
52 : const ActiveScrolledRoot* mASR;
53 : const DisplayItemClipChain* mParent;
54 : };
55 :
56 : } // namespace mozilla
57 :
58 : #endif /* DISPLAYITEMCLIPCHAIN_H_ */
|