route declaration parsing through subclasses

This commit is contained in:
peterl%netscape.com 1999-08-04 05:08:04 +00:00
parent 8efdd17690
commit c5b1c60850
6 changed files with 27 additions and 84 deletions

View File

@ -200,32 +200,13 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName,
const nsString& aPriority)
{
nsAutoString declString;
nsICSSDeclaration *decl;
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
if ((NS_OK == result) && (nsnull != decl)) {
declString=aPropertyName;
declString.Append(":");
declString.Append(aValue);
declString.Append(aPriority);
declString=aPropertyName;
declString.Append(":");
declString.Append(aValue);
declString.Append(aPriority);
nsICSSParser* css;
result = NS_NewCSSParser(&css);
if (NS_OK == result) {
PRInt32 hint;
nsIURI* baseURL = nsnull;
GetBaseURL(&baseURL);
result = css->ParseAndAppendDeclaration(declString, baseURL, decl, &hint);
NS_IF_RELEASE(baseURL);
if (NS_OK == result) {
result = StylePropertyChanged(aPropertyName, hint);
}
NS_RELEASE(css);
}
NS_RELEASE(decl);
}
return result;
return ParseDeclaration(declString);
}
NS_IMETHODIMP

View File

@ -24,6 +24,7 @@
#include "nsIScriptObjectOwner.h"
class nsICSSDeclaration;
class nsICSSParser;
class nsIURI;
class nsDOMCSSDeclaration : public nsIDOMCSS2Properties,
@ -45,11 +46,10 @@ public:
virtual void DropReference() = 0;
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
PRBool aAllocate) = 0;
virtual nsresult StylePropertyChanged(const nsString& aPropertyName,
PRInt32 aHint) = 0;
virtual nsresult GetParent(nsISupports **aParent) = 0;
virtual nsresult GetBaseURL(nsIURI** aURL) = 0; // get URL that style URLs are realtive to
virtual nsresult ParseDeclaration(const nsString& aDecl) = 0;
virtual nsresult GetParent(nsISupports **aParent) = 0;
protected:
virtual ~nsDOMCSSDeclaration();

View File

@ -200,32 +200,13 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName,
const nsString& aPriority)
{
nsAutoString declString;
nsICSSDeclaration *decl;
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
if ((NS_OK == result) && (nsnull != decl)) {
declString=aPropertyName;
declString.Append(":");
declString.Append(aValue);
declString.Append(aPriority);
declString=aPropertyName;
declString.Append(":");
declString.Append(aValue);
declString.Append(aPriority);
nsICSSParser* css;
result = NS_NewCSSParser(&css);
if (NS_OK == result) {
PRInt32 hint;
nsIURI* baseURL = nsnull;
GetBaseURL(&baseURL);
result = css->ParseAndAppendDeclaration(declString, baseURL, decl, &hint);
NS_IF_RELEASE(baseURL);
if (NS_OK == result) {
result = StylePropertyChanged(aPropertyName, hint);
}
NS_RELEASE(css);
}
NS_RELEASE(decl);
}
return result;
return ParseDeclaration(declString);
}
NS_IMETHODIMP

View File

@ -24,6 +24,7 @@
#include "nsIScriptObjectOwner.h"
class nsICSSDeclaration;
class nsICSSParser;
class nsIURI;
class nsDOMCSSDeclaration : public nsIDOMCSS2Properties,
@ -45,11 +46,10 @@ public:
virtual void DropReference() = 0;
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
PRBool aAllocate) = 0;
virtual nsresult StylePropertyChanged(const nsString& aPropertyName,
PRInt32 aHint) = 0;
virtual nsresult GetParent(nsISupports **aParent) = 0;
virtual nsresult GetBaseURL(nsIURI** aURL) = 0; // get URL that style URLs are realtive to
virtual nsresult ParseDeclaration(const nsString& aDecl) = 0;
virtual nsresult GetParent(nsISupports **aParent) = 0;
protected:
virtual ~nsDOMCSSDeclaration();

View File

@ -200,32 +200,13 @@ nsDOMCSSDeclaration::SetProperty(const nsString& aPropertyName,
const nsString& aPriority)
{
nsAutoString declString;
nsICSSDeclaration *decl;
nsresult result = GetCSSDeclaration(&decl, PR_TRUE);
if ((NS_OK == result) && (nsnull != decl)) {
declString=aPropertyName;
declString.Append(":");
declString.Append(aValue);
declString.Append(aPriority);
declString=aPropertyName;
declString.Append(":");
declString.Append(aValue);
declString.Append(aPriority);
nsICSSParser* css;
result = NS_NewCSSParser(&css);
if (NS_OK == result) {
PRInt32 hint;
nsIURI* baseURL = nsnull;
GetBaseURL(&baseURL);
result = css->ParseAndAppendDeclaration(declString, baseURL, decl, &hint);
NS_IF_RELEASE(baseURL);
if (NS_OK == result) {
result = StylePropertyChanged(aPropertyName, hint);
}
NS_RELEASE(css);
}
NS_RELEASE(decl);
}
return result;
return ParseDeclaration(declString);
}
NS_IMETHODIMP

View File

@ -24,6 +24,7 @@
#include "nsIScriptObjectOwner.h"
class nsICSSDeclaration;
class nsICSSParser;
class nsIURI;
class nsDOMCSSDeclaration : public nsIDOMCSS2Properties,
@ -45,11 +46,10 @@ public:
virtual void DropReference() = 0;
virtual nsresult GetCSSDeclaration(nsICSSDeclaration **aDecl,
PRBool aAllocate) = 0;
virtual nsresult StylePropertyChanged(const nsString& aPropertyName,
PRInt32 aHint) = 0;
virtual nsresult GetParent(nsISupports **aParent) = 0;
virtual nsresult GetBaseURL(nsIURI** aURL) = 0; // get URL that style URLs are realtive to
virtual nsresult ParseDeclaration(const nsString& aDecl) = 0;
virtual nsresult GetParent(nsISupports **aParent) = 0;
protected:
virtual ~nsDOMCSSDeclaration();