mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
route declaration parsing through subclasses
This commit is contained in:
parent
8efdd17690
commit
c5b1c60850
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user