From 14a4bc76a8593865fd8ce9955af576791b7d8d9d Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Wed, 2 Dec 1998 00:32:20 +0000 Subject: [PATCH] added nsLayoutAtoms --- content/shared/src/nsLayoutAtoms.cpp | 68 ++++++++++++++++++++++++++++ layout/base/nsLayoutAtoms.cpp | 68 ++++++++++++++++++++++++++++ layout/base/nsPresContext.cpp | 3 ++ layout/base/src/Makefile.in | 1 + layout/base/src/makefile.win | 2 + layout/base/src/nsLayoutAtoms.cpp | 68 ++++++++++++++++++++++++++++ layout/base/src/nsPresContext.cpp | 3 ++ 7 files changed, 213 insertions(+) create mode 100644 content/shared/src/nsLayoutAtoms.cpp create mode 100644 layout/base/nsLayoutAtoms.cpp create mode 100644 layout/base/src/nsLayoutAtoms.cpp diff --git a/content/shared/src/nsLayoutAtoms.cpp b/content/shared/src/nsLayoutAtoms.cpp new file mode 100644 index 000000000000..01f2b8a2fb60 --- /dev/null +++ b/content/shared/src/nsLayoutAtoms.cpp @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#include "nsLayoutAtoms.h" + +// XXX make this be autogenerated. doh! + +nsIAtom* nsLayoutAtoms::all; +nsIAtom* nsLayoutAtoms::aural; +nsIAtom* nsLayoutAtoms::braille; +nsIAtom* nsLayoutAtoms::embossed; +nsIAtom* nsLayoutAtoms::handheld; +nsIAtom* nsLayoutAtoms::print; +nsIAtom* nsLayoutAtoms::projection; +nsIAtom* nsLayoutAtoms::screen; +nsIAtom* nsLayoutAtoms::tty; +nsIAtom* nsLayoutAtoms::tv; + +static nsrefcnt gRefCnt; + +void nsLayoutAtoms::AddrefAtoms() +{ + if (0 == gRefCnt) { + all = NS_NewAtom("ALL"); + aural = NS_NewAtom("AURAL"); + braille = NS_NewAtom("BRAILLE"); + embossed = NS_NewAtom("EMBOSSED"); + handheld = NS_NewAtom("HANDHELD"); + print = NS_NewAtom("PRINT"); + projection = NS_NewAtom("PROJECTION"); + screen = NS_NewAtom("SCREEN"); + tty = NS_NewAtom("TTY"); + tv = NS_NewAtom("TV"); + } + ++gRefCnt; +} + +void nsLayoutAtoms::ReleaseAtoms() +{ + NS_PRECONDITION(gRefCnt != 0, "bad release atoms"); + if (--gRefCnt == 0) { + NS_RELEASE(all); + NS_RELEASE(aural); + NS_RELEASE(braille); + NS_RELEASE(embossed); + NS_RELEASE(handheld); + NS_RELEASE(print); + NS_RELEASE(projection); + NS_RELEASE(screen); + NS_RELEASE(tty); + NS_RELEASE(tv); + } +} + diff --git a/layout/base/nsLayoutAtoms.cpp b/layout/base/nsLayoutAtoms.cpp new file mode 100644 index 000000000000..01f2b8a2fb60 --- /dev/null +++ b/layout/base/nsLayoutAtoms.cpp @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#include "nsLayoutAtoms.h" + +// XXX make this be autogenerated. doh! + +nsIAtom* nsLayoutAtoms::all; +nsIAtom* nsLayoutAtoms::aural; +nsIAtom* nsLayoutAtoms::braille; +nsIAtom* nsLayoutAtoms::embossed; +nsIAtom* nsLayoutAtoms::handheld; +nsIAtom* nsLayoutAtoms::print; +nsIAtom* nsLayoutAtoms::projection; +nsIAtom* nsLayoutAtoms::screen; +nsIAtom* nsLayoutAtoms::tty; +nsIAtom* nsLayoutAtoms::tv; + +static nsrefcnt gRefCnt; + +void nsLayoutAtoms::AddrefAtoms() +{ + if (0 == gRefCnt) { + all = NS_NewAtom("ALL"); + aural = NS_NewAtom("AURAL"); + braille = NS_NewAtom("BRAILLE"); + embossed = NS_NewAtom("EMBOSSED"); + handheld = NS_NewAtom("HANDHELD"); + print = NS_NewAtom("PRINT"); + projection = NS_NewAtom("PROJECTION"); + screen = NS_NewAtom("SCREEN"); + tty = NS_NewAtom("TTY"); + tv = NS_NewAtom("TV"); + } + ++gRefCnt; +} + +void nsLayoutAtoms::ReleaseAtoms() +{ + NS_PRECONDITION(gRefCnt != 0, "bad release atoms"); + if (--gRefCnt == 0) { + NS_RELEASE(all); + NS_RELEASE(aural); + NS_RELEASE(braille); + NS_RELEASE(embossed); + NS_RELEASE(handheld); + NS_RELEASE(print); + NS_RELEASE(projection); + NS_RELEASE(screen); + NS_RELEASE(tty); + NS_RELEASE(tv); + } +} + diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index b8ce0eca2ef1..df5c9ab21ca8 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -30,6 +30,7 @@ #include "nsIDocument.h" #include "nsIFrame.h" #include "nsIStyleContext.h" +#include "nsLayoutAtoms.h" #ifdef _WIN32 #include #endif @@ -67,6 +68,7 @@ nsPresContext::nsPresContext() NSIntPointsToTwips(10)) { NS_INIT_REFCNT(); + nsLayoutAtoms::AddrefAtoms(); mCompatibilityMode = eCompatibility_NavQuirks; #ifdef _WIN32 @@ -108,6 +110,7 @@ nsPresContext::~nsPresContext() } NS_IF_RELEASE(mPrefs); NS_IF_RELEASE(mBaseURL); + nsLayoutAtoms::ReleaseAtoms(); } nsrefcnt diff --git a/layout/base/src/Makefile.in b/layout/base/src/Makefile.in index 710fdbe2ff4e..15017b4d9055 100644 --- a/layout/base/src/Makefile.in +++ b/layout/base/src/Makefile.in @@ -47,6 +47,7 @@ CPPSRCS = \ nsXIFConverter.cpp \ nsRange.cpp \ nsRangeList.cpp \ + nsLayoutAtoms.cpp \ $(NULL) MODULE = raptor diff --git a/layout/base/src/makefile.win b/layout/base/src/makefile.win index e3356e1b1ad6..e35ae4161552 100644 --- a/layout/base/src/makefile.win +++ b/layout/base/src/makefile.win @@ -39,6 +39,7 @@ CPPSRCS = \ nsTextFragment.cpp \ nsXIFConverter.cpp \ nsRangeList.cpp \ + nsLayoutAtoms.cpp \ $(NULL) MODULE=raptor @@ -64,6 +65,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsTextFragment.obj \ .\$(OBJDIR)\nsXIFConverter.obj \ .\$(OBJDIR)\nsRangeList.obj \ + .\$(OBJDIR)\nsLayoutAtoms.obj \ $(NULL) LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \ diff --git a/layout/base/src/nsLayoutAtoms.cpp b/layout/base/src/nsLayoutAtoms.cpp new file mode 100644 index 000000000000..01f2b8a2fb60 --- /dev/null +++ b/layout/base/src/nsLayoutAtoms.cpp @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#include "nsLayoutAtoms.h" + +// XXX make this be autogenerated. doh! + +nsIAtom* nsLayoutAtoms::all; +nsIAtom* nsLayoutAtoms::aural; +nsIAtom* nsLayoutAtoms::braille; +nsIAtom* nsLayoutAtoms::embossed; +nsIAtom* nsLayoutAtoms::handheld; +nsIAtom* nsLayoutAtoms::print; +nsIAtom* nsLayoutAtoms::projection; +nsIAtom* nsLayoutAtoms::screen; +nsIAtom* nsLayoutAtoms::tty; +nsIAtom* nsLayoutAtoms::tv; + +static nsrefcnt gRefCnt; + +void nsLayoutAtoms::AddrefAtoms() +{ + if (0 == gRefCnt) { + all = NS_NewAtom("ALL"); + aural = NS_NewAtom("AURAL"); + braille = NS_NewAtom("BRAILLE"); + embossed = NS_NewAtom("EMBOSSED"); + handheld = NS_NewAtom("HANDHELD"); + print = NS_NewAtom("PRINT"); + projection = NS_NewAtom("PROJECTION"); + screen = NS_NewAtom("SCREEN"); + tty = NS_NewAtom("TTY"); + tv = NS_NewAtom("TV"); + } + ++gRefCnt; +} + +void nsLayoutAtoms::ReleaseAtoms() +{ + NS_PRECONDITION(gRefCnt != 0, "bad release atoms"); + if (--gRefCnt == 0) { + NS_RELEASE(all); + NS_RELEASE(aural); + NS_RELEASE(braille); + NS_RELEASE(embossed); + NS_RELEASE(handheld); + NS_RELEASE(print); + NS_RELEASE(projection); + NS_RELEASE(screen); + NS_RELEASE(tty); + NS_RELEASE(tv); + } +} + diff --git a/layout/base/src/nsPresContext.cpp b/layout/base/src/nsPresContext.cpp index b8ce0eca2ef1..df5c9ab21ca8 100644 --- a/layout/base/src/nsPresContext.cpp +++ b/layout/base/src/nsPresContext.cpp @@ -30,6 +30,7 @@ #include "nsIDocument.h" #include "nsIFrame.h" #include "nsIStyleContext.h" +#include "nsLayoutAtoms.h" #ifdef _WIN32 #include #endif @@ -67,6 +68,7 @@ nsPresContext::nsPresContext() NSIntPointsToTwips(10)) { NS_INIT_REFCNT(); + nsLayoutAtoms::AddrefAtoms(); mCompatibilityMode = eCompatibility_NavQuirks; #ifdef _WIN32 @@ -108,6 +110,7 @@ nsPresContext::~nsPresContext() } NS_IF_RELEASE(mPrefs); NS_IF_RELEASE(mBaseURL); + nsLayoutAtoms::ReleaseAtoms(); } nsrefcnt