2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-09-25 04:51:45 +04:00
|
|
|
|
2006-03-25 08:47:31 +03:00
|
|
|
/* base class for DOM objects for element.style and cssStyleRule.style */
|
|
|
|
|
1998-10-06 05:39:33 +04:00
|
|
|
#include "nsDOMCSSDeclaration.h"
|
2000-04-20 17:50:56 +04:00
|
|
|
#include "nsIDOMCSSRule.h"
|
2010-03-02 23:59:32 +03:00
|
|
|
#include "nsCSSParser.h"
|
2010-06-29 02:49:35 +04:00
|
|
|
#include "mozilla/css/Loader.h"
|
2011-04-12 10:18:42 +04:00
|
|
|
#include "nsCSSStyleSheet.h"
|
1998-09-25 04:51:45 +04:00
|
|
|
#include "nsIStyleRule.h"
|
2011-04-08 05:23:46 +04:00
|
|
|
#include "mozilla/css/Rule.h"
|
2010-06-29 02:49:35 +04:00
|
|
|
#include "mozilla/css/Declaration.h"
|
1998-09-25 04:51:45 +04:00
|
|
|
#include "nsCSSProps.h"
|
2000-04-20 17:50:56 +04:00
|
|
|
#include "nsCOMPtr.h"
|
1999-01-15 05:07:46 +03:00
|
|
|
#include "nsIURL.h"
|
2004-01-30 01:04:45 +03:00
|
|
|
#include "nsReadableUtils.h"
|
2007-05-03 05:15:53 +04:00
|
|
|
#include "nsIPrincipal.h"
|
2012-07-20 20:42:08 +04:00
|
|
|
#include "nsDOMClassInfoID.h"
|
2009-12-11 19:13:19 +03:00
|
|
|
#include "mozAutoDocUpdate.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2010-03-03 00:00:53 +03:00
|
|
|
namespace css = mozilla::css;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
1998-10-06 05:39:33 +04:00
|
|
|
nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
|
1998-09-25 04:51:45 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-01-12 16:08:43 +03:00
|
|
|
DOMCI_DATA(CSSStyleDeclaration, nsDOMCSSDeclaration)
|
|
|
|
|
2009-07-13 15:14:57 +04:00
|
|
|
NS_INTERFACE_TABLE_HEAD(nsDOMCSSDeclaration)
|
2010-08-06 09:32:01 +04:00
|
|
|
NS_INTERFACE_TABLE3(nsDOMCSSDeclaration,
|
2010-07-15 00:58:56 +04:00
|
|
|
nsICSSDeclaration,
|
|
|
|
nsIDOMCSSStyleDeclaration,
|
2010-08-06 09:32:01 +04:00
|
|
|
nsIDOMCSS2Properties)
|
2010-07-15 00:58:56 +04:00
|
|
|
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
2010-03-17 18:09:05 +03:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CSSStyleDeclaration)
|
2003-07-12 00:44:25 +04:00
|
|
|
NS_INTERFACE_MAP_END
|
1998-09-25 04:51:45 +04:00
|
|
|
|
2004-06-08 05:32:29 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSDeclaration::GetPropertyValue(const nsCSSProperty aPropID,
|
|
|
|
nsAString& aValue)
|
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPropID != eCSSProperty_UNKNOWN,
|
|
|
|
"Should never pass eCSSProperty_UNKNOWN around");
|
2010-06-29 02:49:35 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* decl = GetCSSDeclaration(false);
|
2004-06-08 05:32:29 +04:00
|
|
|
|
|
|
|
aValue.Truncate();
|
|
|
|
if (decl) {
|
2010-07-23 22:00:34 +04:00
|
|
|
decl->GetValue(aPropID, aValue);
|
2004-06-08 05:32:29 +04:00
|
|
|
}
|
2010-07-23 22:00:34 +04:00
|
|
|
return NS_OK;
|
2004-06-08 05:32:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return ParsePropertyValue(aPropID, aValue, false);
|
2004-06-08 05:32:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-20 17:50:56 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsDOMCSSDeclaration::GetCssText(nsAString& aCssText)
|
1998-11-26 04:34:53 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* decl = GetCSSDeclaration(false);
|
2000-04-20 17:50:56 +04:00
|
|
|
aCssText.Truncate();
|
2001-05-15 12:25:03 +04:00
|
|
|
|
|
|
|
if (decl) {
|
|
|
|
decl->ToString(aCssText);
|
|
|
|
}
|
|
|
|
|
1998-11-26 04:34:53 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-04-20 17:50:56 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
|
1998-11-26 04:34:53 +03:00
|
|
|
{
|
2010-07-23 22:00:49 +04:00
|
|
|
// We don't need to *do* anything with the old declaration, but we need
|
|
|
|
// to ensure that it exists, or else SetCSSDeclaration may crash.
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* olddecl = GetCSSDeclaration(true);
|
2010-07-23 22:00:49 +04:00
|
|
|
if (!olddecl) {
|
2010-07-23 22:00:34 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2010-07-23 22:00:19 +04:00
|
|
|
}
|
|
|
|
|
2011-04-28 00:53:49 +04:00
|
|
|
CSSParsingEnvironment env;
|
|
|
|
GetCSSParsingEnvironment(env);
|
|
|
|
if (!env.mPrincipal) {
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
2010-07-23 22:00:19 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:47 +04:00
|
|
|
// For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
|
2010-07-23 22:00:19 +04:00
|
|
|
// Attribute setting code, which leads in turn to BeginUpdate. We
|
|
|
|
// need to start the update now so that the old rule doesn't get used
|
|
|
|
// between when we mutate the declaration and when we set the new
|
|
|
|
// rule (see stack in bug 209575).
|
2011-10-17 18:59:28 +04:00
|
|
|
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
|
2010-07-23 22:00:19 +04:00
|
|
|
|
2010-07-23 22:00:52 +04:00
|
|
|
nsAutoPtr<css::Declaration> decl(new css::Declaration());
|
2010-07-23 22:00:49 +04:00
|
|
|
decl->InitializeEmpty();
|
2011-04-28 00:53:49 +04:00
|
|
|
nsCSSParser cssParser(env.mCSSLoader);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool changed;
|
2011-04-28 00:53:49 +04:00
|
|
|
nsresult result = cssParser.ParseDeclarations(aCssText, env.mSheetURI,
|
|
|
|
env.mBaseURI,
|
|
|
|
env.mPrincipal, decl, &changed);
|
2010-07-23 22:00:34 +04:00
|
|
|
if (NS_FAILED(result) || !changed) {
|
|
|
|
return result;
|
2010-07-23 22:00:19 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:52 +04:00
|
|
|
return SetCSSDeclaration(decl.forget());
|
1998-11-26 04:34:53 +03:00
|
|
|
}
|
|
|
|
|
2000-04-20 17:50:56 +04:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsDOMCSSDeclaration::GetLength(uint32_t* aLength)
|
1998-09-25 04:51:45 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* decl = GetCSSDeclaration(false);
|
2010-06-29 02:49:35 +04:00
|
|
|
|
2003-06-18 05:59:57 +04:00
|
|
|
if (decl) {
|
2002-01-16 01:43:37 +03:00
|
|
|
*aLength = decl->Count();
|
2003-06-18 05:59:57 +04:00
|
|
|
} else {
|
|
|
|
*aLength = 0;
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:34 +04:00
|
|
|
return NS_OK;
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
|
|
|
|
2000-04-20 17:50:56 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAString& aPropertyName,
|
2000-04-20 17:50:56 +04:00
|
|
|
nsIDOMCSSValue** aReturn)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aReturn);
|
|
|
|
|
|
|
|
// We don't support CSSValue yet so we'll just return null...
|
2012-07-30 18:20:58 +04:00
|
|
|
*aReturn = nullptr;
|
2000-04-20 17:50:56 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-24 08:08:08 +04:00
|
|
|
void
|
|
|
|
nsDOMCSSDeclaration::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName)
|
1998-09-25 04:51:45 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* decl = GetCSSDeclaration(false);
|
2012-08-24 08:08:08 +04:00
|
|
|
aFound = decl && decl->GetNthProperty(aIndex, aPropName);
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:34 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
|
2002-03-24 01:56:05 +03:00
|
|
|
nsAString& aReturn)
|
1998-09-25 04:51:45 +04:00
|
|
|
{
|
2012-07-14 03:59:05 +04:00
|
|
|
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName,
|
|
|
|
nsCSSProps::eEnabled);
|
2004-06-08 05:32:29 +04:00
|
|
|
if (propID == eCSSProperty_UNKNOWN) {
|
|
|
|
aReturn.Truncate();
|
|
|
|
return NS_OK;
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
2010-07-23 22:00:34 +04:00
|
|
|
|
2004-06-08 05:32:29 +04:00
|
|
|
return GetPropertyValue(propID, aReturn);
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:34 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSDeclaration::GetPropertyPriority(const nsAString& aPropertyName,
|
2002-03-24 01:56:05 +03:00
|
|
|
nsAString& aReturn)
|
1998-09-25 04:51:45 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* decl = GetCSSDeclaration(false);
|
1998-09-25 04:51:45 +04:00
|
|
|
|
2003-06-18 05:59:57 +04:00
|
|
|
aReturn.Truncate();
|
|
|
|
if (decl && decl->GetValueIsImportant(aPropertyName)) {
|
2010-07-23 22:00:34 +04:00
|
|
|
aReturn.AssignLiteral("important");
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:34 +04:00
|
|
|
return NS_OK;
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:34 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
|
|
|
|
const nsAString& aValue,
|
2002-03-24 01:56:05 +03:00
|
|
|
const nsAString& aPriority)
|
1998-09-25 04:51:45 +04:00
|
|
|
{
|
2004-06-08 05:32:29 +04:00
|
|
|
// In the common (and fast) cases we can use the property id
|
2012-07-14 03:59:05 +04:00
|
|
|
nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName,
|
|
|
|
nsCSSProps::eEnabled);
|
2004-06-08 05:32:29 +04:00
|
|
|
if (propID == eCSSProperty_UNKNOWN) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2010-04-02 10:07:40 +04:00
|
|
|
|
2001-09-28 05:38:36 +04:00
|
|
|
if (aValue.IsEmpty()) {
|
2004-06-08 05:32:29 +04:00
|
|
|
// If the new value of the property is an empty string we remove the
|
|
|
|
// property.
|
2010-04-02 10:07:40 +04:00
|
|
|
// XXX this ignores the priority string, should it?
|
2004-06-08 05:32:29 +04:00
|
|
|
return RemoveProperty(propID);
|
2000-05-02 02:59:54 +04:00
|
|
|
}
|
|
|
|
|
2002-08-08 21:40:20 +04:00
|
|
|
if (aPriority.IsEmpty()) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return ParsePropertyValue(propID, aValue, false);
|
2002-08-08 21:40:20 +04:00
|
|
|
}
|
2002-10-03 23:41:42 +04:00
|
|
|
|
2010-04-02 10:07:40 +04:00
|
|
|
if (aPriority.EqualsLiteral("important")) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return ParsePropertyValue(propID, aValue, true);
|
2010-04-02 10:07:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// XXX silent failure?
|
|
|
|
return NS_OK;
|
1998-09-25 04:51:45 +04:00
|
|
|
}
|
|
|
|
|
2003-06-18 05:59:57 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
|
|
|
{
|
2012-07-14 03:59:05 +04:00
|
|
|
const nsCSSProperty propID = nsCSSProps::LookupProperty(aPropertyName,
|
|
|
|
nsCSSProps::eEnabled);
|
2004-06-08 05:32:29 +04:00
|
|
|
if (propID == eCSSProperty_UNKNOWN) {
|
|
|
|
aReturn.Truncate();
|
2004-06-07 23:30:54 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2010-07-23 22:00:34 +04:00
|
|
|
|
2004-06-08 05:32:29 +04:00
|
|
|
nsresult rv = GetPropertyValue(propID, aReturn);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2010-07-23 22:00:34 +04:00
|
|
|
|
|
|
|
return RemoveProperty(propID);
|
2003-06-18 05:59:57 +04:00
|
|
|
}
|
|
|
|
|
2011-04-28 00:53:49 +04:00
|
|
|
/* static */ void
|
2011-04-08 05:23:46 +04:00
|
|
|
nsDOMCSSDeclaration::GetCSSParsingEnvironmentForRule(css::Rule* aRule,
|
2011-04-28 00:53:49 +04:00
|
|
|
CSSParsingEnvironment& aCSSParseEnv)
|
2011-04-12 10:18:42 +04:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
nsIStyleSheet* sheet = aRule ? aRule->GetStyleSheet() : nullptr;
|
2011-04-28 00:53:49 +04:00
|
|
|
nsRefPtr<nsCSSStyleSheet> cssSheet(do_QueryObject(sheet));
|
|
|
|
if (!cssSheet) {
|
2012-07-30 18:20:58 +04:00
|
|
|
aCSSParseEnv.mPrincipal = nullptr;
|
2011-04-28 00:53:49 +04:00
|
|
|
return;
|
2011-04-12 10:18:42 +04:00
|
|
|
}
|
|
|
|
|
2011-04-28 00:53:49 +04:00
|
|
|
nsIDocument* document = sheet->GetOwningDocument();
|
|
|
|
aCSSParseEnv.mSheetURI = sheet->GetSheetURI();
|
|
|
|
aCSSParseEnv.mBaseURI = sheet->GetBaseURI();
|
|
|
|
aCSSParseEnv.mPrincipal = cssSheet->Principal();
|
2012-07-30 18:20:58 +04:00
|
|
|
aCSSParseEnv.mCSSLoader = document ? document->CSSLoader() : nullptr;
|
2011-04-12 10:18:42 +04:00
|
|
|
}
|
|
|
|
|
2003-06-18 05:59:57 +04:00
|
|
|
nsresult
|
2004-06-08 05:32:29 +04:00
|
|
|
nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
2010-04-02 10:07:40 +04:00
|
|
|
const nsAString& aPropValue,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsImportant)
|
2003-06-18 05:59:57 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* olddecl = GetCSSDeclaration(true);
|
2010-07-23 22:00:49 +04:00
|
|
|
if (!olddecl) {
|
2010-07-23 22:00:34 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2003-06-18 05:59:57 +04:00
|
|
|
}
|
2010-03-02 23:59:32 +03:00
|
|
|
|
2011-04-28 00:53:49 +04:00
|
|
|
CSSParsingEnvironment env;
|
|
|
|
GetCSSParsingEnvironment(env);
|
|
|
|
if (!env.mPrincipal) {
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
2003-06-18 05:59:57 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:47 +04:00
|
|
|
// For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
|
2009-12-11 19:13:19 +03:00
|
|
|
// Attribute setting code, which leads in turn to BeginUpdate. We
|
|
|
|
// need to start the update now so that the old rule doesn't get used
|
|
|
|
// between when we mutate the declaration and when we set the new
|
|
|
|
// rule (see stack in bug 209575).
|
2011-10-17 18:59:28 +04:00
|
|
|
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
|
2010-07-23 22:00:49 +04:00
|
|
|
css::Declaration* decl = olddecl->EnsureMutable();
|
2009-12-11 19:13:19 +03:00
|
|
|
|
2011-04-28 00:53:49 +04:00
|
|
|
nsCSSParser cssParser(env.mCSSLoader);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool changed;
|
2011-04-28 00:53:49 +04:00
|
|
|
nsresult result = cssParser.ParseProperty(aPropID, aPropValue, env.mSheetURI,
|
|
|
|
env.mBaseURI, env.mPrincipal, decl,
|
|
|
|
&changed, aIsImportant);
|
2010-07-23 22:00:34 +04:00
|
|
|
if (NS_FAILED(result) || !changed) {
|
2010-07-23 22:00:49 +04:00
|
|
|
if (decl != olddecl) {
|
2010-07-23 22:00:52 +04:00
|
|
|
delete decl;
|
2010-07-23 22:00:49 +04:00
|
|
|
}
|
2010-07-23 22:00:34 +04:00
|
|
|
return result;
|
2003-06-18 05:59:57 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:47 +04:00
|
|
|
return SetCSSDeclaration(decl);
|
2003-06-18 05:59:57 +04:00
|
|
|
}
|
|
|
|
|
2004-06-08 05:32:29 +04:00
|
|
|
nsresult
|
|
|
|
nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID)
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
css::Declaration* decl = GetCSSDeclaration(false);
|
2004-06-08 05:32:29 +04:00
|
|
|
if (!decl) {
|
2010-07-23 22:00:34 +04:00
|
|
|
return NS_OK; // no decl, so nothing to remove
|
2004-06-08 05:32:29 +04:00
|
|
|
}
|
|
|
|
|
2010-07-23 22:00:47 +04:00
|
|
|
// For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
|
2009-12-11 19:13:19 +03:00
|
|
|
// Attribute setting code, which leads in turn to BeginUpdate. We
|
|
|
|
// need to start the update now so that the old rule doesn't get used
|
|
|
|
// between when we mutate the declaration and when we set the new
|
|
|
|
// rule (see stack in bug 209575).
|
2011-10-17 18:59:28 +04:00
|
|
|
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
|
2009-12-11 19:13:19 +03:00
|
|
|
|
2010-07-23 22:00:49 +04:00
|
|
|
decl = decl->EnsureMutable();
|
2010-07-23 22:00:34 +04:00
|
|
|
decl->RemoveProperty(aPropID);
|
2010-07-23 22:00:47 +04:00
|
|
|
return SetCSSDeclaration(decl);
|
2004-06-08 05:32:29 +04:00
|
|
|
}
|
2003-06-18 05:59:57 +04:00
|
|
|
|
2002-10-03 23:41:42 +04:00
|
|
|
// nsIDOMCSS2Properties
|
|
|
|
|
2011-03-18 06:14:30 +03:00
|
|
|
#define CSS_PROP_DOMPROP_PREFIXED(prop_) Moz ## prop_
|
2012-05-10 05:29:37 +04:00
|
|
|
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
|
|
|
|
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
|
2004-01-30 01:04:45 +03:00
|
|
|
NS_IMETHODIMP \
|
2010-07-15 00:58:56 +04:00
|
|
|
nsDOMCSSDeclaration::Get##method_(nsAString& aValue) \
|
2004-01-30 01:04:45 +03:00
|
|
|
{ \
|
2010-07-15 00:58:56 +04:00
|
|
|
return GetPropertyValue(eCSSProperty_##id_, aValue); \
|
2004-01-30 01:04:45 +03:00
|
|
|
} \
|
|
|
|
\
|
|
|
|
NS_IMETHODIMP \
|
2010-07-15 00:58:56 +04:00
|
|
|
nsDOMCSSDeclaration::Set##method_(const nsAString& aValue) \
|
2004-01-30 01:04:45 +03:00
|
|
|
{ \
|
2010-07-15 00:58:56 +04:00
|
|
|
return SetPropertyValue(eCSSProperty_##id_, aValue); \
|
2004-06-08 05:32:29 +04:00
|
|
|
}
|
|
|
|
|
2003-06-08 02:14:42 +04:00
|
|
|
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
|
2012-05-10 05:29:37 +04:00
|
|
|
#define CSS_PROP_SHORTHAND(name_, id_, method_, flags_, pref_) \
|
|
|
|
CSS_PROP(name_, id_, method_, flags_, pref_, X, X, X, X, X)
|
2002-09-26 07:46:50 +04:00
|
|
|
#include "nsCSSPropList.h"
|
2004-02-24 09:48:25 +03:00
|
|
|
|
2012-05-10 05:29:37 +04:00
|
|
|
#define CSS_PROP_ALIAS(aliasname_, propid_, aliasmethod_, pref_) \
|
|
|
|
CSS_PROP(X, propid_, aliasmethod_, X, pref_, X, X, X, X, X)
|
2012-02-25 09:23:14 +04:00
|
|
|
#include "nsCSSPropAliasList.h"
|
|
|
|
#undef CSS_PROP_ALIAS
|
2004-02-24 09:48:25 +03:00
|
|
|
|
2003-06-08 02:14:42 +04:00
|
|
|
#undef CSS_PROP_SHORTHAND
|
|
|
|
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
|
2002-09-26 07:46:50 +04:00
|
|
|
#undef CSS_PROP
|
2011-03-18 06:14:30 +03:00
|
|
|
#undef CSS_PROP_DOMPROP_PREFIXED
|