Bug 565826. Use Element in SMIL code as needed. r=dholbert

This commit is contained in:
Boris Zbarsky 2010-05-14 13:04:51 -04:00
Родитель 4399ba2268
Коммит 1316de26e9
10 изменённых файлов: 34 добавлений и 14 удалений

Просмотреть файл

@ -57,6 +57,12 @@ class nsIContent;
class nsIAtom;
class nsAttrValue;
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
enum nsSMILTargetAttrType {
eSMILTargetAttrType_auto,
eSMILTargetAttrType_CSS,
@ -110,7 +116,7 @@ public:
/*
* Returns the target (animated) element.
*/
virtual nsIContent* GetTargetElementContent() = 0;
virtual mozilla::dom::Element* GetTargetElementContent() = 0;
/*
* Returns the name of the target (animated) attribute or property.

Просмотреть файл

@ -43,11 +43,14 @@
#include "nsComponentManagerUtils.h"
#include "nsITimer.h"
#include "nsIContent.h"
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
#include "nsISMILAnimationElement.h"
#include "nsIDOMSVGAnimationElement.h"
#include "nsSMILTimedElement.h"
using namespace mozilla::dom;
//----------------------------------------------------------------------
// nsSMILAnimationController implementation
@ -632,7 +635,7 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation(
nsISMILAnimationElement* aAnimElem, nsSMILTargetIdentifier& aResult)
{
// Look up target (animated) element
nsIContent* targetElem = aAnimElem->GetTargetElementContent();
Element* targetElem = aAnimElem->GetTargetElementContent();
if (!targetElem)
// Animation has no target elem -- skip it.
return PR_FALSE;

Просмотреть файл

@ -46,6 +46,8 @@
#include "nsIContent.h"
#include "nsIDOMElement.h"
using namespace mozilla::dom;
// Helper function
static PRBool
GetCSSComputedValue(nsIContent* aElem,
@ -85,7 +87,7 @@ GetCSSComputedValue(nsIContent* aElem,
// Class Methods
nsSMILCSSProperty::nsSMILCSSProperty(nsCSSProperty aPropID,
nsIContent* aElement)
Element* aElement)
: mPropID(aPropID), mElement(aElement)
{
NS_ABORT_IF_FALSE(IsPropertyAnimatable(mPropID),

Просмотреть файл

@ -48,6 +48,12 @@
class nsIContent;
class nsCSSDeclaration;
namespace mozilla {
namespace dom {
class Element;
} // namespace dom
} // namespace mozilla
/**
* nsSMILCSSProperty: Implements the nsISMILAttr interface for SMIL animations
* that target CSS properties. Represents a particular animation-targeted CSS
@ -61,7 +67,7 @@ public:
* @param aPropID The CSS property we're interested in animating.
* @param aElement The element whose CSS property is being animated.
*/
nsSMILCSSProperty(nsCSSProperty aPropID, nsIContent* aElement);
nsSMILCSSProperty(nsCSSProperty aPropID, mozilla::dom::Element* aElement);
// nsISMILAttr methods
virtual nsresult ValueFromString(const nsAString& aStr,
@ -88,7 +94,7 @@ protected:
// alive for my lifetime because a nsISMILAttr (like me) only lives as long
// as the Compositing step, and DOM elements don't get a chance to die during
// that time.
nsIContent* mElement;
mozilla::dom::Element* mElement;
};
#endif // NS_SMILCSSPROPERTY_H_

Просмотреть файл

@ -66,7 +66,7 @@ public:
* interested in animating.
* @param aElement The element whose attribute is being animated.
*/
nsSMILMappedAttribute(nsCSSProperty aPropID, nsIContent* aElement) :
nsSMILMappedAttribute(nsCSSProperty aPropID, mozilla::dom::Element* aElement) :
nsSMILCSSProperty(aPropID, aElement) {}
// nsISMILAttr methods

Просмотреть файл

@ -38,7 +38,7 @@
#ifndef NS_SMILTARGETIDENTIFIER_H_
#define NS_SMILTARGETIDENTIFIER_H_
#include "nsIContent.h"
#include "mozilla/dom/Element.h"
#include "nsAutoPtr.h"
#include "prtypes.h"
@ -67,7 +67,7 @@ struct nsSMILTargetIdentifier
aOther.mIsCSS == mIsCSS);
}
nsRefPtr<nsIContent> mElement;
nsRefPtr<mozilla::dom::Element> mElement;
nsRefPtr<nsIAtom> mAttributeName; // XXX need to consider namespaces here
PRPackedBool mIsCSS;
};

Просмотреть файл

@ -43,6 +43,8 @@
#include "nsSMILAnimationFunction.h"
#include "nsISMILAttr.h"
using namespace mozilla::dom;
//----------------------------------------------------------------------
// nsISupports methods
@ -135,7 +137,7 @@ nsSVGAnimationElement::HasAnimAttr(nsIAtom* aAttName) const
return HasAttr(kNameSpaceID_None, aAttName);
}
nsIContent*
Element*
nsSVGAnimationElement::GetTargetElementContent()
{
if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) {

Просмотреть файл

@ -91,7 +91,7 @@ public:
virtual const nsAttrValue* GetAnimAttr(nsIAtom* aName) const;
virtual PRBool GetAnimAttr(nsIAtom* aAttName, nsAString& aResult) const;
virtual PRBool HasAnimAttr(nsIAtom* aAttName) const;
virtual nsIContent* GetTargetElementContent();
virtual mozilla::dom::Element* GetTargetElementContent();
virtual nsIAtom* GetTargetAttributeName() const;
virtual nsSMILTargetAttrType GetTargetAttributeType() const;
virtual nsSMILTimedElement& TimedElement();

Просмотреть файл

@ -235,7 +235,7 @@ NS_SMILEnabled()
}
#endif // MOZ_SMIL
nsIContent*
Element*
nsSVGUtils::GetParentElement(nsIContent *aContent)
{
// XXXbz I _think_ this is right. We want to be using the binding manager
@ -250,12 +250,13 @@ nsSVGUtils::GetParentElement(nsIContent *aContent)
// if we have a binding manager -- do we have an anonymous parent?
nsIContent *result = bindingManager->GetInsertionParent(aContent);
if (result) {
return result;
return result->AsElement();
}
}
// otherewise use the explicit one, whether it's null or not...
return aContent->GetParent();
nsIContent* parent = aContent->GetParent();
return parent ? parent->AsElement() : nsnull;
}
float

Просмотреть файл

@ -210,7 +210,7 @@ public:
/*
* Get the parent element of an nsIContent
*/
static nsIContent *GetParentElement(nsIContent *aContent);
static mozilla::dom::Element *GetParentElement(nsIContent *aContent);
/*
* Get a font-size (em) of an nsIContent