зеркало из https://github.com/mozilla/pjs.git
Use property ids from the property list, as long as we're using preprocessing
to create all the Set/Get* functions for nsIDOMCSS2Properties. Bug 243728, r+sr=dbaron
This commit is contained in:
Родитель
dd87aab226
Коммит
9e0ffd1c3c
|
@ -1,59 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = content
|
||||
|
||||
EXPORTS = \
|
||||
nsICSSLoader.h \
|
||||
nsICSSParser.h \
|
||||
nsICSSPseudoComparator.h \
|
||||
nsICSSStyleSheet.h \
|
||||
nsICSSLoaderObserver.h \
|
||||
nsIComputedDOMStyle.h \
|
||||
nsIMediaList.h \
|
||||
nsStyleUtil.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsCSSProperty.h"
|
||||
|
||||
class nsICSSStyleRule;
|
||||
class nsICSSStyleSheet;
|
||||
|
@ -96,7 +97,7 @@ public:
|
|||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult) = 0;
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsAString& aPropName,
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsIComputedDOMStyle_h___
|
||||
#define nsIComputedDOMStyle_h___
|
||||
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
|
||||
class nsIDOMElement;
|
||||
class nsIPresShell;
|
||||
|
||||
#define NS_ICOMPUTEDDOMSTYLE_IID \
|
||||
{ 0x5f0197a1, 0xa873, 0x44e5, \
|
||||
{0x96, 0x31, 0xac, 0xd6, 0xca, 0xb4, 0xf1, 0xe0 } }
|
||||
|
||||
class nsIComputedDOMStyle : public nsIDOMCSSStyleDeclaration
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMPUTEDDOMSTYLE_IID)
|
||||
|
||||
NS_IMETHOD Init(nsIDOMElement *aElement, const nsAString& aPseudoElt,
|
||||
nsIPresShell *aPresShell) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewComputedDOMStyle(nsIComputedDOMStyle** aComputedStyle);
|
||||
|
||||
#endif /* nsIComputedDOMStyle_h___ */
|
|
@ -120,7 +120,7 @@ public:
|
|||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult);
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsAString& aPropName,
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
|
@ -774,7 +774,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
|
|||
//in the decl, then ignore the !important. It should either fail to
|
||||
//parse this or do !important correctly....
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseProperty(const nsAString& aPropName,
|
||||
CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
|
@ -804,10 +804,9 @@ CSSParserImpl::ParseProperty(const nsAString& aPropName,
|
|||
mSection = eCSSSection_General;
|
||||
nsresult errorCode = NS_OK;
|
||||
|
||||
nsCSSProperty propID = nsCSSProps::LookupProperty(aPropName);
|
||||
if (eCSSProperty_UNKNOWN == propID) { // unknown property
|
||||
if (eCSSProperty_UNKNOWN == aPropID) { // unknown property
|
||||
REPORT_UNEXPECTED(NS_LITERAL_STRING("Unknown property '") +
|
||||
aPropName +
|
||||
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)) +
|
||||
NS_LITERAL_STRING("'. Declaration dropped."));
|
||||
OUTPUT_ERROR();
|
||||
ReleaseScanner();
|
||||
|
@ -818,15 +817,15 @@ CSSParserImpl::ParseProperty(const nsAString& aPropName,
|
|||
mTempData.AssertInitialState();
|
||||
aDeclaration->ExpandTo(&mData);
|
||||
nsresult result = NS_OK;
|
||||
if (ParseProperty(errorCode, propID)) {
|
||||
TransferTempData(aDeclaration, propID, PR_FALSE, aChanged);
|
||||
if (ParseProperty(errorCode, aPropID)) {
|
||||
TransferTempData(aDeclaration, aPropID, PR_FALSE, aChanged);
|
||||
} else {
|
||||
REPORT_UNEXPECTED(
|
||||
NS_LITERAL_STRING("Error in parsing value for property '") +
|
||||
aPropName +
|
||||
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)) +
|
||||
NS_LITERAL_STRING("'. Declaration dropped."));
|
||||
OUTPUT_ERROR();
|
||||
ClearTempData(propID);
|
||||
ClearTempData(aPropID);
|
||||
NS_ASSERTION(errorCode != nsresult(-1), "-1 is no longer used for EOF");
|
||||
result = errorCode;
|
||||
}
|
||||
|
|
|
@ -124,6 +124,7 @@ nsComputedDOMStyle::Shutdown()
|
|||
// QueryInterface implementation for nsComputedDOMStyle
|
||||
NS_INTERFACE_MAP_BEGIN(nsComputedDOMStyle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIComputedDOMStyle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties, &mInner)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties, &mInner)
|
||||
|
@ -204,6 +205,26 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComputedDOMStyle::GetPropertyValue(const nsCSSProperty aPropID,
|
||||
nsAString& aValue)
|
||||
{
|
||||
// This is mostly to avoid code duplication with GetPropertyCSSValue(); if
|
||||
// perf ever becomes an issue here (doubtful), we can look into changing
|
||||
// this.
|
||||
return GetPropertyValue(
|
||||
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)),
|
||||
aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComputedDOMStyle::SetPropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComputedDOMStyle::GetCssText(nsAString& aCssText)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,8 @@ public:
|
|||
const nsAString& aPseudoElt,
|
||||
nsIPresShell *aPresShell);
|
||||
|
||||
NS_DECL_NSICSSDECLARATION
|
||||
|
||||
NS_DECL_NSIDOMCSSSTYLEDECLARATION
|
||||
|
||||
nsComputedDOMStyle();
|
||||
|
|
|
@ -61,6 +61,7 @@ nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
|
|||
|
||||
// QueryInterface implementation for nsDOMCSSDeclaration
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMCSSDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties, &mInner)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties, &mInner)
|
||||
|
@ -68,6 +69,38 @@ NS_INTERFACE_MAP_BEGIN(nsDOMCSSDeclaration)
|
|||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetPropertyValue(const nsCSSProperty aPropID,
|
||||
nsAString& aValue)
|
||||
{
|
||||
NS_PRECONDITION(aPropID != eCSSProperty_UNKNOWN,
|
||||
"Should never pass eCSSProperty_UNKNOWN around");
|
||||
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aValue.Truncate();
|
||||
if (decl) {
|
||||
result = decl->GetValue(aPropID, aValue);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::SetPropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
if (aValue.IsEmpty()) {
|
||||
// If the new value of the property is an empty string we remove the
|
||||
// property.
|
||||
return RemoveProperty(aPropID);
|
||||
}
|
||||
|
||||
return ParsePropertyValue(aPropID, aValue);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetCssText(nsAString& aCssText)
|
||||
{
|
||||
|
@ -133,16 +166,13 @@ NS_IMETHODIMP
|
|||
nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
nsCSSValue val;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aReturn.Truncate();
|
||||
if (decl) {
|
||||
result = decl->GetValue(aPropertyName, aReturn);
|
||||
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
aReturn.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return GetPropertyValue(propID, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -165,15 +195,20 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
|
|||
const nsAString& aValue,
|
||||
const nsAString& aPriority)
|
||||
{
|
||||
// In the common (and fast) cases we can use the property id
|
||||
nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aValue.IsEmpty()) {
|
||||
// If the new value of the property is an empty string we remove the
|
||||
// property.
|
||||
nsAutoString tmp;
|
||||
return RemoveProperty(aPropertyName, tmp);
|
||||
// If the new value of the property is an empty string we remove the
|
||||
// property.
|
||||
return RemoveProperty(propID);
|
||||
}
|
||||
|
||||
if (aPriority.IsEmpty()) {
|
||||
return ParsePropertyValue(aPropertyName, aValue);
|
||||
return ParsePropertyValue(propID, aValue);
|
||||
}
|
||||
|
||||
// ParsePropertyValue does not handle priorities correctly -- it's
|
||||
|
@ -189,37 +224,21 @@ NS_IMETHODIMP
|
|||
nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
aReturn.Truncate();
|
||||
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
if (!decl) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (prop == eCSSProperty_UNKNOWN) {
|
||||
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
aReturn.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
decl->GetValue(prop, aReturn);
|
||||
|
||||
rv = decl->RemoveProperty(prop);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = DeclarationChanged();
|
||||
} else {
|
||||
// RemoveProperty used to throw in all sorts of situations -- e.g.
|
||||
// if the property was a shorthand one. Do not propagate its return
|
||||
// value to callers. (XXX or should we propagate it again now?)
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult rv = GetPropertyValue(propID, aReturn);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = RemoveProperty(propID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSDeclaration::ParsePropertyValue(const nsAString& aPropName,
|
||||
nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue)
|
||||
{
|
||||
nsCSSDeclaration* decl;
|
||||
|
@ -240,7 +259,7 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsAString& aPropName,
|
|||
}
|
||||
|
||||
PRBool changed;
|
||||
result = cssParser->ParseProperty(aPropName, aPropValue, baseURI, decl,
|
||||
result = cssParser->ParseProperty(aPropID, aPropValue, baseURI, decl,
|
||||
&changed);
|
||||
if (NS_SUCCEEDED(result) && changed) {
|
||||
result = DeclarationChanged();
|
||||
|
@ -293,10 +312,32 @@ nsDOMCSSDeclaration::ParseDeclaration(const nsAString& aDecl,
|
|||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID)
|
||||
{
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
if (!decl) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = decl->RemoveProperty(aPropID);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = DeclarationChanged();
|
||||
} else {
|
||||
// RemoveProperty used to throw in all sorts of situations -- e.g.
|
||||
// if the property was a shorthand one. Do not propagate its return
|
||||
// value to callers. (XXX or should we propagate it again now?)
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CSS2PropertiesTearoff::CSS2PropertiesTearoff(nsIDOMCSSStyleDeclaration *aOuter)
|
||||
CSS2PropertiesTearoff::CSS2PropertiesTearoff(nsICSSDeclaration *aOuter)
|
||||
: mOuter(aOuter)
|
||||
{
|
||||
NS_ASSERTION(mOuter, "must have outer");
|
||||
|
@ -331,25 +372,36 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \
|
||||
{ \
|
||||
return mOuter->GetPropertyValue(NS_LITERAL_STRING(#name_), aValue); \
|
||||
return mOuter->GetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \
|
||||
{ \
|
||||
return mOuter->SetProperty(NS_LITERAL_STRING(#name_), aValue, \
|
||||
EmptyString()); \
|
||||
return mOuter->SetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
}
|
||||
|
||||
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_) \
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \
|
||||
{ \
|
||||
aValue.Truncate(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \
|
||||
{ \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_) \
|
||||
CSS_PROP(name_, id_, method_, , , , ,)
|
||||
#define CSS_PROP_SHORTHAND(name_, id_, method_) \
|
||||
CSS_PROP(name_, id_, method_, , , , ,)
|
||||
#include "nsCSSPropList.h"
|
||||
|
||||
// Aliases
|
||||
CSS_PROP(opacity, X, MozOpacity, X, X, X, X, X)
|
||||
CSS_PROP(X, opacity, MozOpacity, X, X, X, X, X)
|
||||
|
||||
#undef CSS_PROP_SHORTHAND
|
||||
#undef CSS_PROP_NOTIMPLEMENTED
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#ifndef nsDOMCSSDeclaration_h___
|
||||
#define nsDOMCSSDeclaration_h___
|
||||
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIDOMCSS2Properties.h"
|
||||
|
||||
class nsCSSDeclaration;
|
||||
|
@ -53,14 +53,14 @@ public:
|
|||
NS_DECL_NSIDOMCSS2PROPERTIES
|
||||
NS_DECL_NSIDOMNSCSS2PROPERTIES
|
||||
|
||||
CSS2PropertiesTearoff(nsIDOMCSSStyleDeclaration *aOuter);
|
||||
CSS2PropertiesTearoff(nsICSSDeclaration *aOuter);
|
||||
virtual ~CSS2PropertiesTearoff();
|
||||
|
||||
private:
|
||||
nsIDOMCSSStyleDeclaration* mOuter;
|
||||
nsICSSDeclaration* mOuter;
|
||||
};
|
||||
|
||||
class nsDOMCSSDeclaration : public nsIDOMCSSStyleDeclaration
|
||||
class nsDOMCSSDeclaration : public nsICSSDeclaration
|
||||
{
|
||||
public:
|
||||
nsDOMCSSDeclaration();
|
||||
|
@ -69,6 +69,8 @@ public:
|
|||
// of implementing AddRef/Release.
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
NS_DECL_NSICSSDECLARATION
|
||||
|
||||
// Require subclasses to implement |GetParentRule|.
|
||||
//NS_DECL_NSIDOMCSSSTYLEDECLARATION
|
||||
NS_IMETHOD GetCssText(nsAString & aCssText);
|
||||
|
@ -102,10 +104,15 @@ protected:
|
|||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser) = 0;
|
||||
|
||||
nsresult ParsePropertyValue(const nsAString& aPropName,
|
||||
nsresult ParsePropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue);
|
||||
nsresult ParseDeclaration(const nsAString& aDecl,
|
||||
PRBool aParseOnlyOneDecl, PRBool aClearOldDecl);
|
||||
|
||||
// Prop-id based version of RemoveProperty. Note that this does not
|
||||
// return the old value; it just does a straight removal.
|
||||
nsresult RemoveProperty(const nsCSSProperty aPropID);
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~nsDOMCSSDeclaration();
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nsISVGSVGElement.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsCSSDeclaration.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsICSSParser.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
||||
|
@ -689,7 +690,8 @@ nsSVGElement::UpdateContentStyleRule()
|
|||
mAttrsAndChildren.AttrAt(i)->ToString(value);
|
||||
|
||||
PRBool changed;
|
||||
parser->ParseProperty(name, value, baseURI, declaration, &changed);
|
||||
parser->ParseProperty(nsCSSProps::LookupProperty(name), value, baseURI,
|
||||
declaration, &changed);
|
||||
}
|
||||
|
||||
NS_NewCSSStyleRule(getter_AddRefs(mContentStyleRule), nsnull, declaration);
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult);
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsAString& aPropName,
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
|
@ -774,7 +774,7 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
|
|||
//in the decl, then ignore the !important. It should either fail to
|
||||
//parse this or do !important correctly....
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseProperty(const nsAString& aPropName,
|
||||
CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
|
@ -804,10 +804,9 @@ CSSParserImpl::ParseProperty(const nsAString& aPropName,
|
|||
mSection = eCSSSection_General;
|
||||
nsresult errorCode = NS_OK;
|
||||
|
||||
nsCSSProperty propID = nsCSSProps::LookupProperty(aPropName);
|
||||
if (eCSSProperty_UNKNOWN == propID) { // unknown property
|
||||
if (eCSSProperty_UNKNOWN == aPropID) { // unknown property
|
||||
REPORT_UNEXPECTED(NS_LITERAL_STRING("Unknown property '") +
|
||||
aPropName +
|
||||
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)) +
|
||||
NS_LITERAL_STRING("'. Declaration dropped."));
|
||||
OUTPUT_ERROR();
|
||||
ReleaseScanner();
|
||||
|
@ -818,15 +817,15 @@ CSSParserImpl::ParseProperty(const nsAString& aPropName,
|
|||
mTempData.AssertInitialState();
|
||||
aDeclaration->ExpandTo(&mData);
|
||||
nsresult result = NS_OK;
|
||||
if (ParseProperty(errorCode, propID)) {
|
||||
TransferTempData(aDeclaration, propID, PR_FALSE, aChanged);
|
||||
if (ParseProperty(errorCode, aPropID)) {
|
||||
TransferTempData(aDeclaration, aPropID, PR_FALSE, aChanged);
|
||||
} else {
|
||||
REPORT_UNEXPECTED(
|
||||
NS_LITERAL_STRING("Error in parsing value for property '") +
|
||||
aPropName +
|
||||
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)) +
|
||||
NS_LITERAL_STRING("'. Declaration dropped."));
|
||||
OUTPUT_ERROR();
|
||||
ClearTempData(propID);
|
||||
ClearTempData(aPropID);
|
||||
NS_ASSERTION(errorCode != nsresult(-1), "-1 is no longer used for EOF");
|
||||
result = errorCode;
|
||||
}
|
||||
|
|
|
@ -124,6 +124,7 @@ nsComputedDOMStyle::Shutdown()
|
|||
// QueryInterface implementation for nsComputedDOMStyle
|
||||
NS_INTERFACE_MAP_BEGIN(nsComputedDOMStyle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIComputedDOMStyle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties, &mInner)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties, &mInner)
|
||||
|
@ -204,6 +205,26 @@ nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComputedDOMStyle::GetPropertyValue(const nsCSSProperty aPropID,
|
||||
nsAString& aValue)
|
||||
{
|
||||
// This is mostly to avoid code duplication with GetPropertyCSSValue(); if
|
||||
// perf ever becomes an issue here (doubtful), we can look into changing
|
||||
// this.
|
||||
return GetPropertyValue(
|
||||
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)),
|
||||
aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComputedDOMStyle::SetPropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComputedDOMStyle::GetCssText(nsAString& aCssText)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,8 @@ public:
|
|||
const nsAString& aPseudoElt,
|
||||
nsIPresShell *aPresShell);
|
||||
|
||||
NS_DECL_NSICSSDECLARATION
|
||||
|
||||
NS_DECL_NSIDOMCSSSTYLEDECLARATION
|
||||
|
||||
nsComputedDOMStyle();
|
||||
|
|
|
@ -61,6 +61,7 @@ nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
|
|||
|
||||
// QueryInterface implementation for nsDOMCSSDeclaration
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMCSSDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties, &mInner)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties, &mInner)
|
||||
|
@ -68,6 +69,38 @@ NS_INTERFACE_MAP_BEGIN(nsDOMCSSDeclaration)
|
|||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CSSStyleDeclaration)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetPropertyValue(const nsCSSProperty aPropID,
|
||||
nsAString& aValue)
|
||||
{
|
||||
NS_PRECONDITION(aPropID != eCSSProperty_UNKNOWN,
|
||||
"Should never pass eCSSProperty_UNKNOWN around");
|
||||
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aValue.Truncate();
|
||||
if (decl) {
|
||||
result = decl->GetValue(aPropID, aValue);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::SetPropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
if (aValue.IsEmpty()) {
|
||||
// If the new value of the property is an empty string we remove the
|
||||
// property.
|
||||
return RemoveProperty(aPropID);
|
||||
}
|
||||
|
||||
return ParsePropertyValue(aPropID, aValue);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMCSSDeclaration::GetCssText(nsAString& aCssText)
|
||||
{
|
||||
|
@ -133,16 +166,13 @@ NS_IMETHODIMP
|
|||
nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
nsCSSValue val;
|
||||
nsCSSDeclaration *decl;
|
||||
nsresult result = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
|
||||
aReturn.Truncate();
|
||||
if (decl) {
|
||||
result = decl->GetValue(aPropertyName, aReturn);
|
||||
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
aReturn.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return GetPropertyValue(propID, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -165,15 +195,20 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
|
|||
const nsAString& aValue,
|
||||
const nsAString& aPriority)
|
||||
{
|
||||
// In the common (and fast) cases we can use the property id
|
||||
nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aValue.IsEmpty()) {
|
||||
// If the new value of the property is an empty string we remove the
|
||||
// property.
|
||||
nsAutoString tmp;
|
||||
return RemoveProperty(aPropertyName, tmp);
|
||||
// If the new value of the property is an empty string we remove the
|
||||
// property.
|
||||
return RemoveProperty(propID);
|
||||
}
|
||||
|
||||
if (aPriority.IsEmpty()) {
|
||||
return ParsePropertyValue(aPropertyName, aValue);
|
||||
return ParsePropertyValue(propID, aValue);
|
||||
}
|
||||
|
||||
// ParsePropertyValue does not handle priorities correctly -- it's
|
||||
|
@ -189,37 +224,21 @@ NS_IMETHODIMP
|
|||
nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
aReturn.Truncate();
|
||||
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
if (!decl) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (prop == eCSSProperty_UNKNOWN) {
|
||||
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName);
|
||||
if (propID == eCSSProperty_UNKNOWN) {
|
||||
aReturn.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
decl->GetValue(prop, aReturn);
|
||||
|
||||
rv = decl->RemoveProperty(prop);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = DeclarationChanged();
|
||||
} else {
|
||||
// RemoveProperty used to throw in all sorts of situations -- e.g.
|
||||
// if the property was a shorthand one. Do not propagate its return
|
||||
// value to callers. (XXX or should we propagate it again now?)
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult rv = GetPropertyValue(propID, aReturn);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = RemoveProperty(propID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSDeclaration::ParsePropertyValue(const nsAString& aPropName,
|
||||
nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue)
|
||||
{
|
||||
nsCSSDeclaration* decl;
|
||||
|
@ -240,7 +259,7 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsAString& aPropName,
|
|||
}
|
||||
|
||||
PRBool changed;
|
||||
result = cssParser->ParseProperty(aPropName, aPropValue, baseURI, decl,
|
||||
result = cssParser->ParseProperty(aPropID, aPropValue, baseURI, decl,
|
||||
&changed);
|
||||
if (NS_SUCCEEDED(result) && changed) {
|
||||
result = DeclarationChanged();
|
||||
|
@ -293,10 +312,32 @@ nsDOMCSSDeclaration::ParseDeclaration(const nsAString& aDecl,
|
|||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID)
|
||||
{
|
||||
nsCSSDeclaration* decl;
|
||||
nsresult rv = GetCSSDeclaration(&decl, PR_FALSE);
|
||||
if (!decl) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = decl->RemoveProperty(aPropID);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = DeclarationChanged();
|
||||
} else {
|
||||
// RemoveProperty used to throw in all sorts of situations -- e.g.
|
||||
// if the property was a shorthand one. Do not propagate its return
|
||||
// value to callers. (XXX or should we propagate it again now?)
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CSS2PropertiesTearoff::CSS2PropertiesTearoff(nsIDOMCSSStyleDeclaration *aOuter)
|
||||
CSS2PropertiesTearoff::CSS2PropertiesTearoff(nsICSSDeclaration *aOuter)
|
||||
: mOuter(aOuter)
|
||||
{
|
||||
NS_ASSERTION(mOuter, "must have outer");
|
||||
|
@ -331,25 +372,36 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \
|
||||
{ \
|
||||
return mOuter->GetPropertyValue(NS_LITERAL_STRING(#name_), aValue); \
|
||||
return mOuter->GetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \
|
||||
{ \
|
||||
return mOuter->SetProperty(NS_LITERAL_STRING(#name_), aValue, \
|
||||
EmptyString()); \
|
||||
return mOuter->SetPropertyValue(eCSSProperty_##id_, aValue); \
|
||||
}
|
||||
|
||||
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_) \
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \
|
||||
{ \
|
||||
aValue.Truncate(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \
|
||||
{ \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
|
||||
#define CSS_PROP_NOTIMPLEMENTED(name_, id_, method_) \
|
||||
CSS_PROP(name_, id_, method_, , , , ,)
|
||||
#define CSS_PROP_SHORTHAND(name_, id_, method_) \
|
||||
CSS_PROP(name_, id_, method_, , , , ,)
|
||||
#include "nsCSSPropList.h"
|
||||
|
||||
// Aliases
|
||||
CSS_PROP(opacity, X, MozOpacity, X, X, X, X, X)
|
||||
CSS_PROP(X, opacity, MozOpacity, X, X, X, X, X)
|
||||
|
||||
#undef CSS_PROP_SHORTHAND
|
||||
#undef CSS_PROP_NOTIMPLEMENTED
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#ifndef nsDOMCSSDeclaration_h___
|
||||
#define nsDOMCSSDeclaration_h___
|
||||
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIDOMCSS2Properties.h"
|
||||
|
||||
class nsCSSDeclaration;
|
||||
|
@ -53,14 +53,14 @@ public:
|
|||
NS_DECL_NSIDOMCSS2PROPERTIES
|
||||
NS_DECL_NSIDOMNSCSS2PROPERTIES
|
||||
|
||||
CSS2PropertiesTearoff(nsIDOMCSSStyleDeclaration *aOuter);
|
||||
CSS2PropertiesTearoff(nsICSSDeclaration *aOuter);
|
||||
virtual ~CSS2PropertiesTearoff();
|
||||
|
||||
private:
|
||||
nsIDOMCSSStyleDeclaration* mOuter;
|
||||
nsICSSDeclaration* mOuter;
|
||||
};
|
||||
|
||||
class nsDOMCSSDeclaration : public nsIDOMCSSStyleDeclaration
|
||||
class nsDOMCSSDeclaration : public nsICSSDeclaration
|
||||
{
|
||||
public:
|
||||
nsDOMCSSDeclaration();
|
||||
|
@ -69,6 +69,8 @@ public:
|
|||
// of implementing AddRef/Release.
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
NS_DECL_NSICSSDECLARATION
|
||||
|
||||
// Require subclasses to implement |GetParentRule|.
|
||||
//NS_DECL_NSIDOMCSSSTYLEDECLARATION
|
||||
NS_IMETHOD GetCssText(nsAString & aCssText);
|
||||
|
@ -102,10 +104,15 @@ protected:
|
|||
nsICSSLoader** aCSSLoader,
|
||||
nsICSSParser** aCSSParser) = 0;
|
||||
|
||||
nsresult ParsePropertyValue(const nsAString& aPropName,
|
||||
nsresult ParsePropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue);
|
||||
nsresult ParseDeclaration(const nsAString& aDecl,
|
||||
PRBool aParseOnlyOneDecl, PRBool aClearOldDecl);
|
||||
|
||||
// Prop-id based version of RemoveProperty. Note that this does not
|
||||
// return the old value; it just does a straight removal.
|
||||
nsresult RemoveProperty(const nsCSSProperty aPropID);
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~nsDOMCSSDeclaration();
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Boris Zbarsky <bzbarsky@mit.edu>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsICSSDeclaration_h__
|
||||
#define nsICSSDeclaration_h__
|
||||
|
||||
/**
|
||||
* This interface provides access to methods analogous to those of
|
||||
* nsIDOMCSSStyleDeclaration; the difference is that these use
|
||||
* nsCSSProperty enums for the prop names instead of using strings.
|
||||
* This is meant for use in performance-sensitive code only! Most
|
||||
* consumers should continue to use nsIDOMCSSStyleDeclaration.
|
||||
*/
|
||||
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsCSSProperty.h"
|
||||
|
||||
// 57eb81d1-a607-4429-926b-802519d43aad
|
||||
#define NS_ICSSDECLARATION_IID \
|
||||
{ 0x57eb81d1, 0xa607, 0x4429, \
|
||||
{0x92, 0x6b, 0x80, 0x25, 0x19, 0xd4, 0x3a, 0xad } }
|
||||
|
||||
|
||||
class nsICSSDeclaration : public nsIDOMCSSStyleDeclaration
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSSDECLARATION_IID)
|
||||
|
||||
/**
|
||||
* Method analogous to nsIDOMCSSStyleDeclaration::GetPropertyValue,
|
||||
* which obeys all the same restrictions.
|
||||
*/
|
||||
NS_IMETHOD GetPropertyValue(const nsCSSProperty aPropID,
|
||||
nsAString& aValue) = 0;
|
||||
|
||||
// Also have to declare the nsIDOMCSSStyleDeclaration method, so we
|
||||
// don't hide it... very sad, but it stole the good method name
|
||||
NS_IMETHOD GetPropertyValue(const nsAString& aPropName,
|
||||
nsAString& aValue) = 0;
|
||||
|
||||
/**
|
||||
* Method analogous to nsIDOMCSSStyleDeclaration::SetProperty. This
|
||||
* method does NOT allow setting a priority (the priority will
|
||||
* always be set to default priority).
|
||||
*/
|
||||
NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID,
|
||||
const nsAString& aValue) = 0;
|
||||
};
|
||||
|
||||
#define NS_DECL_NSICSSDECLARATION \
|
||||
NS_IMETHOD GetPropertyValue(const nsCSSProperty aPropID, \
|
||||
nsAString& aValue); \
|
||||
NS_IMETHOD SetPropertyValue(const nsCSSProperty aPropID, \
|
||||
const nsAString& aValue);
|
||||
|
||||
|
||||
|
||||
#endif // nsICSSDeclaration_h__
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsCSSProperty.h"
|
||||
|
||||
class nsICSSStyleRule;
|
||||
class nsICSSStyleSheet;
|
||||
|
@ -96,7 +97,7 @@ public:
|
|||
nsIURI* aBaseURL,
|
||||
nsISupportsArray** aResult) = 0;
|
||||
|
||||
NS_IMETHOD ParseProperty(const nsAString& aPropName,
|
||||
NS_IMETHOD ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
nsIURI* aBaseURL,
|
||||
nsCSSDeclaration* aDeclaration,
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#ifndef nsIComputedDOMStyle_h___
|
||||
#define nsIComputedDOMStyle_h___
|
||||
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
|
||||
class nsIDOMElement;
|
||||
class nsIPresShell;
|
||||
|
@ -46,7 +46,7 @@ class nsIPresShell;
|
|||
{ 0x5f0197a1, 0xa873, 0x44e5, \
|
||||
{0x96, 0x31, 0xac, 0xd6, 0xca, 0xb4, 0xf1, 0xe0 } }
|
||||
|
||||
class nsIComputedDOMStyle : public nsIDOMCSSStyleDeclaration
|
||||
class nsIComputedDOMStyle : public nsICSSDeclaration
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMPUTEDDOMSTYLE_IID)
|
||||
|
|
Загрузка…
Ссылка в новой задаче