michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef ACTIVELAYERTRACKER_H_ michael@0: #define ACTIVELAYERTRACKER_H_ michael@0: michael@0: #include "nsCSSProperty.h" michael@0: michael@0: class nsIFrame; michael@0: michael@0: namespace mozilla { michael@0: michael@0: /** michael@0: * This class receives various notifications about style changes and content michael@0: * changes that affect layerization decisions, and implements the heuristics michael@0: * that drive those decisions. It manages per-frame state to support those michael@0: * heuristics. michael@0: */ michael@0: class ActiveLayerTracker { michael@0: public: michael@0: static void Shutdown(); michael@0: michael@0: /* michael@0: * We track style changes to selected styles: michael@0: * eCSSProperty_transform michael@0: * eCSSProperty_opacity michael@0: * eCSSProperty_left, eCSSProperty_top, eCSSProperty_right, eCSSProperty_bottom michael@0: * and use that information to guess whether style changes are animated. michael@0: */ michael@0: michael@0: /** michael@0: * Notify aFrame's style property as having changed due to a restyle, michael@0: * and therefore possibly wanting an active layer to render that style. michael@0: * Any such marking will time out after a short period. michael@0: * @param aProperty the property that has changed michael@0: */ michael@0: static void NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty); michael@0: /** michael@0: * Notify aFrame's left/top/right/bottom properties as having (maybe) michael@0: * changed due to a restyle, and therefore possibly wanting an active layer michael@0: * to render that style. Any such marking will time out after a short period. michael@0: */ michael@0: static void NotifyOffsetRestyle(nsIFrame* aFrame); michael@0: /** michael@0: * Mark aFrame as being known to have an animation of aProperty. michael@0: * Any such marking will time out after a short period. michael@0: */ michael@0: static void NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty); michael@0: /** michael@0: * Notify that a property in the inline style rule of aFrame's element michael@0: * has been modified. michael@0: * This notification is incomplete --- not all modifications to inline michael@0: * style will trigger this. michael@0: */ michael@0: static void NotifyInlineStyleRuleModified(nsIFrame* aFrame, nsCSSProperty aProperty); michael@0: /** michael@0: * Return true if aFrame's aProperty style should be considered as being animated michael@0: * for constructing active layers. michael@0: */ michael@0: static bool IsStyleAnimated(nsIFrame* aFrame, nsCSSProperty aProperty); michael@0: /** michael@0: * Return true if any of aFrame's offset property styles should be considered michael@0: * as being animated for constructing active layers. michael@0: */ michael@0: static bool IsOffsetOrMarginStyleAnimated(nsIFrame* aFrame); michael@0: michael@0: /* michael@0: * We track modifications to the content of certain frames (i.e. canvas frames) michael@0: * and use that to make layering decisions. michael@0: */ michael@0: michael@0: /** michael@0: * Mark aFrame's content as being active. This marking will time out after michael@0: * a short period. michael@0: */ michael@0: static void NotifyContentChange(nsIFrame* aFrame); michael@0: /** michael@0: * Return true if this frame's content is still marked as active. michael@0: */ michael@0: static bool IsContentActive(nsIFrame* aFrame); michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif /* ACTIVELAYERTRACKER_H_ */