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