Reduce code size of atom lists by storing a table of strings and pointers to fill in. b=181383 r=alecf sr=sfraser
git-svn-id: svn://10.0.0.236/trunk@138195 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
70
mozilla/content/base/src/nsAtomListUtils.cpp
Normal file
70
mozilla/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
mozilla/content/base/src/nsAtomListUtils.h
Normal file
62
mozilla/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 ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsHTMLAtoms.h"
|
#include "nsHTMLAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name;
|
#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name;
|
||||||
#include "nsHTMLAtomList.h"
|
#include "nsHTMLAtomList.h"
|
||||||
#undef HTML_ATOM
|
#undef HTML_ATOM
|
||||||
|
|
||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsHTMLAtoms::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(HTMLAtoms_info,
|
||||||
#define HTML_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||||
#include "nsHTMLAtomList.h"
|
|
||||||
#undef HTML_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,10 +63,8 @@ void nsHTMLAtoms::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(HTMLAtoms_info,
|
||||||
#define HTML_ATOM(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||||
#include "nsHTMLAtomList.h"
|
|
||||||
#undef HTML_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#
|
#
|
||||||
# This is a list of local files which get copied to the mozilla:dist:content directory
|
# This is a list of local files which get copied to the mozilla:dist:content directory
|
||||||
#
|
#
|
||||||
|
nsAtomListUtils.h
|
||||||
nsBidiUtils.h
|
nsBidiUtils.h
|
||||||
nsChangeHint.h
|
nsChangeHint.h
|
||||||
nsCSSAnonBoxList.h
|
nsCSSAnonBoxList.h
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||||||
MODULE = content
|
MODULE = content
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
|
nsAtomListUtils.h \
|
||||||
nsBidiUtils.h \
|
nsBidiUtils.h \
|
||||||
nsChangeHint.h \
|
nsChangeHint.h \
|
||||||
nsCSSAnonBoxList.h \
|
nsCSSAnonBoxList.h \
|
||||||
|
|||||||
62
mozilla/content/shared/public/nsAtomListUtils.h
Normal file
62
mozilla/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)
|
$(NULL)
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
|
nsAtomListUtils.cpp \
|
||||||
nsCSSAnonBoxes.cpp \
|
nsCSSAnonBoxes.cpp \
|
||||||
nsCSSPseudoClasses.cpp \
|
nsCSSPseudoClasses.cpp \
|
||||||
nsCSSPseudoElements.cpp \
|
nsCSSPseudoElements.cpp \
|
||||||
|
|||||||
70
mozilla/content/shared/src/nsAtomListUtils.cpp
Normal file
70
mozilla/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 ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsCSSAnonBoxes.h"
|
#include "nsCSSAnonBoxes.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define CSS_ANON_BOX(_name, _value) \
|
#define CSS_ANON_BOX(_name, _value) \
|
||||||
@@ -45,14 +46,18 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsCSSAnonBoxes::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(CSSAnonBoxes_info,
|
||||||
#define CSS_ANON_BOX(_name, _value) \
|
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||||
_name = NS_STATIC_CAST(nsICSSAnonBoxPseudo*, NS_NewPermanentAtom(_value));
|
|
||||||
#include "nsCSSAnonBoxList.h"
|
|
||||||
#undef CSS_ANON_BOX
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,19 +65,14 @@ void nsCSSAnonBoxes::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(CSSAnonBoxes_info,
|
||||||
#define CSS_ANON_BOX(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||||
#include "nsCSSAnonBoxList.h"
|
|
||||||
#undef CSS_ANON_BOX
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
|
PRBool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
|
||||||
{
|
{
|
||||||
return
|
return nsAtomListUtils::IsMember(aAtom, CSSAnonBoxes_info,
|
||||||
#define CSS_ANON_BOX(_name, _value) (aAtom == _name) ||
|
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||||
#include "nsCSSAnonBoxList.h"
|
|
||||||
#undef CSS_ANON_BOX
|
|
||||||
PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsCSSPseudoClasses.h"
|
#include "nsCSSPseudoClasses.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||||
@@ -45,14 +46,18 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsCSSPseudoClasses::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(CSSPseudoClasses_info,
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||||
_name = NS_STATIC_CAST(nsICSSPseudoClass*, NS_NewPermanentAtom(_value));
|
|
||||||
#include "nsCSSPseudoClassList.h"
|
|
||||||
#undef CSS_PSEUDO_CLASS
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,19 +65,14 @@ void nsCSSPseudoClasses::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(CSSPseudoClasses_info,
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||||
#include "nsCSSPseudoClassList.h"
|
|
||||||
#undef CSS_PSEUDO_CLASS
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsCSSPseudoClasses::IsPseudoClass(nsIAtom *aAtom)
|
PRBool nsCSSPseudoClasses::IsPseudoClass(nsIAtom *aAtom)
|
||||||
{
|
{
|
||||||
return
|
return nsAtomListUtils::IsMember(aAtom, CSSPseudoClasses_info,
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) (aAtom == _name) ||
|
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||||
#include "nsCSSPseudoClassList.h"
|
|
||||||
#undef CSS_PSEUDO_CLASS
|
|
||||||
PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsCSSPseudoElements.h"
|
#include "nsCSSPseudoElements.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
||||||
@@ -45,14 +46,18 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsCSSPseudoElements::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(CSSPseudoElements_info,
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||||
_name = NS_STATIC_CAST(nsICSSPseudoElement*, NS_NewPermanentAtom(_value));
|
|
||||||
#include "nsCSSPseudoElementList.h"
|
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,19 +65,14 @@ void nsCSSPseudoElements::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(CSSPseudoElements_info,
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||||
#include "nsCSSPseudoElementList.h"
|
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsCSSPseudoElements::IsPseudoElement(nsIAtom *aAtom)
|
PRBool nsCSSPseudoElements::IsPseudoElement(nsIAtom *aAtom)
|
||||||
{
|
{
|
||||||
return
|
return nsAtomListUtils::IsMember(aAtom, CSSPseudoElements_info,
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) (aAtom == _name) ||
|
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||||
#include "nsCSSPseudoElementList.h"
|
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
|
||||||
PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,22 +36,26 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsHTMLAtoms.h"
|
#include "nsHTMLAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name;
|
#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name;
|
||||||
#include "nsHTMLAtomList.h"
|
#include "nsHTMLAtomList.h"
|
||||||
#undef HTML_ATOM
|
#undef HTML_ATOM
|
||||||
|
|
||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsHTMLAtoms::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(HTMLAtoms_info,
|
||||||
#define HTML_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||||
#include "nsHTMLAtomList.h"
|
|
||||||
#undef HTML_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,10 +63,8 @@ void nsHTMLAtoms::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(HTMLAtoms_info,
|
||||||
#define HTML_ATOM(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(HTMLAtoms_info));
|
||||||
#include "nsHTMLAtomList.h"
|
|
||||||
#undef HTML_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name;
|
#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name;
|
||||||
@@ -45,13 +46,17 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsLayoutAtoms::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(LayoutAtoms_info,
|
||||||
#define LAYOUT_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||||
#include "nsLayoutAtomList.h"
|
|
||||||
#undef LAYOUT_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,10 +64,8 @@ void nsLayoutAtoms::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(LayoutAtoms_info,
|
||||||
#define LAYOUT_ATOM(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||||
#include "nsLayoutAtomList.h"
|
|
||||||
#undef LAYOUT_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsSVGAtoms.h"
|
#include "nsSVGAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
||||||
@@ -31,13 +32,17 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt = 0;
|
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() {
|
void nsSVGAtoms::AddRefAtoms() {
|
||||||
|
|
||||||
if (gRefCnt == 0) {
|
if (gRefCnt == 0) {
|
||||||
// now register the atoms
|
nsAtomListUtils::AddRefAtoms(SVGAtoms_info,
|
||||||
#define SVG_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||||
#include "nsSVGAtomList.h"
|
|
||||||
#undef SVG_ATOM
|
|
||||||
}
|
}
|
||||||
++gRefCnt;
|
++gRefCnt;
|
||||||
}
|
}
|
||||||
@@ -46,8 +51,7 @@ void nsSVGAtoms::ReleaseAtoms() {
|
|||||||
|
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release of SVG atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release of SVG atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
#define SVG_ATOM(_name, _value) NS_RELEASE(_name);
|
nsAtomListUtils::ReleaseAtoms(SVGAtoms_info,
|
||||||
#include "nsSVGAtomList.h"
|
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||||
#undef SVG_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,8 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsXBLAtoms.h"
|
#include "nsXBLAtoms.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define XBL_ATOM(_name, _value) nsIAtom* nsXBLAtoms::_name;
|
#define XBL_ATOM(_name, _value) nsIAtom* nsXBLAtoms::_name;
|
||||||
@@ -49,13 +48,17 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt = 0;
|
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() {
|
void nsXBLAtoms::AddRefAtoms() {
|
||||||
|
|
||||||
if (gRefCnt == 0) {
|
if (gRefCnt == 0) {
|
||||||
// now register the atoms
|
nsAtomListUtils::AddRefAtoms(XBLAtoms_info,
|
||||||
#define XBL_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||||
#include "nsXBLAtomList.h"
|
|
||||||
#undef XBL_ATOM
|
|
||||||
}
|
}
|
||||||
++gRefCnt;
|
++gRefCnt;
|
||||||
}
|
}
|
||||||
@@ -64,8 +67,7 @@ void nsXBLAtoms::ReleaseAtoms() {
|
|||||||
|
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release of XBL atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release of XBL atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
#define XBL_ATOM(_name, _value) NS_RELEASE(_name);
|
nsAtomListUtils::ReleaseAtoms(XBLAtoms_info,
|
||||||
#include "nsXBLAtomList.h"
|
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||||
#undef XBL_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsXULAtoms.h"
|
#include "nsXULAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name;
|
#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name;
|
||||||
@@ -48,13 +48,17 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt = 0;
|
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()
|
void nsXULAtoms::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (++gRefCnt == 1) {
|
if (++gRefCnt == 1) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(XULAtoms_info,
|
||||||
#define XUL_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(XULAtoms_info));
|
||||||
#include "nsXULAtomList.h"
|
|
||||||
#undef XUL_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,9 +66,7 @@ void nsXULAtoms::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(XULAtoms_info,
|
||||||
#define XUL_ATOM(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(XULAtoms_info));
|
||||||
#include "nsXULAtomList.h"
|
|
||||||
#undef XUL_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsSVGAtoms.h"
|
#include "nsSVGAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
#define SVG_ATOM(_name, _value) nsIAtom* nsSVGAtoms::_name;
|
||||||
@@ -31,13 +32,17 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt = 0;
|
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() {
|
void nsSVGAtoms::AddRefAtoms() {
|
||||||
|
|
||||||
if (gRefCnt == 0) {
|
if (gRefCnt == 0) {
|
||||||
// now register the atoms
|
nsAtomListUtils::AddRefAtoms(SVGAtoms_info,
|
||||||
#define SVG_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||||
#include "nsSVGAtomList.h"
|
|
||||||
#undef SVG_ATOM
|
|
||||||
}
|
}
|
||||||
++gRefCnt;
|
++gRefCnt;
|
||||||
}
|
}
|
||||||
@@ -46,8 +51,7 @@ void nsSVGAtoms::ReleaseAtoms() {
|
|||||||
|
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release of SVG atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release of SVG atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
#define SVG_ATOM(_name, _value) NS_RELEASE(_name);
|
nsAtomListUtils::ReleaseAtoms(SVGAtoms_info,
|
||||||
#include "nsSVGAtomList.h"
|
MOZ_ARRAY_LENGTH(SVGAtoms_info));
|
||||||
#undef SVG_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,8 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsXBLAtoms.h"
|
#include "nsXBLAtoms.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define XBL_ATOM(_name, _value) nsIAtom* nsXBLAtoms::_name;
|
#define XBL_ATOM(_name, _value) nsIAtom* nsXBLAtoms::_name;
|
||||||
@@ -49,13 +48,17 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt = 0;
|
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() {
|
void nsXBLAtoms::AddRefAtoms() {
|
||||||
|
|
||||||
if (gRefCnt == 0) {
|
if (gRefCnt == 0) {
|
||||||
// now register the atoms
|
nsAtomListUtils::AddRefAtoms(XBLAtoms_info,
|
||||||
#define XBL_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||||
#include "nsXBLAtomList.h"
|
|
||||||
#undef XBL_ATOM
|
|
||||||
}
|
}
|
||||||
++gRefCnt;
|
++gRefCnt;
|
||||||
}
|
}
|
||||||
@@ -64,8 +67,7 @@ void nsXBLAtoms::ReleaseAtoms() {
|
|||||||
|
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release of XBL atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release of XBL atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
#define XBL_ATOM(_name, _value) NS_RELEASE(_name);
|
nsAtomListUtils::ReleaseAtoms(XBLAtoms_info,
|
||||||
#include "nsXBLAtomList.h"
|
MOZ_ARRAY_LENGTH(XBLAtoms_info));
|
||||||
#undef XBL_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name;
|
#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name;
|
||||||
@@ -45,13 +46,17 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsLayoutAtoms::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(LayoutAtoms_info,
|
||||||
#define LAYOUT_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||||
#include "nsLayoutAtomList.h"
|
|
||||||
#undef LAYOUT_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,10 +64,8 @@ void nsLayoutAtoms::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(LayoutAtoms_info,
|
||||||
#define LAYOUT_ATOM(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(LayoutAtoms_info));
|
||||||
#include "nsLayoutAtomList.h"
|
|
||||||
#undef LAYOUT_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ REQUIRES = xpcom \
|
|||||||
string \
|
string \
|
||||||
necko \
|
necko \
|
||||||
gfx \
|
gfx \
|
||||||
|
content \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
include $(topsrcdir)/config/config.mk
|
include $(topsrcdir)/config/config.mk
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsMathMLAtoms.h"
|
#include "nsMathMLAtoms.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define MATHML_ATOM(_name, _value) nsIAtom* nsMathMLAtoms::_name;
|
#define MATHML_ATOM(_name, _value) nsIAtom* nsMathMLAtoms::_name;
|
||||||
@@ -29,12 +30,16 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt = 0;
|
static nsrefcnt gRefCnt = 0;
|
||||||
|
|
||||||
void nsMathMLAtoms::AddRefAtoms() {
|
static const nsAtomListInfo MathMLAtoms_info[] = {
|
||||||
if (gRefCnt == 0) {
|
#define MATHML_ATOM(name_, value_) { &nsMathMLAtoms::name_, value_ },
|
||||||
// create atoms
|
|
||||||
#define MATHML_ATOM(_name, _value) _name = NS_NewPermanentAtom(_value);
|
|
||||||
#include "nsMathMLAtomList.h"
|
#include "nsMathMLAtomList.h"
|
||||||
#undef MATHML_ATOM
|
#undef MATHML_ATOM
|
||||||
|
};
|
||||||
|
|
||||||
|
void nsMathMLAtoms::AddRefAtoms() {
|
||||||
|
if (gRefCnt == 0) {
|
||||||
|
nsAtomListUtils::AddRefAtoms(MathMLAtoms_info,
|
||||||
|
MOZ_ARRAY_LENGTH(MathMLAtoms_info));
|
||||||
}
|
}
|
||||||
++gRefCnt;
|
++gRefCnt;
|
||||||
}
|
}
|
||||||
@@ -42,9 +47,7 @@ void nsMathMLAtoms::AddRefAtoms() {
|
|||||||
void nsMathMLAtoms::ReleaseAtoms() {
|
void nsMathMLAtoms::ReleaseAtoms() {
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release of MathML atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release of MathML atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(MathMLAtoms_info,
|
||||||
#define MATHML_ATOM(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(MathMLAtoms_info));
|
||||||
#include "nsMathMLAtomList.h"
|
|
||||||
#undef MATHML_ATOM
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsCSSAnonBoxes.h"
|
#include "nsCSSAnonBoxes.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define CSS_ANON_BOX(_name, _value) \
|
#define CSS_ANON_BOX(_name, _value) \
|
||||||
@@ -45,14 +46,18 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsCSSAnonBoxes::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(CSSAnonBoxes_info,
|
||||||
#define CSS_ANON_BOX(_name, _value) \
|
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||||
_name = NS_STATIC_CAST(nsICSSAnonBoxPseudo*, NS_NewPermanentAtom(_value));
|
|
||||||
#include "nsCSSAnonBoxList.h"
|
|
||||||
#undef CSS_ANON_BOX
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,19 +65,14 @@ void nsCSSAnonBoxes::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(CSSAnonBoxes_info,
|
||||||
#define CSS_ANON_BOX(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||||
#include "nsCSSAnonBoxList.h"
|
|
||||||
#undef CSS_ANON_BOX
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
|
PRBool nsCSSAnonBoxes::IsAnonBox(nsIAtom *aAtom)
|
||||||
{
|
{
|
||||||
return
|
return nsAtomListUtils::IsMember(aAtom, CSSAnonBoxes_info,
|
||||||
#define CSS_ANON_BOX(_name, _value) (aAtom == _name) ||
|
MOZ_ARRAY_LENGTH(CSSAnonBoxes_info));
|
||||||
#include "nsCSSAnonBoxList.h"
|
|
||||||
#undef CSS_ANON_BOX
|
|
||||||
PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsCSSPseudoClasses.h"
|
#include "nsCSSPseudoClasses.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
#define CSS_PSEUDO_CLASS(_name, _value) \
|
||||||
@@ -45,14 +46,18 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsCSSPseudoClasses::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(CSSPseudoClasses_info,
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) \
|
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||||
_name = NS_STATIC_CAST(nsICSSPseudoClass*, NS_NewPermanentAtom(_value));
|
|
||||||
#include "nsCSSPseudoClassList.h"
|
|
||||||
#undef CSS_PSEUDO_CLASS
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,19 +65,14 @@ void nsCSSPseudoClasses::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(CSSPseudoClasses_info,
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||||
#include "nsCSSPseudoClassList.h"
|
|
||||||
#undef CSS_PSEUDO_CLASS
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsCSSPseudoClasses::IsPseudoClass(nsIAtom *aAtom)
|
PRBool nsCSSPseudoClasses::IsPseudoClass(nsIAtom *aAtom)
|
||||||
{
|
{
|
||||||
return
|
return nsAtomListUtils::IsMember(aAtom, CSSPseudoClasses_info,
|
||||||
#define CSS_PSEUDO_CLASS(_name, _value) (aAtom == _name) ||
|
MOZ_ARRAY_LENGTH(CSSPseudoClasses_info));
|
||||||
#include "nsCSSPseudoClassList.h"
|
|
||||||
#undef CSS_PSEUDO_CLASS
|
|
||||||
PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
#include "nsCSSPseudoElements.h"
|
#include "nsCSSPseudoElements.h"
|
||||||
|
#include "nsAtomListUtils.h"
|
||||||
|
|
||||||
// define storage for all atoms
|
// define storage for all atoms
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
||||||
@@ -45,14 +46,18 @@
|
|||||||
|
|
||||||
static nsrefcnt gRefCnt;
|
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()
|
void nsCSSPseudoElements::AddRefAtoms()
|
||||||
{
|
{
|
||||||
if (0 == gRefCnt++) {
|
if (0 == gRefCnt++) {
|
||||||
// create atoms
|
nsAtomListUtils::AddRefAtoms(CSSPseudoElements_info,
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) \
|
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||||
_name = NS_STATIC_CAST(nsICSSPseudoElement*, NS_NewPermanentAtom(_value));
|
|
||||||
#include "nsCSSPseudoElementList.h"
|
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,19 +65,14 @@ void nsCSSPseudoElements::ReleaseAtoms()
|
|||||||
{
|
{
|
||||||
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
NS_PRECONDITION(gRefCnt != 0, "bad release atoms");
|
||||||
if (--gRefCnt == 0) {
|
if (--gRefCnt == 0) {
|
||||||
// release atoms
|
nsAtomListUtils::ReleaseAtoms(CSSPseudoElements_info,
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) NS_RELEASE(_name);
|
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||||
#include "nsCSSPseudoElementList.h"
|
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsCSSPseudoElements::IsPseudoElement(nsIAtom *aAtom)
|
PRBool nsCSSPseudoElements::IsPseudoElement(nsIAtom *aAtom)
|
||||||
{
|
{
|
||||||
return
|
return nsAtomListUtils::IsMember(aAtom, CSSPseudoElements_info,
|
||||||
#define CSS_PSEUDO_ELEMENT(_name, _value) (aAtom == _name) ||
|
MOZ_ARRAY_LENGTH(CSSPseudoElements_info));
|
||||||
#include "nsCSSPseudoElementList.h"
|
|
||||||
#undef CSS_PSEUDO_ELEMENT
|
|
||||||
PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user