layout/base/ActiveLayerTracker.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/ActiveLayerTracker.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,86 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef ACTIVELAYERTRACKER_H_
     1.9 +#define ACTIVELAYERTRACKER_H_
    1.10 +
    1.11 +#include "nsCSSProperty.h"
    1.12 +
    1.13 +class nsIFrame;
    1.14 +
    1.15 +namespace mozilla {
    1.16 +
    1.17 +/**
    1.18 + * This class receives various notifications about style changes and content
    1.19 + * changes that affect layerization decisions, and implements the heuristics
    1.20 + * that drive those decisions. It manages per-frame state to support those
    1.21 + * heuristics.
    1.22 + */
    1.23 +class ActiveLayerTracker {
    1.24 +public:
    1.25 +  static void Shutdown();
    1.26 +
    1.27 +  /*
    1.28 +   * We track style changes to selected styles:
    1.29 +   *   eCSSProperty_transform
    1.30 +   *   eCSSProperty_opacity
    1.31 +   *   eCSSProperty_left, eCSSProperty_top, eCSSProperty_right, eCSSProperty_bottom
    1.32 +   * and use that information to guess whether style changes are animated.
    1.33 +   */
    1.34 +
    1.35 +  /**
    1.36 +   * Notify aFrame's style property as having changed due to a restyle,
    1.37 +   * and therefore possibly wanting an active layer to render that style.
    1.38 +   * Any such marking will time out after a short period.
    1.39 +   * @param aProperty the property that has changed
    1.40 +   */
    1.41 +  static void NotifyRestyle(nsIFrame* aFrame, nsCSSProperty aProperty);
    1.42 +  /**
    1.43 +   * Notify aFrame's left/top/right/bottom properties as having (maybe)
    1.44 +   * changed due to a restyle, and therefore possibly wanting an active layer
    1.45 +   * to render that style. Any such marking will time out after a short period.
    1.46 +   */
    1.47 +  static void NotifyOffsetRestyle(nsIFrame* aFrame);
    1.48 +  /**
    1.49 +   * Mark aFrame as being known to have an animation of aProperty.
    1.50 +   * Any such marking will time out after a short period.
    1.51 +   */
    1.52 +  static void NotifyAnimated(nsIFrame* aFrame, nsCSSProperty aProperty);
    1.53 +  /**
    1.54 +   * Notify that a property in the inline style rule of aFrame's element
    1.55 +   * has been modified.
    1.56 +   * This notification is incomplete --- not all modifications to inline
    1.57 +   * style will trigger this.
    1.58 +   */
    1.59 +  static void NotifyInlineStyleRuleModified(nsIFrame* aFrame, nsCSSProperty aProperty);
    1.60 +  /**
    1.61 +   * Return true if aFrame's aProperty style should be considered as being animated
    1.62 +   * for constructing active layers.
    1.63 +   */
    1.64 +  static bool IsStyleAnimated(nsIFrame* aFrame, nsCSSProperty aProperty);
    1.65 +  /**
    1.66 +   * Return true if any of aFrame's offset property styles should be considered
    1.67 +   * as being animated for constructing active layers.
    1.68 +   */
    1.69 +  static bool IsOffsetOrMarginStyleAnimated(nsIFrame* aFrame);
    1.70 +
    1.71 +  /*
    1.72 +   * We track modifications to the content of certain frames (i.e. canvas frames)
    1.73 +   * and use that to make layering decisions.
    1.74 +   */
    1.75 +
    1.76 +  /**
    1.77 +   * Mark aFrame's content as being active. This marking will time out after
    1.78 +   * a short period.
    1.79 +   */
    1.80 +  static void NotifyContentChange(nsIFrame* aFrame);
    1.81 +  /**
    1.82 +   * Return true if this frame's content is still marked as active.
    1.83 +   */
    1.84 +  static bool IsContentActive(nsIFrame* aFrame);
    1.85 +};
    1.86 +
    1.87 +}
    1.88 +
    1.89 +#endif /* ACTIVELAYERTRACKER_H_ */

mercurial