dom/smil/nsISMILAttr.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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef NS_ISMILATTR_H_
michael@0 7 #define NS_ISMILATTR_H_
michael@0 8
michael@0 9 #include "nscore.h"
michael@0 10
michael@0 11 class nsSMILValue;
michael@0 12 class nsISMILType;
michael@0 13 class nsIContent;
michael@0 14 class nsAString;
michael@0 15
michael@0 16 namespace mozilla {
michael@0 17 namespace dom {
michael@0 18 class SVGAnimationElement;
michael@0 19 }
michael@0 20 }
michael@0 21
michael@0 22 ////////////////////////////////////////////////////////////////////////
michael@0 23 // nsISMILAttr: A variable targeted by SMIL for animation and can therefore have
michael@0 24 // an underlying (base) value and an animated value For example, an attribute of
michael@0 25 // a particular SVG element.
michael@0 26 //
michael@0 27 // These objects only exist during the compositing phase of SMIL animation
michael@0 28 // calculations. They have a single owner who is responsible for deleting the
michael@0 29 // object.
michael@0 30
michael@0 31 class nsISMILAttr
michael@0 32 {
michael@0 33 public:
michael@0 34 /**
michael@0 35 * Creates a new nsSMILValue for this attribute from a string. The string is
michael@0 36 * parsed in the context of this attribute so that context-dependent values
michael@0 37 * such as em-based units can be resolved into a canonical form suitable for
michael@0 38 * animation (including interpolation etc.).
michael@0 39 *
michael@0 40 * @param aStr A string defining the new value to be created.
michael@0 41 * @param aSrcElement The source animation element. This may be needed to
michael@0 42 * provided additional context data such as for
michael@0 43 * animateTransform where the 'type' attribute is needed to
michael@0 44 * parse the value.
michael@0 45 * @param[out] aValue Outparam for storing the parsed value.
michael@0 46 * @param[out] aPreventCachingOfSandwich
michael@0 47 * Outparam to indicate whether the attribute contains
michael@0 48 * dependencies on its context that should prevent the
michael@0 49 * result of the animation sandwich from being cached and
michael@0 50 * reused in future samples.
michael@0 51 * @return NS_OK on success or an error code if creation failed.
michael@0 52 */
michael@0 53 virtual nsresult ValueFromString(const nsAString& aStr,
michael@0 54 const mozilla::dom::SVGAnimationElement* aSrcElement,
michael@0 55 nsSMILValue& aValue,
michael@0 56 bool& aPreventCachingOfSandwich) const = 0;
michael@0 57
michael@0 58 /**
michael@0 59 * Gets the underlying value of this attribute.
michael@0 60 *
michael@0 61 * @return an nsSMILValue object. returned_object.IsNull() will be true if an
michael@0 62 * error occurred.
michael@0 63 */
michael@0 64 virtual nsSMILValue GetBaseValue() const = 0;
michael@0 65
michael@0 66 /**
michael@0 67 * Clears the animated value of this attribute.
michael@0 68 *
michael@0 69 * NOTE: The animation target is not guaranteed to be in a document when this
michael@0 70 * method is called. (See bug 523188)
michael@0 71 */
michael@0 72 virtual void ClearAnimValue() = 0;
michael@0 73
michael@0 74 /**
michael@0 75 * Sets the presentation value of this attribute.
michael@0 76 *
michael@0 77 * @param aValue The value to set.
michael@0 78 * @return NS_OK on success or an error code if setting failed.
michael@0 79 */
michael@0 80 virtual nsresult SetAnimValue(const nsSMILValue& aValue) = 0;
michael@0 81
michael@0 82 /**
michael@0 83 * Returns the targeted content node, for any nsISMILAttr implementations
michael@0 84 * that want to expose that to the animation logic. Otherwise, returns
michael@0 85 * null.
michael@0 86 *
michael@0 87 * @return the targeted content node, if this nsISMILAttr implementation
michael@0 88 * wishes to make it avaiable. Otherwise, nullptr.
michael@0 89 */
michael@0 90 virtual const nsIContent* GetTargetNode() const { return nullptr; }
michael@0 91
michael@0 92 /**
michael@0 93 * Virtual destructor, to make sure subclasses can clean themselves up.
michael@0 94 */
michael@0 95 virtual ~nsISMILAttr() {}
michael@0 96 };
michael@0 97
michael@0 98 #endif // NS_ISMILATTR_H_

mercurial