added inline style rule accessor

This commit is contained in:
peterl%netscape.com 1998-12-02 00:34:31 +00:00
Родитель 70114e4809
Коммит 12fda54c43
5 изменённых файлов: 80 добавлений и 21 удалений

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

@ -810,15 +810,36 @@ nsGenericHTMLElement::GetClass(nsIAtom*& aResult) const
}
nsresult
nsGenericHTMLElement::GetStyleRule(nsIStyleRule*& aResult)
nsGenericHTMLElement::GetContentStyleRule(nsIStyleRule*& aResult)
{
nsIStyleRule* result = nsnull;
nsresult result = NS_ERROR_NULL_POINTER;
nsIStyleRule* rule = nsnull;
if (nsnull != mAttributes) {
mAttributes->QueryInterface(kIStyleRuleIID, (void**)&result);
result = mAttributes->QueryInterface(kIStyleRuleIID, (void**)&rule);
}
aResult = result;
return NS_OK;
aResult = rule;
return result;
}
nsresult
nsGenericHTMLElement::GetInlineStyleRule(nsIStyleRule*& aResult)
{
nsresult result = NS_ERROR_NULL_POINTER;
nsIStyleRule* rule = nsnull;
if (nsnull != mAttributes) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE == mAttributes->GetAttribute(nsHTMLAtoms::style, value)) {
if (eHTMLUnit_ISupports == value.GetUnit()) {
nsISupports* supports = value.GetISupportsValue();
result = supports->QueryInterface(kIStyleRuleIID, (void**)&rule);
NS_RELEASE(supports);
}
}
}
aResult = rule;
return result;
}
void

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

@ -85,7 +85,8 @@ public:
nsresult GetID(nsIAtom*& aResult) const;
nsresult SetClass(nsIAtom* aClass);
nsresult GetClass(nsIAtom*& aResult) const;
nsresult GetStyleRule(nsIStyleRule*& aResult);
nsresult GetContentStyleRule(nsIStyleRule*& aResult);
nsresult GetInlineStyleRule(nsIStyleRule*& aResult);
nsresult ToHTMLString(nsString& aResult) const;
nsresult ToHTML(FILE* out) const;
@ -420,8 +421,11 @@ public:
NS_IMETHOD GetClass(nsIAtom*& aResult) const { \
return _g.GetClass(aResult); \
} \
NS_IMETHOD GetStyleRule(nsIStyleRule*& aResult) { \
return _g.GetStyleRule(aResult); \
NS_IMETHOD GetContentStyleRule(nsIStyleRule*& aResult) { \
return _g.GetContentStyleRule(aResult); \
} \
NS_IMETHOD GetInlineStyleRule(nsIStyleRule*& aResult) { \
return _g.GetInlineStyleRule(aResult); \
} \
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
return _g.ToHTMLString(aResult); \
@ -469,7 +473,8 @@ public:
NS_IMETHOD GetClass(nsIAtom*& aResult) const { \
return _g.GetClass(aResult); \
} \
NS_IMETHOD GetStyleRule(nsIStyleRule*& aResult); \
NS_IMETHOD GetContentStyleRule(nsIStyleRule*& aResult); \
NS_IMETHOD GetInlineStyleRule(nsIStyleRule*& aResult); \
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
return _g.ToHTMLString(aResult); \
} \

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

