mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Reduce code size of atom lists by storing a table of strings and pointers to fill in. b=181383 r=alecf sr=sfraser
This commit is contained in:
parent
1a3d5baedd
commit
ea93b55cc8
70
content/base/src/nsAtomListUtils.cpp
Normal file
70
content/base/src/nsAtomListUtils.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 nsAtomListUtils.h .
|
||||
*
|
||||
* The Initial Developer of the Original Code is L. David Baron.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* L. David Baron <dbaron@fas.harvard.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either 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 ***** */
|
||||
|
||||
#include "nsAtomListUtils.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
/* static */ void
|
||||
nsAtomListUtils::AddRefAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount)
|
||||
{
|
||||
for (nsAtomListInfo *info = aInfo, *info_end = aInfo + aCount;
|
||||
info != info_end; ++info) {
|
||||
*(info->mAtom) = NS_NewPermanentAtom(info->mString);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsAtomListUtils::ReleaseAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount)
|
||||
{
|
||||
for (nsAtomListInfo *info = aInfo, *info_end = aInfo + aCount;
|
||||
info != info_end; ++info) {
|
||||
NS_RELEASE(*(info->mAtom));
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ PRBool
|
||||
nsAtomListUtils::IsMember(nsIAtom *aAtom,
|
||||
const nsAtomListInfo* aInfo,
|
||||
PRUint32 aInfoCount)
|
||||
{
|
||||
for (nsAtomListInfo *info = aInfo, *info_end = aInfo + aInfoCount;
|
||||
info != info_end; ++info) {
|
||||
if (aAtom == *(info->mAtom))
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
62
content/base/src/nsAtomListUtils.h
Normal file
62
content/base/src/nsAtomListUtils.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 nsAtomListUtils.h .
|
||||
*
|
||||
* The Initial Developer of the Original Code is L. David Baron.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* L. David Baron <dbaron@fas.harvard.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either 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 nsAtomListUtils_h__
|
||||
#define nsAtomListUtils_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
class nsIAtom;
|
||||
|
||||
#define MOZ_ARRAY_LENGTH(a_) (sizeof(a_)/sizeof(a_[0]))
|
||||
|
||||
struct nsAtomListInfo {
|
||||
nsIAtom** mAtom;
|
||||
const char* mString;
|
||||
};
|
||||
|
||||
class nsAtomListUtils {
|
||||
public:
|
||||
static void AddRefAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount);
|
||||
static void ReleaseAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount);
|
||||
|
||||
static PRBool IsMember(nsIAtom *aAtom,
|
||||
const nsAtomListInfo* aInfo,
|
||||
PRUint32 aInfoCount);
|
||||
};
|
||||
|
||||
#endif /* !defined(nsAtomListUtils_h__) */
|
@ -36,22 +36,26 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name;
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo HTMLAtoms_info[] = {
|
||||
#define HTML_ATOM(name_, value_) { &nsHTMLAtoms::name_, value_ },
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
};
|
||||
|
||||
void nsHTMLAtoms::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define HTML_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(HTMLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,10 +63,8 @@ void nsHTMLAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define HTML_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(HTMLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:content directory
|
||||
#
|
||||
nsAtomListUtils.h
|
||||
nsBidiUtils.h
|
||||
nsChangeHint.h
|
||||
nsCSSAnonBoxList.h
|
||||
|
@ -29,6 +29,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = content
|
||||
|
||||
EXPORTS = \
|
||||
nsAtomListUtils.h \
|
||||
nsBidiUtils.h \
|
||||
nsChangeHint.h \
|
||||
nsCSSAnonBoxList.h \
|
||||
|
62
content/shared/public/nsAtomListUtils.h
Normal file
62
content/shared/public/nsAtomListUtils.h
Normal file
@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 nsAtomListUtils.h .
|
||||
*
|
||||
* The Initial Developer of the Original Code is L. David Baron.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* L. David Baron <dbaron@fas.harvard.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either 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 nsAtomListUtils_h__
|
||||
#define nsAtomListUtils_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
|
||||
class nsIAtom;
|
||||
|
||||
#define MOZ_ARRAY_LENGTH(a_) (sizeof(a_)/sizeof(a_[0]))
|
||||
|
||||
struct nsAtomListInfo {
|
||||
nsIAtom** mAtom;
|
||||
const char* mString;
|
||||
};
|
||||
|
||||
class nsAtomListUtils {
|
||||
public:
|
||||
static void AddRefAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount);
|
||||
static void ReleaseAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount);
|
||||
|
||||
static PRBool IsMember(nsIAtom *aAtom,
|
||||
const nsAtomListInfo* aInfo,
|
||||
PRUint32 aInfoCount);
|
||||
};
|
||||
|
||||
#endif /* !defined(nsAtomListUtils_h__) */
|
@ -43,6 +43,7 @@ REQUIRES = xpcom \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsAtomListUtils.cpp \
|
||||
nsCSSAnonBoxes.cpp \
|
||||
nsCSSPseudoClasses.cpp \
|
||||
nsCSSPseudoElements.cpp \
|
||||
|
70
content/shared/src/nsAtomListUtils.cpp
Normal file
70
content/shared/src/nsAtomListUtils.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 nsAtomListUtils.h .
|
||||
*
|
||||
* The Initial Developer of the Original Code is L. David Baron.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* L. David Baron <dbaron@fas.harvard.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either 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 ***** */
|
||||
|
||||
#include "nsAtomListUtils.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
/* static */ void
|
||||
nsAtomListUtils::AddRefAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount)
|
||||
{
|
||||
for (nsAtomListInfo *info = aInfo, *info_end = aInfo + aCount;
|
||||
info != info_end; ++info) {
|
||||
*(info->mAtom) = NS_NewPermanentAtom(info->mString);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsAtomListUtils::ReleaseAtoms(const nsAtomListInfo* aInfo, PRUint32 aCount)
|
||||
{
|
||||
for (nsAtomListInfo *info = aInfo, *info_end = aInfo + aCount;
|
||||
info != info_end; ++info) {
|
||||
NS_RELEASE(*(info->mAtom));
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ PRBool
|
||||
nsAtomListUtils::IsMember(nsIAtom *aAtom,
|
||||
const nsAtomListInfo* aInfo,
|
||||
PRUint32 aInfoCount)
|
||||
{
|
||||
for (nsAtomListInfo *info = aInfo, *info_end = aInfo + aInfoCount;
|
||||
info != info_end; ++info) {
|
||||
if (aAtom == *(info->mAtom))
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define CSS_ANON_BOX(_name, _value) \
|
||||
@ -45,14 +46,18 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo CSSAnonBoxes_info[] = {
|
||||
#define CSS_ANON_BOX(name_, value_) \
|
||||
{ (nsIAtom**)&nsCSSAnonBoxes::name_, value_ },
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
};
|
||||
|
||||
void nsCSSAnonBoxes::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define CSS_ANON_BOX(_name, _value) \
|
||||
_name = NS_STATIC_CAST(nsICSSAnonBoxPseudo*, NS_NewPermanentAtom(_value));
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
nsAtomListUtils::AddRefAtoms(CSSAnonBoxes_info,
|
||||
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,19 +65,14 @@ void nsCSSAnonBoxes::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define CSS_ANON_BOX(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
nsAtomListUtils::ReleaseAtoms(CSSAnonBoxes_info,
|
||||
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
|
||||
{
|
||||
return
|
||||
#define CSS_ANON_BOX(_name, _value) (aAtom == _name) ||
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
PR_FALSE;
|
||||
return nsAtomListUtils::IsMember(aAtom, CSSAnonBoxes_info,
|
||||
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSPseudoClasses.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||
@ -45,14 +46,18 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo CSSPseudoClasses_info[] = {
|
||||
#define CSS_PSEUDO_CLASS(name_, value_) \
|
||||
{ (nsIAtom**)&nsCSSPseudoClasses::name_, value_ },
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
};
|
||||
|
||||
void nsCSSPseudoClasses::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||
_name = NS_STATIC_CAST(nsICSSPseudoClass*, NS_NewPermanentAtom(_value));
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
nsAtomListUtils::AddRefAtoms(CSSPseudoClasses_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,19 +65,14 @@ void nsCSSPseudoClasses::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
nsAtomListUtils::ReleaseAtoms(CSSPseudoClasses_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCSSPseudoClasses::IsPseudoClass(nsIAtom *aAtom)
|
||||
{
|
||||
return
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) (aAtom == _name) ||
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
PR_FALSE;
|
||||
return nsAtomListUtils::IsMember(aAtom, CSSPseudoClasses_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
||||
@ -45,14 +46,18 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo CSSPseudoElements_info[] = {
|
||||
#define CSS_PSEUDO_ELEMENT(name_, value_) \
|
||||
{ (nsIAtom**)&nsCSSPseudoElements::name_, value_ },
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
};
|
||||
|
||||
void nsCSSPseudoElements::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
||||
_name = NS_STATIC_CAST(nsICSSPseudoElement*, NS_NewPermanentAtom(_value));
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
nsAtomListUtils::AddRefAtoms(CSSPseudoElements_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,19 +65,14 @@ void nsCSSPseudoElements::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
nsAtomListUtils::ReleaseAtoms(CSSPseudoElements_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCSSPseudoElements::IsPseudoElement(nsIAtom *aAtom)
|
||||
{
|
||||
return
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) (aAtom == _name) ||
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
PR_FALSE;
|
||||
return nsAtomListUtils::IsMember(aAtom, CSSPseudoElements_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||
}
|
||||
|
||||
|
@ -36,22 +36,26 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name;
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo HTMLAtoms_info[] = {
|
||||
#define HTML_ATOM(name_, value_) { &nsHTMLAtoms::name_, value_ },
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
};
|
||||
|
||||
void nsHTMLAtoms::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define HTML_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(HTMLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,10 +63,8 @@ void nsHTMLAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define HTML_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsHTMLAtomList.h"
|
||||
#undef HTML_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(HTMLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name;
|
||||
@ -45,13 +46,17 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo LayoutAtoms_info[] = {
|
||||
#define LAYOUT_ATOM(name_, value_) { &nsLayoutAtoms::name_, value_ },
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
};
|
||||
|
||||
void nsLayoutAtoms::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define LAYOUT_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(LayoutAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,10 +64,8 @@ void nsLayoutAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define LAYOUT_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(LayoutAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "nsSVGAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
||||
@ -31,13 +32,17 @@
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
|
||||
static const nsAtomListInfo SVGAtoms_info[] = {
|
||||
#define SVG_ATOM(name_, value_) { &nsSVGAtoms::name_, value_ },
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
};
|
||||
|
||||
void nsSVGAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
// now register the atoms
|
||||
#define SVG_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(SVGAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||
}
|
||||
++gRefCnt;
|
||||
}
|
||||
@ -46,8 +51,7 @@ void nsSVGAtoms::ReleaseAtoms() {
|
||||
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of SVG atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
#define SVG_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(SVGAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,8 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsXBLAtoms.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define XBL_ATOM(_name, _value) nsIAtom* nsXBLAtoms::_name;
|
||||
@ -49,13 +48,17 @@
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
|
||||
static const nsAtomListInfo XBLAtoms_info[] = {
|
||||
#define XBL_ATOM(name_, value_) { &nsXBLAtoms::name_, value_ },
|
||||
#include "nsXBLAtomList.h"
|
||||
#undef XBL_ATOM
|
||||
};
|
||||
|
||||
void nsXBLAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
// now register the atoms
|
||||
#define XBL_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsXBLAtomList.h"
|
||||
#undef XBL_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(XBLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||
}
|
||||
++gRefCnt;
|
||||
}
|
||||
@ -64,8 +67,7 @@ void nsXBLAtoms::ReleaseAtoms() {
|
||||
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of XBL atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
#define XBL_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsXBLAtomList.h"
|
||||
#undef XBL_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(XBLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,8 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name;
|
||||
@ -48,13 +48,17 @@
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
|
||||
static const nsAtomListInfo XULAtoms_info[] = {
|
||||
#define XUL_ATOM(name_, value_) { &nsXULAtoms::name_, value_ },
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
};
|
||||
|
||||
void nsXULAtoms::AddRefAtoms()
|
||||
{
|
||||
if (++gRefCnt == 1) {
|
||||
// create atoms
|
||||
#define XUL_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(XULAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(XULAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,9 +66,7 @@ void nsXULAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define XUL_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsXULAtomList.h"
|
||||
#undef XUL_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(XULAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(XULAtoms_info));
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "nsSVGAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
||||
@ -31,13 +32,17 @@
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
|
||||
static const nsAtomListInfo SVGAtoms_info[] = {
|
||||
#define SVG_ATOM(name_, value_) { &nsSVGAtoms::name_, value_ },
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
};
|
||||
|
||||
void nsSVGAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
// now register the atoms
|
||||
#define SVG_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(SVGAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||
}
|
||||
++gRefCnt;
|
||||
}
|
||||
@ -46,8 +51,7 @@ void nsSVGAtoms::ReleaseAtoms() {
|
||||
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of SVG atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
#define SVG_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsSVGAtomList.h"
|
||||
#undef SVG_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(SVGAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||
}
|
||||
}
|
||||
|
@ -37,9 +37,8 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsXBLAtoms.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define XBL_ATOM(_name, _value) nsIAtom* nsXBLAtoms::_name;
|
||||
@ -49,13 +48,17 @@
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
|
||||
static const nsAtomListInfo XBLAtoms_info[] = {
|
||||
#define XBL_ATOM(name_, value_) { &nsXBLAtoms::name_, value_ },
|
||||
#include "nsXBLAtomList.h"
|
||||
#undef XBL_ATOM
|
||||
};
|
||||
|
||||
void nsXBLAtoms::AddRefAtoms() {
|
||||
|
||||
if (gRefCnt == 0) {
|
||||
// now register the atoms
|
||||
#define XBL_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsXBLAtomList.h"
|
||||
#undef XBL_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(XBLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||
}
|
||||
++gRefCnt;
|
||||
}
|
||||
@ -64,8 +67,7 @@ void nsXBLAtoms::ReleaseAtoms() {
|
||||
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of XBL atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
#define XBL_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsXBLAtomList.h"
|
||||
#undef XBL_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(XBLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name;
|
||||
@ -45,13 +46,17 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo LayoutAtoms_info[] = {
|
||||
#define LAYOUT_ATOM(name_, value_) { &nsLayoutAtoms::name_, value_ },
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
};
|
||||
|
||||
void nsLayoutAtoms::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define LAYOUT_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
nsAtomListUtils::AddRefAtoms(LayoutAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,10 +64,8 @@ void nsLayoutAtoms::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define LAYOUT_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsLayoutAtomList.h"
|
||||
#undef LAYOUT_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(LayoutAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ REQUIRES = xpcom \
|
||||
string \
|
||||
necko \
|
||||
gfx \
|
||||
content \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "nsMathMLAtoms.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define MATHML_ATOM(_name, _value) nsIAtom* nsMathMLAtoms::_name;
|
||||
@ -29,12 +30,16 @@
|
||||
|
||||
static nsrefcnt gRefCnt = 0;
|
||||
|
||||
void nsMathMLAtoms::AddRefAtoms() {
|
||||
if (gRefCnt == 0) {
|
||||
// create atoms
|
||||
#define MATHML_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
||||
static const nsAtomListInfo MathMLAtoms_info[] = {
|
||||
#define MATHML_ATOM(name_, value_) { &nsMathMLAtoms::name_, value_ },
|
||||
#include "nsMathMLAtomList.h"
|
||||
#undef MATHML_ATOM
|
||||
};
|
||||
|
||||
void nsMathMLAtoms::AddRefAtoms() {
|
||||
if (gRefCnt == 0) {
|
||||
nsAtomListUtils::AddRefAtoms(MathMLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(MathMLAtoms_info));
|
||||
}
|
||||
++gRefCnt;
|
||||
}
|
||||
@ -42,9 +47,7 @@ void nsMathMLAtoms::AddRefAtoms() {
|
||||
void nsMathMLAtoms::ReleaseAtoms() {
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release of MathML atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define MATHML_ATOM(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsMathMLAtomList.h"
|
||||
#undef MATHML_ATOM
|
||||
nsAtomListUtils::ReleaseAtoms(MathMLAtoms_info,
|
||||
MOZ_ARRAY_LENGTH(MathMLAtoms_info));
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define CSS_ANON_BOX(_name, _value) \
|
||||
@ -45,14 +46,18 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo CSSAnonBoxes_info[] = {
|
||||
#define CSS_ANON_BOX(name_, value_) \
|
||||
{ (nsIAtom**)&nsCSSAnonBoxes::name_, value_ },
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
};
|
||||
|
||||
void nsCSSAnonBoxes::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define CSS_ANON_BOX(_name, _value) \
|
||||
_name = NS_STATIC_CAST(nsICSSAnonBoxPseudo*, NS_NewPermanentAtom(_value));
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
nsAtomListUtils::AddRefAtoms(CSSAnonBoxes_info,
|
||||
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,19 +65,14 @@ void nsCSSAnonBoxes::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define CSS_ANON_BOX(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
nsAtomListUtils::ReleaseAtoms(CSSAnonBoxes_info,
|
||||
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
|
||||
{
|
||||
return
|
||||
#define CSS_ANON_BOX(_name, _value) (aAtom == _name) ||
|
||||
#include "nsCSSAnonBoxList.h"
|
||||
#undef CSS_ANON_BOX
|
||||
PR_FALSE;
|
||||
return nsAtomListUtils::IsMember(aAtom, CSSAnonBoxes_info,
|
||||
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSPseudoClasses.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||
@ -45,14 +46,18 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo CSSPseudoClasses_info[] = {
|
||||
#define CSS_PSEUDO_CLASS(name_, value_) \
|
||||
{ (nsIAtom**)&nsCSSPseudoClasses::name_, value_ },
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
};
|
||||
|
||||
void nsCSSPseudoClasses::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||
_name = NS_STATIC_CAST(nsICSSPseudoClass*, NS_NewPermanentAtom(_value));
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
nsAtomListUtils::AddRefAtoms(CSSPseudoClasses_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,19 +65,14 @@ void nsCSSPseudoClasses::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
nsAtomListUtils::ReleaseAtoms(CSSPseudoClasses_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCSSPseudoClasses::IsPseudoClass(nsIAtom *aAtom)
|
||||
{
|
||||
return
|
||||
#define CSS_PSEUDO_CLASS(_name, _value) (aAtom == _name) ||
|
||||
#include "nsCSSPseudoClassList.h"
|
||||
#undef CSS_PSEUDO_CLASS
|
||||
PR_FALSE;
|
||||
return nsAtomListUtils::IsMember(aAtom, CSSPseudoClasses_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsAtomListUtils.h"
|
||||
|
||||
// define storage for all atoms
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
||||
@ -45,14 +46,18 @@
|
||||
|
||||
static nsrefcnt gRefCnt;
|
||||
|
||||
static const nsAtomListInfo CSSPseudoElements_info[] = {
|
||||
#define CSS_PSEUDO_ELEMENT(name_, value_) \
|
||||
{ (nsIAtom**)&nsCSSPseudoElements::name_, value_ },
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
};
|
||||
|
||||
void nsCSSPseudoElements::AddRefAtoms()
|
||||
{
|
||||
if (0 == gRefCnt++) {
|
||||
// create atoms
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
||||
_name = NS_STATIC_CAST(nsICSSPseudoElement*, NS_NewPermanentAtom(_value));
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
nsAtomListUtils::AddRefAtoms(CSSPseudoElements_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,19 +65,14 @@ void nsCSSPseudoElements::ReleaseAtoms()
|
||||
{
|
||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||
if (--gRefCnt == 0) {
|
||||
// release atoms
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) NS_RELEASE(_name);
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
nsAtomListUtils::ReleaseAtoms(CSSPseudoElements_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsCSSPseudoElements::IsPseudoElement(nsIAtom *aAtom)
|
||||
{
|
||||
return
|
||||
#define CSS_PSEUDO_ELEMENT(_name, _value) (aAtom == _name) ||
|
||||
#include "nsCSSPseudoElementList.h"
|
||||
#undef CSS_PSEUDO_ELEMENT
|
||||
PR_FALSE;
|
||||
return nsAtomListUtils::IsMember(aAtom, CSSPseudoElements_info,
|
||||
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user