Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / painting / ActiveLayerTracker.h
blob8525e16ef4493c3fb87bb630ea7841687dfd023c
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 ACTIVELAYERTRACKER_H_
8 #define ACTIVELAYERTRACKER_H_
10 #include "nsCSSPropertyID.h"
12 class nsIFrame;
13 class nsIContent;
14 class nsCSSPropertyIDSet;
15 class nsDOMCSSDeclaration;
17 namespace mozilla {
19 class nsDisplayListBuilder;
21 /**
22 * This class receives various notifications about style changes and content
23 * changes that affect layerization decisions, and implements the heuristics
24 * that drive those decisions. It manages per-frame state to support those
25 * heuristics.
27 class ActiveLayerTracker {
28 public:
29 static void Shutdown();
32 * We track style changes to selected styles:
33 * eCSSProperty_transform, eCSSProperty_translate,
34 * eCSSProperty_rotate, eCSSProperty_scale
35 * eCSSProperty_offset_path, eCSSProperty_offset_distance,
36 * eCSSProperty_offset_rotate, eCSSProperty_offset_anchor,
37 * eCSSProperty_offset_position, eCSSProperty_opacity
38 * and use that information to guess whether style changes are animated.
41 /**
42 * Notify aFrame's style property as having changed due to a restyle,
43 * and therefore possibly wanting an active layer to render that style.
44 * Any such marking will time out after a short period.
45 * @param aProperty the property that has changed
47 static void NotifyRestyle(nsIFrame* aFrame, nsCSSPropertyID aProperty);
49 /**
50 * Notify that a property in the inline style rule of aFrame's element
51 * has been modified.
53 static void NotifyInlineStyleRuleModified(nsIFrame* aFrame,
54 nsCSSPropertyID aProperty);
55 /**
56 * Notify that a frame needs to be repainted. This is important for layering
57 * decisions where, say, aFrame's transform is updated from JS, but we need
58 * to repaint aFrame anyway, so we get no benefit from giving it its own
59 * layer.
61 static void NotifyNeedsRepaint(nsIFrame* aFrame);
62 /**
63 * Return true if aFrame's property style in |aPropertySet| should be
64 * considered as being animated for constructing active layers.
66 static bool IsStyleAnimated(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
67 const nsCSSPropertyIDSet& aPropertySet);
68 /**
69 * Return true if aFrame's transform-like property,
70 * i.e. transform/translate/rotate/scale, is animated.
72 static bool IsTransformAnimated(nsDisplayListBuilder* aBuilder,
73 nsIFrame* aFrame);
74 /**
75 * Return true if aFrame's transform style should be considered as being
76 * animated for pre-rendering.
78 static bool IsTransformMaybeAnimated(nsIFrame* aFrame);
79 /**
80 * Return true if aFrame either has an animated scale now, or is likely to
81 * have one in the future because it has a CSS animation or transition
82 * (which may not be playing right now) that affects its scale.
84 static bool IsScaleSubjectToAnimation(nsIFrame* aFrame);
86 /**
87 * Transfer the LayerActivity property to the frame's content node when the
88 * frame is about to be destroyed so that layer activity can be tracked
89 * throughout reframes of an element. Only call this when aFrame is the
90 * primary frame of aContent.
92 static void TransferActivityToContent(nsIFrame* aFrame, nsIContent* aContent);
93 /**
94 * Transfer the LayerActivity property back to the content node's primary
95 * frame after the frame has been created.
97 static void TransferActivityToFrame(nsIContent* aContent, nsIFrame* aFrame);
100 } // namespace mozilla
102 #endif /* ACTIVELAYERTRACKER_H_ */