Bug 743438 - Move some style rule functions from nsIContent to Element; r=mounir sr=bz

This commit is contained in:
Ms2ger 2012-04-14 15:09:19 +02:00
parent cd459b00c5
commit 66a517cac0
8 changed files with 60 additions and 109 deletions

View File

@ -88,9 +88,9 @@ namespace dom {
class Link;
// IID for the dom::Element interface
#define NS_ELEMENT_IID \
{ 0xa1588efb, 0x5a84, 0x49cd, \
{ 0x99, 0x1a, 0xac, 0x84, 0x9d, 0x92, 0x05, 0x0f } }
#define NS_ELEMENT_IID \
{ 0xab6554b0, 0xb675, 0x45a7, \
{ 0xac, 0x23, 0x44, 0x1c, 0x94, 0x5f, 0x3b, 0xee } }
class Element : public nsIContent
{
@ -171,6 +171,53 @@ public:
*/
void ClearStyleStateLocks();
/**
* Get the inline style rule, if any, for this element.
*/
virtual css::StyleRule* GetInlineStyleRule() = 0;
/**
* Set the inline style rule for this element. This will send an appropriate
* AttributeChanged notification if aNotify is true.
*/
virtual nsresult SetInlineStyleRule(css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify) = 0;
/**
* Get the SMIL override style rule for this element. If the rule hasn't been
* created, this method simply returns null.
*/
virtual css::StyleRule* GetSMILOverrideStyleRule() = 0;
/**
* Set the SMIL override style rule for this element. If aNotify is true, this
* method will notify the document's pres context, so that the style changes
* will be noticed.
*/
virtual nsresult SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
bool aNotify) = 0;
/**
* Returns a new nsISMILAttr that allows the caller to animate the given
* attribute on this element.
*
* The CALLER OWNS the result and is responsible for deleting it.
*/
virtual nsISMILAttr* GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName) = 0;
/**
* Get the SMIL override style for this element. This is a style declaration
* that is applied *after* the inline style, and it can be used e.g. to store
* animated style values.
*
* Note: This method is analogous to the 'GetStyle' method in
* nsGenericHTMLElement and nsStyledElement.
*
* TODO: Bug 744157 - All callers QI to nsICSSDeclaration.
*/
virtual nsIDOMCSSStyleDeclaration* GetSMILOverrideStyle() = 0;
protected:
/**
* Method to get the _intrinsic_ content state of this element. This is the

View File

@ -77,8 +77,8 @@ enum nsLinkState {
// IID for the nsIContent interface
#define NS_ICONTENT_IID \
{ 0x94671671, 0x9e1b, 0x447a, \
{ 0xad, 0xb7, 0xc3, 0x2e, 0x05, 0x6a, 0x96, 0xc9 } }
{ 0xa887c108, 0xc25e, 0x42ab, \
{ 0x87, 0xef, 0xad, 0x4b, 0xee, 0x50, 0x28, 0x28 } }
/**
* A node of content in a document's content model. This interface
@ -793,22 +793,6 @@ public:
*/
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0;
/**
* Get the inline style rule, if any, for this content node
*/
virtual mozilla::css::StyleRule* GetInlineStyleRule() = 0;
/**
* Set the inline style rule for this node. This will send an
* appropriate AttributeChanged notification if aNotify is true. If
* a serialized form of aStyleRule is available, a pointer to it
* should be passed in aSerialized. Otherwise, aSerialized should
* be null.
*/
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify) = 0;
/**
* Is the attribute named stored in the mapped attributes?
*
@ -875,39 +859,6 @@ public:
mPrimaryFrame = aFrame;
}
/*
* Returns a new nsISMILAttr that allows the caller to animate the given
* attribute on this element.
*
* The CALLER OWNS the result and is responsible for deleting it.
*/
virtual nsISMILAttr* GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName) = 0;
/**
* Get the SMIL override style for this content node. This is a style
* declaration that is applied *after* the inline style, and it can be used
* e.g. to store animated style values.
*
* Note: This method is analogous to the 'GetStyle' method in
* nsGenericHTMLElement and nsStyledElement.
*/
virtual nsIDOMCSSStyleDeclaration* GetSMILOverrideStyle() = 0;
/**
* Get the SMIL override style rule for this content node. If the rule
* hasn't been created (or if this nsIContent object doesn't support SMIL
* override style), this method simply returns null.
*/
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule() = 0;
/**
* Set the SMIL override style rule for this node. If aNotify is true, this
* method will notify the document's pres context, so that the style changes
* will be noticed.
*/
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
bool aNotify) = 0;
nsresult LookupNamespaceURIInternal(const nsAString& aNamespacePrefix,
nsAString& aNamespaceURI) const;

View File

@ -949,41 +949,6 @@ nsGenericDOMDataNode::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
return NS_OK;
}
nsIDOMCSSStyleDeclaration*
nsGenericDOMDataNode::GetSMILOverrideStyle()
{
return nsnull;
}
css::StyleRule*
nsGenericDOMDataNode::GetSMILOverrideStyleRule()
{
return nsnull;
}
nsresult
nsGenericDOMDataNode::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
bool aNotify)
{
NS_NOTREACHED("How come we're setting SMILOverrideStyle on a non-element?");
return NS_ERROR_UNEXPECTED;
}
css::StyleRule*
nsGenericDOMDataNode::GetInlineStyleRule()
{
return nsnull;
}
NS_IMETHODIMP
nsGenericDOMDataNode::SetInlineStyleRule(css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify)
{
NS_NOTREACHED("How come we're setting inline style on a non-element?");
return NS_ERROR_UNEXPECTED;
}
NS_IMETHODIMP_(bool)
nsGenericDOMDataNode::IsAttributeMapped(const nsIAtom* aAttribute) const
{

View File

@ -226,15 +226,6 @@ public:
virtual void DestroyContent();
virtual void SaveSubtreeState();
virtual nsISMILAttr* GetAnimatedAttr(PRInt32 /*aNamespaceID*/, nsIAtom* /*aName*/)
{
return nsnull;
}
virtual nsIDOMCSSStyleDeclaration* GetSMILOverrideStyle();
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule();
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
bool aNotify);
#ifdef DEBUG
virtual void List(FILE* out, PRInt32 aIndent) const;
virtual void DumpContent(FILE* out, PRInt32 aIndent, bool aDumpAll) const;
@ -247,9 +238,6 @@ public:
virtual nsIAtom* DoGetID() const;
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized, bool aNotify);
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const;

View File

@ -3610,7 +3610,7 @@ nsGenericElement::GetInlineStyleRule()
return nsnull;
}
NS_IMETHODIMP
nsresult
nsGenericElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify)

View File

@ -368,9 +368,9 @@ public:
virtual const nsAttrValue* DoGetClasses() const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify);
virtual nsresult SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify);
NS_IMETHOD_(bool)
IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,

View File

@ -161,7 +161,7 @@ nsStyledElementNotElementCSSInlineStyle::AfterSetAttr(PRInt32 aNamespaceID,
aNotify);
}
NS_IMETHODIMP
nsresult
nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify)

View File

@ -74,9 +74,9 @@ public:
virtual const nsAttrValue* DoGetClasses() const;
virtual mozilla::css::StyleRule* GetInlineStyleRule();
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify);
virtual nsresult SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
const nsAString* aSerialized,
bool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
bool aNotify);