Bumping manifests a=b2g-bump
[gecko.git] / layout / base / ActiveLayerTracker.h
blobd8167721489084037d31be6a448ac12055c3a014
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 ACTIVELAYERTRACKER_H_
6 #define ACTIVELAYERTRACKER_H_
8 #include "nsCSSProperty.h"
10 class nsIFrame;
11 class nsIContent;
12 class nsDisplayListBuilder;
14 namespace mozilla {
16 /**
17 * This class receives various notifications about style changes and content
18 * changes that affect layerization decisions, and implements the heuristics
19 * that drive those decisions. It manages per-frame state to support those
20 * heuristics.
22 class ActiveLayerTracker {
23 public:
24 static void Shutdown();
27 * We track style changes to selected styles:
28 * eCSSProperty_transform
29 * eCSSProperty_opacity
30 * eCSSProperty_left, eCSSProperty_top, eCSSProperty_right, eCSSProperty_bottom
31 * and use that information to guess whether style changes are animated.
34 /**
35 * Notify aFrame's style property as having changed due to a restyle,
36 * and therefore possibly wanting an active layer to render that style.
37 * Any such marking will time out after a short period.
38 * @param aProperty the property that has changed
40 static void NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty);
41 /**
42 * Notify aFrame's left/top/right/bottom properties as having (maybe)
43 * changed due to a restyle, and therefore possibly wanting an active layer
44 * to render that style. Any such marking will time out after a short period.
46 static void NotifyOffsetRestyle(nsIFrame* aFrame);
47 /**
48 * Mark aFrame as being known to have an animation of aProperty.
49 * Any such marking will time out after a short period.
51 static void NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty);
52 /**
53 * Notify that a property in the inline style rule of aFrame's element
54 * has been modified.
55 * This notification is incomplete --- not all modifications to inline
56 * style will trigger this.
58 static void NotifyInlineStyleRuleModified(nsIFrame* aFrame, nsCSSProperty aProperty);
59 /**
60 * Return true if aFrame's aProperty style should be considered as being animated
61 * for pre-rendering.
63 static bool IsStyleMaybeAnimated(nsIFrame* aFrame, nsCSSProperty aProperty);
64 /**
65 * Return true if aFrame's aProperty style should be considered as being animated
66 * for constructing active layers.
68 static bool IsStyleAnimated(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
69 nsCSSProperty aProperty);
70 /**
71 * Return true if any of aFrame's offset property styles should be considered
72 * as being animated for constructing active layers.
74 static bool IsOffsetOrMarginStyleAnimated(nsIFrame* aFrame);
75 /**
76 * Transfer the LayerActivity property to the frame's content node when the
77 * frame is about to be destroyed so that layer activity can be tracked
78 * throughout reframes of an element. Only call this when aFrame is the
79 * primary frame of aContent.
81 static void TransferActivityToContent(nsIFrame* aFrame, nsIContent* aContent);
82 /**
83 * Transfer the LayerActivity property back to the content node's primary
84 * frame after the frame has been created.
86 static void TransferActivityToFrame(nsIContent* aContent, nsIFrame* aFrame);
89 * We track modifications to the content of certain frames (i.e. canvas frames)
90 * and use that to make layering decisions.
93 /**
94 * Mark aFrame's content as being active. This marking will time out after
95 * a short period.
97 static void NotifyContentChange(nsIFrame* aFrame);
98 /**
99 * Return true if this frame's content is still marked as active.
101 static bool IsContentActive(nsIFrame* aFrame);
106 #endif /* ACTIVELAYERTRACKER_H_ */