2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-10-03 01:37:25 +04:00
|
|
|
|
|
|
|
/* representation of a SMIL-animatable CSS property on an element */
|
|
|
|
|
2019-01-25 11:16:09 +03:00
|
|
|
#ifndef mozilla_SMILCSSProperty_h
|
|
|
|
#define mozilla_SMILCSSProperty_h
|
2009-10-03 01:37:25 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2019-01-25 06:24:01 +03:00
|
|
|
#include "mozilla/SMILAttr.h"
|
2017-10-03 01:05:19 +03:00
|
|
|
#include "nsAtom.h"
|
2016-08-17 04:37:48 +03:00
|
|
|
#include "nsCSSPropertyID.h"
|
2009-10-03 01:37:25 +04:00
|
|
|
#include "nsCSSValue.h"
|
|
|
|
|
2010-05-14 21:04:51 +04:00
|
|
|
namespace mozilla {
|
2018-03-22 21:20:41 +03:00
|
|
|
class ComputedStyle;
|
2010-05-14 21:04:51 +04:00
|
|
|
namespace dom {
|
|
|
|
class Element;
|
|
|
|
} // namespace dom
|
|
|
|
|
2009-10-03 01:37:25 +04:00
|
|
|
/**
|
2019-01-25 06:24:01 +03:00
|
|
|
* SMILCSSProperty: Implements the SMILAttr interface for SMIL animations
|
2009-10-03 01:37:25 +04:00
|
|
|
* that target CSS properties. Represents a particular animation-targeted CSS
|
|
|
|
* property on a particular element.
|
|
|
|
*/
|
2019-01-25 06:24:01 +03:00
|
|
|
class SMILCSSProperty : public SMILAttr {
|
2009-10-03 01:37:25 +04:00
|
|
|
public:
|
|
|
|
/**
|
2019-01-08 10:55:14 +03:00
|
|
|
* Constructs a new SMILCSSProperty.
|
2009-10-03 01:37:25 +04:00
|
|
|
* @param aPropID The CSS property we're interested in animating.
|
|
|
|
* @param aElement The element whose CSS property is being animated.
|
2018-03-23 16:49:21 +03:00
|
|
|
* @param aBaseComputedStyle The ComputedStyle to use when getting the base
|
2018-03-22 21:20:41 +03:00
|
|
|
* value. If this is nullptr and GetBaseValue is
|
2019-01-23 16:48:08 +03:00
|
|
|
* called, an empty SMILValue initialized with
|
2018-12-27 20:02:38 +03:00
|
|
|
* the SMILCSSValueType will be returned.
|
2009-10-03 01:37:25 +04:00
|
|
|
*/
|
2019-01-08 10:55:14 +03:00
|
|
|
SMILCSSProperty(nsCSSPropertyID aPropID, dom::Element* aElement,
|
|
|
|
ComputedStyle* aBaseComputedStyle);
|
2009-10-03 01:37:25 +04:00
|
|
|
|
2019-01-25 06:24:01 +03:00
|
|
|
// SMILAttr methods
|
2009-10-03 01:37:25 +04:00
|
|
|
virtual nsresult ValueFromString(
|
2019-01-08 10:55:14 +03:00
|
|
|
const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement,
|
2019-01-23 16:48:08 +03:00
|
|
|
SMILValue& aValue, bool& aPreventCachingOfSandwich) const override;
|
|
|
|
virtual SMILValue GetBaseValue() const override;
|
|
|
|
virtual nsresult SetAnimValue(const SMILValue& aValue) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ClearAnimValue() override;
|
2009-10-03 01:37:25 +04:00
|
|
|
|
|
|
|
/**
|
2011-10-17 18:59:28 +04:00
|
|
|
* Utility method - returns true if the given property is supported for
|
2009-10-03 01:37:25 +04:00
|
|
|
* SMIL animation.
|
|
|
|
*
|
|
|
|
* @param aProperty The property to check for animation support.
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if the given property is supported for SMIL animation, or
|
|
|
|
* false otherwise
|
2009-10-03 01:37:25 +04:00
|
|
|
*/
|
2018-03-28 18:34:34 +03:00
|
|
|
static bool IsPropertyAnimatable(nsCSSPropertyID aPropID);
|
2009-10-03 01:37:25 +04:00
|
|
|
|
|
|
|
protected:
|
2016-08-17 04:37:48 +03:00
|
|
|
nsCSSPropertyID mPropID;
|
2009-10-03 01:37:25 +04:00
|
|
|
// Using non-refcounted pointer for mElement -- we know mElement will stay
|
2019-01-25 06:24:01 +03:00
|
|
|
// alive for my lifetime because a SMILAttr (like me) only lives as long
|
2009-10-03 01:37:25 +04:00
|
|
|
// as the Compositing step, and DOM elements don't get a chance to die during
|
|
|
|
// that time.
|
2019-01-08 10:55:14 +03:00
|
|
|
dom::Element* mElement;
|
2017-04-03 10:49:10 +03:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
// The style to use when fetching base styles.
|
|
|
|
//
|
2019-01-25 06:24:01 +03:00
|
|
|
// As with mElement, since a SMILAttr only lives as long as the
|
2017-04-03 10:49:10 +03:00
|
|
|
// compositing step and since ComposeAttribute holds an owning reference to
|
2018-03-23 16:49:21 +03:00
|
|
|
// the base ComputedStyle, we can use a non-owning reference here.
|
2019-01-08 10:55:14 +03:00
|
|
|
ComputedStyle* mBaseComputedStyle;
|
2009-10-03 01:37:25 +04:00
|
|
|
};
|
|
|
|
|
2019-01-08 10:55:14 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2019-01-25 11:16:09 +03:00
|
|
|
#endif // mozilla_SMILCSSProperty_h
|