Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef ACTIVELAYERTRACKER_H_ |
michael@0 | 6 | #define ACTIVELAYERTRACKER_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include "nsCSSProperty.h" |
michael@0 | 9 | |
michael@0 | 10 | class nsIFrame; |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | |
michael@0 | 14 | /** |
michael@0 | 15 | * This class receives various notifications about style changes and content |
michael@0 | 16 | * changes that affect layerization decisions, and implements the heuristics |
michael@0 | 17 | * that drive those decisions. It manages per-frame state to support those |
michael@0 | 18 | * heuristics. |
michael@0 | 19 | */ |
michael@0 | 20 | class ActiveLayerTracker { |
michael@0 | 21 | public: |
michael@0 | 22 | static void Shutdown(); |
michael@0 | 23 | |
michael@0 | 24 | /* |
michael@0 | 25 | * We track style changes to selected styles: |
michael@0 | 26 | * eCSSProperty_transform |
michael@0 | 27 | * eCSSProperty_opacity |
michael@0 | 28 | * eCSSProperty_left, eCSSProperty_top, eCSSProperty_right, eCSSProperty_bottom |
michael@0 | 29 | * and use that information to guess whether style changes are animated. |
michael@0 | 30 | */ |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * Notify aFrame's style property as having changed due to a restyle, |
michael@0 | 34 | * and therefore possibly wanting an active layer to render that style. |
michael@0 | 35 | * Any such marking will time out after a short period. |
michael@0 | 36 | * @param aProperty the property that has changed |
michael@0 | 37 | */ |
michael@0 | 38 | static void NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty); |
michael@0 | 39 | /** |
michael@0 | 40 | * Notify aFrame's left/top/right/bottom properties as having (maybe) |
michael@0 | 41 | * changed due to a restyle, and therefore possibly wanting an active layer |
michael@0 | 42 | * to render that style. Any such marking will time out after a short period. |
michael@0 | 43 | */ |
michael@0 | 44 | static void NotifyOffsetRestyle(nsIFrame* aFrame); |
michael@0 | 45 | /** |
michael@0 | 46 | * Mark aFrame as being known to have an animation of aProperty. |
michael@0 | 47 | * Any such marking will time out after a short period. |
michael@0 | 48 | */ |
michael@0 | 49 | static void NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty); |
michael@0 | 50 | /** |
michael@0 | 51 | * Notify that a property in the inline style rule of aFrame's element |
michael@0 | 52 | * has been modified. |
michael@0 | 53 | * This notification is incomplete --- not all modifications to inline |
michael@0 | 54 | * style will trigger this. |
michael@0 | 55 | */ |
michael@0 | 56 | static void NotifyInlineStyleRuleModified(nsIFrame* aFrame, nsCSSProperty aProperty); |
michael@0 | 57 | /** |
michael@0 | 58 | * Return true if aFrame's aProperty style should be considered as being animated |
michael@0 | 59 | * for constructing active layers. |
michael@0 | 60 | */ |
michael@0 | 61 | static bool IsStyleAnimated(nsIFrame* aFrame, nsCSSProperty aProperty); |
michael@0 | 62 | /** |
michael@0 | 63 | * Return true if any of aFrame's offset property styles should be considered |
michael@0 | 64 | * as being animated for constructing active layers. |
michael@0 | 65 | */ |
michael@0 | 66 | static bool IsOffsetOrMarginStyleAnimated(nsIFrame* aFrame); |
michael@0 | 67 | |
michael@0 | 68 | /* |
michael@0 | 69 | * We track modifications to the content of certain frames (i.e. canvas frames) |
michael@0 | 70 | * and use that to make layering decisions. |
michael@0 | 71 | */ |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Mark aFrame's content as being active. This marking will time out after |
michael@0 | 75 | * a short period. |
michael@0 | 76 | */ |
michael@0 | 77 | static void NotifyContentChange(nsIFrame* aFrame); |
michael@0 | 78 | /** |
michael@0 | 79 | * Return true if this frame's content is still marked as active. |
michael@0 | 80 | */ |
michael@0 | 81 | static bool IsContentActive(nsIFrame* aFrame); |
michael@0 | 82 | }; |
michael@0 | 83 | |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | #endif /* ACTIVELAYERTRACKER_H_ */ |