@ -188,7 +188,11 @@ struct nsGenericDOMDataNode {
aResult = nsnull;
return NS_OK;
}
nsresult GetStyleRule(nsIStyleRule*& aResult) {
nsresult GetContentStyleRule(nsIStyleRule*& aResult) {
aResult = nsnull;
return NS_OK;
}
nsresult GetInlineStyleRule(nsIStyleRule*& aResult) {
aResult = nsnull;
return NS_OK;
}
@ -493,8 +497,11 @@ struct nsGenericDOMDataNode {
NS_IMETHOD GetClass(nsIAtom*& aResult) const { \
return _g.GetClass(aResult); \
} \
NS_IMETHOD GetStyleRule(nsIStyleRule*& aResult) { \
return _g.GetStyleRule(aResult); \
NS_IMETHOD GetContentStyleRule(nsIStyleRule*& aResult) { \
return _g.GetContentStyleRule(aResult); \
} \
NS_IMETHOD GetInlineStyleRule(nsIStyleRule*& aResult) { \
return _g.GetInlineStyleRule(aResult); \
} \
NS_IMETHOD ToHTMLString(nsString& aResult) const; \
NS_IMETHOD ToHTML(FILE* out) const; \

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

@ -810,15 +810,36 @@ nsGenericHTMLElement::GetClass(nsIAtom*& aResult) const
}
nsresult
nsGenericHTMLElement::GetStyleRule(nsIStyleRule*& aResult)
nsGenericHTMLElement::GetContentStyleRule(nsIStyleRule*& aResult)
{
nsIStyleRule* result = nsnull;
nsresult result = NS_ERROR_NULL_POINTER;
nsIStyleRule* rule = nsnull;
if (nsnull != mAttributes) {
mAttributes->QueryInterface(kIStyleRuleIID, (void**)&result);
result = mAttributes->QueryInterface(kIStyleRuleIID, (void**)&rule);
}
aResult = result;
return NS_OK;
aResult = rule;
return result;
}
nsresult
nsGenericHTMLElement::GetInlineStyleRule(nsIStyleRule*& aResult)
{
nsresult result = NS_ERROR_NULL_POINTER;
nsIStyleRule* rule = nsnull;
if (nsnull != mAttributes) {
nsHTMLValue value;
if (NS_CONTENT_ATTR_HAS_VALUE == mAttributes->GetAttribute(nsHTMLAtoms::style, value)) {
if (eHTMLUnit_ISupports == value.GetUnit()) {
nsISupports* supports = value.GetISupportsValue();
result = supports->QueryInterface(kIStyleRuleIID, (void**)&rule);
NS_RELEASE(supports);
}
}
}
aResult = rule;
return result;
}
void

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

@ -85,7 +85,8 @@ public:
nsresult GetID(nsIAtom*& aResult) const;
nsresult SetClass(nsIAtom* aClass);
nsresult GetClass(nsIAtom*& aResult) const;
nsresult GetStyleRule(nsIStyleRule*& aResult);
nsresult GetContentStyleRule(nsIStyleRule*& aResult);
nsresult GetInlineStyleRule(nsIStyleRule*& aResult);
nsresult ToHTMLString(nsString& aResult) const;
nsresult ToHTML(FILE* out) const;
@ -420,8 +421,11 @@ public:
NS_IMETHOD GetClass(nsIAtom*& aResult) const { \
return _g.GetClass(aResult); \
} \
NS_IMETHOD GetStyleRule(nsIStyleRule*& aResult) { \
return _g.GetStyleRule(aResult); \
NS_IMETHOD GetContentStyleRule(nsIStyleRule*& aResult) { \
return _g.GetContentStyleRule(aResult); \
} \
NS_IMETHOD GetInlineStyleRule(nsIStyleRule*& aResult) { \
return _g.GetInlineStyleRule(aResult); \
} \
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
return _g.ToHTMLString(aResult); \
@ -469,7 +473,8 @@ public:
NS_IMETHOD GetClass(nsIAtom*& aResult) const { \
return _g.GetClass(aResult); \
} \
NS_IMETHOD GetStyleRule(nsIStyleRule*& aResult); \
NS_IMETHOD GetContentStyleRule(nsIStyleRule*& aResult); \
NS_IMETHOD GetInlineStyleRule(nsIStyleRule*& aResult); \
NS_IMETHOD ToHTMLString(nsString& aResult) const { \
return _g.ToHTMLString(aResult); \
} \