dom/smil/nsSMILCSSProperty.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /* representation of a SMIL-animatable CSS property on an element */
     8 #ifndef NS_SMILCSSPROPERTY_H_
     9 #define NS_SMILCSSPROPERTY_H_
    11 #include "mozilla/Attributes.h"
    12 #include "nsISMILAttr.h"
    13 #include "nsIAtom.h"
    14 #include "nsCSSProperty.h"
    15 #include "nsCSSValue.h"
    17 namespace mozilla {
    18 namespace dom {
    19 class Element;
    20 } // namespace dom
    21 } // namespace mozilla
    23 /**
    24  * nsSMILCSSProperty: Implements the nsISMILAttr interface for SMIL animations
    25  * that target CSS properties.  Represents a particular animation-targeted CSS
    26  * property on a particular element.
    27  */
    28 class nsSMILCSSProperty : public nsISMILAttr
    29 {
    30 public:
    31   /**
    32    * Constructs a new nsSMILCSSProperty.
    33    * @param  aPropID   The CSS property we're interested in animating.
    34    * @param  aElement  The element whose CSS property is being animated.
    35    */
    36   nsSMILCSSProperty(nsCSSProperty aPropID, mozilla::dom::Element* aElement);
    38   // nsISMILAttr methods
    39   virtual nsresult ValueFromString(const nsAString& aStr,
    40                                    const mozilla::dom::SVGAnimationElement* aSrcElement,
    41                                    nsSMILValue& aValue,
    42                                    bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE;
    43   virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE;
    44   virtual nsresult    SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE;
    45   virtual void        ClearAnimValue() MOZ_OVERRIDE;
    47   /**
    48    * Utility method - returns true if the given property is supported for
    49    * SMIL animation.
    50    *
    51    * @param   aProperty  The property to check for animation support.
    52    * @return  true if the given property is supported for SMIL animation, or
    53    *          false otherwise
    54    */
    55   static bool IsPropertyAnimatable(nsCSSProperty aPropID);
    57 protected:
    58   nsCSSProperty mPropID;
    59   // Using non-refcounted pointer for mElement -- we know mElement will stay
    60   // alive for my lifetime because a nsISMILAttr (like me) only lives as long
    61   // as the Compositing step, and DOM elements don't get a chance to die during
    62   // that time.
    63   mozilla::dom::Element*   mElement;
    64 };
    66 #endif // NS_SMILCSSPROPERTY_H_

mercurial