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/. */
|
2010-02-21 00:13:11 +03:00
|
|
|
|
|
|
|
#ifndef NS_SMILTARGETIDENTIFIER_H_
|
|
|
|
#define NS_SMILTARGETIDENTIFIER_H_
|
|
|
|
|
2010-05-14 21:04:51 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2010-02-21 00:13:11 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Struct: nsSMILTargetIdentifier
|
|
|
|
*
|
2017-03-21 09:42:17 +03:00
|
|
|
* Tuple of: { Animated Element, Attribute Name }
|
2010-02-21 00:13:11 +03:00
|
|
|
*
|
|
|
|
* Used in nsSMILAnimationController as hash key for mapping an animation
|
|
|
|
* target to the nsSMILCompositor for that target.
|
|
|
|
*
|
|
|
|
* NOTE: Need a nsRefPtr for the element & attribute name, because
|
|
|
|
* nsSMILAnimationController retain its hash table for one sample into the
|
|
|
|
* future, and we need to make sure their target isn't deleted in that time.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct nsSMILTargetIdentifier
|
|
|
|
{
|
|
|
|
nsSMILTargetIdentifier()
|
2012-07-30 18:20:58 +04:00
|
|
|
: mElement(nullptr), mAttributeName(nullptr),
|
2017-03-21 09:42:17 +03:00
|
|
|
mAttributeNamespaceID(kNameSpaceID_Unknown) {}
|
2010-02-21 00:13:11 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool Equals(const nsSMILTargetIdentifier& aOther) const
|
2010-02-21 00:13:11 +03:00
|
|
|
{
|
2010-10-07 23:19:32 +04:00
|
|
|
return (aOther.mElement == mElement &&
|
|
|
|
aOther.mAttributeName == mAttributeName &&
|
2017-03-21 09:42:17 +03:00
|
|
|
aOther.mAttributeNamespaceID == mAttributeNamespaceID);
|
2010-02-21 00:13:11 +03:00
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::dom::Element> mElement;
|
2017-10-03 01:05:19 +03:00
|
|
|
RefPtr<nsAtom> mAttributeName;
|
2017-03-21 09:42:17 +03:00
|
|
|
int32_t mAttributeNamespaceID;
|
2010-02-21 00:13:11 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class: nsSMILWeakTargetIdentifier
|
|
|
|
*
|
|
|
|
* Version of the above struct that uses non-owning pointers. These are kept
|
|
|
|
* private, to ensure that they aren't ever dereferenced (or used at all,
|
|
|
|
* outside of Equals()).
|
|
|
|
*
|
|
|
|
* This is solely for comparisons to determine if a target has changed
|
|
|
|
* from one sample to the next.
|
|
|
|
*/
|
|
|
|
class nsSMILWeakTargetIdentifier
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Trivial constructor
|
|
|
|
nsSMILWeakTargetIdentifier()
|
2017-03-21 09:42:17 +03:00
|
|
|
: mElement(nullptr), mAttributeName(nullptr) {}
|
2010-02-21 00:13:11 +03:00
|
|
|
|
|
|
|
// Allow us to update a weak identifier to match a given non-weak identifier
|
|
|
|
nsSMILWeakTargetIdentifier&
|
|
|
|
operator=(const nsSMILTargetIdentifier& aOther)
|
|
|
|
{
|
|
|
|
mElement = aOther.mElement;
|
|
|
|
mAttributeName = aOther.mAttributeName;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Allow for comparison vs. non-weak identifier
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool Equals(const nsSMILTargetIdentifier& aOther) const
|
2010-02-21 00:13:11 +03:00
|
|
|
{
|
|
|
|
return (aOther.mElement == mElement &&
|
2017-03-21 09:42:17 +03:00
|
|
|
aOther.mAttributeName == mAttributeName);
|
2010-02-21 00:13:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const nsIContent* mElement;
|
2017-10-03 01:05:19 +03:00
|
|
|
const nsAtom* mAttributeName;
|
2010-02-21 00:13:11 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NS_SMILTARGETIDENTIFIER_H_
|