From 71d5a4d22d85bc127770a79c09f5ea396dfa9fa4 Mon Sep 17 00:00:00 2001 From: "heikki%netscape.com" Date: Thu, 8 Mar 2001 02:41:16 +0000 Subject: [PATCH] Bug 69830, cleanup after layout split by moving duplicated files to a library that is statically linked to content and layout, and backing out changes to inline some functions that now also live in the shared lib. r=jst, sr=waterson. git-svn-id: svn://10.0.0.236/trunk@88896 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/allmakefiles.sh | 8 +- mozilla/content/Makefile.in | 2 +- mozilla/content/base/public/MANIFEST | 2 +- mozilla/content/base/public/Makefile.in | 1 - mozilla/content/base/public/makefile.win | 1 - mozilla/content/base/public/nsTextFragment.h | 317 ----- mozilla/content/base/src/Makefile.in | 2 - mozilla/content/base/src/makefile.win | 3 - mozilla/content/base/src/nsHTMLValue.cpp | 46 + mozilla/content/base/src/nsHTMLValue.h | 46 +- mozilla/content/base/src/nsLayoutAtoms.cpp | 52 - mozilla/content/base/src/nsTextFragment.cpp | 167 --- mozilla/content/base/src/nsTextFragment.h | 87 +- mozilla/content/build/MANIFEST | 1 - mozilla/content/build/Makefile.in | 6 +- mozilla/content/build/makefile.win | 4 +- mozilla/content/build/nsContentDLF.cpp | 29 +- mozilla/content/html/Makefile.in | 2 +- mozilla/content/html/base/Makefile.in | 32 - mozilla/content/html/base/src/Makefile.in | 52 - .../content/html/base/src/nsHTMLAtomList.h | 301 ----- mozilla/content/html/base/src/nsHTMLAtoms.cpp | 52 - mozilla/content/html/base/src/nsHTMLAtoms.h | 54 - .../html/content/src/nsHTMLSpacerElement.cpp | 1 - mozilla/content/html/makefile.win | 2 +- mozilla/content/html/style/public/MANIFEST | 3 - mozilla/content/html/style/public/Makefile.in | 3 - .../content/html/style/public/makefile.win | 2 +- .../content/html/style/public/nsCSSAtomList.h | 77 -- .../content/html/style/public/nsCSSAtoms.h | 52 - mozilla/content/html/style/src/MANIFEST | 5 - mozilla/content/html/style/src/Makefile.in | 10 - mozilla/content/html/style/src/makefile.win | 15 - mozilla/content/html/style/src/nsCSSAtoms.cpp | 52 - .../content/html/style/src/nsCSSKeywordList.h | 382 ------ .../content/html/style/src/nsCSSKeywords.cpp | 103 -- .../content/html/style/src/nsCSSKeywords.h | 59 - .../content/html/style/src/nsCSSPropList.h | 227 ---- mozilla/content/html/style/src/nsCSSProps.cpp | 1103 ----------------- mozilla/content/html/style/src/nsCSSProps.h | 133 -- .../content/html/style/src/nsHTMLValue.cpp | 289 ----- mozilla/content/html/style/src/nsHTMLValue.h | 215 ---- mozilla/content/makefile.win | 1 + .../content => content/shared}/Makefile.in | 4 +- .../{html/base => shared}/makefile.win | 5 +- mozilla/content/shared/public/nsHTMLValue.h | 46 +- mozilla/content/shared/public/nsStyleCoord.h | 252 +--- .../content/shared/public/nsTextFragment.h | 87 +- .../shared}/src/Makefile.in | 23 +- .../{html/base => shared}/src/makefile.win | 48 +- mozilla/content/shared/src/nsHTMLValue.cpp | 46 + mozilla/content/shared/src/nsStyleCoord.cpp | 284 +++++ mozilla/content/shared/src/nsTextFragment.cpp | 95 ++ mozilla/content/xul/content/src/Makefile.in | 1 - mozilla/content/xul/content/src/makefile.win | 2 - .../content/xul/content/src/nsXULAtomList.h | 249 ---- .../content/xul/content/src/nsXULAtoms.cpp | 74 -- mozilla/content/xul/content/src/nsXULAtoms.h | 60 - mozilla/layout/base/nsLayoutUtils.cpp | 273 ---- mozilla/layout/base/nsLayoutUtils.h | 75 -- mozilla/layout/base/public/MANIFEST | 4 - mozilla/layout/base/public/Makefile.in | 4 - mozilla/layout/base/public/makefile.win | 4 - mozilla/layout/base/public/nsLayoutAtomList.h | 199 --- mozilla/layout/base/public/nsLayoutAtoms.h | 52 - mozilla/layout/base/public/nsLayoutUtils.h | 75 -- mozilla/layout/base/public/nsStyleCoord.h | 458 ------- mozilla/layout/base/src/Makefile.in | 2 - mozilla/layout/base/src/makefile.win | 4 - mozilla/layout/base/src/nsLayoutAtoms.cpp | 52 - mozilla/layout/base/src/nsLayoutUtils.cpp | 273 ---- mozilla/layout/build/Makefile.in | 12 +- mozilla/layout/build/makefile.win | 11 +- mozilla/layout/build/nsContentDLF.cpp | 29 +- mozilla/layout/build/nsLayoutModule.cpp | 24 - mozilla/layout/html/base/src/MANIFEST | 2 + mozilla/layout/html/base/src/Makefile.in | 1 - mozilla/layout/html/base/src/makefile.win | 2 - mozilla/layout/html/base/src/nsHTMLAtomList.h | 301 ----- mozilla/layout/html/base/src/nsHTMLAtoms.cpp | 52 - mozilla/layout/html/base/src/nsHTMLAtoms.h | 54 - mozilla/layout/html/style/Makefile.in | 2 +- mozilla/layout/html/style/makefile.win | 2 +- mozilla/layout/html/style/public/MANIFEST | 4 - mozilla/layout/html/style/public/Makefile.in | 38 - mozilla/layout/html/style/public/makefile.win | 28 - .../layout/html/style/public/nsStyleUtil.h | 68 - mozilla/layout/html/style/src/Makefile.in | 4 - mozilla/layout/html/style/src/makefile.win | 10 - mozilla/layout/html/style/src/nsCSSAtoms.cpp | 52 - .../layout/html/style/src/nsCSSKeywordList.h | 382 ------ .../layout/html/style/src/nsCSSKeywords.cpp | 103 -- mozilla/layout/html/style/src/nsCSSKeywords.h | 59 - mozilla/layout/html/style/src/nsCSSProps.cpp | 1103 ----------------- mozilla/layout/html/style/src/nsCSSProps.h | 133 -- .../layout/html/style/src/nsCSSScanner.cpp | 897 -------------- mozilla/layout/html/style/src/nsCSSScanner.h | 166 --- mozilla/layout/html/style/src/nsStyleUtil.cpp | 782 ------------ mozilla/layout/html/tests/Makefile.in | 2 +- mozilla/layout/html/tests/makefile.win | 2 +- mozilla/layout/style/nsStyleCoord.cpp | 284 +++++ mozilla/layout/style/nsStyleCoord.h | 252 +--- mozilla/layout/xul/Makefile.in | 2 +- mozilla/layout/xul/content/makefile.win | 26 - mozilla/layout/xul/content/src/makefile.win | 54 - .../layout/xul/content/src/nsXULAtomList.h | 210 ---- mozilla/layout/xul/content/src/nsXULAtoms.cpp | 76 -- mozilla/layout/xul/content/src/nsXULAtoms.h | 60 - mozilla/layout/xul/makefile.win | 2 +- 109 files changed, 902 insertions(+), 11141 deletions(-) delete mode 100644 mozilla/content/base/public/nsTextFragment.h delete mode 100644 mozilla/content/base/src/nsLayoutAtoms.cpp delete mode 100644 mozilla/content/base/src/nsTextFragment.cpp delete mode 100644 mozilla/content/html/base/Makefile.in delete mode 100644 mozilla/content/html/base/src/Makefile.in delete mode 100644 mozilla/content/html/base/src/nsHTMLAtomList.h delete mode 100644 mozilla/content/html/base/src/nsHTMLAtoms.cpp delete mode 100644 mozilla/content/html/base/src/nsHTMLAtoms.h delete mode 100644 mozilla/content/html/style/public/nsCSSAtomList.h delete mode 100644 mozilla/content/html/style/public/nsCSSAtoms.h delete mode 100644 mozilla/content/html/style/src/nsCSSAtoms.cpp delete mode 100644 mozilla/content/html/style/src/nsCSSKeywordList.h delete mode 100644 mozilla/content/html/style/src/nsCSSKeywords.cpp delete mode 100644 mozilla/content/html/style/src/nsCSSKeywords.h delete mode 100644 mozilla/content/html/style/src/nsCSSPropList.h delete mode 100644 mozilla/content/html/style/src/nsCSSProps.cpp delete mode 100644 mozilla/content/html/style/src/nsCSSProps.h delete mode 100644 mozilla/content/html/style/src/nsHTMLValue.cpp delete mode 100644 mozilla/content/html/style/src/nsHTMLValue.h rename mozilla/{layout/xul/content => content/shared}/Makefile.in (96%) rename mozilla/content/{html/base => shared}/makefile.win (94%) rename mozilla/{layout/xul/content => content/shared}/src/Makefile.in (77%) rename mozilla/content/{html/base => shared}/src/makefile.win (61%) create mode 100644 mozilla/content/shared/src/nsStyleCoord.cpp delete mode 100644 mozilla/content/xul/content/src/nsXULAtomList.h delete mode 100644 mozilla/content/xul/content/src/nsXULAtoms.cpp delete mode 100644 mozilla/content/xul/content/src/nsXULAtoms.h delete mode 100644 mozilla/layout/base/nsLayoutUtils.cpp delete mode 100644 mozilla/layout/base/nsLayoutUtils.h delete mode 100644 mozilla/layout/base/public/nsLayoutAtomList.h delete mode 100644 mozilla/layout/base/public/nsLayoutAtoms.h delete mode 100644 mozilla/layout/base/public/nsLayoutUtils.h delete mode 100644 mozilla/layout/base/public/nsStyleCoord.h delete mode 100644 mozilla/layout/base/src/nsLayoutAtoms.cpp delete mode 100644 mozilla/layout/base/src/nsLayoutUtils.cpp delete mode 100644 mozilla/layout/html/base/src/nsHTMLAtomList.h delete mode 100644 mozilla/layout/html/base/src/nsHTMLAtoms.cpp delete mode 100644 mozilla/layout/html/base/src/nsHTMLAtoms.h delete mode 100644 mozilla/layout/html/style/public/MANIFEST delete mode 100644 mozilla/layout/html/style/public/Makefile.in delete mode 100644 mozilla/layout/html/style/public/makefile.win delete mode 100644 mozilla/layout/html/style/public/nsStyleUtil.h delete mode 100644 mozilla/layout/html/style/src/nsCSSAtoms.cpp delete mode 100644 mozilla/layout/html/style/src/nsCSSKeywordList.h delete mode 100644 mozilla/layout/html/style/src/nsCSSKeywords.cpp delete mode 100644 mozilla/layout/html/style/src/nsCSSKeywords.h delete mode 100644 mozilla/layout/html/style/src/nsCSSProps.cpp delete mode 100644 mozilla/layout/html/style/src/nsCSSProps.h delete mode 100644 mozilla/layout/html/style/src/nsCSSScanner.cpp delete mode 100644 mozilla/layout/html/style/src/nsCSSScanner.h delete mode 100644 mozilla/layout/html/style/src/nsStyleUtil.cpp create mode 100644 mozilla/layout/style/nsStyleCoord.cpp delete mode 100644 mozilla/layout/xul/content/makefile.win delete mode 100644 mozilla/layout/xul/content/src/makefile.win delete mode 100644 mozilla/layout/xul/content/src/nsXULAtomList.h delete mode 100644 mozilla/layout/xul/content/src/nsXULAtoms.cpp delete mode 100644 mozilla/layout/xul/content/src/nsXULAtoms.h diff --git a/mozilla/allmakefiles.sh b/mozilla/allmakefiles.sh index bc3aa97691c..d52f2d08f69 100755 --- a/mozilla/allmakefiles.sh +++ b/mozilla/allmakefiles.sh @@ -241,8 +241,6 @@ content/events/Makefile content/events/public/Makefile content/events/src/Makefile content/html/Makefile -content/html/base/Makefile -content/html/base/src/Makefile content/html/content/Makefile content/html/content/public/Makefile content/html/content/src/Makefile @@ -276,6 +274,9 @@ content/xbl/builtin/os2/Makefile content/xsl/Makefile content/xsl/document/Makefile content/xsl/document/src/Makefile +content/shared/Makefile +content/shared/public/Makefile +content/shared/src/Makefile " MAKEFILES_layout=" @@ -294,7 +295,6 @@ layout/html/forms/Makefile layout/html/forms/public/Makefile layout/html/forms/src/Makefile layout/html/style/Makefile -layout/html/style/public/Makefile layout/html/style/src/Makefile layout/html/table/Makefile layout/html/table/public/Makefile @@ -308,8 +308,6 @@ layout/xul/base/src/Makefile layout/xul/base/src/outliner/Makefile layout/xul/base/src/outliner/src/Makefile layout/xul/base/src/outliner/public/Makefile -layout/xul/content/Makefile -layout/xul/content/src/Makefile " MAKEFILES_mpfilelocprovider=" diff --git a/mozilla/content/Makefile.in b/mozilla/content/Makefile.in index c72618833d7..e22ad53b614 100644 --- a/mozilla/content/Makefile.in +++ b/mozilla/content/Makefile.in @@ -28,7 +28,7 @@ include $(DEPTH)/config/autoconf.mk DIRS = base html xml xul xbl xsl -DIRS += events build +DIRS += events shared build include $(topsrcdir)/config/rules.mk diff --git a/mozilla/content/base/public/MANIFEST b/mozilla/content/base/public/MANIFEST index 6bcbeaf7bf6..a24f9859cb8 100644 --- a/mozilla/content/base/public/MANIFEST +++ b/mozilla/content/base/public/MANIFEST @@ -24,4 +24,4 @@ nsIStyleRuleSupplier.h nsIStyleSheet.h nsIStyleSheetLinkingElement.h nsITextContent.h -nsTextFragment.h + diff --git a/mozilla/content/base/public/Makefile.in b/mozilla/content/base/public/Makefile.in index 7117077e311..fcaa9f70ef8 100644 --- a/mozilla/content/base/public/Makefile.in +++ b/mozilla/content/base/public/Makefile.in @@ -51,7 +51,6 @@ nsIStyleSheet.h \ nsIStyleSheetLinkingElement.h \ nsIStyleRuleProcessor.h \ nsITextContent.h \ -nsTextFragment.h \ nsIPrivateDOMImplementation.h \ nsIContentSerializer.h \ nsIHTMLToTextSink.h \ diff --git a/mozilla/content/base/public/makefile.win b/mozilla/content/base/public/makefile.win index 98c85b9a509..626fe613f00 100644 --- a/mozilla/content/base/public/makefile.win +++ b/mozilla/content/base/public/makefile.win @@ -43,7 +43,6 @@ EXPORTS = \ nsIStyleRuleProcessor.h \ nsITextContent.h \ nsContentUtils.h \ - nsTextFragment.h \ nsIPrivateDOMImplementation.h \ nsIContentSerializer.h \ nsIHTMLToTextSink.h \ diff --git a/mozilla/content/base/public/nsTextFragment.h b/mozilla/content/base/public/nsTextFragment.h deleted file mode 100644 index 5c3e7bea3a0..00000000000 --- a/mozilla/content/base/public/nsTextFragment.h +++ /dev/null @@ -1,317 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsTextFragment_h___ -#define nsTextFragment_h___ - -#include "nslayout.h" -#include "nsAWritableString.h" -#include "nsCRT.h" -#include "nsString.h" -#include "nsMemory.h" - -// XXX should this normalize the code to keep a \u0000 at the end? - -// XXX nsTextFragmentPool? - -// XXX these need I18N spankage -#define XP_IS_SPACE(_ch) \ - (((_ch) == ' ') || ((_ch) == '\t') || ((_ch) == '\n')) - -#define XP_IS_UPPERCASE(_ch) \ - (((_ch) >= 'A') && ((_ch) <= 'Z')) - -#define XP_IS_LOWERCASE(_ch) \ - (((_ch) >= 'a') && ((_ch) <= 'z')) - -#define XP_TO_LOWER(_ch) ((_ch) | 32) - -#define XP_TO_UPPER(_ch) ((_ch) & ~32) - -#define XP_IS_SPACE_W XP_IS_SPACE - -/** - * A fragment of text. If mIs2b is 1 then the m2b pointer is valid - * otherwise the m1b pointer is valid. If m1b is used then each byte - * of data represents a single ucs2 character with the high byte being - * zero. - * - * This class does not have a virtual destructor therefore it is not - * meant to be subclassed. - */ -class NS_LAYOUT nsTextFragment { -public: - /** - * Default constructor. Initialize the fragment to be empty. - */ - nsTextFragment() { - m1b = nsnull; - mAllBits = 0; - } - - ~nsTextFragment() { - ReleaseText(); - } - - /** - * Initialize the contents of this fragment to be a copy of - * the argument fragment. - */ - nsTextFragment(const nsTextFragment& aOther); - - /** - * Initialize the contents of this fragment to be a copy of - * the argument 7bit ascii string. - */ - nsTextFragment(const char* aString); - - /** - * Initialize the contents of this fragment to be a copy of - * the argument ucs2 string. - */ - nsTextFragment(const PRUnichar* aString) : m1b(nsnull), mAllBits(0) { - SetTo(aString, nsCRT::strlen(aString)); - } - - - /** - * Initialize the contents of this fragment to be a copy of - * the argument string. - */ - nsTextFragment(const nsString& aString); - - /** - * Change the contents of this fragment to be a copy of the - * the argument fragment. - */ - nsTextFragment& operator=(const nsTextFragment& aOther); - - /** - * Change the contents of this fragment to be a copy of the - * the argument 7bit ascii string. - */ - nsTextFragment& operator=(const char* aString); - - /** - * Change the contents of this fragment to be a copy of the - * the argument ucs2 string. - */ - nsTextFragment& operator=(const PRUnichar* aString); - - /** - * Change the contents of this fragment to be a copy of the - * the argument string. - */ - nsTextFragment& operator=(const nsAReadableString& aString); - - /** - * Return PR_TRUE if this fragment is represented by PRUnichar data - */ - PRBool Is2b() const { - return mState.mIs2b; - } - - /** - * Get a pointer to constant PRUnichar data. - */ - const PRUnichar* Get2b() const { - NS_ASSERTION(Is2b(), "not 2b text"); - return m2b; - } - - /** - * Get a pointer to constant char data. - */ - const char* Get1b() const { - NS_ASSERTION(!Is2b(), "not 1b text"); - return (const char*) m1b; - } - - /** - * Get the length of the fragment. The length is the number of logical - * characters, not the number of bytes to store the characters. - */ - PRInt32 GetLength() const { - return PRInt32(mState.mLength); - } - - /** - * Mutable version of Get2b. Only works for a non-const object. - * Returns a pointer to the PRUnichar data. - */ - PRUnichar* Get2b() { - NS_ASSERTION(Is2b(), "not 2b text"); - return m2b; - } - - /** - * Mutable version of Get1b. Only works for a non-const object. - * Returns a pointer to the char data. - */ - char* Get1b() { - NS_ASSERTION(!Is2b(), "not 1b text"); - return (char*) m1b; - } - - /** - * Change the contents of this fragment to be the given buffer and - * length. The memory becomes owned by the fragment. In addition, - * the memory for aBuffer must have been allocated using the - * nsIMemory interface. - */ - void SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease); - - /** - * Change the contents of this fragment to be a copy of the given - * buffer. Like operator= except a length is specified instead of - * assuming 0 termination. - */ - void SetTo(const PRUnichar* aBuffer, PRInt32 aLength) { - ReleaseText(); - if (0 != aLength) { - // See if we need to store the data in ucs2 or not - PRBool need2 = PR_FALSE; - const PRUnichar* ucp = aBuffer; - const PRUnichar* uend = aBuffer + aLength; - while (ucp < uend) { - PRUnichar ch = *ucp++; - if (ch >> 8) { - need2 = PR_TRUE; - break; - } - } - - if (need2) { - // Use ucs2 storage because we have to - PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar)); - if (nsnull != nt) { - // Copy data - nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength); - - // Setup our fields - m2b = nt; - mState.mIs2b = 1; - mState.mInHeap = 1; - mState.mLength = aLength; - } - } - else { - // Use 1 byte storage because we can - unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); - if (nsnull != nt) { - // Copy data - unsigned char* cp = nt; - unsigned char* end = nt + aLength; - while (cp < end) { - *cp++ = (unsigned char) *aBuffer++; - } - - // Setup our fields - m1b = nt; - mState.mIs2b = 0; - mState.mInHeap = 1; - mState.mLength = aLength; - } - } - } - } - - /** - * Change the contents of this fragment to be a copy of the given - * buffer. Like operator= except a length is specified instead of - * assuming 0 termination. - */ - void SetTo(const char* aBuffer, PRInt32 aLength); - - /** - * Append the contents of this string fragment to aString - */ - void AppendTo(nsString& aString) const { - if (mState.mIs2b) { - aString.Append(m2b, mState.mLength); - } - else { - aString.AppendWithConversion((char*)m1b, mState.mLength); - } - } - - /** - * Make a copy of the fragments contents starting at offset for - * count characters. The offset and count will be adjusted to - * lie within the fragments data. The fragments data is converted if - * necessary. - */ - void CopyTo(PRUnichar* aDest, PRInt32 aOffset, PRInt32 aCount); - - /** - * Make a copy of the fragments contents starting at offset for - * count characters. The offset and count will be adjusted to - * lie within the fragments data. The fragments data is converted if - * necessary. - */ - void CopyTo(char* aDest, PRInt32 aOffset, PRInt32 aCount); - - /** - * Return the character in the text-fragment at the given - * index. This always returns a PRUnichar. - */ - PRUnichar CharAt(PRInt32 aIndex) const { - NS_ASSERTION(PRUint32(aIndex) < mState.mLength, "bad index"); - return mState.mIs2b ? m2b[aIndex] : PRUnichar(m1b[aIndex]); - } - -protected: - union { - PRUnichar* m2b; - unsigned char* m1b; - }; - -public: - struct FragmentBits { - PRUint32 mInHeap : 1; - PRUint32 mIs2b : 1; - PRUint32 mLength : 30; - }; - -protected: - union { - PRUint32 mAllBits; - FragmentBits mState; - }; - - void ReleaseText() { - if (mState.mLength && m1b && mState.mInHeap) { - if (mState.mIs2b) { - nsMemory::Free(m2b); - } - else { - nsMemory::Free(m1b); - } - } - m1b = nsnull; - mState.mIs2b = 0; - mState.mInHeap = 0; - mState.mLength = 0; - } -}; - -#endif /* nsTextFragment_h___ */ - diff --git a/mozilla/content/base/src/Makefile.in b/mozilla/content/base/src/Makefile.in index 55d7aac7703..4caf406130f 100644 --- a/mozilla/content/base/src/Makefile.in +++ b/mozilla/content/base/src/Makefile.in @@ -46,7 +46,6 @@ CPPSRCS = \ nsGenericDOMDataNode.cpp \ nsGenericDOMNodeList.cpp \ nsGenericElement.cpp \ - nsLayoutAtoms.cpp \ nsContentUtils.cpp \ nsNameSpaceManager.cpp \ nsNodeInfo.cpp \ @@ -56,7 +55,6 @@ CPPSRCS = \ nsStyleContext.cpp \ nsStyleSet.cpp \ nsTextContentChangeData.cpp \ - nsTextFragment.cpp \ nsTextNode.cpp \ nsXMLContentSerializer.cpp \ nsHTMLContentSerializer.cpp \ diff --git a/mozilla/content/base/src/makefile.win b/mozilla/content/base/src/makefile.win index 1ba5fd31d8a..0c9f54498d0 100644 --- a/mozilla/content/base/src/makefile.win +++ b/mozilla/content/base/src/makefile.win @@ -57,7 +57,6 @@ CPPSRCS = \ nsHTMLContentSerializer.cpp \ nsParserUtils.cpp \ nsPlainTextSerializer.cpp \ - nsLayoutAtoms.cpp \ nsContentUtils.cpp \ $(NULL) @@ -84,7 +83,6 @@ CPP_OBJS= \ .\$(OBJDIR)\nsNameSpaceManager.obj \ .\$(OBJDIR)\nsNodeInfo.obj \ .\$(OBJDIR)\nsNodeInfoManager.obj \ - .\$(OBJDIR)\nsTextFragment.obj \ .\$(OBJDIR)\nsSelection.obj \ .\$(OBJDIR)\nsRange.obj \ .\$(OBJDIR)\nsTextContentChangeData.obj \ @@ -93,7 +91,6 @@ CPP_OBJS= \ .\$(OBJDIR)\nsHTMLContentSerializer.obj \ .\$(OBJDIR)\nsParserUtils.obj \ .\$(OBJDIR)\nsPlainTextSerializer.obj \ - .\$(OBJDIR)\nsLayoutAtoms.obj \ .\$(OBJDIR)\nsContentUtils.obj \ $(NULL) diff --git a/mozilla/content/base/src/nsHTMLValue.cpp b/mozilla/content/base/src/nsHTMLValue.cpp index ec0cdc4749d..6e7c540d03c 100644 --- a/mozilla/content/base/src/nsHTMLValue.cpp +++ b/mozilla/content/base/src/nsHTMLValue.cpp @@ -22,9 +22,20 @@ #include "nsHTMLValue.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsISizeOfHandler.h" +nsHTMLValue::nsHTMLValue(nsHTMLUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION((aUnit <= eHTMLUnit_Empty), "not a valueless unit"); + if (aUnit > eHTMLUnit_Empty) { + mUnit = eHTMLUnit_Null; + } + mValue.mString = nsnull; +} + nsHTMLValue::nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit) : mUnit(aUnit) { @@ -50,6 +61,21 @@ nsHTMLValue::nsHTMLValue(float aValue) mValue.mFloat = aValue; } +nsHTMLValue::nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION((eHTMLUnit_String == aUnit) || + (eHTMLUnit_ColorName == aUnit), "not a string value"); + if ((eHTMLUnit_String == aUnit) || + (eHTMLUnit_ColorName == aUnit)) { + mValue.mString = ToNewUnicode(aValue); + } + else { + mUnit = eHTMLUnit_Null; + mValue.mInt = 0; + } +} + nsHTMLValue::nsHTMLValue(nsISupports* aValue) : mUnit(eHTMLUnit_ISupports) { @@ -89,6 +115,11 @@ nsHTMLValue::nsHTMLValue(const nsHTMLValue& aCopy) } } +nsHTMLValue::~nsHTMLValue(void) +{ + Reset(); +} + nsHTMLValue& nsHTMLValue::operator=(const nsHTMLValue& aCopy) { Reset(); @@ -153,6 +184,21 @@ PRUint32 nsHTMLValue::HashValue(void) const } +void nsHTMLValue::Reset(void) +{ + if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { + if (nsnull != mValue.mString) { + nsCRT::free(mValue.mString); + } + } + else if (eHTMLUnit_ISupports == mUnit) { + NS_IF_RELEASE(mValue.mISupports); + } + mUnit = eHTMLUnit_Null; + mValue.mString = nsnull; +} + + void nsHTMLValue::SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit) { Reset(); diff --git a/mozilla/content/base/src/nsHTMLValue.h b/mozilla/content/base/src/nsHTMLValue.h index 95a6eb21a28..1c7ed08306f 100644 --- a/mozilla/content/base/src/nsHTMLValue.h +++ b/mozilla/content/base/src/nsHTMLValue.h @@ -26,7 +26,6 @@ #include "nsColor.h" #include "nsString.h" #include "nsISupports.h" -#include "nsReadableUtils.h" enum nsHTMLUnit { eHTMLUnit_Null = 0, // (n/a) null unit, value is not specified @@ -46,39 +45,14 @@ enum nsHTMLUnit { class nsHTMLValue { public: - nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null) : mUnit(aUnit) - { - NS_ASSERTION((aUnit <= eHTMLUnit_Empty), "not a valueless unit"); - if (aUnit > eHTMLUnit_Empty) { - mUnit = eHTMLUnit_Null; - } - mValue.mString = nsnull; - } - + nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null); nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit); nsHTMLValue(float aValue); - nsHTMLValue(const nsAReadableString& aValue, - nsHTMLUnit aUnit = eHTMLUnit_String) : mUnit(aUnit) - { - NS_ASSERTION((eHTMLUnit_String == aUnit) || - (eHTMLUnit_ColorName == aUnit), "not a string value"); - if ((eHTMLUnit_String == aUnit) || - (eHTMLUnit_ColorName == aUnit)) { - mValue.mString = ToNewUnicode(aValue); - } - else { - mUnit = eHTMLUnit_Null; - mValue.mInt = 0; - } - } - + nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); nsHTMLValue(nsISupports* aValue); nsHTMLValue(nscolor aValue); nsHTMLValue(const nsHTMLValue& aCopy); - ~nsHTMLValue(void) - { - Reset(); - } + ~nsHTMLValue(void); nsHTMLValue& operator=(const nsHTMLValue& aCopy); PRBool operator==(const nsHTMLValue& aOther) const; @@ -93,19 +67,7 @@ public: nsISupports* GetISupportsValue(void) const; nscolor GetColorValue(void) const; - void Reset(void) { - if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { - if (nsnull != mValue.mString) { - nsCRT::free(mValue.mString); - } - } - else if (eHTMLUnit_ISupports == mUnit) { - NS_IF_RELEASE(mValue.mISupports); - } - mUnit = eHTMLUnit_Null; - mValue.mString = nsnull; - } - + void Reset(void); void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit); void SetPixelValue(PRInt32 aValue); void SetPercentValue(float aValue); diff --git a/mozilla/content/base/src/nsLayoutAtoms.cpp b/mozilla/content/base/src/nsLayoutAtoms.cpp deleted file mode 100644 index 6eac0503eaf..00000000000 --- a/mozilla/content/base/src/nsLayoutAtoms.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsLayoutAtoms.h" - -// define storage for all atoms -#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name; -#include "nsLayoutAtomList.h" -#undef LAYOUT_ATOM - - -static nsrefcnt gRefCnt; - -void nsLayoutAtoms::AddRefAtoms() -{ - if (0 == gRefCnt++) { - // create atoms -#define LAYOUT_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsLayoutAtomList.h" -#undef LAYOUT_ATOM - } -} - -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 - } -} - diff --git a/mozilla/content/base/src/nsTextFragment.cpp b/mozilla/content/base/src/nsTextFragment.cpp deleted file mode 100644 index 6400a43e619..00000000000 --- a/mozilla/content/base/src/nsTextFragment.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsTextFragment.h" -#include "nsReadableUtils.h" - -nsTextFragment::nsTextFragment(const nsTextFragment& aOther) - : m1b(nsnull), - mAllBits(0) -{ - if (aOther.Is2b()) { - SetTo(aOther.Get2b(), aOther.GetLength()); - } - else { - SetTo(aOther.Get1b(), aOther.GetLength()); - } -} - -nsTextFragment::nsTextFragment(const char* aString) - : m1b(nsnull), - mAllBits(0) -{ - SetTo(aString, strlen(aString)); -} - -nsTextFragment::nsTextFragment(const nsString& aString) - : m1b(nsnull), - mAllBits(0) -{ - SetTo(aString.GetUnicode(), aString.Length()); -} - -nsTextFragment& -nsTextFragment::operator=(const nsTextFragment& aOther) -{ - if (aOther.Is2b()) { - SetTo(aOther.Get2b(), aOther.GetLength()); - } - else { - SetTo(aOther.Get1b(), aOther.GetLength()); - } - return *this; -} - -nsTextFragment& -nsTextFragment::operator=(const char* aString) -{ - SetTo(aString, nsCRT::strlen(aString)); - return *this; -} - -nsTextFragment& -nsTextFragment::operator=(const PRUnichar* aString) -{ - SetTo(aString, nsCRT::strlen(aString)); - return *this; -} - -nsTextFragment& -nsTextFragment::operator=(const nsAReadableString& aString) -{ - ReleaseText(); - - PRUint32 length = aString.Length(); - if (length > 0) { - if (IsASCII(aString)) { - m1b = NS_REINTERPRET_CAST(unsigned char *, ToNewCString(aString)); - mState.mIs2b = 0; - } - else { - m2b = ToNewUnicode(aString); - mState.mIs2b = 1; - } - mState.mInHeap = 1; - mState.mLength = (PRInt32)length; - } - - return *this; -} - -void -nsTextFragment::SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease) -{ - ReleaseText(); - - m2b = aBuffer; - mState.mIs2b = 1; - mState.mInHeap = aRelease ? 1 : 0; - mState.mLength = aLength; -} - -void -nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength) -{ - ReleaseText(); - if (0 != aLength) { - unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); - if (nsnull != nt) { - nsCRT::memcpy(nt, aBuffer, sizeof(unsigned char) * aLength); - - m1b = nt; - mState.mIs2b = 0; - mState.mInHeap = 1; - mState.mLength = aLength; - } - } -} - -void -nsTextFragment::CopyTo(PRUnichar* aDest, PRInt32 aOffset, PRInt32 aCount) -{ - if (aOffset < 0) aOffset = 0; - if (aOffset + aCount > GetLength()) { - aCount = mState.mLength - aOffset; - } - if (0 != aCount) { - if (mState.mIs2b) { - nsCRT::memcpy(aDest, m2b + aOffset, sizeof(PRUnichar) * aCount); - } - else { - unsigned char* cp = m1b + aOffset; - unsigned char* end = cp + aCount; - while (cp < end) { - *aDest++ = PRUnichar(*cp++); - } - } - } -} - -void -nsTextFragment::CopyTo(char* aDest, PRInt32 aOffset, PRInt32 aCount) -{ - if (aOffset < 0) aOffset = 0; - if (aOffset + aCount > GetLength()) { - aCount = mState.mLength - aOffset; - } - if (0 != aCount) { - if (mState.mIs2b) { - PRUnichar* cp = m2b + aOffset; - PRUnichar* end = cp + aCount; - while (cp < end) { - *aDest++ = (unsigned char) (*cp++); - } - } - else { - nsCRT::memcpy(aDest, m1b + aOffset, sizeof(char) * aCount); - } - } -} diff --git a/mozilla/content/base/src/nsTextFragment.h b/mozilla/content/base/src/nsTextFragment.h index 5c3e7bea3a0..52ccecd4763 100644 --- a/mozilla/content/base/src/nsTextFragment.h +++ b/mozilla/content/base/src/nsTextFragment.h @@ -24,9 +24,7 @@ #include "nslayout.h" #include "nsAWritableString.h" -#include "nsCRT.h" -#include "nsString.h" -#include "nsMemory.h" +class nsString; // XXX should this normalize the code to keep a \u0000 at the end? @@ -67,9 +65,7 @@ public: mAllBits = 0; } - ~nsTextFragment() { - ReleaseText(); - } + ~nsTextFragment(); /** * Initialize the contents of this fragment to be a copy of @@ -87,10 +83,7 @@ public: * Initialize the contents of this fragment to be a copy of * the argument ucs2 string. */ - nsTextFragment(const PRUnichar* aString) : m1b(nsnull), mAllBits(0) { - SetTo(aString, nsCRT::strlen(aString)); - } - + nsTextFragment(const PRUnichar* aString); /** * Initialize the contents of this fragment to be a copy of @@ -184,55 +177,7 @@ public: * buffer. Like operator= except a length is specified instead of * assuming 0 termination. */ - void SetTo(const PRUnichar* aBuffer, PRInt32 aLength) { - ReleaseText(); - if (0 != aLength) { - // See if we need to store the data in ucs2 or not - PRBool need2 = PR_FALSE; - const PRUnichar* ucp = aBuffer; - const PRUnichar* uend = aBuffer + aLength; - while (ucp < uend) { - PRUnichar ch = *ucp++; - if (ch >> 8) { - need2 = PR_TRUE; - break; - } - } - - if (need2) { - // Use ucs2 storage because we have to - PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar)); - if (nsnull != nt) { - // Copy data - nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength); - - // Setup our fields - m2b = nt; - mState.mIs2b = 1; - mState.mInHeap = 1; - mState.mLength = aLength; - } - } - else { - // Use 1 byte storage because we can - unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); - if (nsnull != nt) { - // Copy data - unsigned char* cp = nt; - unsigned char* end = nt + aLength; - while (cp < end) { - *cp++ = (unsigned char) *aBuffer++; - } - - // Setup our fields - m1b = nt; - mState.mIs2b = 0; - mState.mInHeap = 1; - mState.mLength = aLength; - } - } - } - } + void SetTo(const PRUnichar* aBuffer, PRInt32 aLength); /** * Change the contents of this fragment to be a copy of the given @@ -244,14 +189,7 @@ public: /** * Append the contents of this string fragment to aString */ - void AppendTo(nsString& aString) const { - if (mState.mIs2b) { - aString.Append(m2b, mState.mLength); - } - else { - aString.AppendWithConversion((char*)m1b, mState.mLength); - } - } + void AppendTo(nsString& aString) const; /** * Make a copy of the fragments contents starting at offset for @@ -297,20 +235,7 @@ protected: FragmentBits mState; }; - void ReleaseText() { - if (mState.mLength && m1b && mState.mInHeap) { - if (mState.mIs2b) { - nsMemory::Free(m2b); - } - else { - nsMemory::Free(m1b); - } - } - m1b = nsnull; - mState.mIs2b = 0; - mState.mInHeap = 0; - mState.mLength = 0; - } + void ReleaseText(); }; #endif /* nsTextFragment_h___ */ diff --git a/mozilla/content/build/MANIFEST b/mozilla/content/build/MANIFEST index 37cb37c3367..d981881902e 100644 --- a/mozilla/content/build/MANIFEST +++ b/mozilla/content/build/MANIFEST @@ -3,4 +3,3 @@ # nsContentCID.h -gbdate.h diff --git a/mozilla/content/build/Makefile.in b/mozilla/content/build/Makefile.in index 9cf2c6932be..f1beb4112c6 100644 --- a/mozilla/content/build/Makefile.in +++ b/mozilla/content/build/Makefile.in @@ -45,11 +45,10 @@ ifndef MKSHLIB_FORCE_ALL CPPSRCS += dlldeps.cpp endif -EXPORTS = nsContentCID.h $(BUILD_DATE) +EXPORTS = nsContentCID.h SHARED_LIBRARY_LIBS = \ $(DIST)/lib/libgkconevents_s.$(LIB_SUFFIX) \ - $(DIST)/lib/libgkconhtmlbase_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkconhtmlcon_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkconhtmldoc_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkconhtmlstyle_s.$(LIB_SUFFIX) \ @@ -61,6 +60,7 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/libgkconxultmpl_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkconxbl_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkconbase_s.$(LIB_SUFFIX) \ + $(DIST)/lib/libgkconshared_s.$(LIB_SUFFIX) \ $(NULL) ifdef MOZ_PERF_METRICS @@ -80,8 +80,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),os2) EXPORT_OBJS = 1 endif -GARBAGE += $(BUILD_DATE) - include $(topsrcdir)/config/rules.mk DEFINES += -D_IMPL_NS_HTML diff --git a/mozilla/content/build/makefile.win b/mozilla/content/build/makefile.win index 2b61dff9bd6..f18e367bcfc 100644 --- a/mozilla/content/build/makefile.win +++ b/mozilla/content/build/makefile.win @@ -38,7 +38,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsContentModule.obj \ $(NULL) -EXPORTS=nsContentCID.h $(BUILD_DATE) +EXPORTS=nsContentCID.h MAKE_OBJ_TYPE = DLL @@ -62,7 +62,6 @@ LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\dom \ # These are the libraries we need to link with to create the dll LLIBS= \ $(DIST)\lib\contentbase_s.lib \ - $(DIST)\lib\contenthtmlbase_s.lib \ $(DIST)\lib\contenthtmlcontent_s.lib \ $(DIST)\lib\contenthtmldoc_s.lib \ $(DIST)\lib\contenthtmlstyle_s.lib \ @@ -74,6 +73,7 @@ LLIBS= \ $(DIST)\lib\contentxultemplates_s.lib \ $(DIST)\lib\contentxbl_s.lib \ $(DIST)\lib\contentevents_s.lib \ + $(DIST)\lib\contentshared_s.lib \ $(DIST)\lib\xpcom.lib \ $(DIST)\lib\gkgfxwin.lib \ $(DIST)\lib\timer_s.lib \ diff --git a/mozilla/content/build/nsContentDLF.cpp b/mozilla/content/build/nsContentDLF.cpp index 0b8fd22d109..af12814b443 100644 --- a/mozilla/content/build/nsContentDLF.cpp +++ b/mozilla/content/build/nsContentDLF.cpp @@ -513,33 +513,6 @@ nsContentDLF::CreateXULDocumentFromStream(nsIInputStream& aXULStream, return status; } -static NS_DEFINE_IID(kDocumentFactoryImplCID, NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID); - -static nsresult -RegisterTypes(nsIComponentManager* aCompMgr, - const char* aCommand, - nsIFile* aPath, - char** aTypes) -{ - nsresult rv = NS_OK; - while (*aTypes) { - char contractid[500]; - char* contentType = *aTypes++; - PR_snprintf(contractid, sizeof(contractid), - NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "%s;1?type=%s", - aCommand, contentType); -#ifdef NOISY_REGISTRY - printf("Register %s => %s\n", contractid, aPath); -#endif - rv = aCompMgr->RegisterComponentSpec(kDocumentFactoryImplCID, "Content", - contractid, aPath, PR_TRUE, PR_TRUE); - if (NS_FAILED(rv)) { - break; - } - } - return rv; -} - nsresult nsContentModule::RegisterDocumentFactories(nsIComponentManager* aCompMgr, nsIFile* aPath) @@ -549,6 +522,8 @@ nsContentModule::RegisterDocumentFactories(nsIComponentManager* aCompMgr, return NS_OK; } +static NS_DEFINE_IID(kDocumentFactoryImplCID, NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID); + void nsContentModule::UnregisterDocumentFactories(nsIComponentManager* aCompMgr, nsIFile* aPath) diff --git a/mozilla/content/html/Makefile.in b/mozilla/content/html/Makefile.in index c6f7ea95dc7..efa6b70a2e8 100644 --- a/mozilla/content/html/Makefile.in +++ b/mozilla/content/html/Makefile.in @@ -26,6 +26,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = base content document style +DIRS = content document style include $(topsrcdir)/config/rules.mk diff --git a/mozilla/content/html/base/Makefile.in b/mozilla/content/html/base/Makefile.in deleted file mode 100644 index 0b4d2a90ab5..00000000000 --- a/mozilla/content/html/base/Makefile.in +++ /dev/null @@ -1,32 +0,0 @@ -# -# The contents of this file are subject to the Netscape 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/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -DIRS = src - -include $(topsrcdir)/config/rules.mk - diff --git a/mozilla/content/html/base/src/Makefile.in b/mozilla/content/html/base/src/Makefile.in deleted file mode 100644 index 5c13bce048d..00000000000 --- a/mozilla/content/html/base/src/Makefile.in +++ /dev/null @@ -1,52 +0,0 @@ -# -# The contents of this file are subject to the Netscape 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/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = layout -LIBRARY_NAME = gkconhtmlbase_s -REQUIRES = xpcom string dom widget locale view necko js caps pref htmlparser webshell plugin timer docshell mime webbrwsr oji util uriloader rdf unicharutil lwbrk - -CPPSRCS = \ - nsHTMLAtoms.cpp \ - $(NULL) - -# we don't want the shared lib, but we want to force the creation of a static lib. -override NO_SHARED_LIB=1 -override NO_STATIC_LIB= - -include $(topsrcdir)/config/rules.mk - -DEFINES += -D_IMPL_NS_HTML - -INCLUDES += \ - -I$(srcdir)/../../../xul/base/src \ - -I$(srcdir)/../../../xul/content/src \ - -I$(srcdir)/../../style/src \ - -I$(srcdir)/../../forms/src \ - -I$(srcdir)/../../../base/src \ - -I$(srcdir) \ - $(NULL) diff --git a/mozilla/content/html/base/src/nsHTMLAtomList.h b/mozilla/content/html/base/src/nsHTMLAtomList.h deleted file mode 100644 index 14c44aacf58..00000000000 --- a/mozilla/content/html/base/src/nsHTMLAtomList.h +++ /dev/null @@ -1,301 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all HTML atoms - See nsHTMLAtoms.h for access to the atoms - - It is designed to be used as inline input to nsHTMLAtoms.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro HTML_ATOM which will have cruel - and unusual things done to it - - The first argument to HTML_ATOM is the C++ name of the atom - The second argument it HTML_ATOM is the string value of the atom - - ******/ - -HTML_ATOM(mozAnonymousBlock, ":-moz-anonymous-block") -HTML_ATOM(mozAnonymousPositionedBlock, ":-moz-anonymous-positioned-block") -HTML_ATOM(mozFirstLineFixup, ":-moz-first-line-fixup") -HTML_ATOM(mozLetterFrame, ":-moz-letter-frame") -HTML_ATOM(mozLineFrame, ":-moz-line-frame") -HTML_ATOM(mozListBulletPseudo, ":-moz-list-bullet") -HTML_ATOM(mozSingleLineTextControlFrame, ":-moz-singleline-textcontrol-frame") -HTML_ATOM(mozFocusInnerPseudo, ":-moz-focus-inner") -HTML_ATOM(mozFocusOuterPseudo, ":-moz-focus-outer") -HTML_ATOM(mozDisplayComboboxControlFrame, ":-moz-display-comboboxcontrol-frame") - -HTML_ATOM(_baseHref, NS_HTML_BASE_HREF) -HTML_ATOM(_baseTarget, NS_HTML_BASE_TARGET) -HTML_ATOM(a, "a") -HTML_ATOM(abbr, "abbr") -HTML_ATOM(above, "above") -HTML_ATOM(accept, "accept") -HTML_ATOM(acceptcharset, "accept-charset") -HTML_ATOM(accesskey, "accesskey") -HTML_ATOM(action, "action") -HTML_ATOM(align, "align") -HTML_ATOM(alink, "alink") -HTML_ATOM(alt, "alt") -HTML_ATOM(applet, "applet") -HTML_ATOM(archive, "archive") -HTML_ATOM(area, "area") -HTML_ATOM(axis, "axis") -HTML_ATOM(background, "background") -HTML_ATOM(below, "below") -HTML_ATOM(bgcolor, "bgcolor") -HTML_ATOM(blockquote, "blockquote") -HTML_ATOM(body, "body") -HTML_ATOM(border, "border") -HTML_ATOM(bordercolor, "bordercolor") -HTML_ATOM(bottompadding, "bottompadding") -HTML_ATOM(br, "br") -HTML_ATOM(b, "b") -HTML_ATOM(button, "button") -HTML_ATOM(buttonContentPseudo, ":button-content") -HTML_ATOM(caption, "caption") -HTML_ATOM(cellContentPseudo, ":cell-content") -HTML_ATOM(cellpadding, "cellpadding") -HTML_ATOM(cellspacing, "cellspacing") -HTML_ATOM(ch, "ch") -HTML_ATOM(_char, "char") -HTML_ATOM(charoff, "charoff") -HTML_ATOM(charset, "charset") -HTML_ATOM(checked, "checked") -HTML_ATOM(cite, "cite") -HTML_ATOM(kClass, "class") -HTML_ATOM(classid, "classid") -HTML_ATOM(clear, "clear") -HTML_ATOM(clip, "clip") -HTML_ATOM(code, "code") -HTML_ATOM(codebase, "codebase") -HTML_ATOM(codetype, "codetype") -HTML_ATOM(color, "color") -HTML_ATOM(col, "col") -HTML_ATOM(colgroup, "colgroup") -HTML_ATOM(cols, "cols") -HTML_ATOM(colspan, "colspan") -HTML_ATOM(combobox, "combobox") -HTML_ATOM(columnPseudo, ":body-column") -HTML_ATOM(commentPseudo, ":-moz-comment") -HTML_ATOM(compact, "compact") -HTML_ATOM(content, "content") -HTML_ATOM(coords, "coords") -HTML_ATOM(dd, "dd") -HTML_ATOM(defaultchecked, "defaultchecked") -HTML_ATOM(defaultselected, "defaultselected") -HTML_ATOM(defaultvalue, "defaultvalue") -HTML_ATOM(declare, "declare") -HTML_ATOM(defer, "defer") -HTML_ATOM(dir, "dir") -HTML_ATOM(div, "div") -HTML_ATOM(disabled, "disabled") -HTML_ATOM(dl, "dl") -HTML_ATOM(dropDownListPseudo, ":-moz-dropdown-list") -HTML_ATOM(dt, "dt") - -HTML_ATOM(datetime, "datetime") -HTML_ATOM(data, "data") -HTML_ATOM(dfn, "dfn") -HTML_ATOM(em, "em") -HTML_ATOM(embed, "embed") -HTML_ATOM(encoding, "encoding") -HTML_ATOM(enctype, "enctype") -HTML_ATOM(face, "face") -HTML_ATOM(fieldset, "fieldset") -HTML_ATOM(fieldsetContentPseudo, ":fieldset-content") -HTML_ATOM(firstLetterPseudo, ":first-letter") -HTML_ATOM(firstLinePseudo, ":first-line") -HTML_ATOM(font, "font") -HTML_ATOM(fontWeight, "font-weight") -HTML_ATOM(_for, "for") -HTML_ATOM(form, "form") -HTML_ATOM(frame, "frame") -HTML_ATOM(frameborder, "frameborder") -HTML_ATOM(frameset, "frameset") -HTML_ATOM(framesetBlankPseudo, ":frameset-blank") -HTML_ATOM(gutter, "gutter") -HTML_ATOM(h1, "h1") -HTML_ATOM(h2, "h2") -HTML_ATOM(h3, "h3") -HTML_ATOM(h4, "h4") -HTML_ATOM(h5, "h5") -HTML_ATOM(h6, "h6") -HTML_ATOM(head, "head") -HTML_ATOM(headerContentBase, "content-base") -HTML_ATOM(headerContentLanguage, "content-language") -HTML_ATOM(headerContentScriptType, "content-script-type") -HTML_ATOM(headerContentStyleType, "content-style-type") -HTML_ATOM(headerContentType, "content-type") -HTML_ATOM(headerDefaultStyle, "default-style") -HTML_ATOM(headerWindowTarget, "window-target") -HTML_ATOM(headers, "headers") -HTML_ATOM(height, "height") -HTML_ATOM(hidden, "hidden") -HTML_ATOM(horizontalFramesetBorderPseudo, ":hframeset-border") -HTML_ATOM(hr, "hr") -HTML_ATOM(href, "href") -HTML_ATOM(hreflang, "hreflang") -HTML_ATOM(hspace, "hspace") -HTML_ATOM(html, "html") -HTML_ATOM(httpEquiv, "http-equiv") -HTML_ATOM(ibPseudo, ":ib-pseudo") -HTML_ATOM(i, "i") -HTML_ATOM(id, "id") -HTML_ATOM(iframe, "iframe") -HTML_ATOM(ilayer, "ilayer") -HTML_ATOM(img, "img") -HTML_ATOM(index, "index") -HTML_ATOM(input, "input") -HTML_ATOM(isindex, "isindex") -HTML_ATOM(ismap, "ismap") -HTML_ATOM(label, "label") -HTML_ATOM(labelContentPseudo, ":label-content") -HTML_ATOM(lang, "lang") -HTML_ATOM(layer, "layer") -HTML_ATOM(layout, "layout") -HTML_ATOM(li, "li") -HTML_ATOM(link, "link") -HTML_ATOM(left, "left") -HTML_ATOM(leftpadding, "leftpadding") -HTML_ATOM(legend, "legend") -HTML_ATOM(legendContentPseudo, ":legend-content") -HTML_ATOM(length, "length") -HTML_ATOM(longdesc, "longdesc") -HTML_ATOM(lowsrc, "lowsrc") -HTML_ATOM(marginheight, "marginheight") -HTML_ATOM(marginwidth, "marginwidth") -HTML_ATOM(maxlength, "maxlength") -HTML_ATOM(mayscript, "mayscript") -HTML_ATOM(media, "media") -HTML_ATOM(menu, "menu") -HTML_ATOM(meta, "meta") -HTML_ATOM(method, "method") -HTML_ATOM(multicol, "multicol") -HTML_ATOM(multiple, "multiple") -HTML_ATOM(name, "name") -HTML_ATOM(nohref, "nohref") -HTML_ATOM(noresize, "noresize") -HTML_ATOM(noscript, "noscript") -HTML_ATOM(noshade, "noshade") -HTML_ATOM(nowrap, "nowrap") -HTML_ATOM(object, "object") -HTML_ATOM(ol, "ol") -HTML_ATOM(option, "option") -HTML_ATOM(overflow, "overflow") -HTML_ATOM(p, "p") -HTML_ATOM(pagex, "pagex") -HTML_ATOM(pagey, "pagey") -HTML_ATOM(param, "param") -HTML_ATOM(placeholderPseudo, ":placeholder-frame") -HTML_ATOM(pointSize, "point-size") -HTML_ATOM(pre, "pre") -HTML_ATOM(processingInstructionPseudo, ":-moz-pi") -HTML_ATOM(profile, "profile") -HTML_ATOM(prompt, "prompt") -HTML_ATOM(radioPseudo, ":-moz-radio") -HTML_ATOM(checkPseudo, ":-moz-checkbox") -HTML_ATOM(readonly, "readonly") -HTML_ATOM(refresh, "refresh") -HTML_ATOM(rel, "rel") -HTML_ATOM(repeat, "repeat") -HTML_ATOM(rev, "rev") -HTML_ATOM(rightpadding, "rightpadding") -HTML_ATOM(rows, "rows") -HTML_ATOM(rowspan, "rowspan") -HTML_ATOM(rules, "rules") -HTML_ATOM(s, "s") -HTML_ATOM(scheme, "scheme") -HTML_ATOM(scope, "scope") -HTML_ATOM(script, "script") -HTML_ATOM(scrolling, "scrolling") -HTML_ATOM(select, "select") -HTML_ATOM(selected, "selected") -HTML_ATOM(selectedindex, "selectedindex") -HTML_ATOM(setcookie, "set-cookie") -HTML_ATOM(shape, "shape") -HTML_ATOM(size, "size") -HTML_ATOM(spacer, "spacer") -HTML_ATOM(span, "span") -HTML_ATOM(src, "src") -HTML_ATOM(standby, "standby") -HTML_ATOM(start, "start") -HTML_ATOM(strike, "strike") -HTML_ATOM(strong, "strong") -HTML_ATOM(style, "style") -HTML_ATOM(summary, "summary") -HTML_ATOM(suppress, "suppress") -HTML_ATOM(tabindex, "tabindex") -HTML_ATOM(table, "table") -HTML_ATOM(tablePseudo, ":table") -HTML_ATOM(tableCellPseudo, ":table-cell") -HTML_ATOM(tableColGroupPseudo, ":table-column-group") -HTML_ATOM(tableColPseudo, ":table-column") -HTML_ATOM(tableOuterPseudo, ":table-outer") -HTML_ATOM(tableRowGroupPseudo, ":table-row-group") -HTML_ATOM(tableRowPseudo, ":table-row") -HTML_ATOM(tabstop, "tabstop") -HTML_ATOM(target, "target") -HTML_ATOM(tbody, "tbody") -HTML_ATOM(td, "td") -HTML_ATOM(tfoot, "tfoot") -HTML_ATOM(thead, "thead") -HTML_ATOM(text, "text") -HTML_ATOM(textarea, "textarea") -HTML_ATOM(textPseudo, ":-moz-text") -HTML_ATOM(th, "th") -HTML_ATOM(title, "title") -HTML_ATOM(top, "top") -HTML_ATOM(toppadding, "toppadding") -HTML_ATOM(tr, "tr") -HTML_ATOM(tt, "tt") -HTML_ATOM(type, "type") -HTML_ATOM(u, "u") -HTML_ATOM(ul, "ul") -HTML_ATOM(usemap, "usemap") -HTML_ATOM(valign, "valign") -HTML_ATOM(value, "value") -HTML_ATOM(valuetype, "valuetype") -HTML_ATOM(variable, "variable") -HTML_ATOM(vcard_name, "vcard_name") -HTML_ATOM(version, "version") -HTML_ATOM(verticalFramesetBorderPseudo, ":vframeset-border") -HTML_ATOM(visibility, "visibility") -HTML_ATOM(vlink, "vlink") -HTML_ATOM(vspace, "vspace") -HTML_ATOM(wbr, "wbr") -HTML_ATOM(width, "width") -HTML_ATOM(wrap, "wrap") -HTML_ATOM(wrappedFramePseudo, ":wrapped-frame") -HTML_ATOM(zindex, "zindex") -HTML_ATOM(z_index, "z-index") - -HTML_ATOM(moz_tristate, "moz-tristate") -HTML_ATOM(moz_tristatevalue, "moz-tristatevalue") - -#ifdef DEBUG -HTML_ATOM(iform, "IForm") -HTML_ATOM(form_control_list, "FormControlList") -#endif diff --git a/mozilla/content/html/base/src/nsHTMLAtoms.cpp b/mozilla/content/html/base/src/nsHTMLAtoms.cpp deleted file mode 100644 index 622b759d11b..00000000000 --- a/mozilla/content/html/base/src/nsHTMLAtoms.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsHTMLAtoms.h" - -// define storage for all atoms -#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name; -#include "nsHTMLAtomList.h" -#undef HTML_ATOM - - -static nsrefcnt gRefCnt; - -void nsHTMLAtoms::AddRefAtoms() -{ - if (0 == gRefCnt++) { - // create atoms -#define HTML_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsHTMLAtomList.h" -#undef HTML_ATOM - } -} - -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 - } -} - diff --git a/mozilla/content/html/base/src/nsHTMLAtoms.h b/mozilla/content/html/base/src/nsHTMLAtoms.h deleted file mode 100644 index afcc8b5d375..00000000000 --- a/mozilla/content/html/base/src/nsHTMLAtoms.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsHTMLAtoms_h___ -#define nsHTMLAtoms_h___ - -#include "nsIAtom.h" - -#define NS_HTML_BASE_HREF "_base_href" -#define NS_HTML_BASE_TARGET "_base_target" - -/** - * This class wraps up the creation (and destruction) of the standard - * set of html atoms used during normal html handling. This objects - * are created when the first html content object is created and they - * are destroyed when the last html content object is destroyed. - */ -class nsHTMLAtoms { -public: - - static void AddRefAtoms(); - static void ReleaseAtoms(); - - /* Declare all atoms - - The atom names and values are stored in nsHTMLAtomList.h and - are brought to you by the magic of C preprocessing - - Add new atoms to nsHTMLAtomList and all support logic will be auto-generated - */ -#define HTML_ATOM(_name, _value) static nsIAtom* _name; -#include "nsHTMLAtomList.h" -#undef HTML_ATOM -}; - -#endif /* nsHTMLAtoms_h___ */ diff --git a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp index 8d1a01ed1ed..5688351e551 100644 --- a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp @@ -44,7 +44,6 @@ #include "nsIURL.h" #include "nsIServiceManager.h" #include "nsNetUtil.h" -#include "nsContentUtils.h" #include "nsIWebShell.h" #include "nsIFrame.h" #include "nsLayoutAtoms.h" diff --git a/mozilla/content/html/makefile.win b/mozilla/content/html/makefile.win index 2b599d07cc8..288d1edca03 100644 --- a/mozilla/content/html/makefile.win +++ b/mozilla/content/html/makefile.win @@ -21,7 +21,7 @@ DEPTH=..\.. -DIRS = base content document style +DIRS = content document style # tests is now done after we build content/events include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/content/html/style/public/MANIFEST b/mozilla/content/html/style/public/MANIFEST index b44f0301ae6..a722bcbb8d9 100644 --- a/mozilla/content/html/style/public/MANIFEST +++ b/mozilla/content/html/style/public/MANIFEST @@ -1,12 +1,9 @@ # # This is a list of local files which get copied to the mozilla:dist:content directory # -nsCSSAtomList.h -nsCSSAtoms.h nsIComputedDOMStyle.h nsICSSLoader.h nsICSSLoaderObserver.h nsICSSParser.h nsICSSPseudoComparator.h nsICSSStyleSheet.h -nsStyleUtil.h diff --git a/mozilla/content/html/style/public/Makefile.in b/mozilla/content/html/style/public/Makefile.in index 5dd21ecfe50..07bd65be435 100644 --- a/mozilla/content/html/style/public/Makefile.in +++ b/mozilla/content/html/style/public/Makefile.in @@ -29,13 +29,10 @@ include $(DEPTH)/config/autoconf.mk MODULE = layout EXPORTS = \ - nsCSSAtoms.h \ - nsCSSAtomList.h \ nsICSSLoader.h \ nsICSSParser.h \ nsICSSPseudoComparator.h \ nsICSSStyleSheet.h \ - nsStyleUtil.h \ nsICSSLoaderObserver.h \ nsIComputedDOMStyle.h \ $(NULL) diff --git a/mozilla/content/html/style/public/makefile.win b/mozilla/content/html/style/public/makefile.win index ab88e1f4dd8..df86585cf5f 100644 --- a/mozilla/content/html/style/public/makefile.win +++ b/mozilla/content/html/style/public/makefile.win @@ -21,7 +21,7 @@ DEPTH=..\..\..\.. -EXPORTS=nsCSSAtoms.h nsCSSAtomList.h nsICSSLoader.h nsICSSParser.h nsICSSPseudoComparator.h nsICSSStyleSheet.h nsStyleUtil.h nsICSSLoaderObserver.h nsIComputedDOMStyle.h +EXPORTS=nsICSSLoader.h nsICSSParser.h nsICSSPseudoComparator.h nsICSSStyleSheet.h nsICSSLoaderObserver.h nsIComputedDOMStyle.h MODULE=raptor include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/content/html/style/public/nsCSSAtomList.h b/mozilla/content/html/style/public/nsCSSAtomList.h deleted file mode 100644 index 368bed8a53e..00000000000 --- a/mozilla/content/html/style/public/nsCSSAtomList.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all CSS nsIAtomsand their values - - It is designed to be used as inline input to nsCSSAtoms.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro CSS_ATOM which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - The first argument to CSS_ATOM is the C++ identifier of the atom - The second argument is the string value of the atom - - ******/ - - -CSS_ATOM(activePseudo, ":active") -CSS_ATOM(afterPseudo, ":after") - -CSS_ATOM(beforePseudo, ":before") - -CSS_ATOM(buttonLabelPseudo, ":-moz-buttonlabel") - -CSS_ATOM(checkedPseudo, ":checked") - -CSS_ATOM(disabledPseudo, ":disabled") -CSS_ATOM(dragOverPseudo, ":drag-over") -CSS_ATOM(dragPseudo, ":drag") - -CSS_ATOM(enabledPseudo, ":enabled") - -CSS_ATOM(firstChildPseudo, ":first-child") -CSS_ATOM(firstNodePseudo, ":first-node") -CSS_ATOM(lastNodePseudo, ":last-node") -CSS_ATOM(focusPseudo, ":focus") - -CSS_ATOM(hoverPseudo, ":hover") - -CSS_ATOM(langPseudo, ":lang") -CSS_ATOM(linkPseudo, ":link") - -CSS_ATOM(menuPseudo, ":menu") - -CSS_ATOM(outOfDatePseudo, ":out-of-date") - -CSS_ATOM(rootPseudo, ":root") - -CSS_ATOM(selectionPseudo, ":selection") - -CSS_ATOM(universalSelector, "*") - -CSS_ATOM(visitedPseudo, ":visited") diff --git a/mozilla/content/html/style/public/nsCSSAtoms.h b/mozilla/content/html/style/public/nsCSSAtoms.h deleted file mode 100644 index fc69afde452..00000000000 --- a/mozilla/content/html/style/public/nsCSSAtoms.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSAtoms_h___ -#define nsCSSAtoms_h___ - -#include "nsIAtom.h" - -/** - * This class wraps up the creation (and destruction) of the standard - * set of CSS atoms used during normal CSS handling. These objects - * are created when the first CSS style sheet is created and they - * are destroyed when the last CSS style sheet is destroyed. - */ -class nsCSSAtoms { -public: - - static void AddRefAtoms(); - static void ReleaseAtoms(); - - - /* Declare all atoms - - The atom names and values are stored in nsCSSAtomList.h and - are brought to you by the magic of C preprocessing - - Add new atoms to nsCSSAtomList and all support logic will be auto-generated - */ -#define CSS_ATOM(_name, _value) static nsIAtom* _name; -#include "nsCSSAtomList.h" -#undef CSS_ATOM -}; - -#endif /* nsCSSAtoms_h___ */ diff --git a/mozilla/content/html/style/src/MANIFEST b/mozilla/content/html/style/src/MANIFEST index 54bea9102ce..2471b0ec366 100644 --- a/mozilla/content/html/style/src/MANIFEST +++ b/mozilla/content/html/style/src/MANIFEST @@ -1,13 +1,8 @@ # # This is a list of local files which get copied to the mozilla:dist:content directory # -nsCSSKeywordList.h -nsCSSKeywords.h -nsCSSPropList.h -nsCSSProps.h nsCSSValue.h nsDOMCSSDeclaration.h -nsHTMLValue.h nsICSSCharsetRule.h nsICSSDeclaration.h nsICSSGroupRule.h diff --git a/mozilla/content/html/style/src/Makefile.in b/mozilla/content/html/style/src/Makefile.in index ea8330933aa..6a72ae7aae3 100644 --- a/mozilla/content/html/style/src/Makefile.in +++ b/mozilla/content/html/style/src/Makefile.in @@ -31,12 +31,9 @@ LIBRARY_NAME = gkconhtmlstyle_s REQUIRES = xpcom string dom widget timer caps editor locale js view necko webshell pref rdf xul htmlparser txmgr docshell uriloader unicharutil uconv xuldoc xpconnect CPPSRCS = \ - nsCSSAtoms.cpp \ - nsCSSKeywords.cpp \ nsCSSDeclaration.cpp \ nsCSSLoader.cpp \ nsCSSParser.cpp \ - nsCSSProps.cpp \ nsCSSScanner.cpp \ nsCSSRule.cpp \ nsCSSStyleRule.cpp \ @@ -47,18 +44,12 @@ CPPSRCS = \ nsHTMLAttributes.cpp \ nsHTMLStyleSheet.cpp \ nsHTMLCSSStyleSheet.cpp \ - nsHTMLValue.cpp \ - nsStyleUtil.cpp \ nsComputedDOMStyle.cpp \ nsROCSSPrimitiveValue.cpp \ $(NULL) EXPORTS = \ nsDOMCSSDeclaration.h \ - nsCSSKeywords.h \ - nsCSSKeywordList.h \ - nsCSSProps.h \ - nsCSSPropList.h \ nsCSSValue.h \ nsICSSStyleRuleProcessor.h \ nsICSSRule.h \ @@ -69,7 +60,6 @@ EXPORTS = \ nsICSSMediaRule.h \ nsICSSNameSpaceRule.h \ nsICSSDeclaration.h \ - nsHTMLValue.h \ nsIHTMLCSSStyleSheet.h \ nsIHTMLAttributes.h \ $(NULL) diff --git a/mozilla/content/html/style/src/makefile.win b/mozilla/content/html/style/src/makefile.win index 36607886535..a77c73a3849 100644 --- a/mozilla/content/html/style/src/makefile.win +++ b/mozilla/content/html/style/src/makefile.win @@ -27,10 +27,6 @@ MODULE=raptor DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN EXPORTS = \ - nsCSSKeywords.h \ - nsCSSKeywordList.h \ - nsCSSProps.h \ - nsCSSPropList.h \ nsCSSValue.h \ nsICSSStyleRuleProcessor.h \ nsICSSRule.h \ @@ -42,19 +38,15 @@ EXPORTS = \ nsICSSNameSpaceRule.h \ nsICSSDeclaration.h \ nsIHTMLCSSStyleSheet.h \ - nsHTMLValue.h \ nsDOMCSSDeclaration.h \ nsIHTMLAttributes.h \ $(NULL) CPPSRCS= \ nsHTMLStyleSheet.cpp \ - nsCSSAtoms.cpp \ - nsCSSKeywords.cpp \ nsCSSDeclaration.cpp \ nsCSSLoader.cpp \ nsCSSParser.cpp \ - nsCSSProps.cpp \ nsCSSScanner.cpp \ nsCSSRule.cpp \ nsCSSStyleRule.cpp \ @@ -63,8 +55,6 @@ CPPSRCS= \ nsCSSValue.cpp \ nsHTMLAttributes.cpp \ nsHTMLCSSStyleSheet.cpp \ - nsHTMLValue.cpp \ - nsStyleUtil.cpp \ nsDOMCSSDeclaration.cpp \ nsComputedDOMStyle.cpp \ nsROCSSPrimitiveValue.cpp \ @@ -72,12 +62,9 @@ CPPSRCS= \ CPP_OBJS = \ .\$(OBJDIR)\nsHTMLStyleSheet.obj \ - .\$(OBJDIR)\nsCSSAtoms.obj \ - .\$(OBJDIR)\nsCSSKeywords.obj \ .\$(OBJDIR)\nsCSSDeclaration.obj \ .\$(OBJDIR)\nsCSSLoader.obj \ .\$(OBJDIR)\nsCSSParser.obj \ - .\$(OBJDIR)\nsCSSProps.obj \ .\$(OBJDIR)\nsCSSScanner.obj \ .\$(OBJDIR)\nsCSSRule.obj \ .\$(OBJDIR)\nsCSSStyleRule.obj \ @@ -86,8 +73,6 @@ CPP_OBJS = \ .\$(OBJDIR)\nsCSSValue.obj \ .\$(OBJDIR)\nsHTMLAttributes.obj \ .\$(OBJDIR)\nsHTMLCSSStyleSheet.obj \ - .\$(OBJDIR)\nsHTMLValue.obj \ - .\$(OBJDIR)\nsStyleUtil.obj \ .\$(OBJDIR)\nsDOMCSSDeclaration.obj \ .\$(OBJDIR)\nsComputedDOMStyle.obj \ .\$(OBJDIR)\nsROCSSPrimitiveValue.obj \ diff --git a/mozilla/content/html/style/src/nsCSSAtoms.cpp b/mozilla/content/html/style/src/nsCSSAtoms.cpp deleted file mode 100644 index 020050b8f95..00000000000 --- a/mozilla/content/html/style/src/nsCSSAtoms.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsCSSAtoms.h" - -// define storage for all atoms -#define CSS_ATOM(_name, _value) nsIAtom* nsCSSAtoms::_name; -#include "nsCSSAtomList.h" -#undef CSS_ATOM - - -static nsrefcnt gRefCnt; - -void nsCSSAtoms::AddRefAtoms() -{ - if (0 == gRefCnt++) { - // create atoms -#define CSS_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsCSSAtomList.h" -#undef CSS_ATOM - } -} - -void nsCSSAtoms::ReleaseAtoms() -{ - NS_PRECONDITION(gRefCnt != 0, "bad release atoms"); - if (--gRefCnt == 0) { - // release atoms -#define CSS_ATOM(_name, _value) NS_RELEASE(_name); -#include "nsCSSAtomList.h" -#undef CSS_ATOM - } -} - diff --git a/mozilla/content/html/style/src/nsCSSKeywordList.h b/mozilla/content/html/style/src/nsCSSKeywordList.h deleted file mode 100644 index bb3228811ac..00000000000 --- a/mozilla/content/html/style/src/nsCSSKeywordList.h +++ /dev/null @@ -1,382 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all parsed CSS keywords - See nsCSSKeywords.h for access to the enum values for keywords - - It is designed to be used as inline input to nsCSSKeywords.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro CSS_KEY which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - Requirements: - - Entries are in the form: (name,id). 'id' must always be the same as 'name' - except that all hyphens ('-') in 'name' are converted to underscores ('_') - in 'id'. This lets us do nice things with the macros without having to - copy/convert strings at runtime. - - 'name' entries *must* use only lowercase characters. - - ** Break these invarient and bad things will happen. ** - - ******/ - -CSS_KEY(-moz-all, _moz_all) -CSS_KEY(-moz-bg-inset, _moz_bg_inset) -CSS_KEY(-moz-bg-outset, _moz_bg_outset) -CSS_KEY(-moz-center, _moz_center) -CSS_KEY(-moz-field, _moz_field) -CSS_KEY(-moz-dragtargetzone, _moz_dragtargetzone) -CSS_KEY(-moz-mac-focusring, _moz_mac_focusring) -CSS_KEY(-moz-mac-menuselect, _moz_mac_menuselect) -CSS_KEY(-moz-mac-menushadow, _moz_mac_menushadow) -CSS_KEY(-moz-mac-menutextselect, _moz_mac_menutextselect) -CSS_KEY(-moz-mac-accentlightesthighlight, _moz_mac_accentlightesthighlight) -CSS_KEY(-moz-mac-accentregularhighlight, _moz_mac_accentregularhighlight) -CSS_KEY(-moz-mac-accentface, _moz_mac_accentface) -CSS_KEY(-moz-mac-accentlightshadow, _moz_mac_accentlightshadow) -CSS_KEY(-moz-mac-accentregularshadow, _moz_mac_accentregularshadow) -CSS_KEY(-moz-mac-accentdarkshadow, _moz_mac_accentdarkshadow) -CSS_KEY(-moz-mac-accentdarkestshadow, _moz_mac_accentdarkestshadow) -CSS_KEY(-moz-right, _moz_right) -CSS_KEY(-moz-pre-wrap, _moz_pre_wrap) -CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none) -CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal) -CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical) -CSS_KEY(-moz-box, _moz_box) -CSS_KEY(-moz-inline-box, _moz_inline_box) -CSS_KEY(-moz-grid, _moz_grid) -CSS_KEY(-moz-inline-grid, _moz_inline_grid) -CSS_KEY(-moz-grid-group, _moz_grid_group) -CSS_KEY(-moz-grid-line, _moz_grid_line) -CSS_KEY(-moz-stack, _moz_stack) -CSS_KEY(-moz-inline-stack, _moz_inline_stack) -CSS_KEY(above, above) -CSS_KEY(absolute, absolute) -CSS_KEY(activeborder, activeborder) -CSS_KEY(activecaption, activecaption) -CSS_KEY(alias, alias) -CSS_KEY(all, all) -CSS_KEY(always, always) -CSS_KEY(appworkspace, appworkspace) -CSS_KEY(arabic-indic, arabic_indic) -CSS_KEY(armenian, armenian) -CSS_KEY(auto, auto) -CSS_KEY(avoid, avoid) -CSS_KEY(background, background) -CSS_KEY(baseline, baseline) -CSS_KEY(behind, behind) -CSS_KEY(below, below) -CSS_KEY(bengali, bengali) -CSS_KEY(bidi-override, bidi_override) -CSS_KEY(blink, blink) -CSS_KEY(block, block) -CSS_KEY(block-axis, block_axis) -CSS_KEY(bold, bold) -CSS_KEY(bolder, bolder) -CSS_KEY(border-box, border_box) -CSS_KEY(both, both) -CSS_KEY(bottom, bottom) -CSS_KEY(button, button) -CSS_KEY(buttonface, buttonface) -CSS_KEY(buttonhighlight, buttonhighlight) -CSS_KEY(buttonshadow, buttonshadow) -CSS_KEY(buttontext, buttontext) -CSS_KEY(capitalize, capitalize) -CSS_KEY(caption, caption) -CSS_KEY(captiontext, captiontext) -CSS_KEY(cell, cell) -CSS_KEY(center, center) -CSS_KEY(center-left, center_left) -CSS_KEY(center-right, center_right) -CSS_KEY(ch, ch) -CSS_KEY(circle, circle) -CSS_KEY(cjk-earthly-branch, cjk_earthly_branch) -CSS_KEY(cjk-heavenly-stem, cjk_heavenly_stem) -CSS_KEY(cjk-ideographic, cjk_ideographic) -CSS_KEY(close-quote, close_quote) -CSS_KEY(cm, cm) -CSS_KEY(code, code) -CSS_KEY(collapse, collapse) -CSS_KEY(compact, compact) -CSS_KEY(condensed, condensed) -CSS_KEY(content-box, content_box) -CSS_KEY(context-menu, context_menu) -CSS_KEY(continuous, continuous) -CSS_KEY(copy, copy) -CSS_KEY(count-down, count_down) -CSS_KEY(count-up, count_up) -CSS_KEY(count-up-down, count_up_down) -CSS_KEY(crop, crop) -CSS_KEY(cross, cross) -CSS_KEY(crosshair, crosshair) -CSS_KEY(dashed, dashed) -CSS_KEY(decimal, decimal) -CSS_KEY(decimal-leading-zero, decimal_leading_zero) -CSS_KEY(default, default) -CSS_KEY(deg, deg) -CSS_KEY(desktop, desktop) -CSS_KEY(devanagari, devanagari) -CSS_KEY(dialog, dialog) -CSS_KEY(digits, digits) -CSS_KEY(disabled, disabled) -CSS_KEY(disc, disc) -CSS_KEY(document, document) -CSS_KEY(dotted, dotted) -CSS_KEY(double, double) -CSS_KEY(e-resize, e_resize) -CSS_KEY(element, element) -CSS_KEY(elements, elements) -CSS_KEY(em, em) -CSS_KEY(embed, embed) -CSS_KEY(enabled, enabled) -CSS_KEY(end, end) -CSS_KEY(ex, ex) -CSS_KEY(expanded, expanded) -CSS_KEY(extra-condensed, extra_condensed) -CSS_KEY(extra-expanded, extra_expanded) -CSS_KEY(far-left, far_left) -CSS_KEY(far-right, far_right) -CSS_KEY(fast, fast) -CSS_KEY(faster, faster) -CSS_KEY(field, field) -CSS_KEY(fixed, fixed) -CSS_KEY(georgian, georgian) -CSS_KEY(grab, grab) -CSS_KEY(grabbing, grabbing) -CSS_KEY(grad, grad) -CSS_KEY(graytext, graytext) -CSS_KEY(groove, groove) -CSS_KEY(gujarati, gujarati) -CSS_KEY(gurmukhi, gurmukhi) -CSS_KEY(hebrew, hebrew) -CSS_KEY(help, help) -CSS_KEY(hidden, hidden) -CSS_KEY(hide, hide) -CSS_KEY(high, high) -CSS_KEY(higher, higher) -CSS_KEY(highlight, highlight) -CSS_KEY(highlighttext, highlighttext) -CSS_KEY(hiragana, hiragana) -CSS_KEY(hiragana-iroha, hiragana_iroha) -CSS_KEY(horizontal, horizontal) -CSS_KEY(hz, hz) -CSS_KEY(icon, icon) -CSS_KEY(ignore, ignore) -CSS_KEY(in, in) -CSS_KEY(inactiveborder, inactiveborder) -CSS_KEY(inactivecaption, inactivecaption) -CSS_KEY(inactivecaptiontext, inactivecaptiontext) -CSS_KEY(info, info) -CSS_KEY(infobackground, infobackground) -CSS_KEY(infotext, infotext) -CSS_KEY(inherit, inherit) -CSS_KEY(inline, inline) -CSS_KEY(inline-axis, inline_axis) -CSS_KEY(inline-block, inline_block) -CSS_KEY(inline-table, inline_table) -CSS_KEY(inset, inset) -CSS_KEY(inside, inside) -CSS_KEY(invert, invert) -CSS_KEY(italic, italic) -CSS_KEY(japanese-formal, japanese_formal) -CSS_KEY(japanese-informal, japanese_informal) -CSS_KEY(justify, justify) -CSS_KEY(kannada, kannada) -CSS_KEY(katakana, katakana) -CSS_KEY(katakana-iroha, katakana_iroha) -CSS_KEY(khmer, khmer) -CSS_KEY(khz, khz) -CSS_KEY(landscape, landscape) -CSS_KEY(lao, lao) -CSS_KEY(large, large) -CSS_KEY(larger, larger) -CSS_KEY(left, left) -CSS_KEY(left-side, left_side) -CSS_KEY(leftwards, leftwards) -CSS_KEY(level, level) -CSS_KEY(lighter, lighter) -CSS_KEY(line-through, line_through) -CSS_KEY(list, list) -CSS_KEY(list-item, list_item) -CSS_KEY(loud, loud) -CSS_KEY(low, low) -CSS_KEY(lower, lower) -CSS_KEY(lower-alpha, lower_alpha) -CSS_KEY(lower-greek, lower_greek) -CSS_KEY(lower-latin, lower_latin) -CSS_KEY(lower-roman, lower_roman) -CSS_KEY(lowercase, lowercase) -CSS_KEY(ltr, ltr) -CSS_KEY(malayalam, malayalam) -CSS_KEY(margin-box, margin_box) -CSS_KEY(marker, marker) -CSS_KEY(medium, medium) -CSS_KEY(menu, menu) -CSS_KEY(menutext, menutext) -CSS_KEY(message-box, message_box) -CSS_KEY(middle, middle) -CSS_KEY(mix, mix) -CSS_KEY(mm, mm) -CSS_KEY(move, move) -CSS_KEY(ms, ms) -CSS_KEY(myanmar, myanmar) -CSS_KEY(n-resize, n_resize) -CSS_KEY(narrower, narrower) -CSS_KEY(ne-resize, ne_resize) -CSS_KEY(no-close-quote, no_close_quote) -CSS_KEY(no-open-quote, no_open_quote) -CSS_KEY(no-repeat, no_repeat) -CSS_KEY(none, none) -CSS_KEY(normal, normal) -CSS_KEY(noshade, noshade) -CSS_KEY(nowrap, nowrap) -CSS_KEY(nw-resize, nw_resize) -CSS_KEY(oblique, oblique) -CSS_KEY(once, once) -CSS_KEY(open-quote, open_quote) -CSS_KEY(oriya, oriya) -CSS_KEY(outset, outset) -CSS_KEY(outside, outside) -CSS_KEY(overline, overline) -CSS_KEY(padding-box, padding_box) -CSS_KEY(paragraph, paragraph) -CSS_KEY(pc, pc) -CSS_KEY(persian, persian) -CSS_KEY(pointer, pointer) -CSS_KEY(portrait, portrait) -CSS_KEY(pre, pre) -CSS_KEY(pt, pt) -CSS_KEY(pull-down-menu, pull_down_menu) -CSS_KEY(px, px) -CSS_KEY(rad, rad) -CSS_KEY(read-only, read_only) -CSS_KEY(read-write, read_write) -CSS_KEY(relative, relative) -CSS_KEY(repeat, repeat) -CSS_KEY(repeat-x, repeat_x) -CSS_KEY(repeat-y, repeat_y) -CSS_KEY(reverse, reverse) -CSS_KEY(ridge, ridge) -CSS_KEY(right, right) -CSS_KEY(right-side, right_side) -CSS_KEY(rightwards, rightwards) -CSS_KEY(rtl, rtl) -CSS_KEY(run-in, run_in) -CSS_KEY(s, s) -CSS_KEY(s-resize, s_resize) -CSS_KEY(scroll, scroll) -CSS_KEY(scrollbar, scrollbar) -CSS_KEY(se-resize, se_resize) -CSS_KEY(select-all, select_all) -CSS_KEY(select-before, select_before) -CSS_KEY(select-after, select_after) -CSS_KEY(select-same, select_same) -CSS_KEY(select-menu, select_menu) -CSS_KEY(semi-condensed, semi_condensed) -CSS_KEY(semi-expanded, semi_expanded) -CSS_KEY(separate, separate) -CSS_KEY(show, show) -CSS_KEY(silent, silent) -CSS_KEY(simp-chinese-formal, simp_chinese_formal) -CSS_KEY(simp-chinese-informal, simp_chinese_informal) -CSS_KEY(slow, slow) -CSS_KEY(slower, slower) -CSS_KEY(small, small) -CSS_KEY(small-caps, small_caps) -CSS_KEY(small-caption, small_caption) -CSS_KEY(smaller, smaller) -CSS_KEY(soft, soft) -CSS_KEY(solid, solid) -CSS_KEY(spell-out, spell_out) -CSS_KEY(spinning, spinning) -CSS_KEY(square, square) -CSS_KEY(start, start) -CSS_KEY(static, static) -CSS_KEY(status-bar, status_bar) -CSS_KEY(stretch, stretch) -CSS_KEY(sub, sub) -CSS_KEY(super, super) -CSS_KEY(sw-resize, sw_resize) -CSS_KEY(table, table) -CSS_KEY(table-caption, table_caption) -CSS_KEY(table-cell, table_cell) -CSS_KEY(table-column, table_column) -CSS_KEY(table-column-group, table_column_group) -CSS_KEY(table-footer-group, table_footer_group) -CSS_KEY(table-header-group, table_header_group) -CSS_KEY(table-row, table_row) -CSS_KEY(table-row-group, table_row_group) -CSS_KEY(tamil, tamil) -CSS_KEY(telugu, telugu) -CSS_KEY(text, text) -CSS_KEY(text-bottom, text_bottom) -CSS_KEY(text-top, text_top) -CSS_KEY(thai, thai) -CSS_KEY(thick, thick) -CSS_KEY(thin, thin) -CSS_KEY(threeddarkshadow, threeddarkshadow) -CSS_KEY(threedface, threedface) -CSS_KEY(threedhighlight, threedhighlight) -CSS_KEY(threedlightshadow, threedlightshadow) -CSS_KEY(threedshadow, threedshadow) -CSS_KEY(toggle, toggle) -CSS_KEY(top, top) -CSS_KEY(trad-chinese-formal, trad_chinese_formal) -CSS_KEY(trad-chinese-informal, trad_chinese_informal) -CSS_KEY(transparent, transparent) -CSS_KEY(tri-state, tri_state) -CSS_KEY(ultra-condensed, ultra_condensed) -CSS_KEY(ultra-expanded, ultra_expanded) -CSS_KEY(underline, underline) -CSS_KEY(upper-alpha, upper_alpha) -CSS_KEY(upper-latin, upper_latin) -CSS_KEY(upper-roman, upper_roman) -CSS_KEY(uppercase, uppercase) -CSS_KEY(urdu, urdu) -CSS_KEY(vertical, vertical) -CSS_KEY(visible, visible) -CSS_KEY(w-resize, w_resize) -CSS_KEY(wait, wait) -CSS_KEY(wider, wider) -CSS_KEY(window, window) -CSS_KEY(windowframe, windowframe) -CSS_KEY(windowtext, windowtext) -CSS_KEY(workspace, workspace) -CSS_KEY(write-only, write_only) -CSS_KEY(x-fast, x_fast) -CSS_KEY(x-high, x_high) -CSS_KEY(x-large, x_large) -CSS_KEY(x-loud, x_loud) -CSS_KEY(x-low, x_low) -CSS_KEY(x-slow, x_slow) -CSS_KEY(x-small, x_small) -CSS_KEY(x-soft, x_soft) -CSS_KEY(xx-large, xx_large) -CSS_KEY(xx-small, xx_small) diff --git a/mozilla/content/html/style/src/nsCSSKeywords.cpp b/mozilla/content/html/style/src/nsCSSKeywords.cpp deleted file mode 100644 index d58e9f86420..00000000000 --- a/mozilla/content/html/style/src/nsCSSKeywords.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsCSSKeywords.h" -#include "nsString.h" -#include "nsStaticNameTable.h" - -// define an array of all CSS keywords -#define CSS_KEY(_name,_id) #_name, -const char* kCSSRawKeywords[] = { -#include "nsCSSKeywordList.h" -}; -#undef CSS_KEY - -static PRInt32 gTableRefCount; -static nsStaticCaseInsensitiveNameTable* gKeywordTable; - -void -nsCSSKeywords::AddRefTable(void) -{ - if (0 == gTableRefCount++) { - NS_ASSERTION(!gKeywordTable, "pre existing array!"); - gKeywordTable = new nsStaticCaseInsensitiveNameTable(); - if (gKeywordTable) { -#ifdef DEBUG - { - // let's verify the table... - for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) { - nsCAutoString temp1(kCSSRawKeywords[index]); - nsCAutoString temp2(kCSSRawKeywords[index]); - temp1.ToLowerCase(); - NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); - NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); - } - } -#endif - gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT); - } - } -} - -void -nsCSSKeywords::ReleaseTable(void) -{ - if (0 == --gTableRefCount) { - if (gKeywordTable) { - delete gKeywordTable; - gKeywordTable = nsnull; - } - } -} - -nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsCString& aKeyword) -{ - NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); - if (gKeywordTable) { - return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); - } - return eCSSKeyword_UNKNOWN; -} - -nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsString& aKeyword) -{ - NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); - if (gKeywordTable) { - return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); - } - return eCSSKeyword_UNKNOWN; -} - -const nsCString& -nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) -{ - NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); - if (gKeywordTable) { - return gKeywordTable->GetStringValue(PRInt32(aKeyword)); - } else { - static nsCString kNullStr; - return kNullStr; - } -} - diff --git a/mozilla/content/html/style/src/nsCSSKeywords.h b/mozilla/content/html/style/src/nsCSSKeywords.h deleted file mode 100644 index 504b4512f3c..00000000000 --- a/mozilla/content/html/style/src/nsCSSKeywords.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSKeywords_h___ -#define nsCSSKeywords_h___ - -#include "nslayout.h" - -class nsString; -class nsCString; - -/* - Declare the enum list using the magic of preprocessing - enum values are "eCSSKeyword_foo" (where foo is the keyword) - - To change the list of keywords, see nsCSSKeywordList.h - - */ -#define CSS_KEY(_name,_id) eCSSKeyword_##_id, -enum nsCSSKeyword { - eCSSKeyword_UNKNOWN = -1, -#include "nsCSSKeywordList.h" - eCSSKeyword_COUNT -}; -#undef CSS_KEY - - -class NS_LAYOUT nsCSSKeywords { -public: - static void AddRefTable(void); - static void ReleaseTable(void); - - // Given a keyword string, return the enum value - static nsCSSKeyword LookupKeyword(const nsCString& aKeyword); - static nsCSSKeyword LookupKeyword(const nsString& aKeyword); - - // Given a keyword enum, get the string value - static const nsCString& GetStringValue(nsCSSKeyword aKeyword); -}; - -#endif /* nsCSSKeywords_h___ */ diff --git a/mozilla/content/html/style/src/nsCSSPropList.h b/mozilla/content/html/style/src/nsCSSPropList.h deleted file mode 100644 index abd214eed87..00000000000 --- a/mozilla/content/html/style/src/nsCSSPropList.h +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all parsed CSS properties - See nsCSSProps.h for access to the enum values for properties - - It is designed to be used as inline input to nsCSSProps.cpp *only* - through the magic of C preprocessing. - - All entries must be enclosed in the macro CSS_PROP which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - Requirements: - - Entries are in the form: (name,id,effect). 'id' must always be the same as - 'name' except that all hyphens ('-') in 'name' are converted to underscores - ('_') in 'id'. This lets us do nice things with the macros without having to - copy/convert strings at runtime. - - 'name' entries *must* use only lowercase characters. - - ** Break these invariants and bad things will happen. ** - - The third argument says what needs to be recomputed when the property - changes. - ******/ - -// For notes XXX bug 3935 below, the names being parsed do not correspond -// to the constants used internally. It would be nice to bring the -// constants into line sometime. - -// The parser will refuse to parse properties marked with -x-. - -// Those marked XXX bug 48973 are CSS2 properties that we support -// differently from the spec for UI requirements. If we ever -// support them correctly the old constants need to be renamed and -// new ones should be entered. - -CSS_PROP(-moz-border-radius, _moz_border_radius, VISUAL) -CSS_PROP(-moz-border-radius-topleft, _moz_border_radius_topLeft, VISUAL) -CSS_PROP(-moz-border-radius-topright, _moz_border_radius_topRight, VISUAL) -CSS_PROP(-moz-border-radius-bottomleft, _moz_border_radius_bottomLeft, VISUAL) -CSS_PROP(-moz-border-radius-bottomright, _moz_border_radius_bottomRight, VISUAL) -CSS_PROP(-moz-outline-radius, _moz_outline_radius, VISUAL) -CSS_PROP(-moz-outline-radius-topleft, _moz_outline_radius_topLeft, VISUAL) -CSS_PROP(-moz-outline-radius-topright, _moz_outline_radius_topRight, VISUAL) -CSS_PROP(-moz-outline-radius-bottomleft, _moz_outline_radius_bottomLeft, VISUAL) -CSS_PROP(-moz-outline-radius-bottomright, _moz_outline_radius_bottomRight, VISUAL) -CSS_PROP(azimuth, azimuth, AURAL) -CSS_PROP(background, background, VISUAL) -CSS_PROP(background-attachment, background_attachment, VISUAL) -CSS_PROP(background-color, background_color, VISUAL) -CSS_PROP(background-image, background_image, VISUAL) -CSS_PROP(background-position, background_position, VISUAL) -CSS_PROP(background-repeat, background_repeat, VISUAL) -CSS_PROP(-x-background-x-position, background_x_position, VISUAL) // XXX bug 3935 -CSS_PROP(-x-background-y-position, background_y_position, VISUAL) // XXX bug 3935 -CSS_PROP(-moz-binding, behavior, FRAMECHANGE) // XXX bug 3935 -CSS_PROP(border, border, REFLOW) -CSS_PROP(border-bottom, border_bottom, REFLOW) -CSS_PROP(border-bottom-color, border_bottom_color, VISUAL) -CSS_PROP(border-bottom-style, border_bottom_style, REFLOW) // on/off will need reflow -CSS_PROP(border-bottom-width, border_bottom_width, REFLOW) -CSS_PROP(border-collapse, border_collapse, REFLOW) -CSS_PROP(border-color, border_color, VISUAL) -CSS_PROP(border-left, border_left, REFLOW) -CSS_PROP(border-left-color, border_left_color, VISUAL) -CSS_PROP(border-left-style, border_left_style, REFLOW) // on/off will need reflow -CSS_PROP(border-left-width, border_left_width, REFLOW) -CSS_PROP(border-right, border_right, REFLOW) -CSS_PROP(border-right-color, border_right_color, VISUAL) -CSS_PROP(border-right-style, border_right_style, REFLOW) // on/off will need reflow -CSS_PROP(border-right-width, border_right_width, REFLOW) -CSS_PROP(border-spacing, border_spacing, REFLOW) -CSS_PROP(border-style, border_style, REFLOW) // on/off will need reflow -CSS_PROP(border-top, border_top, REFLOW) -CSS_PROP(border-top-color, border_top_color, VISUAL) -CSS_PROP(border-top-style, border_top_style, REFLOW) // on/off will need reflow -CSS_PROP(border-top-width, border_top_width, REFLOW) -CSS_PROP(border-width, border_width, REFLOW) -CSS_PROP(-x-border-x-spacing, border_x_spacing, REFLOW) // XXX bug 3935 -CSS_PROP(-x-border-y-spacing, border_y_spacing, REFLOW) // XXX bug 3935 -CSS_PROP(bottom, bottom, REFLOW) -CSS_PROP(-moz-box-align, box_align, REFLOW) // XXX bug 3935 -CSS_PROP(-moz-box-direction, box_direction, REFLOW) // XXX bug 3935 -CSS_PROP(-moz-box-flex, box_flex, REFLOW) // XXX bug 3935 -CSS_PROP(-moz-box-flex-group, box_flex_group, REFLOW) // XXX bug 3935 -CSS_PROP(-moz-box-orient, box_orient, REFLOW) // XXX bug 3935 -CSS_PROP(-moz-box-pack, box_pack, REFLOW) // XXX bug 3935 -CSS_PROP(-moz-box-sizing, box_sizing, REFLOW) // XXX bug 3935 -CSS_PROP(caption-side, caption_side, REFLOW) -CSS_PROP(clear, clear, REFLOW) -CSS_PROP(clip, clip, VISUAL) -CSS_PROP(-x-clip-bottom, clip_bottom, VISUAL) // XXX bug 3935 -CSS_PROP(-x-clip-left, clip_left, VISUAL) // XXX bug 3935 -CSS_PROP(-x-clip-right, clip_right, VISUAL) // XXX bug 3935 -CSS_PROP(-x-clip-top, clip_top, VISUAL) // XXX bug 3935 -CSS_PROP(color, color, VISUAL) -CSS_PROP(content, content, FRAMECHANGE) -CSS_PROP(counter-increment, counter_increment, REFLOW) -CSS_PROP(counter-reset, counter_reset, REFLOW) -CSS_PROP(cue, cue, AURAL) -CSS_PROP(cue-after, cue_after, AURAL) -CSS_PROP(cue-before, cue_before, AURAL) -CSS_PROP(cursor, cursor, VISUAL) -CSS_PROP(direction, direction, REFLOW) -CSS_PROP(display, display, FRAMECHANGE) -CSS_PROP(elevation, elevation, AURAL) -CSS_PROP(empty-cells, empty_cells, VISUAL) -CSS_PROP(float, float, FRAMECHANGE) -CSS_PROP(-moz-float-edge, float_edge, REFLOW) // XXX bug 3935 -CSS_PROP(font, font, REFLOW) -CSS_PROP(font-family, font_family, REFLOW) -CSS_PROP(font-size, font_size, REFLOW) -CSS_PROP(font-size-adjust, font_size_adjust, REFLOW) -CSS_PROP(font-stretch, font_stretch, REFLOW) -CSS_PROP(font-style, font_style, REFLOW) -CSS_PROP(font-variant, font_variant, REFLOW) -CSS_PROP(font-weight, font_weight, REFLOW) -CSS_PROP(height, height, REFLOW) -CSS_PROP(-moz-key-equivalent, key_equivalent, CONTENT) // This will need some other notification, but what? // XXX bug 3935 -CSS_PROP(left, left, REFLOW) -CSS_PROP(letter-spacing, letter_spacing, REFLOW) -CSS_PROP(line-height, line_height, REFLOW) -CSS_PROP(list-style, list_style, REFLOW) -CSS_PROP(list-style-image, list_style_image, REFLOW) -CSS_PROP(list-style-position, list_style_position, REFLOW) -CSS_PROP(list-style-type, list_style_type, REFLOW) -CSS_PROP(margin, margin, REFLOW) -CSS_PROP(margin-bottom, margin_bottom, REFLOW) -CSS_PROP(margin-left, margin_left, REFLOW) -CSS_PROP(margin-right, margin_right, REFLOW) -CSS_PROP(margin-top, margin_top, REFLOW) -CSS_PROP(marker-offset, marker_offset, REFLOW) -CSS_PROP(marks, marks, VISUAL) -CSS_PROP(max-height, max_height, REFLOW) -CSS_PROP(max-width, max_width, REFLOW) -CSS_PROP(min-height, min_height, REFLOW) -CSS_PROP(min-width, min_width, REFLOW) -CSS_PROP(-moz-opacity, opacity, VISUAL) // XXX bug 3935 -CSS_PROP(orphans, orphans, REFLOW) -CSS_PROP(-moz-outline, outline, VISUAL) // XXX This is temporary fix for nsbeta3+ Bug 48973, turning outline into -moz-outline XXX bug 48973 -CSS_PROP(-moz-outline-color, outline_color, VISUAL) // XXX bug 48973 -CSS_PROP(-moz-outline-style, outline_style, VISUAL) // XXX bug 48973 -CSS_PROP(-moz-outline-width, outline_width, VISUAL) // XXX bug 48973 -CSS_PROP(overflow, overflow, FRAMECHANGE) -CSS_PROP(padding, padding, REFLOW) -CSS_PROP(padding-bottom, padding_bottom, REFLOW) -CSS_PROP(padding-left, padding_left, REFLOW) -CSS_PROP(padding-right, padding_right, REFLOW) -CSS_PROP(padding-top, padding_top, REFLOW) -CSS_PROP(page, page, REFLOW) -CSS_PROP(page-break-after, page_break_after, REFLOW) -CSS_PROP(page-break-before, page_break_before, REFLOW) -CSS_PROP(page-break-inside, page_break_inside, REFLOW) -CSS_PROP(pause, pause, AURAL) -CSS_PROP(pause-after, pause_after, AURAL) -CSS_PROP(pause-before, pause_before, AURAL) -CSS_PROP(pitch, pitch, AURAL) -CSS_PROP(pitch-range, pitch_range, AURAL) -CSS_PROP(play-during, play_during, AURAL) -CSS_PROP(-x-play-during-flags, play_during_flags, AURAL) // XXX why is this here? -CSS_PROP(position, position, FRAMECHANGE) -CSS_PROP(quotes, quotes, REFLOW) -CSS_PROP(-x-quotes-close, quotes_close, REFLOW) // XXX bug 3935 -CSS_PROP(-x-quotes-open, quotes_open, REFLOW) // XXX bug 3935 -CSS_PROP(-moz-resizer, resizer, FRAMECHANGE) // XXX bug 3935 -CSS_PROP(richness, richness, AURAL) -CSS_PROP(right, right, REFLOW) -CSS_PROP(size, size, REFLOW) -CSS_PROP(-x-size-height, size_height, REFLOW) // XXX bug 3935 -CSS_PROP(-x-size-width, size_width, REFLOW) // XXX bug 3935 -CSS_PROP(speak, speak, AURAL) -CSS_PROP(speak-header, speak_header, AURAL) -CSS_PROP(speak-numeral, speak_numeral, AURAL) -CSS_PROP(speak-punctuation, speak_punctuation, AURAL) -CSS_PROP(speech-rate, speech_rate, AURAL) -CSS_PROP(stress, stress, AURAL) -CSS_PROP(table-layout, table_layout, REFLOW) -CSS_PROP(text-align, text_align, REFLOW) -CSS_PROP(text-decoration, text_decoration, VISUAL) -CSS_PROP(text-indent, text_indent, REFLOW) -CSS_PROP(text-shadow, text_shadow, VISUAL) -CSS_PROP(-x-text-shadow-color, text_shadow_color, VISUAL) // XXX bug 3935 -CSS_PROP(-x-text-shadow-radius, text_shadow_radius, VISUAL) // XXX bug 3935 -CSS_PROP(-x-text-shadow-x, text_shadow_x, VISUAL) // XXX bug 3935 -CSS_PROP(-x-text-shadow-y, text_shadow_y, VISUAL) // XXX bug 3935 -CSS_PROP(text-transform, text_transform, REFLOW) -CSS_PROP(top, top, REFLOW) -CSS_PROP(unicode-bidi, unicode_bidi, REFLOW) -CSS_PROP(-moz-user-focus, user_focus, CONTENT) // XXX bug 3935 -CSS_PROP(-moz-user-input, user_input, FRAMECHANGE) // XXX ??? // XXX bug 3935 -CSS_PROP(-moz-user-modify, user_modify, FRAMECHANGE) // XXX bug 3935 -CSS_PROP(-moz-user-select, user_select, CONTENT) // XXX bug 3935 -CSS_PROP(vertical-align, vertical_align, REFLOW) -CSS_PROP(visibility, visibility, REFLOW) // reflow for collapse -CSS_PROP(voice-family, voice_family, AURAL) -CSS_PROP(volume, volume, AURAL) -CSS_PROP(white-space, white_space, REFLOW) -CSS_PROP(widows, widows, REFLOW) -CSS_PROP(width, width, REFLOW) -CSS_PROP(word-spacing, word_spacing, REFLOW) -CSS_PROP(z-index, z_index, REFLOW) diff --git a/mozilla/content/html/style/src/nsCSSProps.cpp b/mozilla/content/html/style/src/nsCSSProps.cpp deleted file mode 100644 index 4c6deb67250..00000000000 --- a/mozilla/content/html/style/src/nsCSSProps.cpp +++ /dev/null @@ -1,1103 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsCSSProps.h" -#include "nsCSSKeywords.h" -#include "nsStyleConsts.h" - -#include "nsILookAndFeel.h" // for system colors - -#include "nsString.h" -#include "nsStaticNameTable.h" - -// define an array of all CSS properties -#define CSS_PROP(_name, _id, _hint) #_name, -const char* kCSSRawProperties[] = { -#include "nsCSSPropList.h" -}; -#undef CSS_PROP - - -static PRInt32 gTableRefCount; -static nsStaticCaseInsensitiveNameTable* gPropertyTable; - -void -nsCSSProps::AddRefTable(void) -{ - if (0 == gTableRefCount++) { - NS_ASSERTION(!gPropertyTable, "pre existing array!"); - gPropertyTable = new nsStaticCaseInsensitiveNameTable(); - if (gPropertyTable) { -#ifdef DEBUG - { - // let's verify the table... - for (PRInt32 index = 0; index < eCSSProperty_COUNT; ++index) { - nsCAutoString temp1(kCSSRawProperties[index]); - nsCAutoString temp2(kCSSRawProperties[index]); - temp1.ToLowerCase(); - NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); - NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); - } - } -#endif - gPropertyTable->Init(kCSSRawProperties, eCSSProperty_COUNT); - } - } -} - -void -nsCSSProps::ReleaseTable(void) -{ - if (0 == --gTableRefCount) { - if (gPropertyTable) { - delete gPropertyTable; - gPropertyTable = nsnull; - } - } -} - -nsCSSProperty -nsCSSProps::LookupProperty(const nsCString& aProperty) -{ - NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); - if (gPropertyTable) { - return nsCSSProperty(gPropertyTable->Lookup(aProperty)); - } - return eCSSProperty_UNKNOWN; -} - -nsCSSProperty -nsCSSProps::LookupProperty(const nsAReadableString& aProperty) { - nsCAutoString theProp; theProp.AssignWithConversion(aProperty); - return LookupProperty(theProp); -} - -const nsCString& -nsCSSProps::GetStringValue(nsCSSProperty aProperty) -{ - NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); - if (gPropertyTable) { - return gPropertyTable->GetStringValue(PRInt32(aProperty)); - } else { - static nsCString sNullStr; - return sNullStr; - } -} - - -/***************************************************************************/ - -// Keyword id tables for variant/enum parsing -const PRInt32 nsCSSProps::kAzimuthKTable[] = { - eCSSKeyword_left_side, NS_STYLE_AZIMUTH_LEFT_SIDE, - eCSSKeyword_far_left, NS_STYLE_AZIMUTH_FAR_LEFT, - eCSSKeyword_left, NS_STYLE_AZIMUTH_LEFT, - eCSSKeyword_center_left, NS_STYLE_AZIMUTH_CENTER_LEFT, - eCSSKeyword_center, NS_STYLE_AZIMUTH_CENTER, - eCSSKeyword_center_right, NS_STYLE_AZIMUTH_CENTER_RIGHT, - eCSSKeyword_right, NS_STYLE_AZIMUTH_RIGHT, - eCSSKeyword_far_right, NS_STYLE_AZIMUTH_FAR_RIGHT, - eCSSKeyword_right_side, NS_STYLE_AZIMUTH_RIGHT_SIDE, - eCSSKeyword_behind, NS_STYLE_AZIMUTH_BEHIND, - eCSSKeyword_leftwards, NS_STYLE_AZIMUTH_LEFTWARDS, - eCSSKeyword_rightwards, NS_STYLE_AZIMUTH_RIGHTWARDS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = { - eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED, - eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBackgroundColorKTable[] = { - eCSSKeyword_transparent, NS_STYLE_BG_COLOR_TRANSPARENT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBackgroundRepeatKTable[] = { - eCSSKeyword_no_repeat, NS_STYLE_BG_REPEAT_OFF, - eCSSKeyword_repeat, NS_STYLE_BG_REPEAT_XY, - eCSSKeyword_repeat_x, NS_STYLE_BG_REPEAT_X, - eCSSKeyword_repeat_y, NS_STYLE_BG_REPEAT_Y, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderCollapseKTable[] = { - eCSSKeyword_collapse, NS_STYLE_BORDER_COLLAPSE, - eCSSKeyword_separate, NS_STYLE_BORDER_SEPARATE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderColorKTable[] = { - eCSSKeyword_transparent, NS_STYLE_COLOR_TRANSPARENT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderStyleKTable[] = { - eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN, - eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED, - eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED, - eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID, - eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE, - eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE, - eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE, - eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET, - eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET, - eCSSKeyword__moz_bg_inset, NS_STYLE_BORDER_STYLE_BG_INSET, - eCSSKeyword__moz_bg_outset, NS_STYLE_BORDER_STYLE_BG_OUTSET, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderWidthKTable[] = { - eCSSKeyword_thin, NS_STYLE_BORDER_WIDTH_THIN, - eCSSKeyword_medium, NS_STYLE_BORDER_WIDTH_MEDIUM, - eCSSKeyword_thick, NS_STYLE_BORDER_WIDTH_THICK, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBoxSizingKTable[] = { - eCSSKeyword_content_box, NS_STYLE_BOX_SIZING_CONTENT, - eCSSKeyword_border_box, NS_STYLE_BOX_SIZING_BORDER, - eCSSKeyword_padding_box, NS_STYLE_BOX_SIZING_PADDING, - -1,-1 -}; - -const PRInt32 nsCSSProps::kCaptionSideKTable[] = { - eCSSKeyword_top, NS_SIDE_TOP, - eCSSKeyword_right, NS_SIDE_RIGHT, - eCSSKeyword_bottom, NS_SIDE_BOTTOM, - eCSSKeyword_left, NS_SIDE_LEFT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kClearKTable[] = { - eCSSKeyword_left, NS_STYLE_CLEAR_LEFT, - eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT, - eCSSKeyword_both, NS_STYLE_CLEAR_LEFT_AND_RIGHT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kColorKTable[] = { - eCSSKeyword_activeborder, nsILookAndFeel::eColor_activeborder, - eCSSKeyword_activecaption, nsILookAndFeel::eColor_activecaption, - eCSSKeyword_appworkspace, nsILookAndFeel::eColor_appworkspace, - eCSSKeyword_background, nsILookAndFeel::eColor_background, - eCSSKeyword_buttonface, nsILookAndFeel::eColor_buttonface, - eCSSKeyword_buttonhighlight, nsILookAndFeel::eColor_buttonhighlight, - eCSSKeyword_buttonshadow, nsILookAndFeel::eColor_buttonshadow, - eCSSKeyword_buttontext, nsILookAndFeel::eColor_buttontext, - eCSSKeyword_captiontext, nsILookAndFeel::eColor_captiontext, - eCSSKeyword_graytext, nsILookAndFeel::eColor_graytext, - eCSSKeyword_highlight, nsILookAndFeel::eColor_highlight, - eCSSKeyword_highlighttext, nsILookAndFeel::eColor_highlighttext, - eCSSKeyword_inactiveborder, nsILookAndFeel::eColor_inactiveborder, - eCSSKeyword_inactivecaption, nsILookAndFeel::eColor_inactivecaption, - eCSSKeyword_inactivecaptiontext, nsILookAndFeel::eColor_inactivecaptiontext, - eCSSKeyword_infobackground, nsILookAndFeel::eColor_infobackground, - eCSSKeyword_infotext, nsILookAndFeel::eColor_infotext, - eCSSKeyword_menu, nsILookAndFeel::eColor_menu, - eCSSKeyword_menutext, nsILookAndFeel::eColor_menutext, - eCSSKeyword_scrollbar, nsILookAndFeel::eColor_scrollbar, - eCSSKeyword_threeddarkshadow, nsILookAndFeel::eColor_threeddarkshadow, - eCSSKeyword_threedface, nsILookAndFeel::eColor_threedface, - eCSSKeyword_threedhighlight, nsILookAndFeel::eColor_threedhighlight, - eCSSKeyword_threedlightshadow, nsILookAndFeel::eColor_threedlightshadow, - eCSSKeyword_threedshadow, nsILookAndFeel::eColor_threedshadow, - eCSSKeyword_window, nsILookAndFeel::eColor_window, - eCSSKeyword_windowframe, nsILookAndFeel::eColor_windowframe, - eCSSKeyword_windowtext, nsILookAndFeel::eColor_windowtext, - eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field, - eCSSKeyword__moz_dragtargetzone, nsILookAndFeel::eColor__moz_dragtargetzone, - eCSSKeyword__moz_mac_focusring, nsILookAndFeel::eColor__moz_mac_focusring, - eCSSKeyword__moz_mac_menuselect, nsILookAndFeel::eColor__moz_mac_menuselect, - eCSSKeyword__moz_mac_menushadow, nsILookAndFeel::eColor__moz_mac_menushadow, - eCSSKeyword__moz_mac_menutextselect, nsILookAndFeel::eColor__moz_mac_menutextselect, - eCSSKeyword__moz_mac_accentlightesthighlight, nsILookAndFeel::eColor__moz_mac_accentlightesthighlight, - eCSSKeyword__moz_mac_accentregularhighlight, nsILookAndFeel::eColor__moz_mac_accentregularhighlight, - eCSSKeyword__moz_mac_accentface, nsILookAndFeel::eColor__moz_mac_accentface, - eCSSKeyword__moz_mac_accentlightshadow, nsILookAndFeel::eColor__moz_mac_accentlightshadow, - eCSSKeyword__moz_mac_accentregularshadow, nsILookAndFeel::eColor__moz_mac_accentregularshadow, - eCSSKeyword__moz_mac_accentdarkshadow, nsILookAndFeel::eColor__moz_mac_accentdarkshadow, - eCSSKeyword__moz_mac_accentdarkestshadow, nsILookAndFeel::eColor__moz_mac_accentdarkestshadow, - -1,-1 -}; - -const PRInt32 nsCSSProps::kContentKTable[] = { - eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE, - eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE, - eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE, - eCSSKeyword_no_close_quote, NS_STYLE_CONTENT_NO_CLOSE_QUOTE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kCursorKTable[] = { - eCSSKeyword_crosshair, NS_STYLE_CURSOR_CROSSHAIR, - eCSSKeyword_default, NS_STYLE_CURSOR_DEFAULT, - eCSSKeyword_pointer, NS_STYLE_CURSOR_POINTER, - eCSSKeyword_move, NS_STYLE_CURSOR_MOVE, - eCSSKeyword_e_resize, NS_STYLE_CURSOR_E_RESIZE, - eCSSKeyword_ne_resize, NS_STYLE_CURSOR_NE_RESIZE, - eCSSKeyword_nw_resize, NS_STYLE_CURSOR_NW_RESIZE, - eCSSKeyword_n_resize, NS_STYLE_CURSOR_N_RESIZE, - eCSSKeyword_se_resize, NS_STYLE_CURSOR_SE_RESIZE, - eCSSKeyword_sw_resize, NS_STYLE_CURSOR_SW_RESIZE, - eCSSKeyword_s_resize, NS_STYLE_CURSOR_S_RESIZE, - eCSSKeyword_w_resize, NS_STYLE_CURSOR_W_RESIZE, - eCSSKeyword_text, NS_STYLE_CURSOR_TEXT, - eCSSKeyword_wait, NS_STYLE_CURSOR_WAIT, - eCSSKeyword_help, NS_STYLE_CURSOR_HELP, - eCSSKeyword_copy, NS_STYLE_CURSOR_COPY, // CSS3 - eCSSKeyword_alias, NS_STYLE_CURSOR_ALIAS, - eCSSKeyword_context_menu, NS_STYLE_CURSOR_CONTEXT_MENU, - eCSSKeyword_cell, NS_STYLE_CURSOR_CELL, - eCSSKeyword_grab, NS_STYLE_CURSOR_GRAB, - eCSSKeyword_grabbing, NS_STYLE_CURSOR_GRABBING, - eCSSKeyword_spinning, NS_STYLE_CURSOR_SPINNING, - eCSSKeyword_count_up, NS_STYLE_CURSOR_COUNT_UP, - eCSSKeyword_count_down, NS_STYLE_CURSOR_COUNT_DOWN, - eCSSKeyword_count_up_down, NS_STYLE_CURSOR_COUNT_UP_DOWN, - -1,-1 -}; - -const PRInt32 nsCSSProps::kDirectionKTable[] = { - eCSSKeyword_ltr, NS_STYLE_DIRECTION_LTR, - eCSSKeyword_rtl, NS_STYLE_DIRECTION_RTL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kDisplayKTable[] = { - eCSSKeyword_inline, NS_STYLE_DISPLAY_INLINE, - eCSSKeyword_block, NS_STYLE_DISPLAY_BLOCK, - eCSSKeyword_inline_block, NS_STYLE_DISPLAY_INLINE_BLOCK, - eCSSKeyword_list_item, NS_STYLE_DISPLAY_LIST_ITEM, - eCSSKeyword_run_in, NS_STYLE_DISPLAY_RUN_IN, - eCSSKeyword_compact, NS_STYLE_DISPLAY_COMPACT, - eCSSKeyword_marker, NS_STYLE_DISPLAY_MARKER, - eCSSKeyword_table, NS_STYLE_DISPLAY_TABLE, - eCSSKeyword_inline_table, NS_STYLE_DISPLAY_INLINE_TABLE, - eCSSKeyword_table_row_group, NS_STYLE_DISPLAY_TABLE_ROW_GROUP, - eCSSKeyword_table_header_group, NS_STYLE_DISPLAY_TABLE_HEADER_GROUP, - eCSSKeyword_table_footer_group, NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP, - eCSSKeyword_table_row, NS_STYLE_DISPLAY_TABLE_ROW, - eCSSKeyword_table_column_group, NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP, - eCSSKeyword_table_column, NS_STYLE_DISPLAY_TABLE_COLUMN, - eCSSKeyword_table_cell, NS_STYLE_DISPLAY_TABLE_CELL, - eCSSKeyword_table_caption, NS_STYLE_DISPLAY_TABLE_CAPTION, - eCSSKeyword_menu, NS_STYLE_DISPLAY_MENU, - eCSSKeyword__moz_box, NS_STYLE_DISPLAY_BOX, - eCSSKeyword__moz_inline_box, NS_STYLE_DISPLAY_INLINE_BOX, - eCSSKeyword__moz_grid, NS_STYLE_DISPLAY_GRID, - eCSSKeyword__moz_inline_grid, NS_STYLE_DISPLAY_INLINE_GRID, - eCSSKeyword__moz_grid_group, NS_STYLE_DISPLAY_GRID_GROUP, - eCSSKeyword__moz_grid_line, NS_STYLE_DISPLAY_GRID_LINE, - eCSSKeyword__moz_stack, NS_STYLE_DISPLAY_STACK, - eCSSKeyword__moz_inline_stack, NS_STYLE_DISPLAY_INLINE_STACK, - -1,-1 -}; - -const PRInt32 nsCSSProps::kElevationKTable[] = { - eCSSKeyword_below, NS_STYLE_ELEVATION_BELOW, - eCSSKeyword_level, NS_STYLE_ELEVATION_LEVEL, - eCSSKeyword_above, NS_STYLE_ELEVATION_ABOVE, - eCSSKeyword_higher, NS_STYLE_ELEVATION_HIGHER, - eCSSKeyword_lower, NS_STYLE_ELEVATION_LOWER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kEmptyCellsKTable[] = { - eCSSKeyword_show, NS_STYLE_TABLE_EMPTY_CELLS_SHOW, - eCSSKeyword_hide, NS_STYLE_TABLE_EMPTY_CELLS_HIDE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFloatKTable[] = { - eCSSKeyword_left, NS_STYLE_FLOAT_LEFT, - eCSSKeyword_right, NS_STYLE_FLOAT_RIGHT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFloatEdgeKTable[] = { - eCSSKeyword_content_box, NS_STYLE_FLOAT_EDGE_CONTENT, - eCSSKeyword_border_box, NS_STYLE_FLOAT_EDGE_BORDER, - eCSSKeyword_padding_box, NS_STYLE_FLOAT_EDGE_PADDING, - eCSSKeyword_margin_box, NS_STYLE_FLOAT_EDGE_MARGIN, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontKTable[] = { - eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, // css2 - eCSSKeyword_icon, NS_STYLE_FONT_ICON, - eCSSKeyword_menu, NS_STYLE_FONT_MENU, - eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX, - eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION, - eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR, - eCSSKeyword_window, NS_STYLE_FONT_WINDOW, // css3 - eCSSKeyword_document, NS_STYLE_FONT_DOCUMENT, - eCSSKeyword_workspace, NS_STYLE_FONT_WORKSPACE, - eCSSKeyword_desktop, NS_STYLE_FONT_DESKTOP, - eCSSKeyword_info, NS_STYLE_FONT_INFO, - eCSSKeyword_dialog, NS_STYLE_FONT_DIALOG, - eCSSKeyword_button, NS_STYLE_FONT_BUTTON, - eCSSKeyword_pull_down_menu, NS_STYLE_FONT_PULL_DOWN_MENU, - eCSSKeyword_list, NS_STYLE_FONT_LIST, - eCSSKeyword_field, NS_STYLE_FONT_FIELD, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontSizeKTable[] = { - eCSSKeyword_xx_small, NS_STYLE_FONT_SIZE_XXSMALL, - eCSSKeyword_x_small, NS_STYLE_FONT_SIZE_XSMALL, - eCSSKeyword_small, NS_STYLE_FONT_SIZE_SMALL, - eCSSKeyword_medium, NS_STYLE_FONT_SIZE_MEDIUM, - eCSSKeyword_large, NS_STYLE_FONT_SIZE_LARGE, - eCSSKeyword_x_large, NS_STYLE_FONT_SIZE_XLARGE, - eCSSKeyword_xx_large, NS_STYLE_FONT_SIZE_XXLARGE, - eCSSKeyword_larger, NS_STYLE_FONT_SIZE_LARGER, - eCSSKeyword_smaller, NS_STYLE_FONT_SIZE_SMALLER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontStretchKTable[] = { - eCSSKeyword_wider, NS_STYLE_FONT_STRETCH_WIDER, - eCSSKeyword_narrower, NS_STYLE_FONT_STRETCH_NARROWER, - eCSSKeyword_ultra_condensed, NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED, - eCSSKeyword_extra_condensed, NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED, - eCSSKeyword_condensed, NS_STYLE_FONT_STRETCH_CONDENSED, - eCSSKeyword_semi_condensed, NS_STYLE_FONT_STRETCH_SEMI_CONDENSED, - eCSSKeyword_semi_expanded, NS_STYLE_FONT_STRETCH_SEMI_EXPANDED, - eCSSKeyword_expanded, NS_STYLE_FONT_STRETCH_EXPANDED, - eCSSKeyword_extra_expanded, NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED, - eCSSKeyword_ultra_expanded, NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontStyleKTable[] = { - eCSSKeyword_italic, NS_STYLE_FONT_STYLE_ITALIC, - eCSSKeyword_oblique, NS_STYLE_FONT_STYLE_OBLIQUE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontVariantKTable[] = { - eCSSKeyword_small_caps, NS_STYLE_FONT_VARIANT_SMALL_CAPS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontWeightKTable[] = { - eCSSKeyword_bold, NS_STYLE_FONT_WEIGHT_BOLD, - eCSSKeyword_bolder, NS_STYLE_FONT_WEIGHT_BOLDER, - eCSSKeyword_lighter, NS_STYLE_FONT_WEIGHT_LIGHTER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kKeyEquivalentKTable[] = { - -1,-1 -}; - -const PRInt32 nsCSSProps::kListStylePositionKTable[] = { - eCSSKeyword_inside, NS_STYLE_LIST_STYLE_POSITION_INSIDE, - eCSSKeyword_outside, NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kListStyleKTable[] = { - eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC, - eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE, - eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE, - eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL, - eCSSKeyword_decimal_leading_zero, NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO, - eCSSKeyword_lower_roman, NS_STYLE_LIST_STYLE_LOWER_ROMAN, - eCSSKeyword_upper_roman, NS_STYLE_LIST_STYLE_UPPER_ROMAN, - eCSSKeyword_lower_greek, NS_STYLE_LIST_STYLE_LOWER_GREEK, - eCSSKeyword_lower_alpha, NS_STYLE_LIST_STYLE_LOWER_ALPHA, - eCSSKeyword_lower_latin, NS_STYLE_LIST_STYLE_LOWER_LATIN, - eCSSKeyword_upper_alpha, NS_STYLE_LIST_STYLE_UPPER_ALPHA, - eCSSKeyword_upper_latin, NS_STYLE_LIST_STYLE_UPPER_LATIN, - eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW, - eCSSKeyword_armenian, NS_STYLE_LIST_STYLE_ARMENIAN, - eCSSKeyword_georgian, NS_STYLE_LIST_STYLE_GEORGIAN, - eCSSKeyword_cjk_ideographic, NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC, - eCSSKeyword_hiragana, NS_STYLE_LIST_STYLE_HIRAGANA, - eCSSKeyword_katakana, NS_STYLE_LIST_STYLE_KATAKANA, - eCSSKeyword_hiragana_iroha, NS_STYLE_LIST_STYLE_HIRAGANA_IROHA, - eCSSKeyword_katakana_iroha, NS_STYLE_LIST_STYLE_KATAKANA_IROHA, - eCSSKeyword_cjk_heavenly_stem, NS_STYLE_LIST_STYLE_CJK_HEAVENLY_STEM, - eCSSKeyword_cjk_earthly_branch, NS_STYLE_LIST_STYLE_CJK_EARTHLY_BRANCH, - eCSSKeyword_trad_chinese_informal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL, - eCSSKeyword_trad_chinese_formal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL, - eCSSKeyword_simp_chinese_informal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL, - eCSSKeyword_simp_chinese_formal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL, - eCSSKeyword_japanese_informal, NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL, - eCSSKeyword_japanese_formal, NS_STYLE_LIST_STYLE_JAPANESE_FORMAL, - eCSSKeyword_arabic_indic, NS_STYLE_LIST_STYLE_ARABIC_INDIC, - eCSSKeyword_persian, NS_STYLE_LIST_STYLE_PERSIAN, - eCSSKeyword_urdu, NS_STYLE_LIST_STYLE_URDU, - eCSSKeyword_devanagari, NS_STYLE_LIST_STYLE_DEVANAGARI, - eCSSKeyword_gurmukhi, NS_STYLE_LIST_STYLE_GURMUKHI, - eCSSKeyword_gujarati, NS_STYLE_LIST_STYLE_GUJARATI, - eCSSKeyword_oriya, NS_STYLE_LIST_STYLE_ORIYA, - eCSSKeyword_kannada, NS_STYLE_LIST_STYLE_KANNADA, - eCSSKeyword_malayalam, NS_STYLE_LIST_STYLE_MALAYALAM, - eCSSKeyword_bengali, NS_STYLE_LIST_STYLE_BENGALI, - eCSSKeyword_tamil, NS_STYLE_LIST_STYLE_TAMIL, - eCSSKeyword_telugu, NS_STYLE_LIST_STYLE_TELUGU, - eCSSKeyword_thai, NS_STYLE_LIST_STYLE_THAI, - eCSSKeyword_lao, NS_STYLE_LIST_STYLE_LAO, - eCSSKeyword_myanmar, NS_STYLE_LIST_STYLE_MYANMAR, - eCSSKeyword_khmer, NS_STYLE_LIST_STYLE_KHMER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kOutlineColorKTable[] = { - eCSSKeyword_invert, NS_STYLE_COLOR_INVERT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kOverflowKTable[] = { - eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, - eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, - eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, - eCSSKeyword__moz_scrollbars_none, NS_STYLE_OVERFLOW_SCROLLBARS_NONE, - eCSSKeyword__moz_scrollbars_horizontal, NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL, - eCSSKeyword__moz_scrollbars_vertical, NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageBreakKTable[] = { - eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS, - eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, - eCSSKeyword_left, NS_STYLE_PAGE_BREAK_LEFT, - eCSSKeyword_right, NS_STYLE_PAGE_BREAK_RIGHT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageBreakInsideKTable[] = { - eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageMarksKTable[] = { - eCSSKeyword_crop, NS_STYLE_PAGE_MARKS_CROP, - eCSSKeyword_cross, NS_STYLE_PAGE_MARKS_REGISTER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageSizeKTable[] = { - eCSSKeyword_landscape, NS_STYLE_PAGE_SIZE_LANDSCAPE, - eCSSKeyword_portrait, NS_STYLE_PAGE_SIZE_PORTRAIT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPitchKTable[] = { - eCSSKeyword_x_low, NS_STYLE_PITCH_X_LOW, - eCSSKeyword_low, NS_STYLE_PITCH_LOW, - eCSSKeyword_medium, NS_STYLE_PITCH_MEDIUM, - eCSSKeyword_high, NS_STYLE_PITCH_HIGH, - eCSSKeyword_x_high, NS_STYLE_PITCH_X_HIGH, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPlayDuringKTable[] = { - eCSSKeyword_mix, NS_STYLE_PLAY_DURING_MIX, - eCSSKeyword_repeat, NS_STYLE_PLAY_DURING_REPEAT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPositionKTable[] = { - eCSSKeyword_static, NS_STYLE_POSITION_NORMAL, - eCSSKeyword_relative, NS_STYLE_POSITION_RELATIVE, - eCSSKeyword_absolute, NS_STYLE_POSITION_ABSOLUTE, - eCSSKeyword_fixed, NS_STYLE_POSITION_FIXED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kResizerKTable[] = { - eCSSKeyword_both, NS_STYLE_RESIZER_BOTH, - eCSSKeyword_horizontal, NS_STYLE_RESIZER_HORIZONTAL, - eCSSKeyword_vertical, NS_STYLE_RESIZER_VERTICAL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakKTable[] = { - eCSSKeyword_spell_out, NS_STYLE_SPEAK_SPELL_OUT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakHeaderKTable[] = { - eCSSKeyword_once, NS_STYLE_SPEAK_HEADER_ONCE, - eCSSKeyword_always, NS_STYLE_SPEAK_HEADER_ALWAYS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakNumeralKTable[] = { - eCSSKeyword_digits, NS_STYLE_SPEAK_NUMERAL_DIGITS, - eCSSKeyword_continuous, NS_STYLE_SPEAK_NUMERAL_CONTINUOUS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakPunctuationKTable[] = { - eCSSKeyword_code, NS_STYLE_SPEAK_PUNCTUATION_CODE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeechRateKTable[] = { - eCSSKeyword_x_slow, NS_STYLE_SPEECH_RATE_X_SLOW, - eCSSKeyword_slow, NS_STYLE_SPEECH_RATE_SLOW, - eCSSKeyword_medium, NS_STYLE_SPEECH_RATE_MEDIUM, - eCSSKeyword_fast, NS_STYLE_SPEECH_RATE_FAST, - eCSSKeyword_x_fast, NS_STYLE_SPEECH_RATE_X_FAST, - eCSSKeyword_faster, NS_STYLE_SPEECH_RATE_FASTER, - eCSSKeyword_slower, NS_STYLE_SPEECH_RATE_SLOWER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTableLayoutKTable[] = { - eCSSKeyword_fixed, NS_STYLE_TABLE_LAYOUT_FIXED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTextAlignKTable[] = { - eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT, - eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT, - eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER, - eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY, - eCSSKeyword__moz_center, NS_STYLE_TEXT_ALIGN_MOZ_CENTER, - eCSSKeyword__moz_right, NS_STYLE_TEXT_ALIGN_MOZ_RIGHT, - eCSSKeyword_start, NS_STYLE_TEXT_ALIGN_DEFAULT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTextDecorationKTable[] = { - eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_UNDERLINE, - eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_OVERLINE, - eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_THROUGH, - eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_BLINK, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTextTransformKTable[] = { - eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE, - eCSSKeyword_lowercase, NS_STYLE_TEXT_TRANSFORM_LOWERCASE, - eCSSKeyword_uppercase, NS_STYLE_TEXT_TRANSFORM_UPPERCASE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUnicodeBidiKTable[] = { - eCSSKeyword_embed, NS_STYLE_UNICODE_BIDI_EMBED, - eCSSKeyword_bidi_override, NS_STYLE_UNICODE_BIDI_OVERRIDE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserFocusKTable[] = { - eCSSKeyword_ignore, NS_STYLE_USER_FOCUS_IGNORE, - eCSSKeyword_select_all, NS_STYLE_USER_FOCUS_SELECT_ALL, - eCSSKeyword_select_before, NS_STYLE_USER_FOCUS_SELECT_BEFORE, - eCSSKeyword_select_after, NS_STYLE_USER_FOCUS_SELECT_AFTER, - eCSSKeyword_select_same, NS_STYLE_USER_FOCUS_SELECT_SAME, - eCSSKeyword_select_menu, NS_STYLE_USER_FOCUS_SELECT_MENU, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserInputKTable[] = { - eCSSKeyword_enabled, NS_STYLE_USER_INPUT_ENABLED, - eCSSKeyword_disabled, NS_STYLE_USER_INPUT_DISABLED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserModifyKTable[] = { - eCSSKeyword_read_only, NS_STYLE_USER_MODIFY_READ_ONLY, - eCSSKeyword_read_write, NS_STYLE_USER_MODIFY_READ_WRITE, - eCSSKeyword_write_only, NS_STYLE_USER_MODIFY_WRITE_ONLY, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserSelectKTable[] = { - eCSSKeyword_text, NS_STYLE_USER_SELECT_TEXT, - eCSSKeyword_element, NS_STYLE_USER_SELECT_ELEMENT, - eCSSKeyword_elements, NS_STYLE_USER_SELECT_ELEMENTS, - eCSSKeyword_all, NS_STYLE_USER_SELECT_ALL, - eCSSKeyword_toggle, NS_STYLE_USER_SELECT_TOGGLE, - eCSSKeyword_tri_state, NS_STYLE_USER_SELECT_TRI_STATE, - eCSSKeyword__moz_all, NS_STYLE_USER_SELECT_MOZ_ALL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kVerticalAlignKTable[] = { - eCSSKeyword_baseline, NS_STYLE_VERTICAL_ALIGN_BASELINE, - eCSSKeyword_sub, NS_STYLE_VERTICAL_ALIGN_SUB, - eCSSKeyword_super, NS_STYLE_VERTICAL_ALIGN_SUPER, - eCSSKeyword_top, NS_STYLE_VERTICAL_ALIGN_TOP, - eCSSKeyword_text_top, NS_STYLE_VERTICAL_ALIGN_TEXT_TOP, - eCSSKeyword_middle, NS_STYLE_VERTICAL_ALIGN_MIDDLE, - eCSSKeyword_bottom, NS_STYLE_VERTICAL_ALIGN_BOTTOM, - eCSSKeyword_text_bottom, NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM, - -1,-1 -}; - -const PRInt32 nsCSSProps::kVisibilityKTable[] = { - eCSSKeyword_visible, NS_STYLE_VISIBILITY_VISIBLE, - eCSSKeyword_hidden, NS_STYLE_VISIBILITY_HIDDEN, - eCSSKeyword_collapse, NS_STYLE_VISIBILITY_COLLAPSE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kVolumeKTable[] = { - eCSSKeyword_silent, NS_STYLE_VOLUME_SILENT, - eCSSKeyword_x_soft, NS_STYLE_VOLUME_X_SOFT, - eCSSKeyword_soft, NS_STYLE_VOLUME_SOFT, - eCSSKeyword_medium, NS_STYLE_VOLUME_MEDIUM, - eCSSKeyword_loud, NS_STYLE_VOLUME_LOUD, - eCSSKeyword_x_loud, NS_STYLE_VOLUME_X_LOUD, - -1,-1 -}; - -const PRInt32 nsCSSProps::kWhitespaceKTable[] = { - eCSSKeyword_pre, NS_STYLE_WHITESPACE_PRE, - eCSSKeyword_nowrap, NS_STYLE_WHITESPACE_NOWRAP, - eCSSKeyword__moz_pre_wrap, NS_STYLE_WHITESPACE_MOZ_PRE_WRAP, - -1,-1 -}; - -#ifdef INCLUDE_XUL -// Specific keyword tables for XUL.properties -const PRInt32 nsCSSProps::kBoxOrientKTable[] = { - eCSSKeyword_horizontal, NS_STYLE_BOX_ORIENT_HORIZONTAL, - eCSSKeyword_vertical, NS_STYLE_BOX_ORIENT_VERTICAL, - eCSSKeyword_inline_axis, NS_STYLE_BOX_ORIENT_HORIZONTAL, - eCSSKeyword_block_axis, NS_STYLE_BOX_ORIENT_VERTICAL, - -1,-1 -}; -#endif - -PRInt32 -nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]) -{ - PRInt32 i = 1; - for (;;) { - if (aTable[i] < 0) { - break; - } - if (aValue == aTable[i]) { - return PRInt32(aTable[i-1]); - } - i += 2; - } - return -1; -} - -const nsCString& -nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) -{ - PRInt32 i = SearchKeywordTableInt(aValue, aTable); - if (i < 0) { - static nsCString sNullStr; - return sNullStr; - } else { - return nsCSSKeywords::GetStringValue(nsCSSKeyword(i)); - } -} - -const nsCString& -nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue) -{ -static const PRInt32 kBackgroundXPositionKTable[] = { - eCSSKeyword_left, 0, - eCSSKeyword_center, 50, - eCSSKeyword_right, 100, - -1,-1 -}; - -static const PRInt32 kBackgroundYPositionKTable[] = { - eCSSKeyword_top, 0, - eCSSKeyword_center, 50, - eCSSKeyword_bottom, 100, - -1,-1 -}; - - switch (aProp) { - - case eCSSProperty__moz_border_radius: - break; - - case eCSSProperty_azimuth: - return SearchKeywordTable(aValue, kAzimuthKTable); - - case eCSSProperty_background: - break; - - case eCSSProperty_background_attachment: - return SearchKeywordTable(aValue, kBackgroundAttachmentKTable); - - case eCSSProperty_background_color: - return SearchKeywordTable(aValue, kBackgroundColorKTable); - - case eCSSProperty_background_image: - break; - - case eCSSProperty_background_position: - break; - - case eCSSProperty_background_repeat: - return SearchKeywordTable(aValue, kBackgroundRepeatKTable); - - case eCSSProperty_background_x_position: - return SearchKeywordTable(aValue, kBackgroundXPositionKTable); - - case eCSSProperty_background_y_position: - return SearchKeywordTable(aValue, kBackgroundYPositionKTable); - - case eCSSProperty_behavior: - break; - - case eCSSProperty_border: - break; - - case eCSSProperty_border_collapse: - return SearchKeywordTable(aValue, kBorderCollapseKTable); - -#ifdef INCLUDE_XUL - case eCSSProperty_box_orient: - return SearchKeywordTable(aValue, kBoxOrientKTable); -#endif - - case eCSSProperty_box_sizing: - return SearchKeywordTable(aValue, kBoxSizingKTable); - - case eCSSProperty_border_color: - case eCSSProperty_border_spacing: - case eCSSProperty_border_style: - case eCSSProperty_border_bottom: - case eCSSProperty_border_left: - case eCSSProperty_border_right: - case eCSSProperty_border_top: - break; - - case eCSSProperty_border_bottom_color: - case eCSSProperty_border_left_color: - case eCSSProperty_border_right_color: - case eCSSProperty_border_top_color: - return SearchKeywordTable(aValue, kBorderColorKTable); - - case eCSSProperty_border_bottom_style: - case eCSSProperty_border_left_style: - case eCSSProperty_border_right_style: - case eCSSProperty_border_top_style: - return SearchKeywordTable(aValue, kBorderStyleKTable); - - case eCSSProperty_border_bottom_width: - case eCSSProperty_border_left_width: - case eCSSProperty_border_right_width: - case eCSSProperty_border_top_width: - return SearchKeywordTable(aValue, kBorderWidthKTable); - - case eCSSProperty_border_width: - case eCSSProperty_border_x_spacing: - case eCSSProperty_border_y_spacing: - case eCSSProperty_bottom: - break; - - case eCSSProperty_caption_side: - return SearchKeywordTable(aValue, kCaptionSideKTable); - - case eCSSProperty_clear: - return SearchKeywordTable(aValue, kClearKTable); - - case eCSSProperty_clip: - case eCSSProperty_clip_bottom: - case eCSSProperty_clip_left: - case eCSSProperty_clip_right: - case eCSSProperty_clip_top: - case eCSSProperty_color: - break; - - case eCSSProperty_content: - return SearchKeywordTable(aValue, kContentKTable); - - case eCSSProperty_counter_increment: - case eCSSProperty_counter_reset: - case eCSSProperty_cue: - case eCSSProperty_cue_after: - case eCSSProperty_cue_before: - break; - - case eCSSProperty_cursor: - return SearchKeywordTable(aValue, kCursorKTable); - - case eCSSProperty_direction: - return SearchKeywordTable(aValue, kDirectionKTable); - - case eCSSProperty_display: - return SearchKeywordTable(aValue, kDisplayKTable); - - case eCSSProperty_elevation: - return SearchKeywordTable(aValue, kElevationKTable); - - case eCSSProperty_empty_cells: - return SearchKeywordTable(aValue, kEmptyCellsKTable); - - case eCSSProperty_float: - return SearchKeywordTable(aValue, kFloatKTable); - - case eCSSProperty_float_edge: - return SearchKeywordTable(aValue, kFloatEdgeKTable); - - case eCSSProperty_font: - break; - - case eCSSProperty_font_family: - return SearchKeywordTable(aValue, kFontKTable); - - case eCSSProperty_font_size: - return SearchKeywordTable(aValue, kFontSizeKTable); - - case eCSSProperty_font_size_adjust: - break; - - case eCSSProperty_font_stretch: - return SearchKeywordTable(aValue, kFontStretchKTable); - - case eCSSProperty_font_style: - return SearchKeywordTable(aValue, kFontStyleKTable); - - case eCSSProperty_font_variant: - return SearchKeywordTable(aValue, kFontVariantKTable); - - case eCSSProperty_font_weight: - return SearchKeywordTable(aValue, kFontWeightKTable); - - case eCSSProperty_height: - break; - - case eCSSProperty_key_equivalent: - return SearchKeywordTable(aValue, kKeyEquivalentKTable); - - case eCSSProperty_left: - case eCSSProperty_letter_spacing: - case eCSSProperty_line_height: - case eCSSProperty_list_style: - case eCSSProperty_list_style_image: - break; - - case eCSSProperty_list_style_position: - return SearchKeywordTable(aValue, kListStylePositionKTable); - - case eCSSProperty_list_style_type: - return SearchKeywordTable(aValue, kListStyleKTable); - - case eCSSProperty_margin: - case eCSSProperty_margin_bottom: - case eCSSProperty_margin_left: - case eCSSProperty_margin_right: - case eCSSProperty_margin_top: - case eCSSProperty_marker_offset: - break; - - case eCSSProperty_marks: - return SearchKeywordTable(aValue, kPageMarksKTable); - - case eCSSProperty_max_height: - case eCSSProperty_max_width: - case eCSSProperty_min_height: - case eCSSProperty_min_width: - break; - - case eCSSProperty_opacity: - case eCSSProperty_orphans: - case eCSSProperty_outline: - break; - - case eCSSProperty_outline_color: - return SearchKeywordTable(aValue, kOutlineColorKTable); - - case eCSSProperty_outline_style: - return SearchKeywordTable(aValue, kBorderStyleKTable); - - case eCSSProperty_outline_width: - return SearchKeywordTable(aValue, kBorderWidthKTable); - - case eCSSProperty_overflow: - return SearchKeywordTable(aValue, kOverflowKTable); - - case eCSSProperty_padding: - case eCSSProperty_padding_bottom: - case eCSSProperty_padding_left: - case eCSSProperty_padding_right: - case eCSSProperty_padding_top: - case eCSSProperty_page: - break; - - case eCSSProperty_page_break_before: - case eCSSProperty_page_break_after: - return SearchKeywordTable(aValue, kPageBreakKTable); - - case eCSSProperty_page_break_inside: - return SearchKeywordTable(aValue, kPageBreakInsideKTable); - - case eCSSProperty_pause: - case eCSSProperty_pause_after: - case eCSSProperty_pause_before: - break; - - case eCSSProperty_pitch: - return SearchKeywordTable(aValue, kPitchKTable); - - case eCSSProperty_pitch_range: - case eCSSProperty_play_during: - break; - - case eCSSProperty_play_during_flags: - return SearchKeywordTable(aValue, kPlayDuringKTable); - - case eCSSProperty_position: - return SearchKeywordTable(aValue, kPositionKTable); - - case eCSSProperty_quotes: - case eCSSProperty_quotes_close: - case eCSSProperty_quotes_open: - break; - - case eCSSProperty_resizer: - return SearchKeywordTable(aValue, kResizerKTable); - - case eCSSProperty_richness: - case eCSSProperty_right: - break; - - case eCSSProperty_size: - break; - - case eCSSProperty_size_height: - case eCSSProperty_size_width: - return SearchKeywordTable(aValue, kPageSizeKTable); - - case eCSSProperty_speak: - return SearchKeywordTable(aValue, kSpeakKTable); - - case eCSSProperty_speak_header: - return SearchKeywordTable(aValue, kSpeakHeaderKTable); - - case eCSSProperty_speak_numeral: - return SearchKeywordTable(aValue, kSpeakNumeralKTable); - - case eCSSProperty_speak_punctuation: - return SearchKeywordTable(aValue, kSpeakPunctuationKTable); - - case eCSSProperty_speech_rate: - return SearchKeywordTable(aValue, kSpeechRateKTable); - - case eCSSProperty_stress: - break; - - case eCSSProperty_table_layout: - return SearchKeywordTable(aValue, kTableLayoutKTable); - - case eCSSProperty_text_align: - return SearchKeywordTable(aValue, kTextAlignKTable); - - case eCSSProperty_text_decoration: - return SearchKeywordTable(aValue, kTextDecorationKTable); - - case eCSSProperty_text_indent: - case eCSSProperty_text_shadow: - case eCSSProperty_text_shadow_color: - case eCSSProperty_text_shadow_radius: - case eCSSProperty_text_shadow_x: - case eCSSProperty_text_shadow_y: - break; - - case eCSSProperty_text_transform: - return SearchKeywordTable(aValue, kTextTransformKTable); - - case eCSSProperty_top: - break; - - case eCSSProperty_unicode_bidi: - return SearchKeywordTable(aValue, kUnicodeBidiKTable); - - case eCSSProperty_user_focus: - return SearchKeywordTable(aValue, kUserFocusKTable); - - case eCSSProperty_user_input: - return SearchKeywordTable(aValue, kUserInputKTable); - - case eCSSProperty_user_modify: - return SearchKeywordTable(aValue, kUserModifyKTable); - - case eCSSProperty_user_select: - return SearchKeywordTable(aValue, kUserSelectKTable); - - case eCSSProperty_vertical_align: - return SearchKeywordTable(aValue, kVerticalAlignKTable); - - case eCSSProperty_visibility: - return SearchKeywordTable(aValue, kVisibilityKTable); - - case eCSSProperty_voice_family: - break; - - case eCSSProperty_volume: - return SearchKeywordTable(aValue, kVolumeKTable); - - case eCSSProperty_white_space: - return SearchKeywordTable(aValue, kWhitespaceKTable); - - case eCSSProperty_widows: - case eCSSProperty_width: - case eCSSProperty_word_spacing: - case eCSSProperty_z_index: - break; - -// no default case, let the compiler help find missing values - case eCSSProperty_UNKNOWN: - case eCSSProperty_COUNT: - NS_ERROR("invalid property"); - break; - } - static nsCString sNullStr; - return sNullStr; -} - -PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) -{ - PRBool rv = PR_FALSE; - PRInt32 keyword = -1; - - // first get the keyword corresponding to the property Value from the color table - keyword = SearchKeywordTableInt(aPropValue, kColorKTable); - - // next get the name as a string from the keywords table - if (keyword >= 0) { - nsCSSKeywords::AddRefTable(); - aStr = nsCSSKeywords::GetStringValue((nsCSSKeyword)keyword); - nsCSSKeywords::ReleaseTable(); - rv = PR_TRUE; - } - return rv; -} - -// define array of all CSS property hints -#define CSS_PROP(_name, _id, _hint) NS_STYLE_HINT_##_hint, -const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { -#include "nsCSSPropList.h" -}; -#undef CSS_PROP - diff --git a/mozilla/content/html/style/src/nsCSSProps.h b/mozilla/content/html/style/src/nsCSSProps.h deleted file mode 100644 index 8f525b6cb2f..00000000000 --- a/mozilla/content/html/style/src/nsCSSProps.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSProps_h___ -#define nsCSSProps_h___ - -#include "nslayout.h" -#include "nsString.h" - -/* - Declare the enum list using the magic of preprocessing - enum values are "eCSSProperty_foo" (where foo is the property) - - To change the list of properties, see nsCSSPropList.h - - */ -#define CSS_PROP(_name, _id, _hint) eCSSProperty_##_id, -enum nsCSSProperty { - eCSSProperty_UNKNOWN = -1, -#include "nsCSSPropList.h" - eCSSProperty_COUNT -}; -#undef CSS_PROP - - -class NS_LAYOUT nsCSSProps { -public: - static void AddRefTable(void); - static void ReleaseTable(void); - - // Given a property string, return the enum value - static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); - static nsCSSProperty LookupProperty(const nsCString& aProperty); - - // Given a property enum, get the string value - static const nsCString& GetStringValue(nsCSSProperty aProperty); - - // Given a CSS Property and a Property Enum Value - // Return back a const nsString& representation of the - // value. Return back nullstr if no value is found - static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); - - // Get a color name for a predefined color value like buttonhighlight or activeborder - // Sets the aStr param to the name of the propertyID - static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr); - - static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]); - static const nsCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]); - - static const PRInt32 kHintTable[]; - - // Keyword/Enum value tables - static const PRInt32 kAzimuthKTable[]; - static const PRInt32 kBackgroundAttachmentKTable[]; - static const PRInt32 kBackgroundColorKTable[]; - static const PRInt32 kBackgroundRepeatKTable[]; - static const PRInt32 kBorderCollapseKTable[]; - static const PRInt32 kBorderColorKTable[]; - static const PRInt32 kBorderStyleKTable[]; - static const PRInt32 kBorderWidthKTable[]; -#ifdef INCLUDE_XUL - static const PRInt32 kBoxOrientKTable[]; -#endif - static const PRInt32 kBoxSizingKTable[]; - static const PRInt32 kCaptionSideKTable[]; - static const PRInt32 kClearKTable[]; - static const PRInt32 kColorKTable[]; - static const PRInt32 kContentKTable[]; - static const PRInt32 kCursorKTable[]; - static const PRInt32 kDirectionKTable[]; - static const PRInt32 kDisplayKTable[]; - static const PRInt32 kElevationKTable[]; - static const PRInt32 kEmptyCellsKTable[]; - static const PRInt32 kFloatKTable[]; - static const PRInt32 kFloatEdgeKTable[]; - static const PRInt32 kFontKTable[]; - static const PRInt32 kFontSizeKTable[]; - static const PRInt32 kFontStretchKTable[]; - static const PRInt32 kFontStyleKTable[]; - static const PRInt32 kFontVariantKTable[]; - static const PRInt32 kFontWeightKTable[]; - static const PRInt32 kKeyEquivalentKTable[]; - static const PRInt32 kListStylePositionKTable[]; - static const PRInt32 kListStyleKTable[]; - static const PRInt32 kOutlineColorKTable[]; - static const PRInt32 kOverflowKTable[]; - static const PRInt32 kPageBreakKTable[]; - static const PRInt32 kPageBreakInsideKTable[]; - static const PRInt32 kPageMarksKTable[]; - static const PRInt32 kPageSizeKTable[]; - static const PRInt32 kPitchKTable[]; - static const PRInt32 kPlayDuringKTable[]; - static const PRInt32 kPositionKTable[]; - static const PRInt32 kResizerKTable[]; - static const PRInt32 kSpeakKTable[]; - static const PRInt32 kSpeakHeaderKTable[]; - static const PRInt32 kSpeakNumeralKTable[]; - static const PRInt32 kSpeakPunctuationKTable[]; - static const PRInt32 kSpeechRateKTable[]; - static const PRInt32 kTableLayoutKTable[]; - static const PRInt32 kTextAlignKTable[]; - static const PRInt32 kTextDecorationKTable[]; - static const PRInt32 kTextTransformKTable[]; - static const PRInt32 kUnicodeBidiKTable[]; - static const PRInt32 kUserFocusKTable[]; - static const PRInt32 kUserInputKTable[]; - static const PRInt32 kUserModifyKTable[]; - static const PRInt32 kUserSelectKTable[]; - static const PRInt32 kVerticalAlignKTable[]; - static const PRInt32 kVisibilityKTable[]; - static const PRInt32 kVolumeKTable[]; - static const PRInt32 kWhitespaceKTable[]; -}; - -#endif /* nsCSSProps_h___ */ diff --git a/mozilla/content/html/style/src/nsHTMLValue.cpp b/mozilla/content/html/style/src/nsHTMLValue.cpp deleted file mode 100644 index ec0cdc4749d..00000000000 --- a/mozilla/content/html/style/src/nsHTMLValue.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsHTMLValue.h" -#include "nsString.h" -#include "nsCRT.h" -#include "nsISizeOfHandler.h" - -nsHTMLValue::nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit) - : mUnit(aUnit) -{ - NS_ASSERTION((eHTMLUnit_Integer == aUnit) || - (eHTMLUnit_Enumerated == aUnit) || - (eHTMLUnit_Proportional == aUnit) || - (eHTMLUnit_Pixel == aUnit), "not an integer value"); - if ((eHTMLUnit_Integer == aUnit) || - (eHTMLUnit_Enumerated == aUnit) || - (eHTMLUnit_Proportional == aUnit) || - (eHTMLUnit_Pixel == aUnit)) { - mValue.mInt = aValue; - } - else { - mUnit = eHTMLUnit_Null; - mValue.mInt = 0; - } -} - -nsHTMLValue::nsHTMLValue(float aValue) - : mUnit(eHTMLUnit_Percent) -{ - mValue.mFloat = aValue; -} - -nsHTMLValue::nsHTMLValue(nsISupports* aValue) - : mUnit(eHTMLUnit_ISupports) -{ - mValue.mISupports = aValue; - NS_IF_ADDREF(mValue.mISupports); -} - -nsHTMLValue::nsHTMLValue(nscolor aValue) - : mUnit(eHTMLUnit_Color) -{ - mValue.mColor = aValue; -} - -nsHTMLValue::nsHTMLValue(const nsHTMLValue& aCopy) - : mUnit(aCopy.mUnit) -{ - if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { - if (nsnull != aCopy.mValue.mString) { - mValue.mString = nsCRT::strdup(aCopy.mValue.mString); - } - else { - mValue.mString = nsnull; - } - } - else if (eHTMLUnit_ISupports == mUnit) { - mValue.mISupports = aCopy.mValue.mISupports; - NS_IF_ADDREF(mValue.mISupports); - } - else if (eHTMLUnit_Color == mUnit){ - mValue.mColor = aCopy.mValue.mColor; - } - else if (eHTMLUnit_Percent == mUnit) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } -} - -nsHTMLValue& nsHTMLValue::operator=(const nsHTMLValue& aCopy) -{ - Reset(); - mUnit = aCopy.mUnit; - if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { - if (nsnull != aCopy.mValue.mString) { - mValue.mString = nsCRT::strdup(aCopy.mValue.mString); - } - } - else if (eHTMLUnit_ISupports == mUnit) { - mValue.mISupports = aCopy.mValue.mISupports; - NS_IF_ADDREF(mValue.mISupports); - } - else if (eHTMLUnit_Color == mUnit){ - mValue.mColor = aCopy.mValue.mColor; - } - else if (eHTMLUnit_Percent == mUnit) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } - return *this; -} - -PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const -{ - if (mUnit == aOther.mUnit) { - if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { - if (nsnull == mValue.mString) { - if (nsnull == aOther.mValue.mString) { - return PR_TRUE; - } - } - else if (nsnull != aOther.mValue.mString) { - return 0 == nsCRT::strcasecmp(mValue.mString, aOther.mValue.mString); - } - } - else if (eHTMLUnit_ISupports == mUnit) { - return PRBool(mValue.mISupports == aOther.mValue.mISupports); - } - else if (eHTMLUnit_Color == mUnit){ - return PRBool(mValue.mColor == aOther.mValue.mColor); - } - else if (eHTMLUnit_Percent == mUnit) { - return PRBool(mValue.mFloat == aOther.mValue.mFloat); - } - else { - return PRBool(mValue.mInt == aOther.mValue.mInt); - } - } - return PR_FALSE; -} - -PRUint32 nsHTMLValue::HashValue(void) const -{ - return PRUint32(mUnit) ^ - ((((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) && - (nsnull != mValue.mString)) ? - nsCRT::HashCode(mValue.mString) : - mValue.mInt); -} - - -void nsHTMLValue::SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit) -{ - Reset(); - NS_ASSERTION((eHTMLUnit_Integer == aUnit) || - (eHTMLUnit_Enumerated == aUnit) || - (eHTMLUnit_Proportional == aUnit), "not an int value"); - if ((eHTMLUnit_Integer == aUnit) || - (eHTMLUnit_Enumerated == aUnit) || - (eHTMLUnit_Proportional == aUnit)) { - mUnit = aUnit; - mValue.mInt = aValue; - } -} - -void nsHTMLValue::SetPixelValue(PRInt32 aValue) -{ - Reset(); - mUnit = eHTMLUnit_Pixel; - mValue.mInt = aValue; -} - -void nsHTMLValue::SetPercentValue(float aValue) -{ - Reset(); - mUnit = eHTMLUnit_Percent; - mValue.mFloat = aValue; -} - -void nsHTMLValue::SetStringValue(const nsAReadableString& aValue, - nsHTMLUnit aUnit) -{ - Reset(); - if ((eHTMLUnit_String == aUnit) || (eHTMLUnit_ColorName == aUnit)) { - mUnit = aUnit; - mValue.mString = ToNewUnicode(aValue); - } -} - -void nsHTMLValue::SetISupportsValue(nsISupports* aValue) -{ - Reset(); - mUnit = eHTMLUnit_ISupports; - mValue.mISupports = aValue; - NS_IF_ADDREF(mValue.mISupports); -} - -void nsHTMLValue::SetColorValue(nscolor aValue) -{ - Reset(); - mUnit = eHTMLUnit_Color; - mValue.mColor = aValue; -} - -void nsHTMLValue::SetEmptyValue(void) -{ - Reset(); - mUnit = eHTMLUnit_Empty; -} - -void nsHTMLValue::AppendToString(nsAWritableString& aBuffer) const -{ - if (eHTMLUnit_Null == mUnit) { - return; - } - - if (eHTMLUnit_Empty == mUnit) { - } - else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { - if (nsnull != mValue.mString) { - aBuffer.Append(PRUnichar('"')); - aBuffer.Append(mValue.mString); - aBuffer.Append(PRUnichar('"')); - } - else { - aBuffer.Append(NS_LITERAL_STRING("null str")); - } - } - else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.Append(NS_LITERAL_STRING("0x")); - nsAutoString intStr; - intStr.AppendInt((PRInt32)mValue.mISupports, 16); - aBuffer.Append(intStr); - } - else if (eHTMLUnit_Color == mUnit){ - nsAutoString intStr; - intStr.Append(NS_LITERAL_STRING("(0x")); - intStr.AppendInt(NS_GET_R(mValue.mColor), 16); - intStr.Append(intStr); - intStr.Append(NS_LITERAL_STRING(" 0x")); - intStr.AppendInt(NS_GET_G(mValue.mColor), 16); - intStr.Append(NS_LITERAL_STRING(" 0x")); - intStr.AppendInt(NS_GET_B(mValue.mColor), 16); - intStr.Append(NS_LITERAL_STRING(" 0x")); - intStr.AppendInt(NS_GET_A(mValue.mColor), 16); - intStr.Append(PRUnichar(')')); - - aBuffer.Append(intStr); - } - else if (eHTMLUnit_Percent == mUnit) { - nsAutoString floatStr; - floatStr.AppendFloat(mValue.mFloat * 100.0f); - aBuffer.Append(floatStr); - } - else { - nsAutoString intStr; - intStr.AppendInt(mValue.mInt, 10); - intStr.Append(NS_LITERAL_STRING("[0x")); - intStr.AppendInt(mValue.mInt, 16); - intStr.Append(PRUnichar(']')); - - aBuffer.Append(intStr); - } - - switch (mUnit) { - case eHTMLUnit_Null: break; - case eHTMLUnit_Empty: break; - case eHTMLUnit_String: break; - case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.Append(NS_LITERAL_STRING("ptr")); break; - case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.Append(NS_LITERAL_STRING("enum")); break; - case eHTMLUnit_Proportional: aBuffer.Append(NS_LITERAL_STRING("*")); break; - case eHTMLUnit_Color: aBuffer.Append(NS_LITERAL_STRING("rbga")); break; - case eHTMLUnit_Percent: aBuffer.Append(NS_LITERAL_STRING("%")); break; - case eHTMLUnit_Pixel: aBuffer.Append(NS_LITERAL_STRING("px")); break; - } - aBuffer.Append(PRUnichar(' ')); -} - -void nsHTMLValue::ToString(nsAWritableString& aBuffer) const -{ - aBuffer.Truncate(); - AppendToString(aBuffer); -} diff --git a/mozilla/content/html/style/src/nsHTMLValue.h b/mozilla/content/html/style/src/nsHTMLValue.h deleted file mode 100644 index 95a6eb21a28..00000000000 --- a/mozilla/content/html/style/src/nsHTMLValue.h +++ /dev/null @@ -1,215 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsHTMLValue_h___ -#define nsHTMLValue_h___ - -#include "nscore.h" -#include "nsColor.h" -#include "nsString.h" -#include "nsISupports.h" -#include "nsReadableUtils.h" - -enum nsHTMLUnit { - eHTMLUnit_Null = 0, // (n/a) null unit, value is not specified - eHTMLUnit_Empty = 1, // (n/a) empty unit, value is not specified - eHTMLUnit_String = 10, // (nsString) a string value - eHTMLUnit_ISupports = 20, // (nsISupports*) a ref counted interface - eHTMLUnit_Integer = 50, // (int) simple value - eHTMLUnit_Enumerated = 51, // (int) value has enumerated meaning - eHTMLUnit_Proportional = 52, // (int) value is a relative proportion of some whole - eHTMLUnit_Color = 80, // (color) an RGBA value - eHTMLUnit_ColorName = 81, // (nsString/color) a color name value - eHTMLUnit_Percent = 90, // (float) 1.0 == 100%) value is percentage of something - - // Screen relative measure - eHTMLUnit_Pixel = 600 // (int) screen pixels -}; - -class nsHTMLValue { -public: - nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null) : mUnit(aUnit) - { - NS_ASSERTION((aUnit <= eHTMLUnit_Empty), "not a valueless unit"); - if (aUnit > eHTMLUnit_Empty) { - mUnit = eHTMLUnit_Null; - } - mValue.mString = nsnull; - } - - nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit); - nsHTMLValue(float aValue); - nsHTMLValue(const nsAReadableString& aValue, - nsHTMLUnit aUnit = eHTMLUnit_String) : mUnit(aUnit) - { - NS_ASSERTION((eHTMLUnit_String == aUnit) || - (eHTMLUnit_ColorName == aUnit), "not a string value"); - if ((eHTMLUnit_String == aUnit) || - (eHTMLUnit_ColorName == aUnit)) { - mValue.mString = ToNewUnicode(aValue); - } - else { - mUnit = eHTMLUnit_Null; - mValue.mInt = 0; - } - } - - nsHTMLValue(nsISupports* aValue); - nsHTMLValue(nscolor aValue); - nsHTMLValue(const nsHTMLValue& aCopy); - ~nsHTMLValue(void) - { - Reset(); - } - - nsHTMLValue& operator=(const nsHTMLValue& aCopy); - PRBool operator==(const nsHTMLValue& aOther) const; - PRBool operator!=(const nsHTMLValue& aOther) const; - PRUint32 HashValue(void) const; - - nsHTMLUnit GetUnit(void) const { return mUnit; } - PRInt32 GetIntValue(void) const; - PRInt32 GetPixelValue(void) const; - float GetPercentValue(void) const; - nsAWritableString& GetStringValue(nsAWritableString& aBuffer) const; - nsISupports* GetISupportsValue(void) const; - nscolor GetColorValue(void) const; - - void Reset(void) { - if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { - if (nsnull != mValue.mString) { - nsCRT::free(mValue.mString); - } - } - else if (eHTMLUnit_ISupports == mUnit) { - NS_IF_RELEASE(mValue.mISupports); - } - mUnit = eHTMLUnit_Null; - mValue.mString = nsnull; - } - - void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit); - void SetPixelValue(PRInt32 aValue); - void SetPercentValue(float aValue); - void SetStringValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); - void SetISupportsValue(nsISupports* aValue); - void SetColorValue(nscolor aValue); - void SetEmptyValue(void); - - void AppendToString(nsAWritableString& aBuffer) const; - void ToString(nsAWritableString& aBuffer) const; - -protected: - nsHTMLUnit mUnit; - union { - PRInt32 mInt; - float mFloat; - PRUnichar* mString; - nsISupports* mISupports; - nscolor mColor; - } mValue; -}; - -inline PRInt32 nsHTMLValue::GetIntValue(void) const -{ - NS_ASSERTION((mUnit == eHTMLUnit_String) || - (mUnit == eHTMLUnit_Integer) || - (mUnit == eHTMLUnit_Enumerated) || - (mUnit == eHTMLUnit_Proportional), "not an int value"); - if ((mUnit == eHTMLUnit_Integer) || - (mUnit == eHTMLUnit_Enumerated) || - (mUnit == eHTMLUnit_Proportional)) { - return mValue.mInt; - } - else if (mUnit == eHTMLUnit_String) { - if (mValue.mString) { - PRInt32 err=0; - nsAutoString str(mValue.mString); // XXX copy. new string APIs will make this better, right? - return str.ToInteger(&err); - } - } - return 0; -} - -inline PRInt32 nsHTMLValue::GetPixelValue(void) const -{ - NS_ASSERTION((mUnit == eHTMLUnit_Pixel), "not a pixel value"); - if (mUnit == eHTMLUnit_Pixel) { - return mValue.mInt; - } - return 0; -} - -inline float nsHTMLValue::GetPercentValue(void) const -{ - NS_ASSERTION(mUnit == eHTMLUnit_Percent, "not a percent value"); - if (mUnit == eHTMLUnit_Percent) { - return mValue.mFloat; - } - return 0.0f; -} - -inline nsAWritableString& nsHTMLValue::GetStringValue(nsAWritableString& aBuffer) const -{ - NS_ASSERTION((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName) || - (mUnit == eHTMLUnit_Null), "not a string value"); - aBuffer.SetLength(0); - if (((mUnit == eHTMLUnit_String) || (mUnit == eHTMLUnit_ColorName)) && - (nsnull != mValue.mString)) { - aBuffer.Append(mValue.mString); - } - return aBuffer; -} - -inline nsISupports* nsHTMLValue::GetISupportsValue(void) const -{ - NS_ASSERTION(mUnit == eHTMLUnit_ISupports, "not an ISupports value"); - if (mUnit == eHTMLUnit_ISupports) { - nsISupports *result = mValue.mISupports; - NS_IF_ADDREF(result); - return result; - } - return nsnull; -} - -inline nscolor nsHTMLValue::GetColorValue(void) const -{ - NS_ASSERTION((mUnit == eHTMLUnit_Color) || (mUnit == eHTMLUnit_ColorName), - "not a color value"); - if (mUnit == eHTMLUnit_Color) { - return mValue.mColor; - } - if ((mUnit == eHTMLUnit_ColorName) && (mValue.mString)) { - nscolor color; - if (NS_ColorNameToRGB(nsAutoString(mValue.mString), &color)) { - return color; - } - } - return NS_RGB(0,0,0); -} - -inline PRBool nsHTMLValue::operator!=(const nsHTMLValue& aOther) const -{ - return PRBool(! ((*this) == aOther)); -} - -#endif /* nsHTMLValue_h___ */ - diff --git a/mozilla/content/makefile.win b/mozilla/content/makefile.win index d8bce23fe05..dea804aeac5 100644 --- a/mozilla/content/makefile.win +++ b/mozilla/content/makefile.win @@ -29,6 +29,7 @@ DIRS= \ xbl \ events \ xul \ + shared \ build \ $(NULL) diff --git a/mozilla/layout/xul/content/Makefile.in b/mozilla/content/shared/Makefile.in similarity index 96% rename from mozilla/layout/xul/content/Makefile.in rename to mozilla/content/shared/Makefile.in index 0b4d2a90ab5..c7532e842eb 100644 --- a/mozilla/layout/xul/content/Makefile.in +++ b/mozilla/content/shared/Makefile.in @@ -19,14 +19,14 @@ # Contributor(s): # -DEPTH = ../../.. +DEPTH = ../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = src +DIRS = public src include $(topsrcdir)/config/rules.mk diff --git a/mozilla/content/html/base/makefile.win b/mozilla/content/shared/makefile.win similarity index 94% rename from mozilla/content/html/base/makefile.win rename to mozilla/content/shared/makefile.win index 1c0e19c44b3..56ade4a66e7 100644 --- a/mozilla/content/html/base/makefile.win +++ b/mozilla/content/shared/makefile.win @@ -19,8 +19,9 @@ # # Contributor(s): -DEPTH=..\..\.. +DEPTH=..\.. -DIRS=src +DIRS=public src \ + $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/content/shared/public/nsHTMLValue.h b/mozilla/content/shared/public/nsHTMLValue.h index 95a6eb21a28..1c7ed08306f 100644 --- a/mozilla/content/shared/public/nsHTMLValue.h +++ b/mozilla/content/shared/public/nsHTMLValue.h @@ -26,7 +26,6 @@ #include "nsColor.h" #include "nsString.h" #include "nsISupports.h" -#include "nsReadableUtils.h" enum nsHTMLUnit { eHTMLUnit_Null = 0, // (n/a) null unit, value is not specified @@ -46,39 +45,14 @@ enum nsHTMLUnit { class nsHTMLValue { public: - nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null) : mUnit(aUnit) - { - NS_ASSERTION((aUnit <= eHTMLUnit_Empty), "not a valueless unit"); - if (aUnit > eHTMLUnit_Empty) { - mUnit = eHTMLUnit_Null; - } - mValue.mString = nsnull; - } - + nsHTMLValue(nsHTMLUnit aUnit = eHTMLUnit_Null); nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit); nsHTMLValue(float aValue); - nsHTMLValue(const nsAReadableString& aValue, - nsHTMLUnit aUnit = eHTMLUnit_String) : mUnit(aUnit) - { - NS_ASSERTION((eHTMLUnit_String == aUnit) || - (eHTMLUnit_ColorName == aUnit), "not a string value"); - if ((eHTMLUnit_String == aUnit) || - (eHTMLUnit_ColorName == aUnit)) { - mValue.mString = ToNewUnicode(aValue); - } - else { - mUnit = eHTMLUnit_Null; - mValue.mInt = 0; - } - } - + nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit = eHTMLUnit_String); nsHTMLValue(nsISupports* aValue); nsHTMLValue(nscolor aValue); nsHTMLValue(const nsHTMLValue& aCopy); - ~nsHTMLValue(void) - { - Reset(); - } + ~nsHTMLValue(void); nsHTMLValue& operator=(const nsHTMLValue& aCopy); PRBool operator==(const nsHTMLValue& aOther) const; @@ -93,19 +67,7 @@ public: nsISupports* GetISupportsValue(void) const; nscolor GetColorValue(void) const; - void Reset(void) { - if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { - if (nsnull != mValue.mString) { - nsCRT::free(mValue.mString); - } - } - else if (eHTMLUnit_ISupports == mUnit) { - NS_IF_RELEASE(mValue.mISupports); - } - mUnit = eHTMLUnit_Null; - mValue.mString = nsnull; - } - + void Reset(void); void SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit); void SetPixelValue(PRInt32 aValue); void SetPercentValue(float aValue); diff --git a/mozilla/content/shared/public/nsStyleCoord.h b/mozilla/content/shared/public/nsStyleCoord.h index 067e0b3112c..bb97cd0a9cd 100644 --- a/mozilla/content/shared/public/nsStyleCoord.h +++ b/mozilla/content/shared/public/nsStyleCoord.h @@ -25,7 +25,7 @@ #include "nscore.h" #include "nsCoord.h" #include "nsCRT.h" -#include "nsString.h" +class nsString; enum nsStyleUnit { eStyleUnit_Null = 0, // (no value) value is not specified @@ -48,86 +48,15 @@ typedef union { class nsStyleCoord { public: - nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null) - : mUnit(aUnit) { - NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit"); - if (aUnit >= eStyleUnit_Percent) { - mUnit = eStyleUnit_Null; - } - mValue.mInt = 0; - } + nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null); + nsStyleCoord(nscoord aValue); + nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit); + nsStyleCoord(float aValue, nsStyleUnit aUnit); + nsStyleCoord(const nsStyleCoord& aCopy); - nsStyleCoord(nscoord aValue) - : mUnit(eStyleUnit_Coord) { - mValue.mInt = aValue; - } - - nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit) - : mUnit(aUnit) { - //if you want to pass in eStyleUnit_Coord, don't. instead, use the - //constructor just above this one... MMP - NS_ASSERTION((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Integer), "not an int value"); - if ((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Integer)) { - mValue.mInt = aValue; - } - else { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } - } - - nsStyleCoord(float aValue, nsStyleUnit aUnit) - : mUnit(aUnit) { - NS_ASSERTION((aUnit == eStyleUnit_Percent) || - (aUnit == eStyleUnit_Factor), "not a float value"); - if ((aUnit == eStyleUnit_Percent) || - (aUnit == eStyleUnit_Factor)) { - mValue.mFloat = aValue; - } - else { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } - } - - nsStyleCoord(const nsStyleCoord& aCopy) - : mUnit(aCopy.mUnit) { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } - } - - nsStyleCoord& operator=(const nsStyleCoord& aCopy) { - mUnit = aCopy.mUnit; - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } - return *this; - } - - PRBool operator==(const nsStyleCoord& aOther) const { - if (mUnit == aOther.mUnit) { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - return PRBool(mValue.mFloat == aOther.mValue.mFloat); - } - else { - return PRBool(mValue.mInt == aOther.mValue.mInt); - } - } - return PR_FALSE; - } - - PRBool operator!=(const nsStyleCoord& aOther) const; + nsStyleCoord& operator=(const nsStyleCoord& aCopy); + PRBool operator==(const nsStyleCoord& aOther) const; + PRBool operator!=(const nsStyleCoord& aOther) const; nsStyleUnit GetUnit(void) const { return mUnit; } nscoord GetCoordValue(void) const; @@ -136,98 +65,18 @@ public: float GetFactorValue(void) const; void GetUnionValue(nsStyleUnion& aValue) const; - void Reset(void) { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } + void Reset(void); // sets to null + void SetCoordValue(nscoord aValue); + void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit); + void SetPercentValue(float aValue); + void SetFactorValue(float aValue); + void SetNormalValue(void); + void SetAutoValue(void); + void SetInheritValue(void); + void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit); - void SetCoordValue(nscoord aValue) { - mUnit = eStyleUnit_Coord; - mValue.mInt = aValue; - } - - void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) { - if ((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Chars) || - (aUnit == eStyleUnit_Integer)) { - mUnit = aUnit; - mValue.mInt = aValue; - } - else { - NS_WARNING("not an int value"); - Reset(); - } - } - - void SetPercentValue(float aValue) { - mUnit = eStyleUnit_Percent; - mValue.mFloat = aValue; - } - - void SetFactorValue(float aValue) { - mUnit = eStyleUnit_Factor; - mValue.mFloat = aValue; - } - - void SetNormalValue(void) { - mUnit = eStyleUnit_Normal; - mValue.mInt = 0; - } - - void SetAutoValue(void) { - mUnit = eStyleUnit_Auto; - mValue.mInt = 0; - } - - void SetInheritValue(void) { - mUnit = eStyleUnit_Inherit; - mValue.mInt = 0; - } - - void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) { - mUnit = aUnit; -#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT - mValue.mInt = aValue.mInt; -#else - nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion)); -#endif - } - - void AppendToString(nsString& aBuffer) const { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - aBuffer.AppendFloat(mValue.mFloat); - } - else if ((eStyleUnit_Coord == mUnit) || - (eStyleUnit_Proportional == mUnit) || - (eStyleUnit_Enumerated == mUnit) || - (eStyleUnit_Integer == mUnit)) { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); - } - - switch (mUnit) { - case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break; - case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break; - case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break; - case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break; - case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break; - case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break; - case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break; - case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break; - case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break; - } - aBuffer.AppendWithConversion(' '); - } - - void ToString(nsString& aBuffer) const { - aBuffer.Truncate(); - AppendToString(aBuffer); - } + void AppendToString(nsString& aBuffer) const; + void ToString(nsString& aBuffer) const; public: nsStyleUnit mUnit; @@ -235,38 +84,12 @@ public: }; -#define COMPARE_SIDE(side) \ - if ((eStyleUnit_Percent <= m##side##Unit) && \ - (m##side##Unit < eStyleUnit_Coord)) { \ - if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \ - return PR_FALSE; \ - } \ - else { \ - if (m##side##Value.mInt != aOther.m##side##Value.mInt) \ - return PR_FALSE; \ - } - class nsStyleSides { public: - nsStyleSides(void) { - nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); - } + nsStyleSides(void); // nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version - PRBool operator==(const nsStyleSides& aOther) const { - if ((mLeftUnit == aOther.mLeftUnit) && - (mTopUnit == aOther.mTopUnit) && - (mRightUnit == aOther.mRightUnit) && - (mBottomUnit == aOther.mBottomUnit)) { - COMPARE_SIDE(Left); - COMPARE_SIDE(Top); - COMPARE_SIDE(Right); - COMPARE_SIDE(Bottom); - return PR_TRUE; - } - return PR_FALSE; - } - + PRBool operator==(const nsStyleSides& aOther) const; PRBool operator!=(const nsStyleSides& aOther) const; nsStyleUnit GetLeftUnit(void) const; @@ -279,39 +102,14 @@ public: nsStyleCoord& GetRight(nsStyleCoord& aCoord) const; nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const; - void Reset(void) { - nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); - } - + void Reset(void); void SetLeft(const nsStyleCoord& aCoord); void SetTop(const nsStyleCoord& aCoord); void SetRight(const nsStyleCoord& aCoord); void SetBottom(const nsStyleCoord& aCoord); - void AppendToString(nsString& aBuffer) const { - nsStyleCoord temp; - - GetLeft(temp); - aBuffer.AppendWithConversion("left: "); - temp.AppendToString(aBuffer); - - GetTop(temp); - aBuffer.AppendWithConversion("top: "); - temp.AppendToString(aBuffer); - - GetRight(temp); - aBuffer.AppendWithConversion("right: "); - temp.AppendToString(aBuffer); - - GetBottom(temp); - aBuffer.AppendWithConversion("bottom: "); - temp.AppendToString(aBuffer); - } - - void ToString(nsString& aBuffer) const { - aBuffer.Truncate(); - AppendToString(aBuffer); - } + void AppendToString(nsString& aBuffer) const; + void ToString(nsString& aBuffer) const; protected: PRUint8 mLeftUnit; diff --git a/mozilla/content/shared/public/nsTextFragment.h b/mozilla/content/shared/public/nsTextFragment.h index 5c3e7bea3a0..52ccecd4763 100644 --- a/mozilla/content/shared/public/nsTextFragment.h +++ b/mozilla/content/shared/public/nsTextFragment.h @@ -24,9 +24,7 @@ #include "nslayout.h" #include "nsAWritableString.h" -#include "nsCRT.h" -#include "nsString.h" -#include "nsMemory.h" +class nsString; // XXX should this normalize the code to keep a \u0000 at the end? @@ -67,9 +65,7 @@ public: mAllBits = 0; } - ~nsTextFragment() { - ReleaseText(); - } + ~nsTextFragment(); /** * Initialize the contents of this fragment to be a copy of @@ -87,10 +83,7 @@ public: * Initialize the contents of this fragment to be a copy of * the argument ucs2 string. */ - nsTextFragment(const PRUnichar* aString) : m1b(nsnull), mAllBits(0) { - SetTo(aString, nsCRT::strlen(aString)); - } - + nsTextFragment(const PRUnichar* aString); /** * Initialize the contents of this fragment to be a copy of @@ -184,55 +177,7 @@ public: * buffer. Like operator= except a length is specified instead of * assuming 0 termination. */ - void SetTo(const PRUnichar* aBuffer, PRInt32 aLength) { - ReleaseText(); - if (0 != aLength) { - // See if we need to store the data in ucs2 or not - PRBool need2 = PR_FALSE; - const PRUnichar* ucp = aBuffer; - const PRUnichar* uend = aBuffer + aLength; - while (ucp < uend) { - PRUnichar ch = *ucp++; - if (ch >> 8) { - need2 = PR_TRUE; - break; - } - } - - if (need2) { - // Use ucs2 storage because we have to - PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar)); - if (nsnull != nt) { - // Copy data - nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength); - - // Setup our fields - m2b = nt; - mState.mIs2b = 1; - mState.mInHeap = 1; - mState.mLength = aLength; - } - } - else { - // Use 1 byte storage because we can - unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); - if (nsnull != nt) { - // Copy data - unsigned char* cp = nt; - unsigned char* end = nt + aLength; - while (cp < end) { - *cp++ = (unsigned char) *aBuffer++; - } - - // Setup our fields - m1b = nt; - mState.mIs2b = 0; - mState.mInHeap = 1; - mState.mLength = aLength; - } - } - } - } + void SetTo(const PRUnichar* aBuffer, PRInt32 aLength); /** * Change the contents of this fragment to be a copy of the given @@ -244,14 +189,7 @@ public: /** * Append the contents of this string fragment to aString */ - void AppendTo(nsString& aString) const { - if (mState.mIs2b) { - aString.Append(m2b, mState.mLength); - } - else { - aString.AppendWithConversion((char*)m1b, mState.mLength); - } - } + void AppendTo(nsString& aString) const; /** * Make a copy of the fragments contents starting at offset for @@ -297,20 +235,7 @@ protected: FragmentBits mState; }; - void ReleaseText() { - if (mState.mLength && m1b && mState.mInHeap) { - if (mState.mIs2b) { - nsMemory::Free(m2b); - } - else { - nsMemory::Free(m1b); - } - } - m1b = nsnull; - mState.mIs2b = 0; - mState.mInHeap = 0; - mState.mLength = 0; - } + void ReleaseText(); }; #endif /* nsTextFragment_h___ */ diff --git a/mozilla/layout/xul/content/src/Makefile.in b/mozilla/content/shared/src/Makefile.in similarity index 77% rename from mozilla/layout/xul/content/src/Makefile.in rename to mozilla/content/shared/src/Makefile.in index 544a0e1dc39..5d286d5f090 100644 --- a/mozilla/layout/xul/content/src/Makefile.in +++ b/mozilla/content/shared/src/Makefile.in @@ -19,7 +19,7 @@ # Contributor(s): # -DEPTH = ../../../.. +DEPTH = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ @@ -27,10 +27,21 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = layout -LIBRARY_NAME = gkxulcon_s +LIBRARY_NAME = gkconshared_s REQUIRES = xpcom string -CPPSRCS = nsXULAtoms.cpp +CPPSRCS = \ + nsCSSAtoms.cpp \ + nsCSSKeywords.cpp \ + nsCSSProps.cpp \ + nsHTMLAtoms.cpp \ + nsHTMLValue.cpp \ + nsLayoutAtoms.cpp \ + nsStyleUtil.cpp \ + nsTextFragment.cpp \ + nsXULAtoms.cpp \ + nsStyleCoord.cpp \ + $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. override NO_SHARED_LIB=1 @@ -38,8 +49,4 @@ override NO_STATIC_LIB= include $(topsrcdir)/config/rules.mk -DEFINES += -D_IMPL_NS_HTML - -INCLUDES += \ - $(NULL) - +DEFINES += -D_IMPL_NS_LAYOUT diff --git a/mozilla/content/html/base/src/makefile.win b/mozilla/content/shared/src/makefile.win similarity index 61% rename from mozilla/content/html/base/src/makefile.win rename to mozilla/content/shared/src/makefile.win index ce9989fd0ce..e7dff3e6dc0 100644 --- a/mozilla/content/html/base/src/makefile.win +++ b/mozilla/content/shared/src/makefile.win @@ -19,34 +19,41 @@ # # Contributor(s): -DEPTH=..\..\..\.. +DEPTH=..\..\.. -LIBRARY_NAME=contenthtmlbase_s -MODULE=raptor -DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN +LIBRARY_NAME=contentshared_s +DEFINES=-D_IMPL_NS_LAYOUT -DWIN32_LEAN_AND_MEAN !if defined(XP_NEW_SELECTION) DEFINES = $(DEFINES) -DXP_NEW_SELECTION !endif -CPPSRCS= \ - nsHTMLAtoms.cpp \ +CPPSRCS = \ + nsCSSAtoms.cpp \ + nsCSSKeywords.cpp \ + nsCSSProps.cpp \ + nsHTMLAtoms.cpp \ + nsHTMLValue.cpp \ + nsLayoutAtoms.cpp \ + nsStyleUtil.cpp \ + nsTextFragment.cpp \ + nsXULAtoms.cpp \ + nsStyleCoord.cpp \ $(NULL) -CPP_OBJS= \ - .\$(OBJDIR)\nsHTMLAtoms.obj \ - $(NULL) +MODULE=raptor -LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \ - -I$(PUBLIC)\dom -I$(PUBLIC)\netlib -I$(PUBLIC)\unicharutil \ - -I..\..\style\src \ - -I..\..\forms\src \ - -I..\..\..\base\src -I$(PUBLIC)\plugin -I$(PUBLIC)\java \ - -I$(PUBLIC)\pref \ - -I$(PUBLIC)\lwbrk \ - -I$(PUBLIC)\unicharutil \ - -I$(PUBLIC)\oji \ - -I..\..\..\xul\content\src \ - -I..\..\..\xul\base\src \ +CPP_OBJS= \ + .\$(OBJDIR)\nsCSSAtoms.obj \ + .\$(OBJDIR)\nsCSSKeywords.obj \ + .\$(OBJDIR)\nsCSSProps.obj \ + .\$(OBJDIR)\nsHTMLAtoms.obj \ + .\$(OBJDIR)\nsHTMLValue.obj \ + .\$(OBJDIR)\nsLayoutAtoms.obj \ + .\$(OBJDIR)\nsStyleUtil.obj \ + .\$(OBJDIR)\nsTextFragment.obj \ + .\$(OBJDIR)\nsXULAtoms.obj \ + .\$(OBJDIR)\StyleCoord.obj \ + $(NULL) LCFLAGS = \ $(LCFLAGS) \ @@ -60,3 +67,4 @@ install:: $(LIBRARY) clobber:: rm -f $(DIST)\lib\$(LIBRARY_NAME).lib + rm -f $(PDBFILE).pdb diff --git a/mozilla/content/shared/src/nsHTMLValue.cpp b/mozilla/content/shared/src/nsHTMLValue.cpp index ec0cdc4749d..6e7c540d03c 100644 --- a/mozilla/content/shared/src/nsHTMLValue.cpp +++ b/mozilla/content/shared/src/nsHTMLValue.cpp @@ -22,9 +22,20 @@ #include "nsHTMLValue.h" #include "nsString.h" +#include "nsReadableUtils.h" #include "nsCRT.h" #include "nsISizeOfHandler.h" +nsHTMLValue::nsHTMLValue(nsHTMLUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION((aUnit <= eHTMLUnit_Empty), "not a valueless unit"); + if (aUnit > eHTMLUnit_Empty) { + mUnit = eHTMLUnit_Null; + } + mValue.mString = nsnull; +} + nsHTMLValue::nsHTMLValue(PRInt32 aValue, nsHTMLUnit aUnit) : mUnit(aUnit) { @@ -50,6 +61,21 @@ nsHTMLValue::nsHTMLValue(float aValue) mValue.mFloat = aValue; } +nsHTMLValue::nsHTMLValue(const nsAReadableString& aValue, nsHTMLUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION((eHTMLUnit_String == aUnit) || + (eHTMLUnit_ColorName == aUnit), "not a string value"); + if ((eHTMLUnit_String == aUnit) || + (eHTMLUnit_ColorName == aUnit)) { + mValue.mString = ToNewUnicode(aValue); + } + else { + mUnit = eHTMLUnit_Null; + mValue.mInt = 0; + } +} + nsHTMLValue::nsHTMLValue(nsISupports* aValue) : mUnit(eHTMLUnit_ISupports) { @@ -89,6 +115,11 @@ nsHTMLValue::nsHTMLValue(const nsHTMLValue& aCopy) } } +nsHTMLValue::~nsHTMLValue(void) +{ + Reset(); +} + nsHTMLValue& nsHTMLValue::operator=(const nsHTMLValue& aCopy) { Reset(); @@ -153,6 +184,21 @@ PRUint32 nsHTMLValue::HashValue(void) const } +void nsHTMLValue::Reset(void) +{ + if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { + if (nsnull != mValue.mString) { + nsCRT::free(mValue.mString); + } + } + else if (eHTMLUnit_ISupports == mUnit) { + NS_IF_RELEASE(mValue.mISupports); + } + mUnit = eHTMLUnit_Null; + mValue.mString = nsnull; +} + + void nsHTMLValue::SetIntValue(PRInt32 aValue, nsHTMLUnit aUnit) { Reset(); diff --git a/mozilla/content/shared/src/nsStyleCoord.cpp b/mozilla/content/shared/src/nsStyleCoord.cpp new file mode 100644 index 00000000000..7d5263e5ab5 --- /dev/null +++ b/mozilla/content/shared/src/nsStyleCoord.cpp @@ -0,0 +1,284 @@ +/* -*- 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.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/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "nsStyleCoord.h" +#include "nsString.h" +#include "nsCRT.h" + +nsStyleCoord::nsStyleCoord(nsStyleUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit"); + if (aUnit >= eStyleUnit_Percent) { + mUnit = eStyleUnit_Null; + } + mValue.mInt = 0; +} + +nsStyleCoord::nsStyleCoord(nscoord aValue) + : mUnit(eStyleUnit_Coord) +{ + mValue.mInt = aValue; +} + +nsStyleCoord::nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit) + : mUnit(aUnit) +{ + //if you want to pass in eStyleUnit_Coord, don't. instead, use the + //constructor just above this one... MMP + NS_ASSERTION((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Integer), "not an int value"); + if ((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Integer)) { + mValue.mInt = aValue; + } + else { + mUnit = eStyleUnit_Null; + mValue.mInt = 0; + } +} + +nsStyleCoord::nsStyleCoord(float aValue, nsStyleUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION((aUnit == eStyleUnit_Percent) || + (aUnit == eStyleUnit_Factor), "not a float value"); + if ((aUnit == eStyleUnit_Percent) || + (aUnit == eStyleUnit_Factor)) { + mValue.mFloat = aValue; + } + else { + mUnit = eStyleUnit_Null; + mValue.mInt = 0; + } +} + +nsStyleCoord::nsStyleCoord(const nsStyleCoord& aCopy) + : mUnit(aCopy.mUnit) +{ + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + mValue.mFloat = aCopy.mValue.mFloat; + } + else { + mValue.mInt = aCopy.mValue.mInt; + } +} + +nsStyleCoord& nsStyleCoord::operator=(const nsStyleCoord& aCopy) +{ + mUnit = aCopy.mUnit; + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + mValue.mFloat = aCopy.mValue.mFloat; + } + else { + mValue.mInt = aCopy.mValue.mInt; + } + return *this; +} + +PRBool nsStyleCoord::operator==(const nsStyleCoord& aOther) const +{ + if (mUnit == aOther.mUnit) { + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + return PRBool(mValue.mFloat == aOther.mValue.mFloat); + } + else { + return PRBool(mValue.mInt == aOther.mValue.mInt); + } + } + return PR_FALSE; +} + +void nsStyleCoord::Reset(void) +{ + mUnit = eStyleUnit_Null; + mValue.mInt = 0; +} + +void nsStyleCoord::SetCoordValue(nscoord aValue) +{ + mUnit = eStyleUnit_Coord; + mValue.mInt = aValue; +} + +void nsStyleCoord::SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) +{ + NS_ASSERTION((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Chars) || + (aUnit == eStyleUnit_Integer), "not an int value"); + if ((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Chars) || + (aUnit == eStyleUnit_Integer)) { + mUnit = aUnit; + mValue.mInt = aValue; + } + else { + Reset(); + } +} + +void nsStyleCoord::SetPercentValue(float aValue) +{ + mUnit = eStyleUnit_Percent; + mValue.mFloat = aValue; +} + +void nsStyleCoord::SetFactorValue(float aValue) +{ + mUnit = eStyleUnit_Factor; + mValue.mFloat = aValue; +} + +void nsStyleCoord::SetNormalValue(void) +{ + mUnit = eStyleUnit_Normal; + mValue.mInt = 0; +} + +void nsStyleCoord::SetAutoValue(void) +{ + mUnit = eStyleUnit_Auto; + mValue.mInt = 0; +} + +void nsStyleCoord::SetInheritValue(void) +{ + mUnit = eStyleUnit_Inherit; + mValue.mInt = 0; +} + +void nsStyleCoord::SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) +{ + mUnit = aUnit; +#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT + mValue.mInt = aValue.mInt; +#else + nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion)); +#endif +} + +void nsStyleCoord::AppendToString(nsString& aBuffer) const +{ + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + aBuffer.AppendFloat(mValue.mFloat); + } + else if ((eStyleUnit_Coord == mUnit) || + (eStyleUnit_Proportional == mUnit) || + (eStyleUnit_Enumerated == mUnit) || + (eStyleUnit_Integer == mUnit)) { + aBuffer.AppendInt(mValue.mInt, 10); + aBuffer.AppendWithConversion("[0x"); + aBuffer.AppendInt(mValue.mInt, 16); + aBuffer.AppendWithConversion(']'); + } + + switch (mUnit) { + case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break; + case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break; + case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break; + case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break; + case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break; + case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break; + case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break; + case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break; + case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; + case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break; + case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break; + } + aBuffer.AppendWithConversion(' '); +} + +void nsStyleCoord::ToString(nsString& aBuffer) const +{ + aBuffer.Truncate(); + AppendToString(aBuffer); +} + + + + +nsStyleSides::nsStyleSides(void) +{ + nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); +} + +#define COMPARE_SIDE(side) \ + if ((eStyleUnit_Percent <= m##side##Unit) && (m##side##Unit < eStyleUnit_Coord)) { \ + if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \ + return PR_FALSE; \ + } \ + else { \ + if (m##side##Value.mInt != aOther.m##side##Value.mInt) \ + return PR_FALSE; \ + } + +PRBool nsStyleSides::operator==(const nsStyleSides& aOther) const +{ + if ((mLeftUnit == aOther.mLeftUnit) && + (mTopUnit == aOther.mTopUnit) && + (mRightUnit == aOther.mRightUnit) && + (mBottomUnit == aOther.mBottomUnit)) { + COMPARE_SIDE(Left); + COMPARE_SIDE(Top); + COMPARE_SIDE(Right); + COMPARE_SIDE(Bottom); + return PR_TRUE; + } + return PR_FALSE; +} + +void nsStyleSides::Reset(void) +{ + nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); +} + +void nsStyleSides::AppendToString(nsString& aBuffer) const +{ + nsStyleCoord temp; + + GetLeft(temp); + aBuffer.AppendWithConversion("left: "); + temp.AppendToString(aBuffer); + + GetTop(temp); + aBuffer.AppendWithConversion("top: "); + temp.AppendToString(aBuffer); + + GetRight(temp); + aBuffer.AppendWithConversion("right: "); + temp.AppendToString(aBuffer); + + GetBottom(temp); + aBuffer.AppendWithConversion("bottom: "); + temp.AppendToString(aBuffer); +} + +void nsStyleSides::ToString(nsString& aBuffer) const +{ + aBuffer.Truncate(); + AppendToString(aBuffer); +} + diff --git a/mozilla/content/shared/src/nsTextFragment.cpp b/mozilla/content/shared/src/nsTextFragment.cpp index 6400a43e619..fad38cd3065 100644 --- a/mozilla/content/shared/src/nsTextFragment.cpp +++ b/mozilla/content/shared/src/nsTextFragment.cpp @@ -20,7 +20,32 @@ * Contributor(s): */ #include "nsTextFragment.h" +#include "nsString.h" +#include "nsCRT.h" #include "nsReadableUtils.h" +#include "nsMemory.h" + +nsTextFragment::~nsTextFragment() +{ + ReleaseText(); +} + +void +nsTextFragment::ReleaseText() +{ + if (mState.mLength && m1b && mState.mInHeap) { + if (mState.mIs2b) { + nsMemory::Free(m2b); + } + else { + nsMemory::Free(m1b); + } + } + m1b = nsnull; + mState.mIs2b = 0; + mState.mInHeap = 0; + mState.mLength = 0; +} nsTextFragment::nsTextFragment(const nsTextFragment& aOther) : m1b(nsnull), @@ -41,6 +66,13 @@ nsTextFragment::nsTextFragment(const char* aString) SetTo(aString, strlen(aString)); } +nsTextFragment::nsTextFragment(const PRUnichar* aString) + : m1b(nsnull), + mAllBits(0) +{ + SetTo(aString, nsCRT::strlen(aString)); +} + nsTextFragment::nsTextFragment(const nsString& aString) : m1b(nsnull), mAllBits(0) @@ -107,6 +139,58 @@ nsTextFragment::SetTo(PRUnichar* aBuffer, PRInt32 aLength, PRBool aRelease) mState.mLength = aLength; } +void +nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength) +{ + ReleaseText(); + if (0 != aLength) { + // See if we need to store the data in ucs2 or not + PRBool need2 = PR_FALSE; + const PRUnichar* ucp = aBuffer; + const PRUnichar* uend = aBuffer + aLength; + while (ucp < uend) { + PRUnichar ch = *ucp++; + if (ch >> 8) { + need2 = PR_TRUE; + break; + } + } + + if (need2) { + // Use ucs2 storage because we have to + PRUnichar* nt = (PRUnichar*)nsMemory::Alloc(aLength*sizeof(PRUnichar)); + if (nsnull != nt) { + // Copy data + nsCRT::memcpy(nt, aBuffer, sizeof(PRUnichar) * aLength); + + // Setup our fields + m2b = nt; + mState.mIs2b = 1; + mState.mInHeap = 1; + mState.mLength = aLength; + } + } + else { + // Use 1 byte storage because we can + unsigned char* nt = (unsigned char*)nsMemory::Alloc(aLength*sizeof(unsigned char)); + if (nsnull != nt) { + // Copy data + unsigned char* cp = nt; + unsigned char* end = nt + aLength; + while (cp < end) { + *cp++ = (unsigned char) *aBuffer++; + } + + // Setup our fields + m1b = nt; + mState.mIs2b = 0; + mState.mInHeap = 1; + mState.mLength = aLength; + } + } + } +} + void nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength) { @@ -124,6 +208,17 @@ nsTextFragment::SetTo(const char* aBuffer, PRInt32 aLength) } } +void +nsTextFragment::AppendTo(nsString& aString) const +{ + if (mState.mIs2b) { + aString.Append(m2b, mState.mLength); + } + else { + aString.AppendWithConversion((char*)m1b, mState.mLength); + } +} + void nsTextFragment::CopyTo(PRUnichar* aDest, PRInt32 aOffset, PRInt32 aCount) { diff --git a/mozilla/content/xul/content/src/Makefile.in b/mozilla/content/xul/content/src/Makefile.in index 34304a5f5e9..e69519adf2f 100644 --- a/mozilla/content/xul/content/src/Makefile.in +++ b/mozilla/content/xul/content/src/Makefile.in @@ -33,7 +33,6 @@ REQUIRES = xpcom string widget htmlparser necko dom webshell js caps rdf xpconne CPPSRCS = \ nsAnonymousElement.cpp \ nsRDFDOMNodeList.cpp \ - nsXULAtoms.cpp \ nsXULAttributeValue.cpp \ nsXULAttributes.cpp \ nsXULElement.cpp \ diff --git a/mozilla/content/xul/content/src/makefile.win b/mozilla/content/xul/content/src/makefile.win index 214acf1e16f..5c3d9c23cac 100644 --- a/mozilla/content/xul/content/src/makefile.win +++ b/mozilla/content/xul/content/src/makefile.win @@ -29,7 +29,6 @@ DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN CPPSRCS= \ nsAnonymousElement.cpp \ nsRDFDOMNodeList.cpp \ - nsXULAtoms.cpp \ nsXULAttributeValue.cpp \ nsXULAttributes.cpp \ nsXULElement.cpp \ @@ -40,7 +39,6 @@ CPPSRCS= \ CPP_OBJS= \ .\$(OBJDIR)\nsAnonymousElement.obj \ .\$(OBJDIR)\nsRDFDOMNodeList.obj \ - .\$(OBJDIR)\nsXULAtoms.obj \ .\$(OBJDIR)\nsXULAttributeValue.obj \ .\$(OBJDIR)\nsXULAttributes.obj \ .\$(OBJDIR)\nsXULElement.obj \ diff --git a/mozilla/content/xul/content/src/nsXULAtomList.h b/mozilla/content/xul/content/src/nsXULAtomList.h deleted file mode 100644 index 3bc9a9e78e6..00000000000 --- a/mozilla/content/xul/content/src/nsXULAtomList.h +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: David W. Hyatt (hyatt@netscape.com) - * - * Contributor(s): - */ - -/****** - - This file contains the list of all XUL nsIAtoms and their values - - It is designed to be used as inline input to nsXULAtoms.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro XUL_ATOM which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - The first argument to XUL_ATOM is the C++ identifier of the atom - The second argument is the string value of the atom - - ******/ - - -XUL_ATOM(button, "button") -XUL_ATOM(spinner, "spinner") -XUL_ATOM(scrollbar, "scrollbar") -XUL_ATOM(slider, "slider") -XUL_ATOM(palettename, "palettename") -XUL_ATOM(fontpicker, "fontpicker") -XUL_ATOM(text, "text") -XUL_ATOM(toolbar, "toolbar") -XUL_ATOM(toolbaritem, "toolbaritem") -XUL_ATOM(toolbox, "toolbox") -XUL_ATOM(image, "image") - - // The tree atoms -XUL_ATOM(tree, "tree") // The start of a tree view -XUL_ATOM(treecaption, "treecaption") // The caption of a tree view -XUL_ATOM(treehead, "treehead") // The header of the tree view -XUL_ATOM(treerow, "treerow") // A row in the tree view -XUL_ATOM(treerows, "treerows") // A row in the tree view -XUL_ATOM(treecell, "treecell") // An item in the tree view -XUL_ATOM(treeitem, "treeitem") // A cell in the tree view -XUL_ATOM(treechildren, "treechildren") // The children of an item in the tree view -XUL_ATOM(treeindentation, "treeindentation") // Specifies that the indentation for the level should occur here. -XUL_ATOM(allowevents, "allowevents") // Lets events be handled on the cell contents or in menus. -XUL_ATOM(treecol, "treecol") // A column in the tree view -XUL_ATOM(treecolgroup, "treecolgroup") // A column group in the tree view -XUL_ATOM(treecols, "treecols") // A column group in the tree view -XUL_ATOM(treefoot, "treefoot") // The footer of the tree view -XUL_ATOM(scrollbarlist, "scrollbarlist") // An atom for internal use by the tree view -XUL_ATOM(indent, "indent") // indicates that a cell should be indented -XUL_ATOM(outer, "outer") // indicates that a treechildren is the outermost rowgroup -XUL_ATOM(sizemode, "sizemode") // when set, measure strings to determine preferred width - -XUL_ATOM(open, "open") // Whether or not a menu, tree, etc. is open - -XUL_ATOM(outliner, "outliner") -XUL_ATOM(outlinerbody, "outlinerbody") -XUL_ATOM(outlinercol, "outlinercol") -XUL_ATOM(cycler, "cycler") -XUL_ATOM(primary, "primary") -XUL_ATOM(current, "current") -XUL_ATOM(mozoutlinerrow, ":-moz-outliner-row") -XUL_ATOM(mozoutlinercell, ":-moz-outliner-cell") -XUL_ATOM(mozoutlinercolumn, ":-moz-outliner-column") -XUL_ATOM(mozoutlinercelltext, ":-moz-outliner-cell-text") -XUL_ATOM(mozoutlinertwisty, ":-moz-outliner-twisty") -XUL_ATOM(mozoutlinerindentation, ":-moz-outliner-indentation") - -XUL_ATOM(menubar, "menubar") // An XP menu bar. -XUL_ATOM(menu, "menu") // Represents an XP menu -XUL_ATOM(menuitem, "menuitem") // Represents an XP menu item -XUL_ATOM(menupopup, "menupopup") // The XP menu's children. -XUL_ATOM(menutobedisplayed, "menutobedisplayed") // The menu is about to be displayed at the next sync w/ frame -XUL_ATOM(menuactive, "menuactive") // Whether or not a menu is active (without necessarily being open) -XUL_ATOM(accesskey, "accesskey") // The shortcut key for a menu or menu item -XUL_ATOM(acceltext, "acceltext") // Text to use for the accelerator -XUL_ATOM(popupset, "popupset") // Contains popup menus, context menus, and tooltips -XUL_ATOM(popup, "popup") // The popup for a context menu, popup menu, or tooltip -XUL_ATOM(menugenerated, "menugenerated") // Internal -XUL_ATOM(popupanchor, "popupanchor") // Anchor for popups -XUL_ATOM(popupalign, "popupalign") // Alignment for popups -XUL_ATOM(ignorekeys, "ignorekeys") // Alignment for popups -XUL_ATOM(sizetopopup, "sizetopopup") // Whether or not menus size to their popup children (used by menulists) - -XUL_ATOM(key, "key") // The key element / attribute -XUL_ATOM(keycode, "keycode") // The keycode attribute -XUL_ATOM(keytext, "keytext") // The keytext attribute -XUL_ATOM(modifiers, "modifiers") // The modifiers attribute -XUL_ATOM(broadcaster, "broadcaster") // A broadcaster -XUL_ATOM(observes, "observes") // The observes element -XUL_ATOM(templateAtom, "template") // A XUL template - -XUL_ATOM(progressbar, "progressbar") -XUL_ATOM(progresstext, "progresstext") -XUL_ATOM(crop, "crop") - -XUL_ATOM(mode, "mode") -XUL_ATOM(equalsize, "equalsize") -XUL_ATOM(box, "box") -XUL_ATOM(hbox, "hbox") -XUL_ATOM(vbox, "vbox") -XUL_ATOM(scrollbox, "scrollbox") -XUL_ATOM(mousethrough, "mousethrough") -XUL_ATOM(flex, "flex") -XUL_ATOM(spring, "spring") -XUL_ATOM(orient, "orient") -XUL_ATOM(autostretch, "autostretch") -XUL_ATOM(minwidth, "min-width") -XUL_ATOM(minheight, "min-height") - -XUL_ATOM(autorepeatbutton, "autorepeatbutton") - -XUL_ATOM(bulletinboard, "bulletinboard") - -XUL_ATOM(titledbox, "titledbox") -XUL_ATOM(title, "title") -XUL_ATOM(titledboxContentPseudo, ":titledbox-content") - -XUL_ATOM(stack, "stack") -XUL_ATOM(deck, "deck") -XUL_ATOM(tabcontrol, "tabcontrol") -XUL_ATOM(tab, "tab") -XUL_ATOM(tabpanel, "tabpanel") -XUL_ATOM(tabpage, "tabpage") -XUL_ATOM(tabbox, "tabbox") -XUL_ATOM(index, "index") -XUL_ATOM(maxpos, "maxpos") -XUL_ATOM(curpos, "curpos") -XUL_ATOM(scrollbarbutton, "scrollbarbutton") -XUL_ATOM(increment, "increment") -XUL_ATOM(pageincrement, "pageincrement") -XUL_ATOM(thumb, "thumb") -XUL_ATOM(toggled, "toggled") -XUL_ATOM(grippy, "grippy") -XUL_ATOM(splitter, "splitter") -XUL_ATOM(collapse, "collapse") -XUL_ATOM(collapsed, "collapsed") -XUL_ATOM(resizebefore, "resizebefore") -XUL_ATOM(resizeafter, "resizeafter") -XUL_ATOM(state, "state") -XUL_ATOM(debug, "debug") - -XUL_ATOM(fixed, "fixed") - -// grid -XUL_ATOM(grid, "grid") -XUL_ATOM(rows, "rows") -XUL_ATOM(columns, "columns") -XUL_ATOM(row, "row") -XUL_ATOM(column, "column") - -// toolbar & toolbar d&d atoms -XUL_ATOM(ddDropLocation, "dd-droplocation") -XUL_ATOM(ddDropLocationCoord, "dd-droplocationcoord") -XUL_ATOM(ddDropOn, "dd-dropon") -XUL_ATOM(ddTriggerRepaintSorted, "dd-triggerrepaintsorted") -XUL_ATOM(ddTriggerRepaintRestore, "dd-triggerrepaintrestore") -XUL_ATOM(ddTriggerRepaint, "dd-triggerrepaint") -XUL_ATOM(ddNoDropBetweenRows, "dd-nodropbetweenrows") -XUL_ATOM(container, "container") -XUL_ATOM(ddDragDropArea, "dragdroparea") -XUL_ATOM(ddDropMarker, ":-moz-drop-marker") - -XUL_ATOM(widget, "widget") -XUL_ATOM(window, "window") - -XUL_ATOM(iframe, "iframe") -XUL_ATOM(browser, "browser") -XUL_ATOM(editor, "editor") - -// - -XUL_ATOM(checkbox, "checkbox") -XUL_ATOM(radio, "radio") -XUL_ATOM(radiogroup, "radiogroup") -XUL_ATOM(menulist, "menulist") -XUL_ATOM(menubutton, "menubutton") -XUL_ATOM(textfield, "textfield") -XUL_ATOM(textarea, "textarea") -XUL_ATOM(listbox, "listbox") -XUL_ATOM(tooltip, "tooltip") -XUL_ATOM(context, "context") -XUL_ATOM(style, "style") -XUL_ATOM(selected, "selected") -XUL_ATOM(clazz, "class") -XUL_ATOM(id, "id") -XUL_ATOM(persist, "persist") -XUL_ATOM(ref, "ref") -XUL_ATOM(command, "command") -XUL_ATOM(value, "value") -XUL_ATOM(width, "width") -XUL_ATOM(height, "height") -XUL_ATOM(left, "left") -XUL_ATOM(top, "top") -XUL_ATOM(events, "events") -XUL_ATOM(targets, "targets") -XUL_ATOM(uri, "uri") -XUL_ATOM(empty, "empty") -XUL_ATOM(textnode, "textnode") -XUL_ATOM(rule, "rule") -XUL_ATOM(action, "action") -XUL_ATOM(containment, "containment") -XUL_ATOM(flags, "flags") -XUL_ATOM(Template, "template") -XUL_ATOM(member, "member") -XUL_ATOM(conditions, "conditions") -XUL_ATOM(property, "property") -XUL_ATOM(instanceOf, "instanceOf") -XUL_ATOM(xulcontentsgenerated, "xulcontentsgenerated") -XUL_ATOM(parent, "parent") -XUL_ATOM(iscontainer, "iscontainer") -XUL_ATOM(isempty, "isempty") -XUL_ATOM(bindings, "bindings") -XUL_ATOM(binding, "binding") -XUL_ATOM(triple, "triple") -XUL_ATOM(subject, "subject") -XUL_ATOM(predicate, "predicate") -XUL_ATOM(child, "child") -XUL_ATOM(object, "object") -XUL_ATOM(tag, "tag") -XUL_ATOM(content, "content") - -XUL_ATOM(blankrow, "blankrow") -XUL_ATOM(titlebar, "titlebar") -XUL_ATOM(resizer, "resizer") -XUL_ATOM(dir, "dir") - diff --git a/mozilla/content/xul/content/src/nsXULAtoms.cpp b/mozilla/content/xul/content/src/nsXULAtoms.cpp deleted file mode 100644 index 653e4f1f20c..00000000000 --- a/mozilla/content/xul/content/src/nsXULAtoms.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: David W. Hyatt (hyatt@netscape.com) - * - * Contributor(s): - */ - -#include "nsString.h" -#include "nsINameSpaceManager.h" -#include "nsXULAtoms.h" - -static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - -PRInt32 nsXULAtoms::nameSpaceID; - -// define storage for all atoms -#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name; -#include "nsXULAtomList.h" -#undef XUL_ATOM - - -static nsrefcnt gRefCnt = 0; -static nsINameSpaceManager* gNameSpaceManager; - -void nsXULAtoms::AddRefAtoms() { - - if (gRefCnt == 0) { - /* XUL Atoms registers the XUL name space ID because it's a convenient - place to do this, if you don't want a permanent, "well-known" ID. - */ - if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) { -// gNameSpaceManager->CreateRootNameSpace(namespace); - nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace); - gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID); - } else { - NS_ASSERTION(0, "failed to create xul atoms namespace manager"); - } - - // now register the atoms -#define XUL_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsXULAtomList.h" -#undef XUL_ATOM - } - ++gRefCnt; -} - -void nsXULAtoms::ReleaseAtoms() { - - NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms"); - if (--gRefCnt == 0) { -#define XUL_ATOM(_name, _value) NS_RELEASE(_name); -#include "nsXULAtomList.h" -#undef XUL_ATOM - - NS_IF_RELEASE(gNameSpaceManager); - } -} diff --git a/mozilla/content/xul/content/src/nsXULAtoms.h b/mozilla/content/xul/content/src/nsXULAtoms.h deleted file mode 100644 index 93b2b7d53e9..00000000000 --- a/mozilla/content/xul/content/src/nsXULAtoms.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: David W. Hyatt (hyatt@netscape.com) - * - * Contributor(s): - */ -#ifndef nsXULAtoms_h___ -#define nsXULAtoms_h___ - -#include "prtypes.h" -#include "nsIAtom.h" - -class nsINameSpaceManager; - -/** - * This class wraps up the creation and destruction of the standard - * set of xul atoms used during normal xul handling. This object - * is created when the first xul content object is created, and - * destroyed when the last such content object is destroyed. - */ -class nsXULAtoms { -public: - - static void AddRefAtoms(); - static void ReleaseAtoms(); - - // XUL namespace ID, good for the life of the nsXULAtoms object - static PRInt32 nameSpaceID; - - /* Declare all atoms - - The atom names and values are stored in nsCSSAtomList.h and - are brought to you by the magic of C preprocessing - - Add new atoms to nsCSSAtomList and all support logic will be auto-generated - */ -#define XUL_ATOM(_name, _value) static nsIAtom* _name; -#include "nsXULAtomList.h" -#undef XUL_ATOM - -}; - -#endif /* nsXULAtoms_h___ */ diff --git a/mozilla/layout/base/nsLayoutUtils.cpp b/mozilla/layout/base/nsLayoutUtils.cpp deleted file mode 100644 index 4f887d3e464..00000000000 --- a/mozilla/layout/base/nsLayoutUtils.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU Public License (the "GPL"), in which case the - * provisions of the GPL are applicable instead of those above. - * If you wish to allow use of your version of this file only - * under the terms of the GPL and not to allow others to use your - * version of this file under the NPL, indicate your decision by - * deleting the provisions above and replace them with the notice - * and other provisions required by the GPL. If you do not delete - * the provisions above, a recipient may use your version of this - * file under either the NPL or the GPL. - */ - -/* A namespace class for static layout utilities. */ - -#include "jsapi.h" -#include "nsCOMPtr.h" -#include "nsIScriptGlobalObject.h" -#include "nsIScriptContext.h" -#include "nsLayoutUtils.h" - -// static -nsresult -nsLayoutUtils::GetStaticScriptGlobal(JSContext* aContext, - JSObject* aObj, - nsIScriptGlobalObject** aNativeGlobal) -{ - nsISupports* supports; - JSClass* clazz; - JSObject* parent; - JSObject* glob = aObj; // starting point for search - - if (!glob) - return NS_ERROR_FAILURE; - - while (nsnull != (parent = JS_GetParent(aContext, glob))) - glob = parent; - -#ifdef JS_THREADSAFE - clazz = JS_GetClass(aContext, glob); -#else - clazz = JS_GetClass(glob); -#endif - - if (!clazz || - !(clazz->flags & JSCLASS_HAS_PRIVATE) || - !(clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) || - !(supports = (nsISupports*) JS_GetPrivate(aContext, glob))) { - return NS_ERROR_FAILURE; - } - - return supports->QueryInterface(NS_GET_IID(nsIScriptGlobalObject), - (void**) aNativeGlobal); -} - -//static -nsresult -nsLayoutUtils::GetStaticScriptContext(JSContext* aContext, - JSObject* aObj, - nsIScriptContext** aScriptContext) -{ - nsCOMPtr nativeGlobal; - GetStaticScriptGlobal(aContext, aObj, getter_AddRefs(nativeGlobal)); - if (!nativeGlobal) - return NS_ERROR_FAILURE; - nsIScriptContext* scriptContext = nsnull; - nativeGlobal->GetContext(&scriptContext); - *aScriptContext = scriptContext; - return scriptContext ? NS_OK : NS_ERROR_FAILURE; -} - -//static -nsresult -nsLayoutUtils::GetDynamicScriptGlobal(JSContext* aContext, - nsIScriptGlobalObject** aNativeGlobal) -{ - nsIScriptGlobalObject* nativeGlobal = nsnull; - nsCOMPtr scriptCX; - GetDynamicScriptContext(aContext, getter_AddRefs(scriptCX)); - if (scriptCX) { - *aNativeGlobal = nativeGlobal = scriptCX->GetGlobalObject(); - } - return nativeGlobal ? NS_OK : NS_ERROR_FAILURE; -} - -//static -nsresult -nsLayoutUtils::GetDynamicScriptContext(JSContext *aContext, - nsIScriptContext** aScriptContext) -{ - // XXX We rely on the rule that if any JSContext in our JSRuntime has a - // private set then that private *must* be a pointer to an nsISupports. - nsISupports *supports = (nsIScriptContext*) JS_GetContextPrivate(aContext); - if (!supports) - return nsnull; - return supports->QueryInterface(NS_GET_IID(nsIScriptContext), - (void**)aScriptContext); -} - -template -struct NormalizeNewlinesCharTraits { - public: - typedef typename OutputIterator::value_type value_type; - - public: - NormalizeNewlinesCharTraits(OutputIterator& aIterator) : mIterator(aIterator) { } - void writechar(typename OutputIterator::value_type aChar) { - *mIterator++ = aChar; - } - - private: - OutputIterator mIterator; -}; - -#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION - -template -struct NormalizeNewlinesCharTraits { - public: - typedef CharT value_type; - - public: - NormalizeNewlinesCharTraits(CharT* aCharPtr) : mCharPtr(aCharPtr) { } - void writechar(CharT aChar) { - *mCharPtr++ = aChar; - } - - private: - CharT* mCharPtr; -}; - -#else - -NS_SPECIALIZE_TEMPLATE -struct NormalizeNewlinesCharTraits { - public: - typedef char value_type; - - public: - NormalizeNewlinesCharTraits(char* aCharPtr) : mCharPtr(aCharPtr) { } - void writechar(char aChar) { - *mCharPtr++ = aChar; - } - - private: - char* mCharPtr; -}; - -NS_SPECIALIZE_TEMPLATE -struct NormalizeNewlinesCharTraits { - public: - typedef PRUnichar value_type; - - public: - NormalizeNewlinesCharTraits(PRUnichar* aCharPtr) : mCharPtr(aCharPtr) { } - void writechar(PRUnichar aChar) { - *mCharPtr++ = aChar; - } - - private: - PRUnichar* mCharPtr; -}; - -#endif - -template -class CopyNormalizeNewlines -{ - public: - typedef typename OutputIterator::value_type value_type; - - public: - CopyNormalizeNewlines(OutputIterator* aDestination) : - mLastCharCR(PR_FALSE), - mDestination(aDestination), - mWritten(0) - { } - - PRUint32 GetCharsWritten() { - return mWritten; - } - - PRUint32 write(const typename OutputIterator::value_type* aSource, PRUint32 aSourceLength) { - // If the last source buffer ended with a CR... - if (mLastCharCR) { - // ..and if the next one is a LF, then skip it since - // we've already written out a newline - if (aSourceLength && (*aSource == value_type('\n'))) { - aSource++; - } - mLastCharCR = PR_FALSE; - } - - const typename OutputIterator::value_type* done_writing = aSource + aSourceLength; - PRUint32 num_written = 0; - while ( aSource < done_writing ) { - if (*aSource == value_type('\r')) { - mDestination->writechar('\n'); - aSource++; - // If we've reached the end of the buffer, record - // that we wrote out a CR - if (aSource == done_writing) { - mLastCharCR = PR_TRUE; - } - // If the next character is a LF, skip it - else if (*aSource == value_type('\n')) { - aSource++; - } - } - else { - mDestination->writechar(*aSource++); - } - num_written++; - } - - mWritten += num_written; - return aSourceLength; - } - - private: - PRBool mLastCharCR; - OutputIterator* mDestination; - PRUint32 mWritten; -}; - -// static -PRUint32 -nsLayoutUtils::CopyNewlineNormalizedUnicodeTo(const nsAReadableString& aSource, PRUint32 aSrcOffset, PRUnichar* aDest, PRUint32 aLength) -{ - typedef NormalizeNewlinesCharTraits sink_traits; - - sink_traits dest_traits(aDest); - CopyNormalizeNewlines normalizer(&dest_traits); - nsReadingIterator fromBegin, fromEnd; - copy_string(aSource.BeginReading(fromBegin).advance( PRInt32(aSrcOffset) ), aSource.BeginReading(fromEnd).advance( PRInt32(aSrcOffset+aLength) ), normalizer); - return normalizer.GetCharsWritten(); -} - -// static -PRUint32 -nsLayoutUtils::CopyNewlineNormalizedUnicodeTo(nsReadingIterator& aSrcStart, const nsReadingIterator& aSrcEnd, nsAWritableString& aDest) -{ - typedef nsWritingIterator WritingIterator; - typedef NormalizeNewlinesCharTraits sink_traits; - - WritingIterator iter; - aDest.BeginWriting(iter); - sink_traits dest_traits(iter); - CopyNormalizeNewlines normalizer(&dest_traits); - copy_string(aSrcStart, aSrcEnd, normalizer); - return normalizer.GetCharsWritten(); -} diff --git a/mozilla/layout/base/nsLayoutUtils.h b/mozilla/layout/base/nsLayoutUtils.h deleted file mode 100644 index ab140c9a6b4..00000000000 --- a/mozilla/layout/base/nsLayoutUtils.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU Public License (the "GPL"), in which case the - * provisions of the GPL are applicable instead of those above. - * If you wish to allow use of your version of this file only - * under the terms of the GPL and not to allow others to use your - * version of this file under the NPL, indicate your decision by - * deleting the provisions above and replace them with the notice - * and other provisions required by the GPL. If you do not delete - * the provisions above, a recipient may use your version of this - * file under either the NPL or the GPL. - */ - -/* A namespace class for static layout utilities. */ - -#ifndef nsLayoutUtils_h___ -#define nsLayoutUtils_h___ - -#include "nslayout.h" -#include "jspubtd.h" -#include "nsAReadableString.h" - -class nsIScriptContext; -class nsIScriptGlobalObject; - -class nsLayoutUtils -{ -public: - - // These are copied from nsJSUtils.h - - static nsresult GetStaticScriptGlobal(JSContext* aContext, - JSObject* aObj, - nsIScriptGlobalObject** aNativeGlobal); - - static nsresult GetStaticScriptContext(JSContext* aContext, - JSObject* aObj, - nsIScriptContext** aScriptContext); - - static nsresult GetDynamicScriptGlobal(JSContext *aContext, - nsIScriptGlobalObject** aNativeGlobal); - - static nsresult GetDynamicScriptContext(JSContext *aContext, - nsIScriptContext** aScriptContext); - - static PRUint32 CopyNewlineNormalizedUnicodeTo(const nsAReadableString& aSource, - PRUint32 aSrcOffset, - PRUnichar* aDest, - PRUint32 aLength); - - static PRUint32 CopyNewlineNormalizedUnicodeTo(nsReadingIterator& aSrcStart, const nsReadingIterator& aSrcEnd, nsAWritableString& aDest); -}; - -#endif /* nsLayoutUtils_h___ */ diff --git a/mozilla/layout/base/public/MANIFEST b/mozilla/layout/base/public/MANIFEST index 24637cfa840..3c4655a4f8f 100644 --- a/mozilla/layout/base/public/MANIFEST +++ b/mozilla/layout/base/public/MANIFEST @@ -31,12 +31,8 @@ nsIStatefulFrame.h nsIStyleContext.h nsIStyleSet.h nslayout.h -nsLayoutAtomList.h -nsLayoutAtoms.h -nsLayoutUtils.h nsStyleChangeList.h nsStyleConsts.h -nsStyleCoord.h nsIStyleFrameConstruction.h nsStyleStruct.h nsIFrameTraversal.h diff --git a/mozilla/layout/base/public/Makefile.in b/mozilla/layout/base/public/Makefile.in index 84d0ca0471b..41041b0fa4e 100644 --- a/mozilla/layout/base/public/Makefile.in +++ b/mozilla/layout/base/public/Makefile.in @@ -58,14 +58,10 @@ nsIStyleContext.h \ nsIMutableStyleContext.h \ nsIStyleFrameConstruction.h \ nsIStyleSet.h \ -nsLayoutAtoms.h \ -nsLayoutAtomList.h \ -nsLayoutUtils.h \ nsFrameList.h \ nsFrameTraversal.h \ nsStyleChangeList.h \ nsStyleConsts.h \ -nsStyleCoord.h \ nsStyleStruct.h \ nsILayoutHistoryState.h \ nsIStatefulFrame.h \ diff --git a/mozilla/layout/base/public/makefile.win b/mozilla/layout/base/public/makefile.win index 948610c8e54..23b826ff129 100644 --- a/mozilla/layout/base/public/makefile.win +++ b/mozilla/layout/base/public/makefile.win @@ -49,14 +49,10 @@ EXPORTS = \ nsIMutableStyleContext.h \ nsIStyleFrameConstruction.h \ nsIStyleSet.h \ - nsLayoutAtoms.h \ - nsLayoutAtomList.h \ - nsLayoutUtils.h \ nsFrameList.h \ nsFrameTraversal.h \ nsStyleChangeList.h \ nsStyleConsts.h \ - nsStyleCoord.h \ nsStyleStruct.h \ nsILayoutHistoryState.h \ nsIStatefulFrame.h \ diff --git a/mozilla/layout/base/public/nsLayoutAtomList.h b/mozilla/layout/base/public/nsLayoutAtomList.h deleted file mode 100644 index 8f943f3893c..00000000000 --- a/mozilla/layout/base/public/nsLayoutAtomList.h +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all layout nsIAtoms and their values - - It is designed to be used as inline input to nsLayoutAtoms.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro LAYOUT_ATOM which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - The first argument to LAYOUT_ATOM is the C++ identifier of the atom - The second argument is the string value of the atom - - ******/ - - - // Alphabetical list of media type atoms -LAYOUT_ATOM(all, "all") // Media atoms must be lower case -LAYOUT_ATOM(aural, "aural") -LAYOUT_ATOM(braille, "braille") -LAYOUT_ATOM(embossed, "embossed") -LAYOUT_ATOM(handheld, "handheld") -LAYOUT_ATOM(print, "print") -LAYOUT_ATOM(projection, "projection") -LAYOUT_ATOM(screen, "screen") -LAYOUT_ATOM(tty, "tty") -LAYOUT_ATOM(tv, "tv") - - // Alphabetical list of standard name space prefixes -LAYOUT_ATOM(htmlNameSpace, "html") -LAYOUT_ATOM(xmlNameSpace, "xml") -LAYOUT_ATOM(xmlnsNameSpace, "xmlns") - - // Alphabetical list of frame additional child list names -LAYOUT_ATOM(absoluteList, "Absolute-list") -LAYOUT_ATOM(bulletList, "Bullet-list") -LAYOUT_ATOM(captionList, "Caption-list") -LAYOUT_ATOM(colGroupList, "ColGroup-list") -LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List") -LAYOUT_ATOM(fixedList, "Fixed-list") -LAYOUT_ATOM(floaterList, "Floater-list") -LAYOUT_ATOM(overflowList, "Overflow-list") -LAYOUT_ATOM(popupList, "Popup-list") - - // Alphabetical list of pseudo tag names for non-element content -LAYOUT_ATOM(canvasPseudo, ":canvas") -LAYOUT_ATOM(commentTagName, "__moz_comment") -LAYOUT_ATOM(dummyOptionPseudo, ":-moz-dummy-option") -LAYOUT_ATOM(optionSelectedPseudo, "-moz-option-selected") -LAYOUT_ATOM(textTagName, "__moz_text") -LAYOUT_ATOM(pagePseudo, ":-moz-page") -LAYOUT_ATOM(pageSequencePseudo, ":-moz-page-sequence") -LAYOUT_ATOM(processingInstructionTagName, "__moz_pi") -LAYOUT_ATOM(scrolledContentPseudo, ":scrolled-content") -LAYOUT_ATOM(viewportPseudo, ":viewport") -LAYOUT_ATOM(viewportScrollPseudo, ":viewport-scroll") -LAYOUT_ATOM(selectScrolledContentPseudo, ":-moz-select-scrolled-content") - - // Alphabetical list of frame types -LAYOUT_ATOM(areaFrame, "AreaFrame") -LAYOUT_ATOM(blockFrame, "BlockFrame") -LAYOUT_ATOM(brFrame, "BRFrame") -LAYOUT_ATOM(bulletFrame, "BulletFrame") -LAYOUT_ATOM(hrFrame, "HRFrame") -LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame") -LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame") -LAYOUT_ATOM(imageFrame, "ImageFrame") -LAYOUT_ATOM(inlineFrame, "InlineFrame") -LAYOUT_ATOM(letterFrame, "LetterFrame") -LAYOUT_ATOM(lineFrame, "LineFrame") -LAYOUT_ATOM(objectFrame, "ObjectFrame") -LAYOUT_ATOM(pageFrame, "PageFrame") -LAYOUT_ATOM(placeholderFrame, "PlaceholderFrame") -LAYOUT_ATOM(positionedInlineFrame, "PositionedInlineFrame") -LAYOUT_ATOM(canvasFrame, "CanvasFrame") -LAYOUT_ATOM(rootFrame, "RootFrame") -LAYOUT_ATOM(scrollFrame, "ScrollFrame") -LAYOUT_ATOM(tableCaptionFrame, "TableCaptionFrame") -LAYOUT_ATOM(tableCellFrame, "TableCellFrame") -LAYOUT_ATOM(tableColFrame, "TableColFrame") -LAYOUT_ATOM(tableColGroupFrame, "TableColGroupFrame") -LAYOUT_ATOM(tableFrame, "TableFrame") -LAYOUT_ATOM(tableOuterFrame, "TableOuterFrame") -LAYOUT_ATOM(tableRowGroupFrame, "TableRowGroupFrame") -LAYOUT_ATOM(tableRowFrame, "TableRowFrame") -LAYOUT_ATOM(textInputFrame,"TextInputFrame") -LAYOUT_ATOM(textFrame, "TextFrame") -LAYOUT_ATOM(viewportFrame, "ViewportFrame") - - // Alphabetical list of frame property names -LAYOUT_ATOM(collapseOffsetProperty, "CollapseOffsetProperty") // nsPoint* -LAYOUT_ATOM(inlineFrameAnnotation, "InlineFrameAnnotation") // BOOL -LAYOUT_ATOM(maxElementSizeProperty, "MaxElementSizeProperty") // nsSize* -LAYOUT_ATOM(overflowAreaProperty, "OverflowArea") // nsRect* -LAYOUT_ATOM(overflowProperty, "OverflowProperty") // list of nsIFrame* -LAYOUT_ATOM(overflowLinesProperty, "OverflowLinesProperty") // list of nsLineBox* -LAYOUT_ATOM(spaceManagerProperty, "SpaceManagerProperty") // the space manager for a block -LAYOUT_ATOM(viewProperty, "ViewProperty") // nsView* - - // Alphabetical list of event handler names -LAYOUT_ATOM(onabort, "onabort") -LAYOUT_ATOM(onblur, "onblur") -LAYOUT_ATOM(onbroadcast, "onbroadcast") -LAYOUT_ATOM(onchange, "onchange") -LAYOUT_ATOM(onclick, "onclick") -LAYOUT_ATOM(onclose, "onclose") -LAYOUT_ATOM(oncommand, "oncommand") -LAYOUT_ATOM(oncommandupdate, "oncommandupdate") -LAYOUT_ATOM(oncreate, "oncreate") -LAYOUT_ATOM(ondblclick, "ondblclick") -LAYOUT_ATOM(ondestroy, "ondestroy") -LAYOUT_ATOM(ondragdrop, "ondragdrop") -LAYOUT_ATOM(ondragenter, "ondragenter") -LAYOUT_ATOM(ondragexit, "ondragexit") -LAYOUT_ATOM(ondraggesture, "ondraggesture") -LAYOUT_ATOM(ondragover, "ondragover") -LAYOUT_ATOM(onerror, "onerror") -LAYOUT_ATOM(onfocus, "onfocus") -LAYOUT_ATOM(oninput, "oninput") -LAYOUT_ATOM(onkeydown, "onkeydown") -LAYOUT_ATOM(onkeypress, "onkeypress") -LAYOUT_ATOM(onkeyup, "onkeyup") -LAYOUT_ATOM(onload, "onload") -LAYOUT_ATOM(onmousedown, "onmousedown") -LAYOUT_ATOM(onmousemove, "onmousemove") -LAYOUT_ATOM(onmouseover, "onmouseover") -LAYOUT_ATOM(onmouseout, "onmouseout") -LAYOUT_ATOM(onmouseup, "onmouseup") -LAYOUT_ATOM(onpaint, "onpaint") -LAYOUT_ATOM(onreset, "onreset") -LAYOUT_ATOM(onresize, "onresize") -LAYOUT_ATOM(onscroll, "onscroll") -LAYOUT_ATOM(onselect, "onselect") -LAYOUT_ATOM(onsubmit, "onsubmit") -LAYOUT_ATOM(onunload, "onunload") - -// scrolling -LAYOUT_ATOM(onoverflow, "onoverflow") -LAYOUT_ATOM(onunderflow, "onunderflow") -LAYOUT_ATOM(onoverflowchanged, "onoverflowchanged") - -// mutation events -LAYOUT_ATOM(onDOMSubtreeModified, "onDOMSubtreeModified") -LAYOUT_ATOM(onDOMNodeInserted, "onDOMNodeInserted") -LAYOUT_ATOM(onDOMNodeRemoved, "onDOMNodeRemoved") -LAYOUT_ATOM(onDOMNodeRemovedFromDocument, "onDOMNodeRemovedFromDocument") -LAYOUT_ATOM(onDOMNodeInsertedIntoDocument, "onDOMNodeInsertedIntoDocument") -LAYOUT_ATOM(onDOMAttrModified, "onDOMAttrModified") -LAYOUT_ATOM(onDOMCharacterDataModified, "onDOMCharacterDataModified") - - // Alphabetical list of languages for lang-specific transforms -LAYOUT_ATOM(Japanese, "ja") -LAYOUT_ATOM(Korean, "ko") - - // other -LAYOUT_ATOM(wildcard, "*") -LAYOUT_ATOM(mozdirty, "_moz_dirty") - -#ifdef DEBUG - // Alphabetical list of atoms used by debugging code -LAYOUT_ATOM(cellMap, "TableCellMap") -LAYOUT_ATOM(imageMap, "ImageMap") -LAYOUT_ATOM(lineBoxBig, "LineBox:inline,big") -LAYOUT_ATOM(lineBoxBlockBig, "LineBox:block,big") -LAYOUT_ATOM(lineBoxBlockSmall, "LineBox:block,small") -LAYOUT_ATOM(lineBoxFloaters, "LineBoxFloaters") -LAYOUT_ATOM(lineBoxSmall, "LineBox:inline,small") -LAYOUT_ATOM(spaceManager, "SpaceManager") -LAYOUT_ATOM(tableColCache, "TableColumnCache") -LAYOUT_ATOM(tableStrategy, "TableLayoutStrategy") -LAYOUT_ATOM(textRun, "TextRun") -LAYOUT_ATOM(xml_document_entities, "XMLDocumentEntities") -LAYOUT_ATOM(xml_document_notations, "XMLDocumentNotations") -#endif diff --git a/mozilla/layout/base/public/nsLayoutAtoms.h b/mozilla/layout/base/public/nsLayoutAtoms.h deleted file mode 100644 index 9a3b8981c88..00000000000 --- a/mozilla/layout/base/public/nsLayoutAtoms.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsLayoutAtoms_h___ -#define nsLayoutAtoms_h___ - -#include "nsIAtom.h" - -/** - * This class wraps up the creation (and destruction) of the standard - * set of atoms used during layout processing. These objects - * are created when the first presentation context is created and they - * are destroyed when the last presentation context object is destroyed. - */ - -class nsLayoutAtoms { -public: - - static void AddRefAtoms(); - static void ReleaseAtoms(); - - /* Declare all atoms - - The atom names and values are stored in nsLayoutAtomList.h and - are brought to you by the magic of C preprocessing - - Add new atoms to nsLayoutAtomList and all support logic will be auto-generated - */ -#define LAYOUT_ATOM(_name, _value) static nsIAtom* _name; -#include "nsLayoutAtomList.h" -#undef LAYOUT_ATOM -}; - -#endif /* nsLayoutAtoms_h___ */ diff --git a/mozilla/layout/base/public/nsLayoutUtils.h b/mozilla/layout/base/public/nsLayoutUtils.h deleted file mode 100644 index ab140c9a6b4..00000000000 --- a/mozilla/layout/base/public/nsLayoutUtils.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU Public License (the "GPL"), in which case the - * provisions of the GPL are applicable instead of those above. - * If you wish to allow use of your version of this file only - * under the terms of the GPL and not to allow others to use your - * version of this file under the NPL, indicate your decision by - * deleting the provisions above and replace them with the notice - * and other provisions required by the GPL. If you do not delete - * the provisions above, a recipient may use your version of this - * file under either the NPL or the GPL. - */ - -/* A namespace class for static layout utilities. */ - -#ifndef nsLayoutUtils_h___ -#define nsLayoutUtils_h___ - -#include "nslayout.h" -#include "jspubtd.h" -#include "nsAReadableString.h" - -class nsIScriptContext; -class nsIScriptGlobalObject; - -class nsLayoutUtils -{ -public: - - // These are copied from nsJSUtils.h - - static nsresult GetStaticScriptGlobal(JSContext* aContext, - JSObject* aObj, - nsIScriptGlobalObject** aNativeGlobal); - - static nsresult GetStaticScriptContext(JSContext* aContext, - JSObject* aObj, - nsIScriptContext** aScriptContext); - - static nsresult GetDynamicScriptGlobal(JSContext *aContext, - nsIScriptGlobalObject** aNativeGlobal); - - static nsresult GetDynamicScriptContext(JSContext *aContext, - nsIScriptContext** aScriptContext); - - static PRUint32 CopyNewlineNormalizedUnicodeTo(const nsAReadableString& aSource, - PRUint32 aSrcOffset, - PRUnichar* aDest, - PRUint32 aLength); - - static PRUint32 CopyNewlineNormalizedUnicodeTo(nsReadingIterator& aSrcStart, const nsReadingIterator& aSrcEnd, nsAWritableString& aDest); -}; - -#endif /* nsLayoutUtils_h___ */ diff --git a/mozilla/layout/base/public/nsStyleCoord.h b/mozilla/layout/base/public/nsStyleCoord.h deleted file mode 100644 index 067e0b3112c..00000000000 --- a/mozilla/layout/base/public/nsStyleCoord.h +++ /dev/null @@ -1,458 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsStyleCoord_h___ -#define nsStyleCoord_h___ - -#include "nscore.h" -#include "nsCoord.h" -#include "nsCRT.h" -#include "nsString.h" - -enum nsStyleUnit { - eStyleUnit_Null = 0, // (no value) value is not specified - eStyleUnit_Normal = 1, // (no value) - eStyleUnit_Auto = 2, // (no value) - eStyleUnit_Inherit = 3, // (no value) value should be inherited - eStyleUnit_Percent = 10, // (float) 1.0 == 100% - eStyleUnit_Factor = 11, // (float) a multiplier - eStyleUnit_Coord = 20, // (nscoord) value is twips - eStyleUnit_Integer = 30, // (int) value is simple integer - eStyleUnit_Proportional = 31, // (int) value has proportional meaning - eStyleUnit_Enumerated = 32, // (int) value has enumerated meaning - eStyleUnit_Chars = 33 // (int) value is number of characters -}; - -typedef union { - PRInt32 mInt; // nscoord is a PRInt32 for now - float mFloat; -} nsStyleUnion; - -class nsStyleCoord { -public: - nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null) - : mUnit(aUnit) { - NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit"); - if (aUnit >= eStyleUnit_Percent) { - mUnit = eStyleUnit_Null; - } - mValue.mInt = 0; - } - - nsStyleCoord(nscoord aValue) - : mUnit(eStyleUnit_Coord) { - mValue.mInt = aValue; - } - - nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit) - : mUnit(aUnit) { - //if you want to pass in eStyleUnit_Coord, don't. instead, use the - //constructor just above this one... MMP - NS_ASSERTION((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Integer), "not an int value"); - if ((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Integer)) { - mValue.mInt = aValue; - } - else { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } - } - - nsStyleCoord(float aValue, nsStyleUnit aUnit) - : mUnit(aUnit) { - NS_ASSERTION((aUnit == eStyleUnit_Percent) || - (aUnit == eStyleUnit_Factor), "not a float value"); - if ((aUnit == eStyleUnit_Percent) || - (aUnit == eStyleUnit_Factor)) { - mValue.mFloat = aValue; - } - else { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } - } - - nsStyleCoord(const nsStyleCoord& aCopy) - : mUnit(aCopy.mUnit) { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } - } - - nsStyleCoord& operator=(const nsStyleCoord& aCopy) { - mUnit = aCopy.mUnit; - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } - return *this; - } - - PRBool operator==(const nsStyleCoord& aOther) const { - if (mUnit == aOther.mUnit) { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - return PRBool(mValue.mFloat == aOther.mValue.mFloat); - } - else { - return PRBool(mValue.mInt == aOther.mValue.mInt); - } - } - return PR_FALSE; - } - - PRBool operator!=(const nsStyleCoord& aOther) const; - - nsStyleUnit GetUnit(void) const { return mUnit; } - nscoord GetCoordValue(void) const; - PRInt32 GetIntValue(void) const; - float GetPercentValue(void) const; - float GetFactorValue(void) const; - void GetUnionValue(nsStyleUnion& aValue) const; - - void Reset(void) { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } - - void SetCoordValue(nscoord aValue) { - mUnit = eStyleUnit_Coord; - mValue.mInt = aValue; - } - - void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) { - if ((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Chars) || - (aUnit == eStyleUnit_Integer)) { - mUnit = aUnit; - mValue.mInt = aValue; - } - else { - NS_WARNING("not an int value"); - Reset(); - } - } - - void SetPercentValue(float aValue) { - mUnit = eStyleUnit_Percent; - mValue.mFloat = aValue; - } - - void SetFactorValue(float aValue) { - mUnit = eStyleUnit_Factor; - mValue.mFloat = aValue; - } - - void SetNormalValue(void) { - mUnit = eStyleUnit_Normal; - mValue.mInt = 0; - } - - void SetAutoValue(void) { - mUnit = eStyleUnit_Auto; - mValue.mInt = 0; - } - - void SetInheritValue(void) { - mUnit = eStyleUnit_Inherit; - mValue.mInt = 0; - } - - void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) { - mUnit = aUnit; -#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT - mValue.mInt = aValue.mInt; -#else - nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion)); -#endif - } - - void AppendToString(nsString& aBuffer) const { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - aBuffer.AppendFloat(mValue.mFloat); - } - else if ((eStyleUnit_Coord == mUnit) || - (eStyleUnit_Proportional == mUnit) || - (eStyleUnit_Enumerated == mUnit) || - (eStyleUnit_Integer == mUnit)) { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); - } - - switch (mUnit) { - case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break; - case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break; - case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break; - case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break; - case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break; - case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break; - case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break; - case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break; - case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break; - } - aBuffer.AppendWithConversion(' '); - } - - void ToString(nsString& aBuffer) const { - aBuffer.Truncate(); - AppendToString(aBuffer); - } - -public: - nsStyleUnit mUnit; - nsStyleUnion mValue; -}; - - -#define COMPARE_SIDE(side) \ - if ((eStyleUnit_Percent <= m##side##Unit) && \ - (m##side##Unit < eStyleUnit_Coord)) { \ - if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \ - return PR_FALSE; \ - } \ - else { \ - if (m##side##Value.mInt != aOther.m##side##Value.mInt) \ - return PR_FALSE; \ - } - -class nsStyleSides { -public: - nsStyleSides(void) { - nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); - } - -// nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version - PRBool operator==(const nsStyleSides& aOther) const { - if ((mLeftUnit == aOther.mLeftUnit) && - (mTopUnit == aOther.mTopUnit) && - (mRightUnit == aOther.mRightUnit) && - (mBottomUnit == aOther.mBottomUnit)) { - COMPARE_SIDE(Left); - COMPARE_SIDE(Top); - COMPARE_SIDE(Right); - COMPARE_SIDE(Bottom); - return PR_TRUE; - } - return PR_FALSE; - } - - PRBool operator!=(const nsStyleSides& aOther) const; - - nsStyleUnit GetLeftUnit(void) const; - nsStyleUnit GetTopUnit(void) const; - nsStyleUnit GetRightUnit(void) const; - nsStyleUnit GetBottomUnit(void) const; - - nsStyleCoord& GetLeft(nsStyleCoord& aCoord) const; - nsStyleCoord& GetTop(nsStyleCoord& aCoord) const; - nsStyleCoord& GetRight(nsStyleCoord& aCoord) const; - nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const; - - void Reset(void) { - nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); - } - - void SetLeft(const nsStyleCoord& aCoord); - void SetTop(const nsStyleCoord& aCoord); - void SetRight(const nsStyleCoord& aCoord); - void SetBottom(const nsStyleCoord& aCoord); - - void AppendToString(nsString& aBuffer) const { - nsStyleCoord temp; - - GetLeft(temp); - aBuffer.AppendWithConversion("left: "); - temp.AppendToString(aBuffer); - - GetTop(temp); - aBuffer.AppendWithConversion("top: "); - temp.AppendToString(aBuffer); - - GetRight(temp); - aBuffer.AppendWithConversion("right: "); - temp.AppendToString(aBuffer); - - GetBottom(temp); - aBuffer.AppendWithConversion("bottom: "); - temp.AppendToString(aBuffer); - } - - void ToString(nsString& aBuffer) const { - aBuffer.Truncate(); - AppendToString(aBuffer); - } - -protected: - PRUint8 mLeftUnit; - PRUint8 mTopUnit; - PRUint8 mRightUnit; - PRUint8 mBottomUnit; - nsStyleUnion mLeftValue; - nsStyleUnion mTopValue; - nsStyleUnion mRightValue; - nsStyleUnion mBottomValue; -}; - -// ------------------------- -// nsStyleCoord inlines -// -inline PRBool nsStyleCoord::operator!=(const nsStyleCoord& aOther) const -{ - return PRBool(! ((*this) == aOther)); -} - -inline PRInt32 nsStyleCoord::GetCoordValue(void) const -{ - NS_ASSERTION((mUnit == eStyleUnit_Coord), "not a coord value"); - if (mUnit == eStyleUnit_Coord) { - return mValue.mInt; - } - return 0; -} - -inline PRInt32 nsStyleCoord::GetIntValue(void) const -{ - NS_ASSERTION((mUnit == eStyleUnit_Proportional) || - (mUnit == eStyleUnit_Enumerated) || - (mUnit == eStyleUnit_Chars) || - (mUnit == eStyleUnit_Integer), "not an int value"); - if ((mUnit == eStyleUnit_Proportional) || - (mUnit == eStyleUnit_Enumerated) || - (mUnit == eStyleUnit_Chars) || - (mUnit == eStyleUnit_Integer)) { - return mValue.mInt; - } - return 0; -} - -inline float nsStyleCoord::GetPercentValue(void) const -{ - NS_ASSERTION(mUnit == eStyleUnit_Percent, "not a percent value"); - if (mUnit == eStyleUnit_Percent) { - return mValue.mFloat; - } - return 0.0f; -} - -inline float nsStyleCoord::GetFactorValue(void) const -{ - NS_ASSERTION(mUnit == eStyleUnit_Factor, "not a factor value"); - if (mUnit == eStyleUnit_Factor) { - return mValue.mFloat; - } - return 0.0f; -} - -inline void nsStyleCoord::GetUnionValue(nsStyleUnion& aValue) const -{ - nsCRT::memcpy(&aValue, &mValue, sizeof(nsStyleUnion)); -} - -// ------------------------- -// nsStyleSides inlines -// -inline PRBool nsStyleSides::operator!=(const nsStyleSides& aOther) const -{ - return PRBool(! ((*this) == aOther)); -} - -inline nsStyleUnit nsStyleSides::GetLeftUnit(void) const -{ - return (nsStyleUnit)mLeftUnit; -} - -inline nsStyleUnit nsStyleSides::GetTopUnit(void) const -{ - return (nsStyleUnit)mTopUnit; -} - -inline nsStyleUnit nsStyleSides::GetRightUnit(void) const -{ - return (nsStyleUnit)mRightUnit; -} - -inline nsStyleUnit nsStyleSides::GetBottomUnit(void) const -{ - return (nsStyleUnit)mBottomUnit; -} - -inline nsStyleCoord& nsStyleSides::GetLeft(nsStyleCoord& aCoord) const -{ - aCoord.SetUnionValue(mLeftValue, (nsStyleUnit)mLeftUnit); - return aCoord; -} - -inline nsStyleCoord& nsStyleSides::GetTop(nsStyleCoord& aCoord) const -{ - aCoord.SetUnionValue(mTopValue, (nsStyleUnit)mTopUnit); - return aCoord; -} - -inline nsStyleCoord& nsStyleSides::GetRight(nsStyleCoord& aCoord) const -{ - aCoord.SetUnionValue(mRightValue, (nsStyleUnit)mRightUnit); - return aCoord; -} - -inline nsStyleCoord& nsStyleSides::GetBottom(nsStyleCoord& aCoord) const -{ - aCoord.SetUnionValue(mBottomValue, (nsStyleUnit)mBottomUnit); - return aCoord; -} - -inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord) -{ - mLeftUnit = aCoord.GetUnit(); - aCoord.GetUnionValue(mLeftValue); -} - -inline void nsStyleSides::SetTop(const nsStyleCoord& aCoord) -{ - mTopUnit = aCoord.GetUnit(); - aCoord.GetUnionValue(mTopValue); -} - -inline void nsStyleSides::SetRight(const nsStyleCoord& aCoord) -{ - mRightUnit = aCoord.GetUnit(); - aCoord.GetUnionValue(mRightValue); -} - -inline void nsStyleSides::SetBottom(const nsStyleCoord& aCoord) -{ - mBottomUnit = aCoord.GetUnit(); - aCoord.GetUnionValue(mBottomValue); -} - -#endif /* nsStyleCoord_h___ */ diff --git a/mozilla/layout/base/src/Makefile.in b/mozilla/layout/base/src/Makefile.in index 2e91df743d5..950ea1156b3 100644 --- a/mozilla/layout/base/src/Makefile.in +++ b/mozilla/layout/base/src/Makefile.in @@ -39,9 +39,7 @@ CPPSRCS = \ nsFrameTraversal.cpp \ nsFrameUtil.cpp \ nsGalleyContext.cpp \ - nsLayoutAtoms.cpp \ nsLayoutDebugger.cpp \ - nsLayoutUtils.cpp \ nsPresContext.cpp \ nsPresState.cpp \ nsPrintContext.cpp \ diff --git a/mozilla/layout/base/src/makefile.win b/mozilla/layout/base/src/makefile.win index 581bd71371d..cb7b5ce3b20 100644 --- a/mozilla/layout/base/src/makefile.win +++ b/mozilla/layout/base/src/makefile.win @@ -41,9 +41,7 @@ CPPSRCS = \ nsPrintPreviewContext.cpp \ nsSpaceManager.cpp \ nsStyleChangeList.cpp \ - nsLayoutAtoms.cpp \ nsLayoutDebugger.cpp \ - nsLayoutUtils.cpp \ nsCaret.cpp \ nsLayoutHistoryState.cpp \ $(NULL) @@ -64,9 +62,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsPrintPreviewContext.obj \ .\$(OBJDIR)\nsSpaceManager.obj \ .\$(OBJDIR)\nsStyleChangeList.obj \ - .\$(OBJDIR)\nsLayoutAtoms.obj \ .\$(OBJDIR)\nsLayoutDebugger.obj \ - .\$(OBJDIR)\nsLayoutUtils.obj \ .\$(OBJDIR)\nsCaret.obj \ .\$(OBJDIR)\nsLayoutHistoryState.obj \ $(NULL) diff --git a/mozilla/layout/base/src/nsLayoutAtoms.cpp b/mozilla/layout/base/src/nsLayoutAtoms.cpp deleted file mode 100644 index 6eac0503eaf..00000000000 --- a/mozilla/layout/base/src/nsLayoutAtoms.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsLayoutAtoms.h" - -// define storage for all atoms -#define LAYOUT_ATOM(_name, _value) nsIAtom* nsLayoutAtoms::_name; -#include "nsLayoutAtomList.h" -#undef LAYOUT_ATOM - - -static nsrefcnt gRefCnt; - -void nsLayoutAtoms::AddRefAtoms() -{ - if (0 == gRefCnt++) { - // create atoms -#define LAYOUT_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsLayoutAtomList.h" -#undef LAYOUT_ATOM - } -} - -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 - } -} - diff --git a/mozilla/layout/base/src/nsLayoutUtils.cpp b/mozilla/layout/base/src/nsLayoutUtils.cpp deleted file mode 100644 index 4f887d3e464..00000000000 --- a/mozilla/layout/base/src/nsLayoutUtils.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU Public License (the "GPL"), in which case the - * provisions of the GPL are applicable instead of those above. - * If you wish to allow use of your version of this file only - * under the terms of the GPL and not to allow others to use your - * version of this file under the NPL, indicate your decision by - * deleting the provisions above and replace them with the notice - * and other provisions required by the GPL. If you do not delete - * the provisions above, a recipient may use your version of this - * file under either the NPL or the GPL. - */ - -/* A namespace class for static layout utilities. */ - -#include "jsapi.h" -#include "nsCOMPtr.h" -#include "nsIScriptGlobalObject.h" -#include "nsIScriptContext.h" -#include "nsLayoutUtils.h" - -// static -nsresult -nsLayoutUtils::GetStaticScriptGlobal(JSContext* aContext, - JSObject* aObj, - nsIScriptGlobalObject** aNativeGlobal) -{ - nsISupports* supports; - JSClass* clazz; - JSObject* parent; - JSObject* glob = aObj; // starting point for search - - if (!glob) - return NS_ERROR_FAILURE; - - while (nsnull != (parent = JS_GetParent(aContext, glob))) - glob = parent; - -#ifdef JS_THREADSAFE - clazz = JS_GetClass(aContext, glob); -#else - clazz = JS_GetClass(glob); -#endif - - if (!clazz || - !(clazz->flags & JSCLASS_HAS_PRIVATE) || - !(clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) || - !(supports = (nsISupports*) JS_GetPrivate(aContext, glob))) { - return NS_ERROR_FAILURE; - } - - return supports->QueryInterface(NS_GET_IID(nsIScriptGlobalObject), - (void**) aNativeGlobal); -} - -//static -nsresult -nsLayoutUtils::GetStaticScriptContext(JSContext* aContext, - JSObject* aObj, - nsIScriptContext** aScriptContext) -{ - nsCOMPtr nativeGlobal; - GetStaticScriptGlobal(aContext, aObj, getter_AddRefs(nativeGlobal)); - if (!nativeGlobal) - return NS_ERROR_FAILURE; - nsIScriptContext* scriptContext = nsnull; - nativeGlobal->GetContext(&scriptContext); - *aScriptContext = scriptContext; - return scriptContext ? NS_OK : NS_ERROR_FAILURE; -} - -//static -nsresult -nsLayoutUtils::GetDynamicScriptGlobal(JSContext* aContext, - nsIScriptGlobalObject** aNativeGlobal) -{ - nsIScriptGlobalObject* nativeGlobal = nsnull; - nsCOMPtr scriptCX; - GetDynamicScriptContext(aContext, getter_AddRefs(scriptCX)); - if (scriptCX) { - *aNativeGlobal = nativeGlobal = scriptCX->GetGlobalObject(); - } - return nativeGlobal ? NS_OK : NS_ERROR_FAILURE; -} - -//static -nsresult -nsLayoutUtils::GetDynamicScriptContext(JSContext *aContext, - nsIScriptContext** aScriptContext) -{ - // XXX We rely on the rule that if any JSContext in our JSRuntime has a - // private set then that private *must* be a pointer to an nsISupports. - nsISupports *supports = (nsIScriptContext*) JS_GetContextPrivate(aContext); - if (!supports) - return nsnull; - return supports->QueryInterface(NS_GET_IID(nsIScriptContext), - (void**)aScriptContext); -} - -template -struct NormalizeNewlinesCharTraits { - public: - typedef typename OutputIterator::value_type value_type; - - public: - NormalizeNewlinesCharTraits(OutputIterator& aIterator) : mIterator(aIterator) { } - void writechar(typename OutputIterator::value_type aChar) { - *mIterator++ = aChar; - } - - private: - OutputIterator mIterator; -}; - -#ifdef HAVE_CPP_PARTIAL_SPECIALIZATION - -template -struct NormalizeNewlinesCharTraits { - public: - typedef CharT value_type; - - public: - NormalizeNewlinesCharTraits(CharT* aCharPtr) : mCharPtr(aCharPtr) { } - void writechar(CharT aChar) { - *mCharPtr++ = aChar; - } - - private: - CharT* mCharPtr; -}; - -#else - -NS_SPECIALIZE_TEMPLATE -struct NormalizeNewlinesCharTraits { - public: - typedef char value_type; - - public: - NormalizeNewlinesCharTraits(char* aCharPtr) : mCharPtr(aCharPtr) { } - void writechar(char aChar) { - *mCharPtr++ = aChar; - } - - private: - char* mCharPtr; -}; - -NS_SPECIALIZE_TEMPLATE -struct NormalizeNewlinesCharTraits { - public: - typedef PRUnichar value_type; - - public: - NormalizeNewlinesCharTraits(PRUnichar* aCharPtr) : mCharPtr(aCharPtr) { } - void writechar(PRUnichar aChar) { - *mCharPtr++ = aChar; - } - - private: - PRUnichar* mCharPtr; -}; - -#endif - -template -class CopyNormalizeNewlines -{ - public: - typedef typename OutputIterator::value_type value_type; - - public: - CopyNormalizeNewlines(OutputIterator* aDestination) : - mLastCharCR(PR_FALSE), - mDestination(aDestination), - mWritten(0) - { } - - PRUint32 GetCharsWritten() { - return mWritten; - } - - PRUint32 write(const typename OutputIterator::value_type* aSource, PRUint32 aSourceLength) { - // If the last source buffer ended with a CR... - if (mLastCharCR) { - // ..and if the next one is a LF, then skip it since - // we've already written out a newline - if (aSourceLength && (*aSource == value_type('\n'))) { - aSource++; - } - mLastCharCR = PR_FALSE; - } - - const typename OutputIterator::value_type* done_writing = aSource + aSourceLength; - PRUint32 num_written = 0; - while ( aSource < done_writing ) { - if (*aSource == value_type('\r')) { - mDestination->writechar('\n'); - aSource++; - // If we've reached the end of the buffer, record - // that we wrote out a CR - if (aSource == done_writing) { - mLastCharCR = PR_TRUE; - } - // If the next character is a LF, skip it - else if (*aSource == value_type('\n')) { - aSource++; - } - } - else { - mDestination->writechar(*aSource++); - } - num_written++; - } - - mWritten += num_written; - return aSourceLength; - } - - private: - PRBool mLastCharCR; - OutputIterator* mDestination; - PRUint32 mWritten; -}; - -// static -PRUint32 -nsLayoutUtils::CopyNewlineNormalizedUnicodeTo(const nsAReadableString& aSource, PRUint32 aSrcOffset, PRUnichar* aDest, PRUint32 aLength) -{ - typedef NormalizeNewlinesCharTraits sink_traits; - - sink_traits dest_traits(aDest); - CopyNormalizeNewlines normalizer(&dest_traits); - nsReadingIterator fromBegin, fromEnd; - copy_string(aSource.BeginReading(fromBegin).advance( PRInt32(aSrcOffset) ), aSource.BeginReading(fromEnd).advance( PRInt32(aSrcOffset+aLength) ), normalizer); - return normalizer.GetCharsWritten(); -} - -// static -PRUint32 -nsLayoutUtils::CopyNewlineNormalizedUnicodeTo(nsReadingIterator& aSrcStart, const nsReadingIterator& aSrcEnd, nsAWritableString& aDest) -{ - typedef nsWritingIterator WritingIterator; - typedef NormalizeNewlinesCharTraits sink_traits; - - WritingIterator iter; - aDest.BeginWriting(iter); - sink_traits dest_traits(iter); - CopyNormalizeNewlines normalizer(&dest_traits); - copy_string(aSrcStart, aSrcEnd, normalizer); - return normalizer.GetCharsWritten(); -} diff --git a/mozilla/layout/build/Makefile.in b/mozilla/layout/build/Makefile.in index a7e3b4a05e4..badaf01341b 100644 --- a/mozilla/layout/build/Makefile.in +++ b/mozilla/layout/build/Makefile.in @@ -26,8 +26,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -BUILD_DATE = gbdate.h - MODULE = layout LIBRARY_NAME = gklayout SHORT_LIBNAME = gkhtml @@ -45,7 +43,7 @@ ifndef MKSHLIB_FORCE_ALL CPPSRCS += dlldeps.cpp endif -EXPORTS = nsLayoutCID.h $(BUILD_DATE) +EXPORTS = nsLayoutCID.h SHARED_LIBRARY_LIBS = \ $(DIST)/lib/libgkhtmlbase_s.$(LIB_SUFFIX) \ @@ -53,9 +51,9 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/libgkhtmlforms_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkhtmlstyle_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkhtmltable_s.$(LIB_SUFFIX) \ - $(DIST)/lib/libgkxulcon_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkxulbase_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkbase_s.$(LIB_SUFFIX) \ + $(DIST)/lib/libgkconshared_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkxuloutliner_s.$(LIB_SUFFIX) \ $(NULL) @@ -90,8 +88,6 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),os2) EXPORT_OBJS = 1 endif -GARBAGE += $(BUILD_DATE) - include $(topsrcdir)/config/rules.mk DEFINES += -D_IMPL_NS_HTML @@ -111,10 +107,6 @@ ifdef MOZ_SVG INCLUDES += -I$(srcdir)/../svg/content/src endif -$(BUILD_DATE): - $(RM) $@ - $(PERL) $(srcdir)/gbdate.pl > $@ - # To prevent ILink from crashing ifeq ($(MOZ_OS2_TOOLS),VACPP) OS_DLLFLAGS := ilink /FREE /NOE /NOL /DLL /O:nglayout.dll /M /INC:_dllentry diff --git a/mozilla/layout/build/makefile.win b/mozilla/layout/build/makefile.win index f29715f1eb6..00251924926 100644 --- a/mozilla/layout/build/makefile.win +++ b/mozilla/layout/build/makefile.win @@ -27,8 +27,6 @@ DEFINES=-D_IMPL_NS_HTML MODULE=raptor IS_COMPONENT = 1 -BUILD_DATE=gbdate.h - CPPSRCS=dlldeps.cpp nsLayoutDLF.cpp nsLayoutFactory.cpp CPP_OBJS= \ @@ -38,8 +36,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsLayoutModule.obj \ $(NULL) -EXPORTS=nsLayoutCID.h $(BUILD_DATE) - +EXPORTS=nsLayoutCID.h MAKE_OBJ_TYPE = DLL DLLNAME = gklayout @@ -72,7 +69,7 @@ LLIBS= \ $(DIST)\lib\layouthtmlstyle_s.lib \ $(DIST)\lib\layouthtmltable_s.lib \ $(DIST)\lib\layoutxulbase_s.lib \ - $(DIST)\lib\layoutxulcontent_s.lib \ + $(DIST)\lib\contentshared_s.lib \ $(DIST)\lib\raptorxuloutliner_s.lib \ !ifdef MOZ_MATHML $(DIST)\lib\layoutmathmlbase_s.lib \ @@ -101,7 +98,3 @@ install:: $(DLL) clobber:: rm -f $(DIST)\bin\$(DLLNAME).dll rm -f $(DIST)\lib\$(DLLNAME).lib - -$(BUILD_DATE):: - rm -f $@ - $(PERL) gbdate.pl > $@ diff --git a/mozilla/layout/build/nsContentDLF.cpp b/mozilla/layout/build/nsContentDLF.cpp index 0b8fd22d109..af12814b443 100644 --- a/mozilla/layout/build/nsContentDLF.cpp +++ b/mozilla/layout/build/nsContentDLF.cpp @@ -513,33 +513,6 @@ nsContentDLF::CreateXULDocumentFromStream(nsIInputStream& aXULStream, return status; } -static NS_DEFINE_IID(kDocumentFactoryImplCID, NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID); - -static nsresult -RegisterTypes(nsIComponentManager* aCompMgr, - const char* aCommand, - nsIFile* aPath, - char** aTypes) -{ - nsresult rv = NS_OK; - while (*aTypes) { - char contractid[500]; - char* contentType = *aTypes++; - PR_snprintf(contractid, sizeof(contractid), - NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "%s;1?type=%s", - aCommand, contentType); -#ifdef NOISY_REGISTRY - printf("Register %s => %s\n", contractid, aPath); -#endif - rv = aCompMgr->RegisterComponentSpec(kDocumentFactoryImplCID, "Content", - contractid, aPath, PR_TRUE, PR_TRUE); - if (NS_FAILED(rv)) { - break; - } - } - return rv; -} - nsresult nsContentModule::RegisterDocumentFactories(nsIComponentManager* aCompMgr, nsIFile* aPath) @@ -549,6 +522,8 @@ nsContentModule::RegisterDocumentFactories(nsIComponentManager* aCompMgr, return NS_OK; } +static NS_DEFINE_IID(kDocumentFactoryImplCID, NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID); + void nsContentModule::UnregisterDocumentFactories(nsIComponentManager* aCompMgr, nsIFile* aPath) diff --git a/mozilla/layout/build/nsLayoutModule.cpp b/mozilla/layout/build/nsLayoutModule.cpp index 617486480d8..861d1fd9cf1 100644 --- a/mozilla/layout/build/nsLayoutModule.cpp +++ b/mozilla/layout/build/nsLayoutModule.cpp @@ -73,12 +73,8 @@ #include "nsSprocketLayout.h" #include "nsStackLayout.h" #endif -#include "nsIHTTPProtocolHandler.h" -#include "gbdate.h" #include "nsContentPolicyUtils.h" -#define PRODUCT_NAME "Gecko" -static NS_DEFINE_CID(kHTTPHandlerCID, NS_IHTTPHANDLER_CID); static nsLayoutModule *gModule = NULL; extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr, @@ -236,8 +232,6 @@ nsLayoutModule::Initialize() } } - SetUserAgent(); - rv = nsTextTransformer::Initialize(); if (NS_FAILED(rv)) { return rv; @@ -417,21 +411,3 @@ nsLayoutModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload) *okToUnload = PR_FALSE; return NS_ERROR_FAILURE; } - -void -nsLayoutModule::SetUserAgent( void ) -{ - nsString productName; productName.AssignWithConversion(PRODUCT_NAME); - nsString productVersion; productVersion.AssignWithConversion(PRODUCT_VERSION); - nsresult rv = nsnull; - - nsCOMPtr theService(do_GetService(kHTTPHandlerCID, - &rv)); - - if( NS_SUCCEEDED(rv) && (nsnull != theService) ) - { - rv = theService->SetProduct(productName.GetUnicode()); - - rv = theService->SetProductSub(productVersion.GetUnicode()); - } -} diff --git a/mozilla/layout/html/base/src/MANIFEST b/mozilla/layout/html/base/src/MANIFEST index 86a8536850c..15a7ab8d083 100644 --- a/mozilla/layout/html/base/src/MANIFEST +++ b/mozilla/layout/html/base/src/MANIFEST @@ -5,3 +5,5 @@ nsILineIterator.h nsIHTMLContent.h nsHTMLParts.h +nsHTMLAtoms.h +nsHTMLAtomList.h diff --git a/mozilla/layout/html/base/src/Makefile.in b/mozilla/layout/html/base/src/Makefile.in index 033f40f1254..74f45f2511e 100644 --- a/mozilla/layout/html/base/src/Makefile.in +++ b/mozilla/layout/html/base/src/Makefile.in @@ -45,7 +45,6 @@ CPPSRCS = \ nsFrame.cpp \ nsFrameManager.cpp \ nsHRFrame.cpp \ - nsHTMLAtoms.cpp \ nsHTMLContainerFrame.cpp \ nsHTMLIIDs.cpp \ nsHTMLFrame.cpp \ diff --git a/mozilla/layout/html/base/src/makefile.win b/mozilla/layout/html/base/src/makefile.win index e634772fbf0..dd0e4e776e2 100644 --- a/mozilla/layout/html/base/src/makefile.win +++ b/mozilla/layout/html/base/src/makefile.win @@ -51,7 +51,6 @@ CPPSRCS= \ nsFrame.cpp \ nsFrameManager.cpp \ nsHRFrame.cpp \ - nsHTMLAtoms.cpp \ nsHTMLContainerFrame.cpp \ nsHTMLIIDs.cpp \ nsHTMLFrame.cpp \ @@ -94,7 +93,6 @@ CPP_OBJS= \ .\$(OBJDIR)\nsFrame.obj \ .\$(OBJDIR)\nsFrameManager.obj \ .\$(OBJDIR)\nsHRFrame.obj \ - .\$(OBJDIR)\nsHTMLAtoms.obj \ .\$(OBJDIR)\nsHTMLContainerFrame.obj \ .\$(OBJDIR)\nsHTMLFrame.obj \ .\$(OBJDIR)\nsHTMLImageLoader.obj \ diff --git a/mozilla/layout/html/base/src/nsHTMLAtomList.h b/mozilla/layout/html/base/src/nsHTMLAtomList.h deleted file mode 100644 index 14c44aacf58..00000000000 --- a/mozilla/layout/html/base/src/nsHTMLAtomList.h +++ /dev/null @@ -1,301 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all HTML atoms - See nsHTMLAtoms.h for access to the atoms - - It is designed to be used as inline input to nsHTMLAtoms.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro HTML_ATOM which will have cruel - and unusual things done to it - - The first argument to HTML_ATOM is the C++ name of the atom - The second argument it HTML_ATOM is the string value of the atom - - ******/ - -HTML_ATOM(mozAnonymousBlock, ":-moz-anonymous-block") -HTML_ATOM(mozAnonymousPositionedBlock, ":-moz-anonymous-positioned-block") -HTML_ATOM(mozFirstLineFixup, ":-moz-first-line-fixup") -HTML_ATOM(mozLetterFrame, ":-moz-letter-frame") -HTML_ATOM(mozLineFrame, ":-moz-line-frame") -HTML_ATOM(mozListBulletPseudo, ":-moz-list-bullet") -HTML_ATOM(mozSingleLineTextControlFrame, ":-moz-singleline-textcontrol-frame") -HTML_ATOM(mozFocusInnerPseudo, ":-moz-focus-inner") -HTML_ATOM(mozFocusOuterPseudo, ":-moz-focus-outer") -HTML_ATOM(mozDisplayComboboxControlFrame, ":-moz-display-comboboxcontrol-frame") - -HTML_ATOM(_baseHref, NS_HTML_BASE_HREF) -HTML_ATOM(_baseTarget, NS_HTML_BASE_TARGET) -HTML_ATOM(a, "a") -HTML_ATOM(abbr, "abbr") -HTML_ATOM(above, "above") -HTML_ATOM(accept, "accept") -HTML_ATOM(acceptcharset, "accept-charset") -HTML_ATOM(accesskey, "accesskey") -HTML_ATOM(action, "action") -HTML_ATOM(align, "align") -HTML_ATOM(alink, "alink") -HTML_ATOM(alt, "alt") -HTML_ATOM(applet, "applet") -HTML_ATOM(archive, "archive") -HTML_ATOM(area, "area") -HTML_ATOM(axis, "axis") -HTML_ATOM(background, "background") -HTML_ATOM(below, "below") -HTML_ATOM(bgcolor, "bgcolor") -HTML_ATOM(blockquote, "blockquote") -HTML_ATOM(body, "body") -HTML_ATOM(border, "border") -HTML_ATOM(bordercolor, "bordercolor") -HTML_ATOM(bottompadding, "bottompadding") -HTML_ATOM(br, "br") -HTML_ATOM(b, "b") -HTML_ATOM(button, "button") -HTML_ATOM(buttonContentPseudo, ":button-content") -HTML_ATOM(caption, "caption") -HTML_ATOM(cellContentPseudo, ":cell-content") -HTML_ATOM(cellpadding, "cellpadding") -HTML_ATOM(cellspacing, "cellspacing") -HTML_ATOM(ch, "ch") -HTML_ATOM(_char, "char") -HTML_ATOM(charoff, "charoff") -HTML_ATOM(charset, "charset") -HTML_ATOM(checked, "checked") -HTML_ATOM(cite, "cite") -HTML_ATOM(kClass, "class") -HTML_ATOM(classid, "classid") -HTML_ATOM(clear, "clear") -HTML_ATOM(clip, "clip") -HTML_ATOM(code, "code") -HTML_ATOM(codebase, "codebase") -HTML_ATOM(codetype, "codetype") -HTML_ATOM(color, "color") -HTML_ATOM(col, "col") -HTML_ATOM(colgroup, "colgroup") -HTML_ATOM(cols, "cols") -HTML_ATOM(colspan, "colspan") -HTML_ATOM(combobox, "combobox") -HTML_ATOM(columnPseudo, ":body-column") -HTML_ATOM(commentPseudo, ":-moz-comment") -HTML_ATOM(compact, "compact") -HTML_ATOM(content, "content") -HTML_ATOM(coords, "coords") -HTML_ATOM(dd, "dd") -HTML_ATOM(defaultchecked, "defaultchecked") -HTML_ATOM(defaultselected, "defaultselected") -HTML_ATOM(defaultvalue, "defaultvalue") -HTML_ATOM(declare, "declare") -HTML_ATOM(defer, "defer") -HTML_ATOM(dir, "dir") -HTML_ATOM(div, "div") -HTML_ATOM(disabled, "disabled") -HTML_ATOM(dl, "dl") -HTML_ATOM(dropDownListPseudo, ":-moz-dropdown-list") -HTML_ATOM(dt, "dt") - -HTML_ATOM(datetime, "datetime") -HTML_ATOM(data, "data") -HTML_ATOM(dfn, "dfn") -HTML_ATOM(em, "em") -HTML_ATOM(embed, "embed") -HTML_ATOM(encoding, "encoding") -HTML_ATOM(enctype, "enctype") -HTML_ATOM(face, "face") -HTML_ATOM(fieldset, "fieldset") -HTML_ATOM(fieldsetContentPseudo, ":fieldset-content") -HTML_ATOM(firstLetterPseudo, ":first-letter") -HTML_ATOM(firstLinePseudo, ":first-line") -HTML_ATOM(font, "font") -HTML_ATOM(fontWeight, "font-weight") -HTML_ATOM(_for, "for") -HTML_ATOM(form, "form") -HTML_ATOM(frame, "frame") -HTML_ATOM(frameborder, "frameborder") -HTML_ATOM(frameset, "frameset") -HTML_ATOM(framesetBlankPseudo, ":frameset-blank") -HTML_ATOM(gutter, "gutter") -HTML_ATOM(h1, "h1") -HTML_ATOM(h2, "h2") -HTML_ATOM(h3, "h3") -HTML_ATOM(h4, "h4") -HTML_ATOM(h5, "h5") -HTML_ATOM(h6, "h6") -HTML_ATOM(head, "head") -HTML_ATOM(headerContentBase, "content-base") -HTML_ATOM(headerContentLanguage, "content-language") -HTML_ATOM(headerContentScriptType, "content-script-type") -HTML_ATOM(headerContentStyleType, "content-style-type") -HTML_ATOM(headerContentType, "content-type") -HTML_ATOM(headerDefaultStyle, "default-style") -HTML_ATOM(headerWindowTarget, "window-target") -HTML_ATOM(headers, "headers") -HTML_ATOM(height, "height") -HTML_ATOM(hidden, "hidden") -HTML_ATOM(horizontalFramesetBorderPseudo, ":hframeset-border") -HTML_ATOM(hr, "hr") -HTML_ATOM(href, "href") -HTML_ATOM(hreflang, "hreflang") -HTML_ATOM(hspace, "hspace") -HTML_ATOM(html, "html") -HTML_ATOM(httpEquiv, "http-equiv") -HTML_ATOM(ibPseudo, ":ib-pseudo") -HTML_ATOM(i, "i") -HTML_ATOM(id, "id") -HTML_ATOM(iframe, "iframe") -HTML_ATOM(ilayer, "ilayer") -HTML_ATOM(img, "img") -HTML_ATOM(index, "index") -HTML_ATOM(input, "input") -HTML_ATOM(isindex, "isindex") -HTML_ATOM(ismap, "ismap") -HTML_ATOM(label, "label") -HTML_ATOM(labelContentPseudo, ":label-content") -HTML_ATOM(lang, "lang") -HTML_ATOM(layer, "layer") -HTML_ATOM(layout, "layout") -HTML_ATOM(li, "li") -HTML_ATOM(link, "link") -HTML_ATOM(left, "left") -HTML_ATOM(leftpadding, "leftpadding") -HTML_ATOM(legend, "legend") -HTML_ATOM(legendContentPseudo, ":legend-content") -HTML_ATOM(length, "length") -HTML_ATOM(longdesc, "longdesc") -HTML_ATOM(lowsrc, "lowsrc") -HTML_ATOM(marginheight, "marginheight") -HTML_ATOM(marginwidth, "marginwidth") -HTML_ATOM(maxlength, "maxlength") -HTML_ATOM(mayscript, "mayscript") -HTML_ATOM(media, "media") -HTML_ATOM(menu, "menu") -HTML_ATOM(meta, "meta") -HTML_ATOM(method, "method") -HTML_ATOM(multicol, "multicol") -HTML_ATOM(multiple, "multiple") -HTML_ATOM(name, "name") -HTML_ATOM(nohref, "nohref") -HTML_ATOM(noresize, "noresize") -HTML_ATOM(noscript, "noscript") -HTML_ATOM(noshade, "noshade") -HTML_ATOM(nowrap, "nowrap") -HTML_ATOM(object, "object") -HTML_ATOM(ol, "ol") -HTML_ATOM(option, "option") -HTML_ATOM(overflow, "overflow") -HTML_ATOM(p, "p") -HTML_ATOM(pagex, "pagex") -HTML_ATOM(pagey, "pagey") -HTML_ATOM(param, "param") -HTML_ATOM(placeholderPseudo, ":placeholder-frame") -HTML_ATOM(pointSize, "point-size") -HTML_ATOM(pre, "pre") -HTML_ATOM(processingInstructionPseudo, ":-moz-pi") -HTML_ATOM(profile, "profile") -HTML_ATOM(prompt, "prompt") -HTML_ATOM(radioPseudo, ":-moz-radio") -HTML_ATOM(checkPseudo, ":-moz-checkbox") -HTML_ATOM(readonly, "readonly") -HTML_ATOM(refresh, "refresh") -HTML_ATOM(rel, "rel") -HTML_ATOM(repeat, "repeat") -HTML_ATOM(rev, "rev") -HTML_ATOM(rightpadding, "rightpadding") -HTML_ATOM(rows, "rows") -HTML_ATOM(rowspan, "rowspan") -HTML_ATOM(rules, "rules") -HTML_ATOM(s, "s") -HTML_ATOM(scheme, "scheme") -HTML_ATOM(scope, "scope") -HTML_ATOM(script, "script") -HTML_ATOM(scrolling, "scrolling") -HTML_ATOM(select, "select") -HTML_ATOM(selected, "selected") -HTML_ATOM(selectedindex, "selectedindex") -HTML_ATOM(setcookie, "set-cookie") -HTML_ATOM(shape, "shape") -HTML_ATOM(size, "size") -HTML_ATOM(spacer, "spacer") -HTML_ATOM(span, "span") -HTML_ATOM(src, "src") -HTML_ATOM(standby, "standby") -HTML_ATOM(start, "start") -HTML_ATOM(strike, "strike") -HTML_ATOM(strong, "strong") -HTML_ATOM(style, "style") -HTML_ATOM(summary, "summary") -HTML_ATOM(suppress, "suppress") -HTML_ATOM(tabindex, "tabindex") -HTML_ATOM(table, "table") -HTML_ATOM(tablePseudo, ":table") -HTML_ATOM(tableCellPseudo, ":table-cell") -HTML_ATOM(tableColGroupPseudo, ":table-column-group") -HTML_ATOM(tableColPseudo, ":table-column") -HTML_ATOM(tableOuterPseudo, ":table-outer") -HTML_ATOM(tableRowGroupPseudo, ":table-row-group") -HTML_ATOM(tableRowPseudo, ":table-row") -HTML_ATOM(tabstop, "tabstop") -HTML_ATOM(target, "target") -HTML_ATOM(tbody, "tbody") -HTML_ATOM(td, "td") -HTML_ATOM(tfoot, "tfoot") -HTML_ATOM(thead, "thead") -HTML_ATOM(text, "text") -HTML_ATOM(textarea, "textarea") -HTML_ATOM(textPseudo, ":-moz-text") -HTML_ATOM(th, "th") -HTML_ATOM(title, "title") -HTML_ATOM(top, "top") -HTML_ATOM(toppadding, "toppadding") -HTML_ATOM(tr, "tr") -HTML_ATOM(tt, "tt") -HTML_ATOM(type, "type") -HTML_ATOM(u, "u") -HTML_ATOM(ul, "ul") -HTML_ATOM(usemap, "usemap") -HTML_ATOM(valign, "valign") -HTML_ATOM(value, "value") -HTML_ATOM(valuetype, "valuetype") -HTML_ATOM(variable, "variable") -HTML_ATOM(vcard_name, "vcard_name") -HTML_ATOM(version, "version") -HTML_ATOM(verticalFramesetBorderPseudo, ":vframeset-border") -HTML_ATOM(visibility, "visibility") -HTML_ATOM(vlink, "vlink") -HTML_ATOM(vspace, "vspace") -HTML_ATOM(wbr, "wbr") -HTML_ATOM(width, "width") -HTML_ATOM(wrap, "wrap") -HTML_ATOM(wrappedFramePseudo, ":wrapped-frame") -HTML_ATOM(zindex, "zindex") -HTML_ATOM(z_index, "z-index") - -HTML_ATOM(moz_tristate, "moz-tristate") -HTML_ATOM(moz_tristatevalue, "moz-tristatevalue") - -#ifdef DEBUG -HTML_ATOM(iform, "IForm") -HTML_ATOM(form_control_list, "FormControlList") -#endif diff --git a/mozilla/layout/html/base/src/nsHTMLAtoms.cpp b/mozilla/layout/html/base/src/nsHTMLAtoms.cpp deleted file mode 100644 index 622b759d11b..00000000000 --- a/mozilla/layout/html/base/src/nsHTMLAtoms.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsHTMLAtoms.h" - -// define storage for all atoms -#define HTML_ATOM(_name, _value) nsIAtom* nsHTMLAtoms::_name; -#include "nsHTMLAtomList.h" -#undef HTML_ATOM - - -static nsrefcnt gRefCnt; - -void nsHTMLAtoms::AddRefAtoms() -{ - if (0 == gRefCnt++) { - // create atoms -#define HTML_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsHTMLAtomList.h" -#undef HTML_ATOM - } -} - -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 - } -} - diff --git a/mozilla/layout/html/base/src/nsHTMLAtoms.h b/mozilla/layout/html/base/src/nsHTMLAtoms.h deleted file mode 100644 index afcc8b5d375..00000000000 --- a/mozilla/layout/html/base/src/nsHTMLAtoms.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsHTMLAtoms_h___ -#define nsHTMLAtoms_h___ - -#include "nsIAtom.h" - -#define NS_HTML_BASE_HREF "_base_href" -#define NS_HTML_BASE_TARGET "_base_target" - -/** - * This class wraps up the creation (and destruction) of the standard - * set of html atoms used during normal html handling. This objects - * are created when the first html content object is created and they - * are destroyed when the last html content object is destroyed. - */ -class nsHTMLAtoms { -public: - - static void AddRefAtoms(); - static void ReleaseAtoms(); - - /* Declare all atoms - - The atom names and values are stored in nsHTMLAtomList.h and - are brought to you by the magic of C preprocessing - - Add new atoms to nsHTMLAtomList and all support logic will be auto-generated - */ -#define HTML_ATOM(_name, _value) static nsIAtom* _name; -#include "nsHTMLAtomList.h" -#undef HTML_ATOM -}; - -#endif /* nsHTMLAtoms_h___ */ diff --git a/mozilla/layout/html/style/Makefile.in b/mozilla/layout/html/style/Makefile.in index 8e79579887a..0b4d2a90ab5 100644 --- a/mozilla/layout/html/style/Makefile.in +++ b/mozilla/layout/html/style/Makefile.in @@ -26,7 +26,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +DIRS = src include $(topsrcdir)/config/rules.mk diff --git a/mozilla/layout/html/style/makefile.win b/mozilla/layout/html/style/makefile.win index 92cdc5cfd97..9be9c41dd76 100644 --- a/mozilla/layout/html/style/makefile.win +++ b/mozilla/layout/html/style/makefile.win @@ -21,6 +21,6 @@ DEPTH=..\..\.. -DIRS=public src +DIRS=src include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/layout/html/style/public/MANIFEST b/mozilla/layout/html/style/public/MANIFEST deleted file mode 100644 index 86e446b4067..00000000000 --- a/mozilla/layout/html/style/public/MANIFEST +++ /dev/null @@ -1,4 +0,0 @@ -# -# This is a list of local files which get copied to the mozilla:dist:layout directory -# -nsStyleUtil.h diff --git a/mozilla/layout/html/style/public/Makefile.in b/mozilla/layout/html/style/public/Makefile.in deleted file mode 100644 index 3ff560b10b0..00000000000 --- a/mozilla/layout/html/style/public/Makefile.in +++ /dev/null @@ -1,38 +0,0 @@ -# -# The contents of this file are subject to the Netscape 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/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = layout - -EXPORTS = \ - nsStyleUtil.h \ - $(NULL) - -EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) - -include $(topsrcdir)/config/rules.mk - diff --git a/mozilla/layout/html/style/public/makefile.win b/mozilla/layout/html/style/public/makefile.win deleted file mode 100644 index 8eb80d77533..00000000000 --- a/mozilla/layout/html/style/public/makefile.win +++ /dev/null @@ -1,28 +0,0 @@ -#!nmake -# -# The contents of this file are subject to the Netscape 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/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\..\.. - -EXPORTS=nsStyleUtil.h -MODULE=raptor - -include <$(DEPTH)\config\rules.mak> - diff --git a/mozilla/layout/html/style/public/nsStyleUtil.h b/mozilla/layout/html/style/public/nsStyleUtil.h deleted file mode 100644 index a4b3913453c..00000000000 --- a/mozilla/layout/html/style/public/nsStyleUtil.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsStyleUtil_h___ -#define nsStyleUtil_h___ - -#include "nslayout.h" -#include "nsCoord.h" -#include "nsIPresContext.h" -#include "nsILinkHandler.h" // for nsLinkState - -class nsIStyleContext; -struct nsStyleColor; - -enum nsFontSizeType { - eFontSize_HTML = 1, - eFontSize_CSS = 2 -}; - - -// Style utility functions -class nsStyleUtil { -public: - - static float GetScalingFactor(PRInt32 aScaler); - - static nscoord CalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize, - float aScalingFactor, nsIPresContext* aPresContext, - nsFontSizeType aFontSizeType = eFontSize_HTML); - - static PRInt32 FindNextSmallerFontSize(nscoord aFontSize, PRInt32 aBasePointSize, - float aScalingFactor, nsIPresContext* aPresContext, - nsFontSizeType aFontSizeType = eFontSize_HTML); - - static PRInt32 FindNextLargerFontSize(nscoord aFontSize, PRInt32 aBasePointSize, - float aScalingFactor, nsIPresContext* aPresContext, - nsFontSizeType aFontSizeType = eFontSize_HTML); - - static PRInt32 ConstrainFontWeight(PRInt32 aWeight); - - static const nsStyleColor* FindNonTransparentBackground(nsIStyleContext* aContext, - PRBool aStartAtParent = PR_FALSE); - - static PRBool IsHTMLLink(nsIContent *aContent, nsIAtom *aTag, nsIPresContext *aPresContext, nsLinkState *aState); - static PRBool IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresContext, nsLinkState *aState); - -}; - - -#endif /* nsStyleUtil_h___ */ diff --git a/mozilla/layout/html/style/src/Makefile.in b/mozilla/layout/html/style/src/Makefile.in index f289a223571..269d8739709 100644 --- a/mozilla/layout/html/style/src/Makefile.in +++ b/mozilla/layout/html/style/src/Makefile.in @@ -31,12 +31,8 @@ LIBRARY_NAME = gkhtmlstyle_s REQUIRES = xpcom string dom widget timer caps editor locale js view necko webshell pref rdf htmlparser txmgr docshell uriloader unicharutil uconv CPPSRCS = \ - nsCSSAtoms.cpp \ - nsCSSKeywords.cpp \ nsCSSFrameConstructor.cpp \ - nsCSSProps.cpp \ nsCSSRendering.cpp \ - nsStyleUtil.cpp \ $(NULL) EXPORTS = \ diff --git a/mozilla/layout/html/style/src/makefile.win b/mozilla/layout/html/style/src/makefile.win index 494f8d3593a..9bd6ef0cd75 100644 --- a/mozilla/layout/html/style/src/makefile.win +++ b/mozilla/layout/html/style/src/makefile.win @@ -32,23 +32,13 @@ EXPORTS = \ $(NULL) CPPSRCS= \ - nsCSSAtoms.cpp \ - nsCSSKeywords.cpp \ nsCSSFrameConstructor.cpp \ - nsCSSProps.cpp \ nsCSSRendering.cpp \ -# nsHTMLStyleSheet.cpp \ - nsStyleUtil.cpp \ $(NULL) CPP_OBJS = \ - .\$(OBJDIR)\nsCSSAtoms.obj \ - .\$(OBJDIR)\nsCSSKeywords.obj \ .\$(OBJDIR)\nsCSSFrameConstructor.obj \ - .\$(OBJDIR)\nsCSSProps.obj \ .\$(OBJDIR)\nsCSSRendering.obj \ -# .\$(OBJDIR)\nsHTMLStyleSheet.obj \ - .\$(OBJDIR)\nsStyleUtil.obj \ $(NULL) LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\netlib \ diff --git a/mozilla/layout/html/style/src/nsCSSAtoms.cpp b/mozilla/layout/html/style/src/nsCSSAtoms.cpp deleted file mode 100644 index 020050b8f95..00000000000 --- a/mozilla/layout/html/style/src/nsCSSAtoms.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsCSSAtoms.h" - -// define storage for all atoms -#define CSS_ATOM(_name, _value) nsIAtom* nsCSSAtoms::_name; -#include "nsCSSAtomList.h" -#undef CSS_ATOM - - -static nsrefcnt gRefCnt; - -void nsCSSAtoms::AddRefAtoms() -{ - if (0 == gRefCnt++) { - // create atoms -#define CSS_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsCSSAtomList.h" -#undef CSS_ATOM - } -} - -void nsCSSAtoms::ReleaseAtoms() -{ - NS_PRECONDITION(gRefCnt != 0, "bad release atoms"); - if (--gRefCnt == 0) { - // release atoms -#define CSS_ATOM(_name, _value) NS_RELEASE(_name); -#include "nsCSSAtomList.h" -#undef CSS_ATOM - } -} - diff --git a/mozilla/layout/html/style/src/nsCSSKeywordList.h b/mozilla/layout/html/style/src/nsCSSKeywordList.h deleted file mode 100644 index bb3228811ac..00000000000 --- a/mozilla/layout/html/style/src/nsCSSKeywordList.h +++ /dev/null @@ -1,382 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/****** - - This file contains the list of all parsed CSS keywords - See nsCSSKeywords.h for access to the enum values for keywords - - It is designed to be used as inline input to nsCSSKeywords.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro CSS_KEY which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - Requirements: - - Entries are in the form: (name,id). 'id' must always be the same as 'name' - except that all hyphens ('-') in 'name' are converted to underscores ('_') - in 'id'. This lets us do nice things with the macros without having to - copy/convert strings at runtime. - - 'name' entries *must* use only lowercase characters. - - ** Break these invarient and bad things will happen. ** - - ******/ - -CSS_KEY(-moz-all, _moz_all) -CSS_KEY(-moz-bg-inset, _moz_bg_inset) -CSS_KEY(-moz-bg-outset, _moz_bg_outset) -CSS_KEY(-moz-center, _moz_center) -CSS_KEY(-moz-field, _moz_field) -CSS_KEY(-moz-dragtargetzone, _moz_dragtargetzone) -CSS_KEY(-moz-mac-focusring, _moz_mac_focusring) -CSS_KEY(-moz-mac-menuselect, _moz_mac_menuselect) -CSS_KEY(-moz-mac-menushadow, _moz_mac_menushadow) -CSS_KEY(-moz-mac-menutextselect, _moz_mac_menutextselect) -CSS_KEY(-moz-mac-accentlightesthighlight, _moz_mac_accentlightesthighlight) -CSS_KEY(-moz-mac-accentregularhighlight, _moz_mac_accentregularhighlight) -CSS_KEY(-moz-mac-accentface, _moz_mac_accentface) -CSS_KEY(-moz-mac-accentlightshadow, _moz_mac_accentlightshadow) -CSS_KEY(-moz-mac-accentregularshadow, _moz_mac_accentregularshadow) -CSS_KEY(-moz-mac-accentdarkshadow, _moz_mac_accentdarkshadow) -CSS_KEY(-moz-mac-accentdarkestshadow, _moz_mac_accentdarkestshadow) -CSS_KEY(-moz-right, _moz_right) -CSS_KEY(-moz-pre-wrap, _moz_pre_wrap) -CSS_KEY(-moz-scrollbars-none, _moz_scrollbars_none) -CSS_KEY(-moz-scrollbars-horizontal, _moz_scrollbars_horizontal) -CSS_KEY(-moz-scrollbars-vertical, _moz_scrollbars_vertical) -CSS_KEY(-moz-box, _moz_box) -CSS_KEY(-moz-inline-box, _moz_inline_box) -CSS_KEY(-moz-grid, _moz_grid) -CSS_KEY(-moz-inline-grid, _moz_inline_grid) -CSS_KEY(-moz-grid-group, _moz_grid_group) -CSS_KEY(-moz-grid-line, _moz_grid_line) -CSS_KEY(-moz-stack, _moz_stack) -CSS_KEY(-moz-inline-stack, _moz_inline_stack) -CSS_KEY(above, above) -CSS_KEY(absolute, absolute) -CSS_KEY(activeborder, activeborder) -CSS_KEY(activecaption, activecaption) -CSS_KEY(alias, alias) -CSS_KEY(all, all) -CSS_KEY(always, always) -CSS_KEY(appworkspace, appworkspace) -CSS_KEY(arabic-indic, arabic_indic) -CSS_KEY(armenian, armenian) -CSS_KEY(auto, auto) -CSS_KEY(avoid, avoid) -CSS_KEY(background, background) -CSS_KEY(baseline, baseline) -CSS_KEY(behind, behind) -CSS_KEY(below, below) -CSS_KEY(bengali, bengali) -CSS_KEY(bidi-override, bidi_override) -CSS_KEY(blink, blink) -CSS_KEY(block, block) -CSS_KEY(block-axis, block_axis) -CSS_KEY(bold, bold) -CSS_KEY(bolder, bolder) -CSS_KEY(border-box, border_box) -CSS_KEY(both, both) -CSS_KEY(bottom, bottom) -CSS_KEY(button, button) -CSS_KEY(buttonface, buttonface) -CSS_KEY(buttonhighlight, buttonhighlight) -CSS_KEY(buttonshadow, buttonshadow) -CSS_KEY(buttontext, buttontext) -CSS_KEY(capitalize, capitalize) -CSS_KEY(caption, caption) -CSS_KEY(captiontext, captiontext) -CSS_KEY(cell, cell) -CSS_KEY(center, center) -CSS_KEY(center-left, center_left) -CSS_KEY(center-right, center_right) -CSS_KEY(ch, ch) -CSS_KEY(circle, circle) -CSS_KEY(cjk-earthly-branch, cjk_earthly_branch) -CSS_KEY(cjk-heavenly-stem, cjk_heavenly_stem) -CSS_KEY(cjk-ideographic, cjk_ideographic) -CSS_KEY(close-quote, close_quote) -CSS_KEY(cm, cm) -CSS_KEY(code, code) -CSS_KEY(collapse, collapse) -CSS_KEY(compact, compact) -CSS_KEY(condensed, condensed) -CSS_KEY(content-box, content_box) -CSS_KEY(context-menu, context_menu) -CSS_KEY(continuous, continuous) -CSS_KEY(copy, copy) -CSS_KEY(count-down, count_down) -CSS_KEY(count-up, count_up) -CSS_KEY(count-up-down, count_up_down) -CSS_KEY(crop, crop) -CSS_KEY(cross, cross) -CSS_KEY(crosshair, crosshair) -CSS_KEY(dashed, dashed) -CSS_KEY(decimal, decimal) -CSS_KEY(decimal-leading-zero, decimal_leading_zero) -CSS_KEY(default, default) -CSS_KEY(deg, deg) -CSS_KEY(desktop, desktop) -CSS_KEY(devanagari, devanagari) -CSS_KEY(dialog, dialog) -CSS_KEY(digits, digits) -CSS_KEY(disabled, disabled) -CSS_KEY(disc, disc) -CSS_KEY(document, document) -CSS_KEY(dotted, dotted) -CSS_KEY(double, double) -CSS_KEY(e-resize, e_resize) -CSS_KEY(element, element) -CSS_KEY(elements, elements) -CSS_KEY(em, em) -CSS_KEY(embed, embed) -CSS_KEY(enabled, enabled) -CSS_KEY(end, end) -CSS_KEY(ex, ex) -CSS_KEY(expanded, expanded) -CSS_KEY(extra-condensed, extra_condensed) -CSS_KEY(extra-expanded, extra_expanded) -CSS_KEY(far-left, far_left) -CSS_KEY(far-right, far_right) -CSS_KEY(fast, fast) -CSS_KEY(faster, faster) -CSS_KEY(field, field) -CSS_KEY(fixed, fixed) -CSS_KEY(georgian, georgian) -CSS_KEY(grab, grab) -CSS_KEY(grabbing, grabbing) -CSS_KEY(grad, grad) -CSS_KEY(graytext, graytext) -CSS_KEY(groove, groove) -CSS_KEY(gujarati, gujarati) -CSS_KEY(gurmukhi, gurmukhi) -CSS_KEY(hebrew, hebrew) -CSS_KEY(help, help) -CSS_KEY(hidden, hidden) -CSS_KEY(hide, hide) -CSS_KEY(high, high) -CSS_KEY(higher, higher) -CSS_KEY(highlight, highlight) -CSS_KEY(highlighttext, highlighttext) -CSS_KEY(hiragana, hiragana) -CSS_KEY(hiragana-iroha, hiragana_iroha) -CSS_KEY(horizontal, horizontal) -CSS_KEY(hz, hz) -CSS_KEY(icon, icon) -CSS_KEY(ignore, ignore) -CSS_KEY(in, in) -CSS_KEY(inactiveborder, inactiveborder) -CSS_KEY(inactivecaption, inactivecaption) -CSS_KEY(inactivecaptiontext, inactivecaptiontext) -CSS_KEY(info, info) -CSS_KEY(infobackground, infobackground) -CSS_KEY(infotext, infotext) -CSS_KEY(inherit, inherit) -CSS_KEY(inline, inline) -CSS_KEY(inline-axis, inline_axis) -CSS_KEY(inline-block, inline_block) -CSS_KEY(inline-table, inline_table) -CSS_KEY(inset, inset) -CSS_KEY(inside, inside) -CSS_KEY(invert, invert) -CSS_KEY(italic, italic) -CSS_KEY(japanese-formal, japanese_formal) -CSS_KEY(japanese-informal, japanese_informal) -CSS_KEY(justify, justify) -CSS_KEY(kannada, kannada) -CSS_KEY(katakana, katakana) -CSS_KEY(katakana-iroha, katakana_iroha) -CSS_KEY(khmer, khmer) -CSS_KEY(khz, khz) -CSS_KEY(landscape, landscape) -CSS_KEY(lao, lao) -CSS_KEY(large, large) -CSS_KEY(larger, larger) -CSS_KEY(left, left) -CSS_KEY(left-side, left_side) -CSS_KEY(leftwards, leftwards) -CSS_KEY(level, level) -CSS_KEY(lighter, lighter) -CSS_KEY(line-through, line_through) -CSS_KEY(list, list) -CSS_KEY(list-item, list_item) -CSS_KEY(loud, loud) -CSS_KEY(low, low) -CSS_KEY(lower, lower) -CSS_KEY(lower-alpha, lower_alpha) -CSS_KEY(lower-greek, lower_greek) -CSS_KEY(lower-latin, lower_latin) -CSS_KEY(lower-roman, lower_roman) -CSS_KEY(lowercase, lowercase) -CSS_KEY(ltr, ltr) -CSS_KEY(malayalam, malayalam) -CSS_KEY(margin-box, margin_box) -CSS_KEY(marker, marker) -CSS_KEY(medium, medium) -CSS_KEY(menu, menu) -CSS_KEY(menutext, menutext) -CSS_KEY(message-box, message_box) -CSS_KEY(middle, middle) -CSS_KEY(mix, mix) -CSS_KEY(mm, mm) -CSS_KEY(move, move) -CSS_KEY(ms, ms) -CSS_KEY(myanmar, myanmar) -CSS_KEY(n-resize, n_resize) -CSS_KEY(narrower, narrower) -CSS_KEY(ne-resize, ne_resize) -CSS_KEY(no-close-quote, no_close_quote) -CSS_KEY(no-open-quote, no_open_quote) -CSS_KEY(no-repeat, no_repeat) -CSS_KEY(none, none) -CSS_KEY(normal, normal) -CSS_KEY(noshade, noshade) -CSS_KEY(nowrap, nowrap) -CSS_KEY(nw-resize, nw_resize) -CSS_KEY(oblique, oblique) -CSS_KEY(once, once) -CSS_KEY(open-quote, open_quote) -CSS_KEY(oriya, oriya) -CSS_KEY(outset, outset) -CSS_KEY(outside, outside) -CSS_KEY(overline, overline) -CSS_KEY(padding-box, padding_box) -CSS_KEY(paragraph, paragraph) -CSS_KEY(pc, pc) -CSS_KEY(persian, persian) -CSS_KEY(pointer, pointer) -CSS_KEY(portrait, portrait) -CSS_KEY(pre, pre) -CSS_KEY(pt, pt) -CSS_KEY(pull-down-menu, pull_down_menu) -CSS_KEY(px, px) -CSS_KEY(rad, rad) -CSS_KEY(read-only, read_only) -CSS_KEY(read-write, read_write) -CSS_KEY(relative, relative) -CSS_KEY(repeat, repeat) -CSS_KEY(repeat-x, repeat_x) -CSS_KEY(repeat-y, repeat_y) -CSS_KEY(reverse, reverse) -CSS_KEY(ridge, ridge) -CSS_KEY(right, right) -CSS_KEY(right-side, right_side) -CSS_KEY(rightwards, rightwards) -CSS_KEY(rtl, rtl) -CSS_KEY(run-in, run_in) -CSS_KEY(s, s) -CSS_KEY(s-resize, s_resize) -CSS_KEY(scroll, scroll) -CSS_KEY(scrollbar, scrollbar) -CSS_KEY(se-resize, se_resize) -CSS_KEY(select-all, select_all) -CSS_KEY(select-before, select_before) -CSS_KEY(select-after, select_after) -CSS_KEY(select-same, select_same) -CSS_KEY(select-menu, select_menu) -CSS_KEY(semi-condensed, semi_condensed) -CSS_KEY(semi-expanded, semi_expanded) -CSS_KEY(separate, separate) -CSS_KEY(show, show) -CSS_KEY(silent, silent) -CSS_KEY(simp-chinese-formal, simp_chinese_formal) -CSS_KEY(simp-chinese-informal, simp_chinese_informal) -CSS_KEY(slow, slow) -CSS_KEY(slower, slower) -CSS_KEY(small, small) -CSS_KEY(small-caps, small_caps) -CSS_KEY(small-caption, small_caption) -CSS_KEY(smaller, smaller) -CSS_KEY(soft, soft) -CSS_KEY(solid, solid) -CSS_KEY(spell-out, spell_out) -CSS_KEY(spinning, spinning) -CSS_KEY(square, square) -CSS_KEY(start, start) -CSS_KEY(static, static) -CSS_KEY(status-bar, status_bar) -CSS_KEY(stretch, stretch) -CSS_KEY(sub, sub) -CSS_KEY(super, super) -CSS_KEY(sw-resize, sw_resize) -CSS_KEY(table, table) -CSS_KEY(table-caption, table_caption) -CSS_KEY(table-cell, table_cell) -CSS_KEY(table-column, table_column) -CSS_KEY(table-column-group, table_column_group) -CSS_KEY(table-footer-group, table_footer_group) -CSS_KEY(table-header-group, table_header_group) -CSS_KEY(table-row, table_row) -CSS_KEY(table-row-group, table_row_group) -CSS_KEY(tamil, tamil) -CSS_KEY(telugu, telugu) -CSS_KEY(text, text) -CSS_KEY(text-bottom, text_bottom) -CSS_KEY(text-top, text_top) -CSS_KEY(thai, thai) -CSS_KEY(thick, thick) -CSS_KEY(thin, thin) -CSS_KEY(threeddarkshadow, threeddarkshadow) -CSS_KEY(threedface, threedface) -CSS_KEY(threedhighlight, threedhighlight) -CSS_KEY(threedlightshadow, threedlightshadow) -CSS_KEY(threedshadow, threedshadow) -CSS_KEY(toggle, toggle) -CSS_KEY(top, top) -CSS_KEY(trad-chinese-formal, trad_chinese_formal) -CSS_KEY(trad-chinese-informal, trad_chinese_informal) -CSS_KEY(transparent, transparent) -CSS_KEY(tri-state, tri_state) -CSS_KEY(ultra-condensed, ultra_condensed) -CSS_KEY(ultra-expanded, ultra_expanded) -CSS_KEY(underline, underline) -CSS_KEY(upper-alpha, upper_alpha) -CSS_KEY(upper-latin, upper_latin) -CSS_KEY(upper-roman, upper_roman) -CSS_KEY(uppercase, uppercase) -CSS_KEY(urdu, urdu) -CSS_KEY(vertical, vertical) -CSS_KEY(visible, visible) -CSS_KEY(w-resize, w_resize) -CSS_KEY(wait, wait) -CSS_KEY(wider, wider) -CSS_KEY(window, window) -CSS_KEY(windowframe, windowframe) -CSS_KEY(windowtext, windowtext) -CSS_KEY(workspace, workspace) -CSS_KEY(write-only, write_only) -CSS_KEY(x-fast, x_fast) -CSS_KEY(x-high, x_high) -CSS_KEY(x-large, x_large) -CSS_KEY(x-loud, x_loud) -CSS_KEY(x-low, x_low) -CSS_KEY(x-slow, x_slow) -CSS_KEY(x-small, x_small) -CSS_KEY(x-soft, x_soft) -CSS_KEY(xx-large, xx_large) -CSS_KEY(xx-small, xx_small) diff --git a/mozilla/layout/html/style/src/nsCSSKeywords.cpp b/mozilla/layout/html/style/src/nsCSSKeywords.cpp deleted file mode 100644 index d58e9f86420..00000000000 --- a/mozilla/layout/html/style/src/nsCSSKeywords.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsCSSKeywords.h" -#include "nsString.h" -#include "nsStaticNameTable.h" - -// define an array of all CSS keywords -#define CSS_KEY(_name,_id) #_name, -const char* kCSSRawKeywords[] = { -#include "nsCSSKeywordList.h" -}; -#undef CSS_KEY - -static PRInt32 gTableRefCount; -static nsStaticCaseInsensitiveNameTable* gKeywordTable; - -void -nsCSSKeywords::AddRefTable(void) -{ - if (0 == gTableRefCount++) { - NS_ASSERTION(!gKeywordTable, "pre existing array!"); - gKeywordTable = new nsStaticCaseInsensitiveNameTable(); - if (gKeywordTable) { -#ifdef DEBUG - { - // let's verify the table... - for (PRInt32 index = 0; index < eCSSKeyword_COUNT; ++index) { - nsCAutoString temp1(kCSSRawKeywords[index]); - nsCAutoString temp2(kCSSRawKeywords[index]); - temp1.ToLowerCase(); - NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); - NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); - } - } -#endif - gKeywordTable->Init(kCSSRawKeywords, eCSSKeyword_COUNT); - } - } -} - -void -nsCSSKeywords::ReleaseTable(void) -{ - if (0 == --gTableRefCount) { - if (gKeywordTable) { - delete gKeywordTable; - gKeywordTable = nsnull; - } - } -} - -nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsCString& aKeyword) -{ - NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); - if (gKeywordTable) { - return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); - } - return eCSSKeyword_UNKNOWN; -} - -nsCSSKeyword -nsCSSKeywords::LookupKeyword(const nsString& aKeyword) -{ - NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); - if (gKeywordTable) { - return nsCSSKeyword(gKeywordTable->Lookup(aKeyword)); - } - return eCSSKeyword_UNKNOWN; -} - -const nsCString& -nsCSSKeywords::GetStringValue(nsCSSKeyword aKeyword) -{ - NS_ASSERTION(gKeywordTable, "no lookup table, needs addref"); - if (gKeywordTable) { - return gKeywordTable->GetStringValue(PRInt32(aKeyword)); - } else { - static nsCString kNullStr; - return kNullStr; - } -} - diff --git a/mozilla/layout/html/style/src/nsCSSKeywords.h b/mozilla/layout/html/style/src/nsCSSKeywords.h deleted file mode 100644 index 504b4512f3c..00000000000 --- a/mozilla/layout/html/style/src/nsCSSKeywords.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSKeywords_h___ -#define nsCSSKeywords_h___ - -#include "nslayout.h" - -class nsString; -class nsCString; - -/* - Declare the enum list using the magic of preprocessing - enum values are "eCSSKeyword_foo" (where foo is the keyword) - - To change the list of keywords, see nsCSSKeywordList.h - - */ -#define CSS_KEY(_name,_id) eCSSKeyword_##_id, -enum nsCSSKeyword { - eCSSKeyword_UNKNOWN = -1, -#include "nsCSSKeywordList.h" - eCSSKeyword_COUNT -}; -#undef CSS_KEY - - -class NS_LAYOUT nsCSSKeywords { -public: - static void AddRefTable(void); - static void ReleaseTable(void); - - // Given a keyword string, return the enum value - static nsCSSKeyword LookupKeyword(const nsCString& aKeyword); - static nsCSSKeyword LookupKeyword(const nsString& aKeyword); - - // Given a keyword enum, get the string value - static const nsCString& GetStringValue(nsCSSKeyword aKeyword); -}; - -#endif /* nsCSSKeywords_h___ */ diff --git a/mozilla/layout/html/style/src/nsCSSProps.cpp b/mozilla/layout/html/style/src/nsCSSProps.cpp deleted file mode 100644 index 4c6deb67250..00000000000 --- a/mozilla/layout/html/style/src/nsCSSProps.cpp +++ /dev/null @@ -1,1103 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#include "nsCSSProps.h" -#include "nsCSSKeywords.h" -#include "nsStyleConsts.h" - -#include "nsILookAndFeel.h" // for system colors - -#include "nsString.h" -#include "nsStaticNameTable.h" - -// define an array of all CSS properties -#define CSS_PROP(_name, _id, _hint) #_name, -const char* kCSSRawProperties[] = { -#include "nsCSSPropList.h" -}; -#undef CSS_PROP - - -static PRInt32 gTableRefCount; -static nsStaticCaseInsensitiveNameTable* gPropertyTable; - -void -nsCSSProps::AddRefTable(void) -{ - if (0 == gTableRefCount++) { - NS_ASSERTION(!gPropertyTable, "pre existing array!"); - gPropertyTable = new nsStaticCaseInsensitiveNameTable(); - if (gPropertyTable) { -#ifdef DEBUG - { - // let's verify the table... - for (PRInt32 index = 0; index < eCSSProperty_COUNT; ++index) { - nsCAutoString temp1(kCSSRawProperties[index]); - nsCAutoString temp2(kCSSRawProperties[index]); - temp1.ToLowerCase(); - NS_ASSERTION(temp1.Equals(temp2), "upper case char in table"); - NS_ASSERTION(-1 == temp1.FindChar('_'), "underscore char in table"); - } - } -#endif - gPropertyTable->Init(kCSSRawProperties, eCSSProperty_COUNT); - } - } -} - -void -nsCSSProps::ReleaseTable(void) -{ - if (0 == --gTableRefCount) { - if (gPropertyTable) { - delete gPropertyTable; - gPropertyTable = nsnull; - } - } -} - -nsCSSProperty -nsCSSProps::LookupProperty(const nsCString& aProperty) -{ - NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); - if (gPropertyTable) { - return nsCSSProperty(gPropertyTable->Lookup(aProperty)); - } - return eCSSProperty_UNKNOWN; -} - -nsCSSProperty -nsCSSProps::LookupProperty(const nsAReadableString& aProperty) { - nsCAutoString theProp; theProp.AssignWithConversion(aProperty); - return LookupProperty(theProp); -} - -const nsCString& -nsCSSProps::GetStringValue(nsCSSProperty aProperty) -{ - NS_ASSERTION(gPropertyTable, "no lookup table, needs addref"); - if (gPropertyTable) { - return gPropertyTable->GetStringValue(PRInt32(aProperty)); - } else { - static nsCString sNullStr; - return sNullStr; - } -} - - -/***************************************************************************/ - -// Keyword id tables for variant/enum parsing -const PRInt32 nsCSSProps::kAzimuthKTable[] = { - eCSSKeyword_left_side, NS_STYLE_AZIMUTH_LEFT_SIDE, - eCSSKeyword_far_left, NS_STYLE_AZIMUTH_FAR_LEFT, - eCSSKeyword_left, NS_STYLE_AZIMUTH_LEFT, - eCSSKeyword_center_left, NS_STYLE_AZIMUTH_CENTER_LEFT, - eCSSKeyword_center, NS_STYLE_AZIMUTH_CENTER, - eCSSKeyword_center_right, NS_STYLE_AZIMUTH_CENTER_RIGHT, - eCSSKeyword_right, NS_STYLE_AZIMUTH_RIGHT, - eCSSKeyword_far_right, NS_STYLE_AZIMUTH_FAR_RIGHT, - eCSSKeyword_right_side, NS_STYLE_AZIMUTH_RIGHT_SIDE, - eCSSKeyword_behind, NS_STYLE_AZIMUTH_BEHIND, - eCSSKeyword_leftwards, NS_STYLE_AZIMUTH_LEFTWARDS, - eCSSKeyword_rightwards, NS_STYLE_AZIMUTH_RIGHTWARDS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = { - eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED, - eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBackgroundColorKTable[] = { - eCSSKeyword_transparent, NS_STYLE_BG_COLOR_TRANSPARENT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBackgroundRepeatKTable[] = { - eCSSKeyword_no_repeat, NS_STYLE_BG_REPEAT_OFF, - eCSSKeyword_repeat, NS_STYLE_BG_REPEAT_XY, - eCSSKeyword_repeat_x, NS_STYLE_BG_REPEAT_X, - eCSSKeyword_repeat_y, NS_STYLE_BG_REPEAT_Y, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderCollapseKTable[] = { - eCSSKeyword_collapse, NS_STYLE_BORDER_COLLAPSE, - eCSSKeyword_separate, NS_STYLE_BORDER_SEPARATE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderColorKTable[] = { - eCSSKeyword_transparent, NS_STYLE_COLOR_TRANSPARENT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderStyleKTable[] = { - eCSSKeyword_hidden, NS_STYLE_BORDER_STYLE_HIDDEN, - eCSSKeyword_dotted, NS_STYLE_BORDER_STYLE_DOTTED, - eCSSKeyword_dashed, NS_STYLE_BORDER_STYLE_DASHED, - eCSSKeyword_solid, NS_STYLE_BORDER_STYLE_SOLID, - eCSSKeyword_double, NS_STYLE_BORDER_STYLE_DOUBLE, - eCSSKeyword_groove, NS_STYLE_BORDER_STYLE_GROOVE, - eCSSKeyword_ridge, NS_STYLE_BORDER_STYLE_RIDGE, - eCSSKeyword_inset, NS_STYLE_BORDER_STYLE_INSET, - eCSSKeyword_outset, NS_STYLE_BORDER_STYLE_OUTSET, - eCSSKeyword__moz_bg_inset, NS_STYLE_BORDER_STYLE_BG_INSET, - eCSSKeyword__moz_bg_outset, NS_STYLE_BORDER_STYLE_BG_OUTSET, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBorderWidthKTable[] = { - eCSSKeyword_thin, NS_STYLE_BORDER_WIDTH_THIN, - eCSSKeyword_medium, NS_STYLE_BORDER_WIDTH_MEDIUM, - eCSSKeyword_thick, NS_STYLE_BORDER_WIDTH_THICK, - -1,-1 -}; - -const PRInt32 nsCSSProps::kBoxSizingKTable[] = { - eCSSKeyword_content_box, NS_STYLE_BOX_SIZING_CONTENT, - eCSSKeyword_border_box, NS_STYLE_BOX_SIZING_BORDER, - eCSSKeyword_padding_box, NS_STYLE_BOX_SIZING_PADDING, - -1,-1 -}; - -const PRInt32 nsCSSProps::kCaptionSideKTable[] = { - eCSSKeyword_top, NS_SIDE_TOP, - eCSSKeyword_right, NS_SIDE_RIGHT, - eCSSKeyword_bottom, NS_SIDE_BOTTOM, - eCSSKeyword_left, NS_SIDE_LEFT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kClearKTable[] = { - eCSSKeyword_left, NS_STYLE_CLEAR_LEFT, - eCSSKeyword_right, NS_STYLE_CLEAR_RIGHT, - eCSSKeyword_both, NS_STYLE_CLEAR_LEFT_AND_RIGHT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kColorKTable[] = { - eCSSKeyword_activeborder, nsILookAndFeel::eColor_activeborder, - eCSSKeyword_activecaption, nsILookAndFeel::eColor_activecaption, - eCSSKeyword_appworkspace, nsILookAndFeel::eColor_appworkspace, - eCSSKeyword_background, nsILookAndFeel::eColor_background, - eCSSKeyword_buttonface, nsILookAndFeel::eColor_buttonface, - eCSSKeyword_buttonhighlight, nsILookAndFeel::eColor_buttonhighlight, - eCSSKeyword_buttonshadow, nsILookAndFeel::eColor_buttonshadow, - eCSSKeyword_buttontext, nsILookAndFeel::eColor_buttontext, - eCSSKeyword_captiontext, nsILookAndFeel::eColor_captiontext, - eCSSKeyword_graytext, nsILookAndFeel::eColor_graytext, - eCSSKeyword_highlight, nsILookAndFeel::eColor_highlight, - eCSSKeyword_highlighttext, nsILookAndFeel::eColor_highlighttext, - eCSSKeyword_inactiveborder, nsILookAndFeel::eColor_inactiveborder, - eCSSKeyword_inactivecaption, nsILookAndFeel::eColor_inactivecaption, - eCSSKeyword_inactivecaptiontext, nsILookAndFeel::eColor_inactivecaptiontext, - eCSSKeyword_infobackground, nsILookAndFeel::eColor_infobackground, - eCSSKeyword_infotext, nsILookAndFeel::eColor_infotext, - eCSSKeyword_menu, nsILookAndFeel::eColor_menu, - eCSSKeyword_menutext, nsILookAndFeel::eColor_menutext, - eCSSKeyword_scrollbar, nsILookAndFeel::eColor_scrollbar, - eCSSKeyword_threeddarkshadow, nsILookAndFeel::eColor_threeddarkshadow, - eCSSKeyword_threedface, nsILookAndFeel::eColor_threedface, - eCSSKeyword_threedhighlight, nsILookAndFeel::eColor_threedhighlight, - eCSSKeyword_threedlightshadow, nsILookAndFeel::eColor_threedlightshadow, - eCSSKeyword_threedshadow, nsILookAndFeel::eColor_threedshadow, - eCSSKeyword_window, nsILookAndFeel::eColor_window, - eCSSKeyword_windowframe, nsILookAndFeel::eColor_windowframe, - eCSSKeyword_windowtext, nsILookAndFeel::eColor_windowtext, - eCSSKeyword__moz_field, nsILookAndFeel::eColor__moz_field, - eCSSKeyword__moz_dragtargetzone, nsILookAndFeel::eColor__moz_dragtargetzone, - eCSSKeyword__moz_mac_focusring, nsILookAndFeel::eColor__moz_mac_focusring, - eCSSKeyword__moz_mac_menuselect, nsILookAndFeel::eColor__moz_mac_menuselect, - eCSSKeyword__moz_mac_menushadow, nsILookAndFeel::eColor__moz_mac_menushadow, - eCSSKeyword__moz_mac_menutextselect, nsILookAndFeel::eColor__moz_mac_menutextselect, - eCSSKeyword__moz_mac_accentlightesthighlight, nsILookAndFeel::eColor__moz_mac_accentlightesthighlight, - eCSSKeyword__moz_mac_accentregularhighlight, nsILookAndFeel::eColor__moz_mac_accentregularhighlight, - eCSSKeyword__moz_mac_accentface, nsILookAndFeel::eColor__moz_mac_accentface, - eCSSKeyword__moz_mac_accentlightshadow, nsILookAndFeel::eColor__moz_mac_accentlightshadow, - eCSSKeyword__moz_mac_accentregularshadow, nsILookAndFeel::eColor__moz_mac_accentregularshadow, - eCSSKeyword__moz_mac_accentdarkshadow, nsILookAndFeel::eColor__moz_mac_accentdarkshadow, - eCSSKeyword__moz_mac_accentdarkestshadow, nsILookAndFeel::eColor__moz_mac_accentdarkestshadow, - -1,-1 -}; - -const PRInt32 nsCSSProps::kContentKTable[] = { - eCSSKeyword_open_quote, NS_STYLE_CONTENT_OPEN_QUOTE, - eCSSKeyword_close_quote, NS_STYLE_CONTENT_CLOSE_QUOTE, - eCSSKeyword_no_open_quote, NS_STYLE_CONTENT_NO_OPEN_QUOTE, - eCSSKeyword_no_close_quote, NS_STYLE_CONTENT_NO_CLOSE_QUOTE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kCursorKTable[] = { - eCSSKeyword_crosshair, NS_STYLE_CURSOR_CROSSHAIR, - eCSSKeyword_default, NS_STYLE_CURSOR_DEFAULT, - eCSSKeyword_pointer, NS_STYLE_CURSOR_POINTER, - eCSSKeyword_move, NS_STYLE_CURSOR_MOVE, - eCSSKeyword_e_resize, NS_STYLE_CURSOR_E_RESIZE, - eCSSKeyword_ne_resize, NS_STYLE_CURSOR_NE_RESIZE, - eCSSKeyword_nw_resize, NS_STYLE_CURSOR_NW_RESIZE, - eCSSKeyword_n_resize, NS_STYLE_CURSOR_N_RESIZE, - eCSSKeyword_se_resize, NS_STYLE_CURSOR_SE_RESIZE, - eCSSKeyword_sw_resize, NS_STYLE_CURSOR_SW_RESIZE, - eCSSKeyword_s_resize, NS_STYLE_CURSOR_S_RESIZE, - eCSSKeyword_w_resize, NS_STYLE_CURSOR_W_RESIZE, - eCSSKeyword_text, NS_STYLE_CURSOR_TEXT, - eCSSKeyword_wait, NS_STYLE_CURSOR_WAIT, - eCSSKeyword_help, NS_STYLE_CURSOR_HELP, - eCSSKeyword_copy, NS_STYLE_CURSOR_COPY, // CSS3 - eCSSKeyword_alias, NS_STYLE_CURSOR_ALIAS, - eCSSKeyword_context_menu, NS_STYLE_CURSOR_CONTEXT_MENU, - eCSSKeyword_cell, NS_STYLE_CURSOR_CELL, - eCSSKeyword_grab, NS_STYLE_CURSOR_GRAB, - eCSSKeyword_grabbing, NS_STYLE_CURSOR_GRABBING, - eCSSKeyword_spinning, NS_STYLE_CURSOR_SPINNING, - eCSSKeyword_count_up, NS_STYLE_CURSOR_COUNT_UP, - eCSSKeyword_count_down, NS_STYLE_CURSOR_COUNT_DOWN, - eCSSKeyword_count_up_down, NS_STYLE_CURSOR_COUNT_UP_DOWN, - -1,-1 -}; - -const PRInt32 nsCSSProps::kDirectionKTable[] = { - eCSSKeyword_ltr, NS_STYLE_DIRECTION_LTR, - eCSSKeyword_rtl, NS_STYLE_DIRECTION_RTL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kDisplayKTable[] = { - eCSSKeyword_inline, NS_STYLE_DISPLAY_INLINE, - eCSSKeyword_block, NS_STYLE_DISPLAY_BLOCK, - eCSSKeyword_inline_block, NS_STYLE_DISPLAY_INLINE_BLOCK, - eCSSKeyword_list_item, NS_STYLE_DISPLAY_LIST_ITEM, - eCSSKeyword_run_in, NS_STYLE_DISPLAY_RUN_IN, - eCSSKeyword_compact, NS_STYLE_DISPLAY_COMPACT, - eCSSKeyword_marker, NS_STYLE_DISPLAY_MARKER, - eCSSKeyword_table, NS_STYLE_DISPLAY_TABLE, - eCSSKeyword_inline_table, NS_STYLE_DISPLAY_INLINE_TABLE, - eCSSKeyword_table_row_group, NS_STYLE_DISPLAY_TABLE_ROW_GROUP, - eCSSKeyword_table_header_group, NS_STYLE_DISPLAY_TABLE_HEADER_GROUP, - eCSSKeyword_table_footer_group, NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP, - eCSSKeyword_table_row, NS_STYLE_DISPLAY_TABLE_ROW, - eCSSKeyword_table_column_group, NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP, - eCSSKeyword_table_column, NS_STYLE_DISPLAY_TABLE_COLUMN, - eCSSKeyword_table_cell, NS_STYLE_DISPLAY_TABLE_CELL, - eCSSKeyword_table_caption, NS_STYLE_DISPLAY_TABLE_CAPTION, - eCSSKeyword_menu, NS_STYLE_DISPLAY_MENU, - eCSSKeyword__moz_box, NS_STYLE_DISPLAY_BOX, - eCSSKeyword__moz_inline_box, NS_STYLE_DISPLAY_INLINE_BOX, - eCSSKeyword__moz_grid, NS_STYLE_DISPLAY_GRID, - eCSSKeyword__moz_inline_grid, NS_STYLE_DISPLAY_INLINE_GRID, - eCSSKeyword__moz_grid_group, NS_STYLE_DISPLAY_GRID_GROUP, - eCSSKeyword__moz_grid_line, NS_STYLE_DISPLAY_GRID_LINE, - eCSSKeyword__moz_stack, NS_STYLE_DISPLAY_STACK, - eCSSKeyword__moz_inline_stack, NS_STYLE_DISPLAY_INLINE_STACK, - -1,-1 -}; - -const PRInt32 nsCSSProps::kElevationKTable[] = { - eCSSKeyword_below, NS_STYLE_ELEVATION_BELOW, - eCSSKeyword_level, NS_STYLE_ELEVATION_LEVEL, - eCSSKeyword_above, NS_STYLE_ELEVATION_ABOVE, - eCSSKeyword_higher, NS_STYLE_ELEVATION_HIGHER, - eCSSKeyword_lower, NS_STYLE_ELEVATION_LOWER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kEmptyCellsKTable[] = { - eCSSKeyword_show, NS_STYLE_TABLE_EMPTY_CELLS_SHOW, - eCSSKeyword_hide, NS_STYLE_TABLE_EMPTY_CELLS_HIDE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFloatKTable[] = { - eCSSKeyword_left, NS_STYLE_FLOAT_LEFT, - eCSSKeyword_right, NS_STYLE_FLOAT_RIGHT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFloatEdgeKTable[] = { - eCSSKeyword_content_box, NS_STYLE_FLOAT_EDGE_CONTENT, - eCSSKeyword_border_box, NS_STYLE_FLOAT_EDGE_BORDER, - eCSSKeyword_padding_box, NS_STYLE_FLOAT_EDGE_PADDING, - eCSSKeyword_margin_box, NS_STYLE_FLOAT_EDGE_MARGIN, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontKTable[] = { - eCSSKeyword_caption, NS_STYLE_FONT_CAPTION, // css2 - eCSSKeyword_icon, NS_STYLE_FONT_ICON, - eCSSKeyword_menu, NS_STYLE_FONT_MENU, - eCSSKeyword_message_box, NS_STYLE_FONT_MESSAGE_BOX, - eCSSKeyword_small_caption, NS_STYLE_FONT_SMALL_CAPTION, - eCSSKeyword_status_bar, NS_STYLE_FONT_STATUS_BAR, - eCSSKeyword_window, NS_STYLE_FONT_WINDOW, // css3 - eCSSKeyword_document, NS_STYLE_FONT_DOCUMENT, - eCSSKeyword_workspace, NS_STYLE_FONT_WORKSPACE, - eCSSKeyword_desktop, NS_STYLE_FONT_DESKTOP, - eCSSKeyword_info, NS_STYLE_FONT_INFO, - eCSSKeyword_dialog, NS_STYLE_FONT_DIALOG, - eCSSKeyword_button, NS_STYLE_FONT_BUTTON, - eCSSKeyword_pull_down_menu, NS_STYLE_FONT_PULL_DOWN_MENU, - eCSSKeyword_list, NS_STYLE_FONT_LIST, - eCSSKeyword_field, NS_STYLE_FONT_FIELD, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontSizeKTable[] = { - eCSSKeyword_xx_small, NS_STYLE_FONT_SIZE_XXSMALL, - eCSSKeyword_x_small, NS_STYLE_FONT_SIZE_XSMALL, - eCSSKeyword_small, NS_STYLE_FONT_SIZE_SMALL, - eCSSKeyword_medium, NS_STYLE_FONT_SIZE_MEDIUM, - eCSSKeyword_large, NS_STYLE_FONT_SIZE_LARGE, - eCSSKeyword_x_large, NS_STYLE_FONT_SIZE_XLARGE, - eCSSKeyword_xx_large, NS_STYLE_FONT_SIZE_XXLARGE, - eCSSKeyword_larger, NS_STYLE_FONT_SIZE_LARGER, - eCSSKeyword_smaller, NS_STYLE_FONT_SIZE_SMALLER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontStretchKTable[] = { - eCSSKeyword_wider, NS_STYLE_FONT_STRETCH_WIDER, - eCSSKeyword_narrower, NS_STYLE_FONT_STRETCH_NARROWER, - eCSSKeyword_ultra_condensed, NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED, - eCSSKeyword_extra_condensed, NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED, - eCSSKeyword_condensed, NS_STYLE_FONT_STRETCH_CONDENSED, - eCSSKeyword_semi_condensed, NS_STYLE_FONT_STRETCH_SEMI_CONDENSED, - eCSSKeyword_semi_expanded, NS_STYLE_FONT_STRETCH_SEMI_EXPANDED, - eCSSKeyword_expanded, NS_STYLE_FONT_STRETCH_EXPANDED, - eCSSKeyword_extra_expanded, NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED, - eCSSKeyword_ultra_expanded, NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontStyleKTable[] = { - eCSSKeyword_italic, NS_STYLE_FONT_STYLE_ITALIC, - eCSSKeyword_oblique, NS_STYLE_FONT_STYLE_OBLIQUE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontVariantKTable[] = { - eCSSKeyword_small_caps, NS_STYLE_FONT_VARIANT_SMALL_CAPS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kFontWeightKTable[] = { - eCSSKeyword_bold, NS_STYLE_FONT_WEIGHT_BOLD, - eCSSKeyword_bolder, NS_STYLE_FONT_WEIGHT_BOLDER, - eCSSKeyword_lighter, NS_STYLE_FONT_WEIGHT_LIGHTER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kKeyEquivalentKTable[] = { - -1,-1 -}; - -const PRInt32 nsCSSProps::kListStylePositionKTable[] = { - eCSSKeyword_inside, NS_STYLE_LIST_STYLE_POSITION_INSIDE, - eCSSKeyword_outside, NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kListStyleKTable[] = { - eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC, - eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE, - eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE, - eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL, - eCSSKeyword_decimal_leading_zero, NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO, - eCSSKeyword_lower_roman, NS_STYLE_LIST_STYLE_LOWER_ROMAN, - eCSSKeyword_upper_roman, NS_STYLE_LIST_STYLE_UPPER_ROMAN, - eCSSKeyword_lower_greek, NS_STYLE_LIST_STYLE_LOWER_GREEK, - eCSSKeyword_lower_alpha, NS_STYLE_LIST_STYLE_LOWER_ALPHA, - eCSSKeyword_lower_latin, NS_STYLE_LIST_STYLE_LOWER_LATIN, - eCSSKeyword_upper_alpha, NS_STYLE_LIST_STYLE_UPPER_ALPHA, - eCSSKeyword_upper_latin, NS_STYLE_LIST_STYLE_UPPER_LATIN, - eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW, - eCSSKeyword_armenian, NS_STYLE_LIST_STYLE_ARMENIAN, - eCSSKeyword_georgian, NS_STYLE_LIST_STYLE_GEORGIAN, - eCSSKeyword_cjk_ideographic, NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC, - eCSSKeyword_hiragana, NS_STYLE_LIST_STYLE_HIRAGANA, - eCSSKeyword_katakana, NS_STYLE_LIST_STYLE_KATAKANA, - eCSSKeyword_hiragana_iroha, NS_STYLE_LIST_STYLE_HIRAGANA_IROHA, - eCSSKeyword_katakana_iroha, NS_STYLE_LIST_STYLE_KATAKANA_IROHA, - eCSSKeyword_cjk_heavenly_stem, NS_STYLE_LIST_STYLE_CJK_HEAVENLY_STEM, - eCSSKeyword_cjk_earthly_branch, NS_STYLE_LIST_STYLE_CJK_EARTHLY_BRANCH, - eCSSKeyword_trad_chinese_informal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL, - eCSSKeyword_trad_chinese_formal, NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL, - eCSSKeyword_simp_chinese_informal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL, - eCSSKeyword_simp_chinese_formal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL, - eCSSKeyword_japanese_informal, NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL, - eCSSKeyword_japanese_formal, NS_STYLE_LIST_STYLE_JAPANESE_FORMAL, - eCSSKeyword_arabic_indic, NS_STYLE_LIST_STYLE_ARABIC_INDIC, - eCSSKeyword_persian, NS_STYLE_LIST_STYLE_PERSIAN, - eCSSKeyword_urdu, NS_STYLE_LIST_STYLE_URDU, - eCSSKeyword_devanagari, NS_STYLE_LIST_STYLE_DEVANAGARI, - eCSSKeyword_gurmukhi, NS_STYLE_LIST_STYLE_GURMUKHI, - eCSSKeyword_gujarati, NS_STYLE_LIST_STYLE_GUJARATI, - eCSSKeyword_oriya, NS_STYLE_LIST_STYLE_ORIYA, - eCSSKeyword_kannada, NS_STYLE_LIST_STYLE_KANNADA, - eCSSKeyword_malayalam, NS_STYLE_LIST_STYLE_MALAYALAM, - eCSSKeyword_bengali, NS_STYLE_LIST_STYLE_BENGALI, - eCSSKeyword_tamil, NS_STYLE_LIST_STYLE_TAMIL, - eCSSKeyword_telugu, NS_STYLE_LIST_STYLE_TELUGU, - eCSSKeyword_thai, NS_STYLE_LIST_STYLE_THAI, - eCSSKeyword_lao, NS_STYLE_LIST_STYLE_LAO, - eCSSKeyword_myanmar, NS_STYLE_LIST_STYLE_MYANMAR, - eCSSKeyword_khmer, NS_STYLE_LIST_STYLE_KHMER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kOutlineColorKTable[] = { - eCSSKeyword_invert, NS_STYLE_COLOR_INVERT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kOverflowKTable[] = { - eCSSKeyword_visible, NS_STYLE_OVERFLOW_VISIBLE, - eCSSKeyword_hidden, NS_STYLE_OVERFLOW_HIDDEN, - eCSSKeyword_scroll, NS_STYLE_OVERFLOW_SCROLL, - eCSSKeyword__moz_scrollbars_none, NS_STYLE_OVERFLOW_SCROLLBARS_NONE, - eCSSKeyword__moz_scrollbars_horizontal, NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL, - eCSSKeyword__moz_scrollbars_vertical, NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageBreakKTable[] = { - eCSSKeyword_always, NS_STYLE_PAGE_BREAK_ALWAYS, - eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, - eCSSKeyword_left, NS_STYLE_PAGE_BREAK_LEFT, - eCSSKeyword_right, NS_STYLE_PAGE_BREAK_RIGHT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageBreakInsideKTable[] = { - eCSSKeyword_avoid, NS_STYLE_PAGE_BREAK_AVOID, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageMarksKTable[] = { - eCSSKeyword_crop, NS_STYLE_PAGE_MARKS_CROP, - eCSSKeyword_cross, NS_STYLE_PAGE_MARKS_REGISTER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPageSizeKTable[] = { - eCSSKeyword_landscape, NS_STYLE_PAGE_SIZE_LANDSCAPE, - eCSSKeyword_portrait, NS_STYLE_PAGE_SIZE_PORTRAIT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPitchKTable[] = { - eCSSKeyword_x_low, NS_STYLE_PITCH_X_LOW, - eCSSKeyword_low, NS_STYLE_PITCH_LOW, - eCSSKeyword_medium, NS_STYLE_PITCH_MEDIUM, - eCSSKeyword_high, NS_STYLE_PITCH_HIGH, - eCSSKeyword_x_high, NS_STYLE_PITCH_X_HIGH, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPlayDuringKTable[] = { - eCSSKeyword_mix, NS_STYLE_PLAY_DURING_MIX, - eCSSKeyword_repeat, NS_STYLE_PLAY_DURING_REPEAT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kPositionKTable[] = { - eCSSKeyword_static, NS_STYLE_POSITION_NORMAL, - eCSSKeyword_relative, NS_STYLE_POSITION_RELATIVE, - eCSSKeyword_absolute, NS_STYLE_POSITION_ABSOLUTE, - eCSSKeyword_fixed, NS_STYLE_POSITION_FIXED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kResizerKTable[] = { - eCSSKeyword_both, NS_STYLE_RESIZER_BOTH, - eCSSKeyword_horizontal, NS_STYLE_RESIZER_HORIZONTAL, - eCSSKeyword_vertical, NS_STYLE_RESIZER_VERTICAL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakKTable[] = { - eCSSKeyword_spell_out, NS_STYLE_SPEAK_SPELL_OUT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakHeaderKTable[] = { - eCSSKeyword_once, NS_STYLE_SPEAK_HEADER_ONCE, - eCSSKeyword_always, NS_STYLE_SPEAK_HEADER_ALWAYS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakNumeralKTable[] = { - eCSSKeyword_digits, NS_STYLE_SPEAK_NUMERAL_DIGITS, - eCSSKeyword_continuous, NS_STYLE_SPEAK_NUMERAL_CONTINUOUS, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeakPunctuationKTable[] = { - eCSSKeyword_code, NS_STYLE_SPEAK_PUNCTUATION_CODE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kSpeechRateKTable[] = { - eCSSKeyword_x_slow, NS_STYLE_SPEECH_RATE_X_SLOW, - eCSSKeyword_slow, NS_STYLE_SPEECH_RATE_SLOW, - eCSSKeyword_medium, NS_STYLE_SPEECH_RATE_MEDIUM, - eCSSKeyword_fast, NS_STYLE_SPEECH_RATE_FAST, - eCSSKeyword_x_fast, NS_STYLE_SPEECH_RATE_X_FAST, - eCSSKeyword_faster, NS_STYLE_SPEECH_RATE_FASTER, - eCSSKeyword_slower, NS_STYLE_SPEECH_RATE_SLOWER, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTableLayoutKTable[] = { - eCSSKeyword_fixed, NS_STYLE_TABLE_LAYOUT_FIXED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTextAlignKTable[] = { - eCSSKeyword_left, NS_STYLE_TEXT_ALIGN_LEFT, - eCSSKeyword_right, NS_STYLE_TEXT_ALIGN_RIGHT, - eCSSKeyword_center, NS_STYLE_TEXT_ALIGN_CENTER, - eCSSKeyword_justify, NS_STYLE_TEXT_ALIGN_JUSTIFY, - eCSSKeyword__moz_center, NS_STYLE_TEXT_ALIGN_MOZ_CENTER, - eCSSKeyword__moz_right, NS_STYLE_TEXT_ALIGN_MOZ_RIGHT, - eCSSKeyword_start, NS_STYLE_TEXT_ALIGN_DEFAULT, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTextDecorationKTable[] = { - eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_UNDERLINE, - eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_OVERLINE, - eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_THROUGH, - eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_BLINK, - -1,-1 -}; - -const PRInt32 nsCSSProps::kTextTransformKTable[] = { - eCSSKeyword_capitalize, NS_STYLE_TEXT_TRANSFORM_CAPITALIZE, - eCSSKeyword_lowercase, NS_STYLE_TEXT_TRANSFORM_LOWERCASE, - eCSSKeyword_uppercase, NS_STYLE_TEXT_TRANSFORM_UPPERCASE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUnicodeBidiKTable[] = { - eCSSKeyword_embed, NS_STYLE_UNICODE_BIDI_EMBED, - eCSSKeyword_bidi_override, NS_STYLE_UNICODE_BIDI_OVERRIDE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserFocusKTable[] = { - eCSSKeyword_ignore, NS_STYLE_USER_FOCUS_IGNORE, - eCSSKeyword_select_all, NS_STYLE_USER_FOCUS_SELECT_ALL, - eCSSKeyword_select_before, NS_STYLE_USER_FOCUS_SELECT_BEFORE, - eCSSKeyword_select_after, NS_STYLE_USER_FOCUS_SELECT_AFTER, - eCSSKeyword_select_same, NS_STYLE_USER_FOCUS_SELECT_SAME, - eCSSKeyword_select_menu, NS_STYLE_USER_FOCUS_SELECT_MENU, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserInputKTable[] = { - eCSSKeyword_enabled, NS_STYLE_USER_INPUT_ENABLED, - eCSSKeyword_disabled, NS_STYLE_USER_INPUT_DISABLED, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserModifyKTable[] = { - eCSSKeyword_read_only, NS_STYLE_USER_MODIFY_READ_ONLY, - eCSSKeyword_read_write, NS_STYLE_USER_MODIFY_READ_WRITE, - eCSSKeyword_write_only, NS_STYLE_USER_MODIFY_WRITE_ONLY, - -1,-1 -}; - -const PRInt32 nsCSSProps::kUserSelectKTable[] = { - eCSSKeyword_text, NS_STYLE_USER_SELECT_TEXT, - eCSSKeyword_element, NS_STYLE_USER_SELECT_ELEMENT, - eCSSKeyword_elements, NS_STYLE_USER_SELECT_ELEMENTS, - eCSSKeyword_all, NS_STYLE_USER_SELECT_ALL, - eCSSKeyword_toggle, NS_STYLE_USER_SELECT_TOGGLE, - eCSSKeyword_tri_state, NS_STYLE_USER_SELECT_TRI_STATE, - eCSSKeyword__moz_all, NS_STYLE_USER_SELECT_MOZ_ALL, - -1,-1 -}; - -const PRInt32 nsCSSProps::kVerticalAlignKTable[] = { - eCSSKeyword_baseline, NS_STYLE_VERTICAL_ALIGN_BASELINE, - eCSSKeyword_sub, NS_STYLE_VERTICAL_ALIGN_SUB, - eCSSKeyword_super, NS_STYLE_VERTICAL_ALIGN_SUPER, - eCSSKeyword_top, NS_STYLE_VERTICAL_ALIGN_TOP, - eCSSKeyword_text_top, NS_STYLE_VERTICAL_ALIGN_TEXT_TOP, - eCSSKeyword_middle, NS_STYLE_VERTICAL_ALIGN_MIDDLE, - eCSSKeyword_bottom, NS_STYLE_VERTICAL_ALIGN_BOTTOM, - eCSSKeyword_text_bottom, NS_STYLE_VERTICAL_ALIGN_TEXT_BOTTOM, - -1,-1 -}; - -const PRInt32 nsCSSProps::kVisibilityKTable[] = { - eCSSKeyword_visible, NS_STYLE_VISIBILITY_VISIBLE, - eCSSKeyword_hidden, NS_STYLE_VISIBILITY_HIDDEN, - eCSSKeyword_collapse, NS_STYLE_VISIBILITY_COLLAPSE, - -1,-1 -}; - -const PRInt32 nsCSSProps::kVolumeKTable[] = { - eCSSKeyword_silent, NS_STYLE_VOLUME_SILENT, - eCSSKeyword_x_soft, NS_STYLE_VOLUME_X_SOFT, - eCSSKeyword_soft, NS_STYLE_VOLUME_SOFT, - eCSSKeyword_medium, NS_STYLE_VOLUME_MEDIUM, - eCSSKeyword_loud, NS_STYLE_VOLUME_LOUD, - eCSSKeyword_x_loud, NS_STYLE_VOLUME_X_LOUD, - -1,-1 -}; - -const PRInt32 nsCSSProps::kWhitespaceKTable[] = { - eCSSKeyword_pre, NS_STYLE_WHITESPACE_PRE, - eCSSKeyword_nowrap, NS_STYLE_WHITESPACE_NOWRAP, - eCSSKeyword__moz_pre_wrap, NS_STYLE_WHITESPACE_MOZ_PRE_WRAP, - -1,-1 -}; - -#ifdef INCLUDE_XUL -// Specific keyword tables for XUL.properties -const PRInt32 nsCSSProps::kBoxOrientKTable[] = { - eCSSKeyword_horizontal, NS_STYLE_BOX_ORIENT_HORIZONTAL, - eCSSKeyword_vertical, NS_STYLE_BOX_ORIENT_VERTICAL, - eCSSKeyword_inline_axis, NS_STYLE_BOX_ORIENT_HORIZONTAL, - eCSSKeyword_block_axis, NS_STYLE_BOX_ORIENT_VERTICAL, - -1,-1 -}; -#endif - -PRInt32 -nsCSSProps::SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]) -{ - PRInt32 i = 1; - for (;;) { - if (aTable[i] < 0) { - break; - } - if (aValue == aTable[i]) { - return PRInt32(aTable[i-1]); - } - i += 2; - } - return -1; -} - -const nsCString& -nsCSSProps::SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]) -{ - PRInt32 i = SearchKeywordTableInt(aValue, aTable); - if (i < 0) { - static nsCString sNullStr; - return sNullStr; - } else { - return nsCSSKeywords::GetStringValue(nsCSSKeyword(i)); - } -} - -const nsCString& -nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, PRInt32 aValue) -{ -static const PRInt32 kBackgroundXPositionKTable[] = { - eCSSKeyword_left, 0, - eCSSKeyword_center, 50, - eCSSKeyword_right, 100, - -1,-1 -}; - -static const PRInt32 kBackgroundYPositionKTable[] = { - eCSSKeyword_top, 0, - eCSSKeyword_center, 50, - eCSSKeyword_bottom, 100, - -1,-1 -}; - - switch (aProp) { - - case eCSSProperty__moz_border_radius: - break; - - case eCSSProperty_azimuth: - return SearchKeywordTable(aValue, kAzimuthKTable); - - case eCSSProperty_background: - break; - - case eCSSProperty_background_attachment: - return SearchKeywordTable(aValue, kBackgroundAttachmentKTable); - - case eCSSProperty_background_color: - return SearchKeywordTable(aValue, kBackgroundColorKTable); - - case eCSSProperty_background_image: - break; - - case eCSSProperty_background_position: - break; - - case eCSSProperty_background_repeat: - return SearchKeywordTable(aValue, kBackgroundRepeatKTable); - - case eCSSProperty_background_x_position: - return SearchKeywordTable(aValue, kBackgroundXPositionKTable); - - case eCSSProperty_background_y_position: - return SearchKeywordTable(aValue, kBackgroundYPositionKTable); - - case eCSSProperty_behavior: - break; - - case eCSSProperty_border: - break; - - case eCSSProperty_border_collapse: - return SearchKeywordTable(aValue, kBorderCollapseKTable); - -#ifdef INCLUDE_XUL - case eCSSProperty_box_orient: - return SearchKeywordTable(aValue, kBoxOrientKTable); -#endif - - case eCSSProperty_box_sizing: - return SearchKeywordTable(aValue, kBoxSizingKTable); - - case eCSSProperty_border_color: - case eCSSProperty_border_spacing: - case eCSSProperty_border_style: - case eCSSProperty_border_bottom: - case eCSSProperty_border_left: - case eCSSProperty_border_right: - case eCSSProperty_border_top: - break; - - case eCSSProperty_border_bottom_color: - case eCSSProperty_border_left_color: - case eCSSProperty_border_right_color: - case eCSSProperty_border_top_color: - return SearchKeywordTable(aValue, kBorderColorKTable); - - case eCSSProperty_border_bottom_style: - case eCSSProperty_border_left_style: - case eCSSProperty_border_right_style: - case eCSSProperty_border_top_style: - return SearchKeywordTable(aValue, kBorderStyleKTable); - - case eCSSProperty_border_bottom_width: - case eCSSProperty_border_left_width: - case eCSSProperty_border_right_width: - case eCSSProperty_border_top_width: - return SearchKeywordTable(aValue, kBorderWidthKTable); - - case eCSSProperty_border_width: - case eCSSProperty_border_x_spacing: - case eCSSProperty_border_y_spacing: - case eCSSProperty_bottom: - break; - - case eCSSProperty_caption_side: - return SearchKeywordTable(aValue, kCaptionSideKTable); - - case eCSSProperty_clear: - return SearchKeywordTable(aValue, kClearKTable); - - case eCSSProperty_clip: - case eCSSProperty_clip_bottom: - case eCSSProperty_clip_left: - case eCSSProperty_clip_right: - case eCSSProperty_clip_top: - case eCSSProperty_color: - break; - - case eCSSProperty_content: - return SearchKeywordTable(aValue, kContentKTable); - - case eCSSProperty_counter_increment: - case eCSSProperty_counter_reset: - case eCSSProperty_cue: - case eCSSProperty_cue_after: - case eCSSProperty_cue_before: - break; - - case eCSSProperty_cursor: - return SearchKeywordTable(aValue, kCursorKTable); - - case eCSSProperty_direction: - return SearchKeywordTable(aValue, kDirectionKTable); - - case eCSSProperty_display: - return SearchKeywordTable(aValue, kDisplayKTable); - - case eCSSProperty_elevation: - return SearchKeywordTable(aValue, kElevationKTable); - - case eCSSProperty_empty_cells: - return SearchKeywordTable(aValue, kEmptyCellsKTable); - - case eCSSProperty_float: - return SearchKeywordTable(aValue, kFloatKTable); - - case eCSSProperty_float_edge: - return SearchKeywordTable(aValue, kFloatEdgeKTable); - - case eCSSProperty_font: - break; - - case eCSSProperty_font_family: - return SearchKeywordTable(aValue, kFontKTable); - - case eCSSProperty_font_size: - return SearchKeywordTable(aValue, kFontSizeKTable); - - case eCSSProperty_font_size_adjust: - break; - - case eCSSProperty_font_stretch: - return SearchKeywordTable(aValue, kFontStretchKTable); - - case eCSSProperty_font_style: - return SearchKeywordTable(aValue, kFontStyleKTable); - - case eCSSProperty_font_variant: - return SearchKeywordTable(aValue, kFontVariantKTable); - - case eCSSProperty_font_weight: - return SearchKeywordTable(aValue, kFontWeightKTable); - - case eCSSProperty_height: - break; - - case eCSSProperty_key_equivalent: - return SearchKeywordTable(aValue, kKeyEquivalentKTable); - - case eCSSProperty_left: - case eCSSProperty_letter_spacing: - case eCSSProperty_line_height: - case eCSSProperty_list_style: - case eCSSProperty_list_style_image: - break; - - case eCSSProperty_list_style_position: - return SearchKeywordTable(aValue, kListStylePositionKTable); - - case eCSSProperty_list_style_type: - return SearchKeywordTable(aValue, kListStyleKTable); - - case eCSSProperty_margin: - case eCSSProperty_margin_bottom: - case eCSSProperty_margin_left: - case eCSSProperty_margin_right: - case eCSSProperty_margin_top: - case eCSSProperty_marker_offset: - break; - - case eCSSProperty_marks: - return SearchKeywordTable(aValue, kPageMarksKTable); - - case eCSSProperty_max_height: - case eCSSProperty_max_width: - case eCSSProperty_min_height: - case eCSSProperty_min_width: - break; - - case eCSSProperty_opacity: - case eCSSProperty_orphans: - case eCSSProperty_outline: - break; - - case eCSSProperty_outline_color: - return SearchKeywordTable(aValue, kOutlineColorKTable); - - case eCSSProperty_outline_style: - return SearchKeywordTable(aValue, kBorderStyleKTable); - - case eCSSProperty_outline_width: - return SearchKeywordTable(aValue, kBorderWidthKTable); - - case eCSSProperty_overflow: - return SearchKeywordTable(aValue, kOverflowKTable); - - case eCSSProperty_padding: - case eCSSProperty_padding_bottom: - case eCSSProperty_padding_left: - case eCSSProperty_padding_right: - case eCSSProperty_padding_top: - case eCSSProperty_page: - break; - - case eCSSProperty_page_break_before: - case eCSSProperty_page_break_after: - return SearchKeywordTable(aValue, kPageBreakKTable); - - case eCSSProperty_page_break_inside: - return SearchKeywordTable(aValue, kPageBreakInsideKTable); - - case eCSSProperty_pause: - case eCSSProperty_pause_after: - case eCSSProperty_pause_before: - break; - - case eCSSProperty_pitch: - return SearchKeywordTable(aValue, kPitchKTable); - - case eCSSProperty_pitch_range: - case eCSSProperty_play_during: - break; - - case eCSSProperty_play_during_flags: - return SearchKeywordTable(aValue, kPlayDuringKTable); - - case eCSSProperty_position: - return SearchKeywordTable(aValue, kPositionKTable); - - case eCSSProperty_quotes: - case eCSSProperty_quotes_close: - case eCSSProperty_quotes_open: - break; - - case eCSSProperty_resizer: - return SearchKeywordTable(aValue, kResizerKTable); - - case eCSSProperty_richness: - case eCSSProperty_right: - break; - - case eCSSProperty_size: - break; - - case eCSSProperty_size_height: - case eCSSProperty_size_width: - return SearchKeywordTable(aValue, kPageSizeKTable); - - case eCSSProperty_speak: - return SearchKeywordTable(aValue, kSpeakKTable); - - case eCSSProperty_speak_header: - return SearchKeywordTable(aValue, kSpeakHeaderKTable); - - case eCSSProperty_speak_numeral: - return SearchKeywordTable(aValue, kSpeakNumeralKTable); - - case eCSSProperty_speak_punctuation: - return SearchKeywordTable(aValue, kSpeakPunctuationKTable); - - case eCSSProperty_speech_rate: - return SearchKeywordTable(aValue, kSpeechRateKTable); - - case eCSSProperty_stress: - break; - - case eCSSProperty_table_layout: - return SearchKeywordTable(aValue, kTableLayoutKTable); - - case eCSSProperty_text_align: - return SearchKeywordTable(aValue, kTextAlignKTable); - - case eCSSProperty_text_decoration: - return SearchKeywordTable(aValue, kTextDecorationKTable); - - case eCSSProperty_text_indent: - case eCSSProperty_text_shadow: - case eCSSProperty_text_shadow_color: - case eCSSProperty_text_shadow_radius: - case eCSSProperty_text_shadow_x: - case eCSSProperty_text_shadow_y: - break; - - case eCSSProperty_text_transform: - return SearchKeywordTable(aValue, kTextTransformKTable); - - case eCSSProperty_top: - break; - - case eCSSProperty_unicode_bidi: - return SearchKeywordTable(aValue, kUnicodeBidiKTable); - - case eCSSProperty_user_focus: - return SearchKeywordTable(aValue, kUserFocusKTable); - - case eCSSProperty_user_input: - return SearchKeywordTable(aValue, kUserInputKTable); - - case eCSSProperty_user_modify: - return SearchKeywordTable(aValue, kUserModifyKTable); - - case eCSSProperty_user_select: - return SearchKeywordTable(aValue, kUserSelectKTable); - - case eCSSProperty_vertical_align: - return SearchKeywordTable(aValue, kVerticalAlignKTable); - - case eCSSProperty_visibility: - return SearchKeywordTable(aValue, kVisibilityKTable); - - case eCSSProperty_voice_family: - break; - - case eCSSProperty_volume: - return SearchKeywordTable(aValue, kVolumeKTable); - - case eCSSProperty_white_space: - return SearchKeywordTable(aValue, kWhitespaceKTable); - - case eCSSProperty_widows: - case eCSSProperty_width: - case eCSSProperty_word_spacing: - case eCSSProperty_z_index: - break; - -// no default case, let the compiler help find missing values - case eCSSProperty_UNKNOWN: - case eCSSProperty_COUNT: - NS_ERROR("invalid property"); - break; - } - static nsCString sNullStr; - return sNullStr; -} - -PRBool nsCSSProps::GetColorName(PRInt32 aPropValue, nsCString &aStr) -{ - PRBool rv = PR_FALSE; - PRInt32 keyword = -1; - - // first get the keyword corresponding to the property Value from the color table - keyword = SearchKeywordTableInt(aPropValue, kColorKTable); - - // next get the name as a string from the keywords table - if (keyword >= 0) { - nsCSSKeywords::AddRefTable(); - aStr = nsCSSKeywords::GetStringValue((nsCSSKeyword)keyword); - nsCSSKeywords::ReleaseTable(); - rv = PR_TRUE; - } - return rv; -} - -// define array of all CSS property hints -#define CSS_PROP(_name, _id, _hint) NS_STYLE_HINT_##_hint, -const PRInt32 nsCSSProps::kHintTable[eCSSProperty_COUNT] = { -#include "nsCSSPropList.h" -}; -#undef CSS_PROP - diff --git a/mozilla/layout/html/style/src/nsCSSProps.h b/mozilla/layout/html/style/src/nsCSSProps.h deleted file mode 100644 index 93b43834b84..00000000000 --- a/mozilla/layout/html/style/src/nsCSSProps.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSProps_h___ -#define nsCSSProps_h___ - -#include "nslayout.h" -#include "nsString.h" - -/* - Declare the enum list using the magic of preprocessing - enum values are "eCSSProperty_foo" (where foo is the property) - - To change the list of properties, see nsCSSPropList.h - - */ -#define CSS_PROP(_name, _id, _hint) eCSSProperty_##_id, -enum nsCSSProperty { - eCSSProperty_UNKNOWN = -1, -#include "nsCSSPropList.h" - eCSSProperty_COUNT -}; -#undef CSS_PROP - - -class NS_LAYOUT nsCSSProps { -public: - static void AddRefTable(void); - static void ReleaseTable(void); - - // Given a property string, return the enum value - static nsCSSProperty LookupProperty(const nsAReadableString& aProperty); - static nsCSSProperty LookupProperty(const nsCString& aProperty); - - // Given a property enum, get the string value - static const nsCString& GetStringValue(nsCSSProperty aProperty); - - // Given a CSS Property and a Property Enum Value - // Return back a const nsString& representation of the - // value. Return back nullstr if no value is found - static const nsCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue); - - // Get a color name for a predefined color value like buttonhighlight or activeborder - // Sets the aStr param to the name of the propertyID - static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr); - - static const PRInt32 kHintTable[]; - - static PRInt32 SearchKeywordTableInt(PRInt32 aValue, const PRInt32 aTable[]); - static const nsCString& SearchKeywordTable(PRInt32 aValue, const PRInt32 aTable[]); - - // Keyword/Enum value tables - static const PRInt32 kAzimuthKTable[]; - static const PRInt32 kBackgroundAttachmentKTable[]; - static const PRInt32 kBackgroundColorKTable[]; - static const PRInt32 kBackgroundRepeatKTable[]; - static const PRInt32 kBorderCollapseKTable[]; - static const PRInt32 kBorderColorKTable[]; - static const PRInt32 kBorderStyleKTable[]; - static const PRInt32 kBorderWidthKTable[]; -#ifdef INCLUDE_XUL - static const PRInt32 kBoxOrientKTable[]; -#endif - static const PRInt32 kBoxSizingKTable[]; - static const PRInt32 kCaptionSideKTable[]; - static const PRInt32 kClearKTable[]; - static const PRInt32 kColorKTable[]; - static const PRInt32 kContentKTable[]; - static const PRInt32 kCursorKTable[]; - static const PRInt32 kDirectionKTable[]; - static const PRInt32 kDisplayKTable[]; - static const PRInt32 kElevationKTable[]; - static const PRInt32 kEmptyCellsKTable[]; - static const PRInt32 kFloatKTable[]; - static const PRInt32 kFloatEdgeKTable[]; - static const PRInt32 kFontKTable[]; - static const PRInt32 kFontSizeKTable[]; - static const PRInt32 kFontStretchKTable[]; - static const PRInt32 kFontStyleKTable[]; - static const PRInt32 kFontVariantKTable[]; - static const PRInt32 kFontWeightKTable[]; - static const PRInt32 kKeyEquivalentKTable[]; - static const PRInt32 kListStylePositionKTable[]; - static const PRInt32 kListStyleKTable[]; - static const PRInt32 kOutlineColorKTable[]; - static const PRInt32 kOverflowKTable[]; - static const PRInt32 kPageBreakKTable[]; - static const PRInt32 kPageBreakInsideKTable[]; - static const PRInt32 kPageMarksKTable[]; - static const PRInt32 kPageSizeKTable[]; - static const PRInt32 kPitchKTable[]; - static const PRInt32 kPlayDuringKTable[]; - static const PRInt32 kPositionKTable[]; - static const PRInt32 kResizerKTable[]; - static const PRInt32 kSpeakKTable[]; - static const PRInt32 kSpeakHeaderKTable[]; - static const PRInt32 kSpeakNumeralKTable[]; - static const PRInt32 kSpeakPunctuationKTable[]; - static const PRInt32 kSpeechRateKTable[]; - static const PRInt32 kTableLayoutKTable[]; - static const PRInt32 kTextAlignKTable[]; - static const PRInt32 kTextDecorationKTable[]; - static const PRInt32 kTextTransformKTable[]; - static const PRInt32 kUnicodeBidiKTable[]; - static const PRInt32 kUserFocusKTable[]; - static const PRInt32 kUserInputKTable[]; - static const PRInt32 kUserModifyKTable[]; - static const PRInt32 kUserSelectKTable[]; - static const PRInt32 kVerticalAlignKTable[]; - static const PRInt32 kVisibilityKTable[]; - static const PRInt32 kVolumeKTable[]; - static const PRInt32 kWhitespaceKTable[]; -}; - -#endif /* nsCSSProps_h___ */ diff --git a/mozilla/layout/html/style/src/nsCSSScanner.cpp b/mozilla/layout/html/style/src/nsCSSScanner.cpp deleted file mode 100644 index f83aa7aadd6..00000000000 --- a/mozilla/layout/html/style/src/nsCSSScanner.cpp +++ /dev/null @@ -1,897 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#include "nsCSSScanner.h" -#include "nsIInputStream.h" -#include "nsIUnicharInputStream.h" -#include "nsString.h" -#include "nsCRT.h" - -#ifdef NS_DEBUG -static char* kNullPointer = "null pointer"; -#endif - -#ifdef CSS_REPORT_PARSE_ERRORS -#include "nsCOMPtr.h" -#include "nsIServiceManager.h" -#include "nsReadableUtils.h" -#include "nsIURI.h" -#include "nsIConsoleService.h" -#include "nsIScriptError.h" -#include "nsComponentManagerUtils.h" // put this higher and gcc barfs... -#endif - -// Don't bother collecting whitespace characters in token's mIdent buffer -#undef COLLECT_WHITESPACE - -#define BUFFER_SIZE 256 - -static const PRUnichar CSS_ESCAPE = PRUnichar('\\'); - -static const PRUint8 IS_LATIN1 = 0x01; -static const PRUint8 IS_DIGIT = 0x02; -static const PRUint8 IS_HEX_DIGIT = 0x04; -static const PRUint8 IS_ALPHA = 0x08; -static const PRUint8 START_IDENT = 0x10; -static const PRUint8 IS_IDENT = 0x20; -static const PRUint8 IS_WHITESPACE = 0x40; - -static PRBool gLexTableSetup = PR_FALSE; -static PRUint8 gLexTable[256]; - -static void BuildLexTable() -{ - gLexTableSetup = PR_TRUE; - - PRUint8* lt = gLexTable; - int i; - lt[CSS_ESCAPE] = START_IDENT; - lt['-'] |= IS_IDENT; - // XXX add in other whitespace chars - lt[' '] |= IS_WHITESPACE; // space - lt['\t'] |= IS_WHITESPACE; // horizontal tab - lt['\v'] |= IS_WHITESPACE; // vertical tab - lt['\r'] |= IS_WHITESPACE; // carriage return - lt['\n'] |= IS_WHITESPACE; // line feed - lt['\f'] |= IS_WHITESPACE; // form feed - for (i = 161; i <= 255; i++) { - lt[i] |= IS_LATIN1 | IS_IDENT | START_IDENT; - } - for (i = '0'; i <= '9'; i++) { - lt[i] |= IS_DIGIT | IS_HEX_DIGIT | IS_IDENT; - } - for (i = 'A'; i <= 'Z'; i++) { - if ((i >= 'A') && (i <= 'F')) { - lt[i] |= IS_HEX_DIGIT; - lt[i+32] |= IS_HEX_DIGIT; - } - lt[i] |= IS_ALPHA | IS_IDENT | START_IDENT; - lt[i+32] |= IS_ALPHA | IS_IDENT | START_IDENT; - } -} - -nsCSSToken::nsCSSToken() -{ - mType = eCSSToken_Symbol; -} - -void -nsCSSToken::AppendToString(nsString& aBuffer) -{ - switch (mType) { - case eCSSToken_AtKeyword: - aBuffer.Append(PRUnichar('@')); // fall through intentional - case eCSSToken_Ident: - case eCSSToken_WhiteSpace: - case eCSSToken_Function: - case eCSSToken_URL: - case eCSSToken_InvalidURL: - case eCSSToken_HTMLComment: - aBuffer.Append(mIdent); - break; - case eCSSToken_Number: - if (mIntegerValid) { - aBuffer.AppendInt(mInteger, 10); - } - else { - aBuffer.AppendFloat(mNumber); - } - break; - case eCSSToken_Percentage: - if (mIntegerValid) { - aBuffer.AppendInt(mInteger, 10); - } - else { - aBuffer.AppendFloat(mNumber); - } - aBuffer.Append(PRUnichar('%')); // STRING USE WARNING: technically, this should be |AppendWithConversion| - break; - case eCSSToken_Dimension: - if (mIntegerValid) { - aBuffer.AppendInt(mInteger, 10); - } - else { - aBuffer.AppendFloat(mNumber); - } - aBuffer.Append(mIdent); - break; - case eCSSToken_String: - aBuffer.Append(mSymbol); - aBuffer.Append(mIdent); // fall through intentional - case eCSSToken_Symbol: - aBuffer.Append(mSymbol); - break; - case eCSSToken_ID: - aBuffer.Append(PRUnichar('#')); - aBuffer.Append(mIdent); - break; - case eCSSToken_Includes: - aBuffer.Append(PRUnichar('~')); - aBuffer.Append(PRUnichar('=')); - break; - case eCSSToken_Dashmatch: - aBuffer.Append(PRUnichar('|')); - aBuffer.Append(PRUnichar('=')); - break; - - default: - NS_ERROR("invalid token type"); - break; - } -} - -MOZ_DECL_CTOR_COUNTER(nsCSSScanner) - -nsCSSScanner::nsCSSScanner() -{ - MOZ_COUNT_CTOR(nsCSSScanner); - if (!gLexTableSetup) { - // XXX need a monitor - BuildLexTable(); - } - mInput = nsnull; - mBuffer = new PRUnichar[BUFFER_SIZE]; - mOffset = 0; - mCount = 0; - mPushback = mLocalPushback; - mPushbackCount = 0; - mPushbackSize = 4; - mLineNumber = 1; - mLastRead = 0; -} - -nsCSSScanner::~nsCSSScanner() -{ - MOZ_COUNT_DTOR(nsCSSScanner); - Close(); - if (nsnull != mBuffer) { - delete [] mBuffer; - mBuffer = nsnull; - } - if (mLocalPushback != mPushback) { - delete [] mPushback; - } -} - -void nsCSSScanner::Init(nsIUnicharInputStream* aInput) -{ - NS_PRECONDITION(nsnull != aInput, kNullPointer); - Close(); - mInput = aInput; - NS_IF_ADDREF(aInput); -} - -#ifdef CSS_REPORT_PARSE_ERRORS - -void nsCSSScanner::InitErrorReporting(nsIURI* aURI) -{ - if (aURI) { - aURI->GetSpec(getter_Copies(mFileName)); - } else { - mFileName = "from DOM"; - } - mColNumber = 0; -} - -void nsCSSScanner::ReportError(const nsAReadableString& aError) -{ - printf("CSS Error (%s :%u.%u): %s.\n", - mFileName.get(), - mLineNumber, - mColNumber, - NS_ConvertUCS2toUTF8(aError).GetBuffer()); - - // Log it to the JavaScript console - nsCOMPtr consoleService - (do_GetService("@mozilla.org/consoleservice;1")); - nsCOMPtr errorObject - (do_CreateInstance("@mozilla.org/scripterror;1")); - - if (consoleService && errorObject) { - nsresult rv; - PRUnichar *error = ToNewUnicode(aError); - rv = errorObject->Init(error, - NS_ConvertASCIItoUCS2(mFileName.get()).GetUnicode(), - NS_LITERAL_STRING(""), - mLineNumber, - mColNumber, - 0, - "CSS Parser"); - nsMemory::Free(error); - if (NS_SUCCEEDED(rv)) - consoleService->LogMessage(errorObject); - } - -} - -#endif // CSS_REPORT_PARSE_ERRORS - -PRUint32 nsCSSScanner::GetLineNumber() -{ - return mLineNumber; -} - -void nsCSSScanner::Close() -{ - NS_IF_RELEASE(mInput); -} - -#ifdef CSS_REPORT_PARSE_ERRORS -#define TAB_STOP_WIDTH 8 -#endif - -// Returns -1 on error or eof -PRInt32 nsCSSScanner::Read(PRInt32& aErrorCode) -{ - PRInt32 rv; - if (0 < mPushbackCount) { - rv = PRInt32(mPushback[--mPushbackCount]); - } else { - if (mCount < 0) { - return -1; - } - if (mOffset == mCount) { - mOffset = 0; - aErrorCode = mInput->Read(mBuffer, 0, BUFFER_SIZE, (PRUint32*)&mCount); - if (NS_FAILED(aErrorCode) || mCount == 0) { - mCount = 0; - return -1; - } - } - rv = PRInt32(mBuffer[mOffset++]); - if (((rv == '\n') && (mLastRead != '\r')) || (rv == '\r')) { - mLineNumber++; -#ifdef CSS_REPORT_PARSE_ERRORS - mColNumber = 0; -#endif - } -#ifdef CSS_REPORT_PARSE_ERRORS - else if (rv == '\t') { - mColNumber = ((mColNumber - 1 + TAB_STOP_WIDTH) / TAB_STOP_WIDTH) - * TAB_STOP_WIDTH; - } else if (rv != '\n') { - mColNumber++; - } -#endif - } - mLastRead = rv; -//printf("Read => %x\n", rv); - return rv; -} - -PRInt32 nsCSSScanner::Peek(PRInt32& aErrorCode) -{ - if (0 == mPushbackCount) { - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - return -1; - } - mPushback[0] = PRUnichar(ch); - mPushbackCount++; - } -//printf("Peek => %x\n", mLookAhead); - return PRInt32(mPushback[mPushbackCount - 1]); -} - -void nsCSSScanner::Unread() -{ - NS_PRECONDITION((mLastRead >= 0), "double pushback"); - Pushback(PRUnichar(mLastRead)); - mLastRead = -1; -} - -void nsCSSScanner::Pushback(PRUnichar aChar) -{ - if (mPushbackCount == mPushbackSize) { // grow buffer - PRUnichar* newPushback = new PRUnichar[mPushbackSize + 4]; - if (nsnull == newPushback) { - return; - } - mPushbackSize += 4; - nsCRT::memcpy(newPushback, mPushback, sizeof(PRUnichar) * mPushbackCount); - if (mPushback != mLocalPushback) { - delete [] mPushback; - } - mPushback = newPushback; - } - mPushback[mPushbackCount++] = aChar; -} - -PRBool nsCSSScanner::LookAhead(PRInt32& aErrorCode, PRUnichar aChar) -{ - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - return PR_FALSE; - } - if (ch == aChar) { - return PR_TRUE; - } - Unread(); - return PR_FALSE; -} - -PRBool nsCSSScanner::EatWhiteSpace(PRInt32& aErrorCode) -{ - PRBool eaten = PR_FALSE; - for (;;) { - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - break; - } - if ((ch == ' ') || (ch == '\n') || (ch == '\r') || (ch == '\t')) { - eaten = PR_TRUE; - continue; - } - Unread(); - break; - } - return eaten; -} - -PRBool nsCSSScanner::EatNewline(PRInt32& aErrorCode) -{ - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - return PR_FALSE; - } - PRBool eaten = PR_FALSE; - if (ch == '\r') { - eaten = PR_TRUE; - ch = Peek(aErrorCode); - if (ch == '\n') { - (void) Read(aErrorCode); - } - } else if (ch == '\n') { - eaten = PR_TRUE; - } else { - Unread(); - } - return eaten; -} - -PRBool nsCSSScanner::Next(PRInt32& aErrorCode, nsCSSToken& aToken) -{ - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - return PR_FALSE; - } - if (ch < 256) { - PRUint8* lexTable = gLexTable; - - // IDENT - if ((lexTable[ch] & START_IDENT) != 0) { - return ParseIdent(aErrorCode, ch, aToken); - } - if (ch == '-') { // possible ident - PRInt32 nextChar = Peek(aErrorCode); - if ((0 <= nextChar) && (0 != (lexTable[nextChar] & START_IDENT))) { - return ParseIdent(aErrorCode, ch, aToken); - } - } - - // AT_KEYWORD - if (ch == '@') { - PRInt32 nextChar = Peek(aErrorCode); - if ((nextChar >= 0) && (nextChar <= 255)) { - if ((lexTable[nextChar] & START_IDENT) != 0) { - return ParseAtKeyword(aErrorCode, ch, aToken); - } - } - } - - // NUMBER or DIM - if ((ch == '.') || (ch == '+') || (ch == '-')) { - PRInt32 nextChar = Peek(aErrorCode); - if ((nextChar >= 0) && (nextChar <= 255)) { - if ((lexTable[nextChar] & IS_DIGIT) != 0) { - return ParseNumber(aErrorCode, ch, aToken); - } - else if (('.' == nextChar) && ('.' != ch)) { - PRInt32 holdNext = Read(aErrorCode); - nextChar = Peek(aErrorCode); - if ((0 <= nextChar) && (nextChar <= 255)) { - if ((lexTable[nextChar] & IS_DIGIT) != 0) { - Pushback(holdNext); - return ParseNumber(aErrorCode, ch, aToken); - } - } - Pushback(holdNext); - } - } - } - if ((lexTable[ch] & IS_DIGIT) != 0) { - return ParseNumber(aErrorCode, ch, aToken); - } - - // ID - if (ch == '#') { - return ParseID(aErrorCode, ch, aToken); - } - - // STRING - if ((ch == '"') || (ch == '\'')) { - return ParseString(aErrorCode, ch, aToken); - } - - // WS - if ((lexTable[ch] & IS_WHITESPACE) != 0) { - aToken.mType = eCSSToken_WhiteSpace; - aToken.mIdent.SetLength(0); - aToken.mIdent.Append(PRUnichar(ch)); - (void) EatWhiteSpace(aErrorCode); - return PR_TRUE; - } - if (ch == '/') { - PRInt32 nextChar = Peek(aErrorCode); - if (nextChar == '*') { - (void) Read(aErrorCode); - aToken.mIdent.SetLength(0); - aToken.mIdent.Append(PRUnichar(ch)); - aToken.mIdent.Append(PRUnichar(nextChar)); - return ParseCComment(aErrorCode, aToken); - } - } - if (ch == '<') { // consume HTML comment tags - if (LookAhead(aErrorCode, '!')) { - if (LookAhead(aErrorCode, '-')) { - if (LookAhead(aErrorCode, '-')) { - aToken.mType = eCSSToken_HTMLComment; - aToken.mIdent.SetLength(0); - aToken.mIdent.Append(PRUnichar('<')); - aToken.mIdent.Append(PRUnichar('!')); - aToken.mIdent.Append(PRUnichar('-')); - aToken.mIdent.Append(PRUnichar('-')); - return PR_TRUE; - } - Pushback('-'); - } - Pushback('!'); - } - } - if (ch == '-') { // check for HTML comment end - if (LookAhead(aErrorCode, '-')) { - if (LookAhead(aErrorCode, '>')) { - aToken.mType = eCSSToken_HTMLComment; - aToken.mIdent.SetLength(0); - aToken.mIdent.AppendWithConversion('-'); - aToken.mIdent.AppendWithConversion('-'); - aToken.mIdent.AppendWithConversion('>'); - return PR_TRUE; - } - Pushback('-'); - } - } - - // INCLUDES ("~=") and DASHMATCH ("|=") - if (( ch == '|' ) || ( ch == '~')) { - PRInt32 nextChar = Read(aErrorCode); - if ( nextChar == '=' ) { - aToken.mType = (ch == '~') ? eCSSToken_Includes : eCSSToken_Dashmatch; - return PR_TRUE; - } else { - Pushback(nextChar); - } - } - } else { - return ParseIdent(aErrorCode, ch, aToken); - } - aToken.mType = eCSSToken_Symbol; - aToken.mSymbol = ch; - return PR_TRUE; -} - -PRBool nsCSSScanner::NextURL(PRInt32& aErrorCode, nsCSSToken& aToken) -{ - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - return PR_FALSE; - } - if (ch < 256) { - PRUint8* lexTable = gLexTable; - - // STRING - if ((ch == '"') || (ch == '\'')) { - return ParseString(aErrorCode, ch, aToken); - } - - // WS - if ((lexTable[ch] & IS_WHITESPACE) != 0) { - aToken.mType = eCSSToken_WhiteSpace; - aToken.mIdent.SetLength(0); - aToken.mIdent.Append(PRUnichar(ch)); - (void) EatWhiteSpace(aErrorCode); - return PR_TRUE; - } - if (ch == '/') { - PRInt32 nextChar = Peek(aErrorCode); - if (nextChar == '*') { - (void) Read(aErrorCode); - aToken.mIdent.SetLength(0); - aToken.mIdent.Append(PRUnichar(ch)); - aToken.mIdent.Append(PRUnichar(nextChar)); - return ParseCComment(aErrorCode, aToken); - } - } - - // Process a url lexical token. A CSS1 url token can contain - // characters beyond identifier characters (e.g. '/', ':', etc.) - // Because of this the normal rules for tokenizing the input don't - // apply very well. To simplify the parser and relax some of the - // requirements on the scanner we parse url's here. If we find a - // malformed URL then we emit a token of type "InvalidURL" so that - // the CSS1 parser can ignore the invalid input. We attempt to eat - // the right amount of input data when an invalid URL is presented. - - aToken.mType = eCSSToken_InvalidURL; - nsString& ident = aToken.mIdent; - ident.SetLength(0); - - if (ch == ')') { - Pushback(ch); - // empty url spec: this is invalid - } else { - // start of a non-quoted url - Pushback(ch); - PRBool ok = PR_TRUE; - for (;;) { - ch = Read(aErrorCode); - if (ch < 0) break; - if (ch == CSS_ESCAPE) { - ch = ParseEscape(aErrorCode); - if (0 < ch) { - ident.Append(PRUnichar(ch)); - } - } else if ((ch == '"') || (ch == '\'') || (ch == '(')) { - // This is an invalid URL spec - ok = PR_FALSE; - } else if ((256 >= ch) && ((gLexTable[ch] & IS_WHITESPACE) != 0)) { - // Whitespace is allowed at the end of the URL - (void) EatWhiteSpace(aErrorCode); - if (LookAhead(aErrorCode, ')')) { - Pushback(')'); // leave the closing symbol - // done! - break; - } - // Whitespace is followed by something other than a - // ")". This is an invalid url spec. - ok = PR_FALSE; - } else if (ch == ')') { - Unread(); - // All done - break; - } else { - // A regular url character. - ident.Append(PRUnichar(ch)); - } - } - - // If the result of the above scanning is ok then change the token - // type to a useful one. - if (ok) { - aToken.mType = eCSSToken_URL; - } - } - } - return PR_TRUE; -} - - -PRInt32 nsCSSScanner::ParseEscape(PRInt32& aErrorCode) -{ - PRUint8* lexTable = gLexTable; - PRInt32 ch = Peek(aErrorCode); - if (ch < 0) { - return CSS_ESCAPE; - } - if ((ch <= 255) && ((lexTable[ch] & IS_HEX_DIGIT) != 0)) { - PRInt32 rv = 0; - int i; - for (i = 0; i < 6; i++) { // up to six digits - ch = Read(aErrorCode); - if (ch < 0) { - // Whoops: error or premature eof - break; - } - if ((lexTable[ch] & IS_HEX_DIGIT) != 0) { - if ((lexTable[ch] & IS_DIGIT) != 0) { - rv = rv * 16 + (ch - '0'); - } else { - // Note: c&7 just keeps the low three bits which causes - // upper and lower case alphabetics to both yield their - // "relative to 10" value for computing the hex value. - rv = rv * 16 + ((ch & 0x7) + 9); - } - } - else if ((lexTable[ch] & IS_WHITESPACE) != 0) { // single space ends escape - if (ch == '\r') { // if CR/LF, eat LF too - ch = Peek(aErrorCode); - if (ch == '\n') { - ch = Read(aErrorCode); - } - } - break; - } - else { - Unread(); - break; - } - } - if (6 == i) { // look for trailing whitespace and eat it - ch = Peek(aErrorCode); - if ((0 <= ch) && (ch <= 255) && - ((lexTable[ch] & IS_WHITESPACE) != 0)) { - ch = Read(aErrorCode); - // special case: if trailing whitespace is CR/LF, eat both chars (not part of spec, but should be) - if (ch == '\r') { - ch = Peek(aErrorCode); - if (ch == '\n') { - ch = Read(aErrorCode); - } - } - } - } - return rv; - } else { - // "Any character except a hexidecimal digit can be escaped to - // remove its special meaning by putting a backslash in front" - // -- CSS1 spec section 7.1 - if (EatNewline(aErrorCode)) { // skip escaped newline - ch = 0; - } - else { - (void) Read(aErrorCode); - } - return ch; - } -} - -/** - * Gather up the characters in an identifier. The identfier was - * started by "aChar" which will be appended to aIdent. The result - * will be aIdent with all of the identifier characters appended - * until the first non-identifier character is seen. The termination - * character is unread for the future re-reading. - */ -PRBool nsCSSScanner::GatherIdent(PRInt32& aErrorCode, PRInt32 aChar, - nsString& aIdent) -{ - if (aChar == CSS_ESCAPE) { - aChar = ParseEscape(aErrorCode); - } - if (0 < aChar) { - aIdent.Append(PRUnichar(aChar)); - } - for (;;) { - aChar = Read(aErrorCode); - if (aChar < 0) break; - if (aChar == CSS_ESCAPE) { - aChar = ParseEscape(aErrorCode); - if (0 < aChar) { - aIdent.Append(PRUnichar(aChar)); - } - } else if ((aChar > 255) || ((gLexTable[aChar] & IS_IDENT) != 0)) { - aIdent.Append(PRUnichar(aChar)); - } else { - Unread(); - break; - } - } - return PR_TRUE; -} - -PRBool nsCSSScanner::ParseID(PRInt32& aErrorCode, - PRInt32 aChar, - nsCSSToken& aToken) -{ - aToken.mIdent.SetLength(0); - aToken.mType = eCSSToken_ID; - return GatherIdent(aErrorCode, 0, aToken.mIdent); -} - -PRBool nsCSSScanner::ParseIdent(PRInt32& aErrorCode, - PRInt32 aChar, - nsCSSToken& aToken) -{ - nsString& ident = aToken.mIdent; - ident.SetLength(0); - if (!GatherIdent(aErrorCode, aChar, ident)) { - return PR_FALSE; - } - - nsCSSTokenType tokenType = eCSSToken_Ident; - // look for functions (ie: "ident(") - if (PRUnichar('(') == PRUnichar(Peek(aErrorCode))) { // this is a function definition - tokenType = eCSSToken_Function; - } - - aToken.mType = tokenType; - return PR_TRUE; -} - -PRBool nsCSSScanner::ParseAtKeyword(PRInt32& aErrorCode, PRInt32 aChar, - nsCSSToken& aToken) -{ - aToken.mIdent.SetLength(0); - aToken.mType = eCSSToken_AtKeyword; - return GatherIdent(aErrorCode, 0, aToken.mIdent); -} - -PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, - nsCSSToken& aToken) -{ - nsString& ident = aToken.mIdent; - ident.SetLength(0); - PRBool gotDot = (c == '.') ? PR_TRUE : PR_FALSE; - if (c != '+') { - ident.Append(PRUnichar(c)); - } - - // Gather up characters that make up the number - PRUint8* lexTable = gLexTable; - for (;;) { - c = Read(aErrorCode); - if (c < 0) break; - if (!gotDot && (c == '.')) { - gotDot = PR_TRUE; - } else if ((c > 255) || ((lexTable[c] & IS_DIGIT) == 0)) { - break; - } - ident.Append(PRUnichar(c)); - } - - // Convert number to floating point - nsCSSTokenType type = eCSSToken_Number; - PRInt32 ec; - float value = ident.ToFloat(&ec); - - // Look at character that terminated the number - aToken.mIntegerValid = PR_FALSE; - if (c >= 0) { - if ((c <= 255) && ((lexTable[c] & START_IDENT) != 0)) { - ident.SetLength(0); - if (!GatherIdent(aErrorCode, c, ident)) { - return PR_FALSE; - } - type = eCSSToken_Dimension; - } else if ('%' == c) { - type = eCSSToken_Percentage; - value = value / 100.0f; - ident.SetLength(0); - } else { - // Put back character that stopped numeric scan - Unread(); - if (!gotDot) { - aToken.mInteger = ident.ToInteger(&ec); - aToken.mIntegerValid = PR_TRUE; - } - ident.SetLength(0); - } - } - else { // stream ended - if (!gotDot) { - aToken.mInteger = ident.ToInteger(&ec); - aToken.mIntegerValid = PR_TRUE; - } - ident.SetLength(0); - } - aToken.mNumber = value; - aToken.mType = type; - return PR_TRUE; -} - -PRBool nsCSSScanner::ParseCComment(PRInt32& aErrorCode, nsCSSToken& aToken) -{ - nsString& ident = aToken.mIdent; - for (;;) { - PRInt32 ch = Read(aErrorCode); - if (ch < 0) break; - if (ch == '*') { - if (LookAhead(aErrorCode, '/')) { - ident.Append(PRUnichar(ch)); // STRING USE WARNING: technically, this should be |AppendWithConversion| - ident.AppendWithConversion('/'); - break; - } - } -#ifdef COLLECT_WHITESPACE - ident.Append(PRUnichar(ch)); -#endif - } - aToken.mType = eCSSToken_WhiteSpace; - return PR_TRUE; -} - -#if 0 -PRBool nsCSSScanner::ParseEOLComment(PRInt32& aErrorCode, nsCSSToken& aToken) -{ - nsString& ident = aToken.mIdent; - ident.SetLength(0); - for (;;) { - if (EatNewline(aErrorCode)) { - break; - } - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - break; - } -#ifdef COLLECT_WHITESPACE - ident.Append(PRUnichar(ch)); -#endif - } - aToken.mType = eCSSToken_WhiteSpace; - return PR_TRUE; -} -#endif // 0 - -PRBool nsCSSScanner::GatherString(PRInt32& aErrorCode, PRInt32 aStop, - nsString& aBuffer) -{ - for (;;) { - if (EatNewline(aErrorCode)) { - break; - } - PRInt32 ch = Read(aErrorCode); - if (ch < 0) { - return PR_FALSE; - } - if (ch == aStop) { - break; - } - if (ch == CSS_ESCAPE) { - ch = ParseEscape(aErrorCode); - if (ch < 0) { - return PR_FALSE; - } - } - if (0 < ch) { - aBuffer.Append(PRUnichar(ch)); - } - } - return PR_TRUE; -} - -PRBool nsCSSScanner::ParseString(PRInt32& aErrorCode, PRInt32 aStop, - nsCSSToken& aToken) -{ - aToken.mIdent.SetLength(0); - aToken.mType = eCSSToken_String; - aToken.mSymbol = PRUnichar(aStop); // remember how it's quoted - return GatherString(aErrorCode, aStop, aToken.mIdent); -} diff --git a/mozilla/layout/html/style/src/nsCSSScanner.h b/mozilla/layout/html/style/src/nsCSSScanner.h deleted file mode 100644 index 30af7d91403..00000000000 --- a/mozilla/layout/html/style/src/nsCSSScanner.h +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ -#ifndef nsCSSScanner_h___ -#define nsCSSScanner_h___ - -#include "nsString.h" -class nsIUnicharInputStream; - -// for testing -//#define CSS_REPORT_PARSE_ERRORS - -#ifdef CSS_REPORT_PARSE_ERRORS -#include "nsXPIDLString.h" -class nsIURI; -#endif - -// Token types -enum nsCSSTokenType { - // A css identifier (e.g. foo) - eCSSToken_Ident = 0, // mIdent - - // A css at keyword (e.g. @foo) - eCSSToken_AtKeyword = 1, // mIdent - - // A css number without a percentage or dimension; with percentage; - // without percentage but with a dimension - eCSSToken_Number = 2, // mNumber - eCSSToken_Percentage = 3, // mNumber - eCSSToken_Dimension = 4, // mNumber + mIdent - - // A css string (e.g. "foo" or 'foo') - eCSSToken_String = 5, // mSymbol + mIdent + mSymbol - - // Whitespace (e.g. " " or "/* abc */") - eCSSToken_WhiteSpace = 6, // mIdent - - // A css symbol (e.g. ':', ';', '+', etc.) - eCSSToken_Symbol = 7, // mSymbol - - // A css1 id (e.g. #foo3) - eCSSToken_ID = 8, // mIdent - - eCSSToken_Function = 9, // mIdent - - eCSSToken_URL = 10, // mIdent - eCSSToken_InvalidURL = 11, // doesn't matter - - eCSSToken_HTMLComment = 12, // "" - - eCSSToken_Includes = 13, // "~=" - eCSSToken_Dashmatch = 14 // "|=" - -}; - -struct nsCSSToken { - nsCSSTokenType mType; - nsAutoString mIdent; - float mNumber; - PRInt32 mInteger; - PRBool mIntegerValid; - PRUnichar mSymbol; - - nsCSSToken(); - - PRBool IsDimension() { - return PRBool((eCSSToken_Dimension == mType) || - ((eCSSToken_Number == mType) && (mNumber == 0.0f))); - } - - PRBool IsSymbol(PRUnichar aSymbol) { - return PRBool((eCSSToken_Symbol == mType) && (mSymbol == aSymbol)); - } - - void AppendToString(nsString& aBuffer); -}; - -// CSS Scanner API. Used to tokenize an input stream using the CSS -// forward compatible tokenization rules. This implementation is -// private to this package and is only used internally by the css -// parser. -class nsCSSScanner { - public: - nsCSSScanner(); - ~nsCSSScanner(); - - // Init the scanner. - void Init(nsIUnicharInputStream* aInput); - -#ifdef CSS_REPORT_PARSE_ERRORS - void InitErrorReporting(nsIURI* aURI); - void ReportError(const nsAReadableString& aError); -#endif - - PRUint32 GetLineNumber(); - - // Get the next token. Return nsfalse on EOF or ERROR. aTokenResult - // is filled in with the data for the token. - PRBool Next(PRInt32& aErrorCode, nsCSSToken& aTokenResult); - - // Get the next token that may be a string or unquoted URL or whitespace - PRBool NextURL(PRInt32& aErrorCode, nsCSSToken& aTokenResult); - -protected: - void Close(); - PRInt32 Read(PRInt32& aErrorCode); - PRInt32 Peek(PRInt32& aErrorCode); - void Unread(); - void Pushback(PRUnichar aChar); - PRBool LookAhead(PRInt32& aErrorCode, PRUnichar aChar); - PRBool EatWhiteSpace(PRInt32& aErrorCode); - PRBool EatNewline(PRInt32& aErrorCode); - - PRInt32 ParseEscape(PRInt32& aErrorCode); - PRBool ParseIdent(PRInt32& aErrorCode, PRInt32 aChar, nsCSSToken& aResult); - PRBool ParseAtKeyword(PRInt32& aErrorCode, PRInt32 aChar, - nsCSSToken& aResult); - PRBool ParseNumber(PRInt32& aErrorCode, PRInt32 aChar, nsCSSToken& aResult); - PRBool ParseID(PRInt32& aErrorCode, PRInt32 aChar, nsCSSToken& aResult); - PRBool ParseString(PRInt32& aErrorCode, PRInt32 aChar, nsCSSToken& aResult); -#if 0 - PRBool ParseEOLComment(PRInt32& aErrorCode, nsCSSToken& aResult); -#endif - PRBool ParseCComment(PRInt32& aErrorCode, nsCSSToken& aResult); - - PRBool GatherString(PRInt32& aErrorCode, PRInt32 aStop, - nsString& aString); - PRBool GatherIdent(PRInt32& aErrorCode, PRInt32 aChar, nsString& aIdent); - - nsIUnicharInputStream* mInput; - PRUnichar* mBuffer; - PRInt32 mOffset; - PRInt32 mCount; - PRUnichar* mPushback; - PRInt32 mPushbackCount; - PRInt32 mPushbackSize; - PRInt32 mLastRead; - PRUnichar mLocalPushback[4]; - - PRUint32 mLineNumber; -#ifdef CSS_REPORT_PARSE_ERRORS - nsXPIDLCString mFileName; - PRUint32 mColNumber; -#endif - -}; - -#endif /* nsCSSScanner_h___ */ diff --git a/mozilla/layout/html/style/src/nsStyleUtil.cpp b/mozilla/layout/html/style/src/nsStyleUtil.cpp deleted file mode 100644 index 66fdb313db8..00000000000 --- a/mozilla/layout/html/style/src/nsStyleUtil.cpp +++ /dev/null @@ -1,782 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * IBM Corp. - */ - -#include -#include "nsStyleUtil.h" -#include "nsCRT.h" -#include "nsIStyleContext.h" -#include "nsStyleConsts.h" -#include "nsUnitConversion.h" - -#include "nsHTMLAtoms.h" -#include "nsILinkHandler.h" -#include "nsILink.h" -#include "nsIXMLContent.h" -#include "nsIHTMLContent.h" -#include "nsIDocument.h" -#include "nsINameSpaceManager.h" -#include "nsIURI.h" -#include "nsNetUtil.h" - -#include "nsIServiceManager.h" -#include "nsIPref.h" - -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - -#define POSITIVE_SCALE_FACTOR 1.10 /* 10% */ -#define NEGATIVE_SCALE_FACTOR .90 /* 10% */ - -#if DEBUG -#define DUMP_FONT_SIZES 0 -#endif - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -/* - * Return the scaling percentage given a font scaler - * Lifted from layutil.c - */ -float nsStyleUtil::GetScalingFactor(PRInt32 aScaler) -{ - double scale = 1.0; - double mult; - PRInt32 count; - - if(aScaler < 0) { - count = -aScaler; - mult = NEGATIVE_SCALE_FACTOR; - } - else { - count = aScaler; - mult = POSITIVE_SCALE_FACTOR; - } - - /* use the percentage scaling factor to the power of the pref */ - while(count--) { - scale *= mult; - } - - return (float)scale; -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -static PRBool gNavAlgorithmPref = PR_FALSE; - -static int PR_CALLBACK NavAlgorithmPrefChangedCallback(const char * name, void * closure) -{ - nsresult rv; - NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv); - if (NS_SUCCEEDED(rv) && prefs) { - prefs->GetBoolPref(name, &gNavAlgorithmPref); - } - return 0; -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -static PRBool UseNewFontAlgorithm() -{ - static PRBool once = PR_TRUE; - - if (once) - { - once = PR_FALSE; - - nsresult rv; - NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv); - if (NS_SUCCEEDED(rv) && prefs) { - prefs->GetBoolPref("font.size.nav4algorithm", &gNavAlgorithmPref); - prefs->RegisterCallback("font.size.nav4algorithm", NavAlgorithmPrefChangedCallback, NULL); - } - } - return (gNavAlgorithmPref ? PR_FALSE : PR_TRUE); -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -/* - * Lifted from winfe/cxdc.cpp - */ -static nscoord OldCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize, - float aScalingFactor) -{ // lifted directly from Nav 5.0 code to replicate rounding errors - double dFontSize; - - switch(aHTMLSize) { - case 1: - dFontSize = 7 * aBasePointSize / 10; - break; - case 2: - dFontSize = 85 * aBasePointSize / 100; - break; - case 3: - dFontSize = aBasePointSize; - break; - case 4: - dFontSize = 12 * aBasePointSize / 10; - break; - case 5: - dFontSize = 3 * aBasePointSize / 2; - break; - case 6: - dFontSize = 2 * aBasePointSize; - break; - case 7: - dFontSize = 3 * aBasePointSize; - break; - default: - if (aHTMLSize < 1) { - dFontSize = (7 * aBasePointSize / 10) * pow(1.1, aHTMLSize - 1); - } - else { // aHTMLSize > 7 - dFontSize = (3 * aBasePointSize) * pow(1.2, aHTMLSize - 7); - } - } - - dFontSize *= aScalingFactor; - - if (1.0 < dFontSize) { - return (nscoord)dFontSize; - } - return (nscoord)1; -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -static nscoord NewCalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize, - float aScalingFactor, nsIPresContext* aPresContext, - nsFontSizeType aFontSizeType) -{ -#define sFontSizeTableMin 9 -#define sFontSizeTableMax 16 - -// This table seems to be the one used by MacIE5. We hope its adoption in Mozilla -// and eventually in WinIE5.5 will help to establish a standard rendering across -// platforms and browsers. For now, it is used only in Strict mode. More can be read -// in the document written by Todd Farhner at: -// http://style.verso.com/font_size_intervals/altintervals.html -// - static PRInt32 sStrictFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] = - { - { 9, 9, 9, 9, 11, 14, 18, 27}, - { 9, 9, 9, 10, 12, 15, 20, 30}, - { 9, 9, 10, 11, 13, 17, 22, 33}, - { 9, 9, 10, 12, 14, 18, 24, 36}, - { 9, 10, 12, 13, 16, 20, 26, 39}, - { 9, 10, 12, 14, 17, 21, 28, 42}, - { 9, 10, 13, 15, 18, 23, 30, 45}, - { 9, 10, 13, 16, 18, 24, 32, 48} - }; -// HTML 1 2 3 4 5 6 7 -// CSS xxs xs s m l xl xxl -// | -// user pref -// -//------------------------------------------------------------ -// -// This table gives us compatibility with WinNav4 for the default fonts only. -// In WinNav4, the default fonts were: -// -// Times/12pt == Times/16px at 96ppi -// Courier/10pt == Courier/13px at 96ppi -// -// The 2 lines below marked "anchored" have the exact pixel sizes used by -// WinNav4 for Times/12pt and Courier/10pt at 96ppi. As you can see, the -// HTML size 3 (user pref) for those 2 anchored lines is 13px and 16px. -// -// All values other than the anchored values were filled in by hand, never -// going below 9px, and maintaining a "diagonal" relationship. See for -// example the 13s -- they follow a diagonal line through the table. -// - static PRInt32 sQuirksFontSizeTable[sFontSizeTableMax - sFontSizeTableMin + 1][8] = - { - { 9, 9, 9, 9, 11, 14, 18, 28 }, - { 9, 9, 9, 10, 12, 15, 20, 31 }, - { 9, 9, 9, 11, 13, 17, 22, 34 }, - { 9, 9, 10, 12, 14, 18, 24, 37 }, - { 9, 9, 10, 13, 16, 20, 26, 40 }, // anchored (13) - { 9, 9, 11, 14, 17, 21, 28, 42 }, - { 9, 10, 12, 15, 17, 23, 30, 45 }, - { 9, 10, 13, 16, 18, 24, 32, 48 } // anchored (16) - }; -// HTML 1 2 3 4 5 6 7 -// CSS xxs xs s m l xl xxl -// | -// user pref - -#if 0 -// -// These are the exact pixel values used by WinIE5 at 96ppi. -// - { ?, 8, 11, 12, 13, 16, 21, 32 }, // smallest - { ?, 9, 12, 13, 16, 21, 27, 40 }, // smaller - { ?, 10, 13, 16, 18, 24, 32, 48 }, // medium - { ?, 13, 16, 19, 21, 27, 37, ?? }, // larger - { ?, 16, 19, 21, 24, 32, 43, ?? } // largest -// -// HTML 1 2 3 4 5 6 7 -// CSS ? ? ? ? ? ? ? ? -// -// (CSS not tested yet.) -// -#endif - - static PRInt32 sFontSizeFactors[8] = { 60,75,89,100,120,150,200,300 }; - - static PRInt32 sCSSColumns[7] = {0, 1, 2, 3, 4, 5, 6}; // xxs...xxl - static PRInt32 sHTMLColumns[7] = {1, 2, 3, 4, 5, 6, 7}; // 1...7 - - double dFontSize; - - if (aFontSizeType == eFontSize_HTML) { - aHTMLSize--; // input as 1-7 - } - - if (aHTMLSize < 0) - aHTMLSize = 0; - else if (aHTMLSize > 6) - aHTMLSize = 6; - - PRInt32* column; - switch (aFontSizeType) - { - case eFontSize_HTML: column = sHTMLColumns; break; - case eFontSize_CSS: column = sCSSColumns; break; - } - - float t2p; - aPresContext->GetTwipsToPixels(&t2p); - PRInt32 fontSize = NSTwipsToIntPixels(aBasePointSize, t2p); - - if ((fontSize >= sFontSizeTableMin) && (fontSize <= sFontSizeTableMax)) - { - float p2t; - aPresContext->GetPixelsToTwips(&p2t); - - PRInt32 row = fontSize - sFontSizeTableMin; - - nsCompatibility mode; - aPresContext->GetCompatibilityMode(&mode); - if (mode == eCompatibility_NavQuirks) { - dFontSize = NSIntPixelsToTwips(sQuirksFontSizeTable[row][column[aHTMLSize]], p2t); - } else { - dFontSize = NSIntPixelsToTwips(sStrictFontSizeTable[row][column[aHTMLSize]], p2t); - } - } - else - { - PRInt32 factor = sFontSizeFactors[column[aHTMLSize]]; - dFontSize = (factor * aBasePointSize) / 100; - } - - dFontSize *= aScalingFactor; - - if (1.0 < dFontSize) { - return (nscoord)dFontSize; - } - return (nscoord)1; -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -nscoord nsStyleUtil::CalcFontPointSize(PRInt32 aHTMLSize, PRInt32 aBasePointSize, - float aScalingFactor, nsIPresContext* aPresContext, - nsFontSizeType aFontSizeType) -{ -#if DUMP_FONT_SIZES - extern void DumpFontSizes(nsIPresContext* aPresContext); - DumpFontSizes(aPresContext); -#endif - if (UseNewFontAlgorithm()) - return NewCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType); - else - return OldCalcFontPointSize(aHTMLSize, aBasePointSize, aScalingFactor); -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -PRInt32 nsStyleUtil::FindNextSmallerFontSize(nscoord aFontSize, PRInt32 aBasePointSize, - float aScalingFactor, nsIPresContext* aPresContext, - nsFontSizeType aFontSizeType) -{ - PRInt32 index; - PRInt32 indexMin; - PRInt32 indexMax; - PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize); - - if (aFontSizeType == eFontSize_HTML) { - indexMin = 1; - indexMax = 7; - } else { - indexMin = 0; - indexMax = 6; - } - - if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) < fontSize) { - if (fontSize <= NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table - for (index = indexMax; index > indexMin; index--) - if (fontSize > NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) - break; - } - else { // larger than HTML table - return indexMax; -// for (index = 8; ; index++) -// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) { -// index--; -// break; -// } - } - } - else { // smaller than HTML table - return indexMin; -// for (index = 0; -25 NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) { -// break; -// } - } - return index; -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -PRInt32 nsStyleUtil::FindNextLargerFontSize(nscoord aFontSize, PRInt32 aBasePointSize, - float aScalingFactor, nsIPresContext* aPresContext, - nsFontSizeType aFontSizeType) -{ - PRInt32 index; - PRInt32 indexMin; - PRInt32 indexMax; - PRInt32 fontSize = NSTwipsToFloorIntPoints(aFontSize); - - if (aFontSizeType == eFontSize_HTML) { - indexMin = 1; - indexMax = 7; - } else { - indexMin = 0; - indexMax = 6; - } - - if (NSTwipsToFloorIntPoints(CalcFontPointSize(indexMin, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType)) <= fontSize) { - if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(indexMax, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) { // in HTML table - for (index = indexMin; index < indexMax; index++) - if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext, aFontSizeType))) - break; - } - else { // larger than HTML table - return indexMax; -// for (index = 8; ; index++) -// if (fontSize < NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) -// break; - } - } - else { // smaller than HTML table - return indexMin; -// for (index = 0; -25 NSTwipsToFloorIntPoints(CalcFontPointSize(index, aBasePointSize, aScalingFactor, aPresContext))) { -// index++; -// break; -// } - } - return index; -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -PRInt32 -nsStyleUtil::ConstrainFontWeight(PRInt32 aWeight) -{ - aWeight = ((aWeight < 100) ? 100 : ((aWeight > 900) ? 900 : aWeight)); - PRInt32 base = ((aWeight / 100) * 100); - PRInt32 step = (aWeight % 100); - PRBool negativeStep = PRBool(50 < step); - PRInt32 maxStep; - if (negativeStep) { - step = 100 - step; - maxStep = (base / 100); - base += 100; - } - else { - maxStep = ((900 - base) / 100); - } - if (maxStep < step) { - step = maxStep; - } - return (base + ((negativeStep) ? -step : step)); -} - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ - -const nsStyleColor* nsStyleUtil::FindNonTransparentBackground(nsIStyleContext* aContext, - PRBool aStartAtParent /*= PR_FALSE*/) -{ - const nsStyleColor* result = nsnull; - nsIStyleContext* context; - if (aStartAtParent) { - context = aContext->GetParent(); // balance ending release - } else { - context = aContext; - NS_IF_ADDREF(context); // balance ending release - } - NS_ASSERTION( context != nsnull, "Cannot find NonTransparentBackground in a null context" ); - - while (nsnull != context) { - result = (const nsStyleColor*)context->GetStyleData(eStyleStruct_Color); - - if (0 == (result->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) { - break; - } - else { - nsIStyleContext* last = context; - context = context->GetParent(); - NS_RELEASE(last); - } - } - NS_IF_RELEASE(context); - return result; -} - -/*static*/ -PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent, nsIAtom *aTag, nsIPresContext *aPresContext, nsLinkState *aState) -{ - NS_ASSERTION(aContent && aState, "null arg in IsHTMLLink"); - - // check for: - // - HTML ANCHOR with valid HREF - // - HTML LINK with valid HREF - // - HTML AREA with valid HREF - - PRBool result = PR_FALSE; - - if ((aTag == nsHTMLAtoms::a) || - (aTag == nsHTMLAtoms::link) || - (aTag == nsHTMLAtoms::area)) { - - nsCOMPtr link( do_QueryInterface(aContent) ); - // In XML documents, this can be null. - if (link) { - nsLinkState linkState; - link->GetLinkState(linkState); - if (linkState == eLinkState_Unknown) { - // if it is an anchor, area or link then check the href attribute - // make sure this anchor has a link even if we are not testing state - // if there is no link, then this anchor is not really a linkpseudo. - // bug=23209 - - char* href; - link->GetHrefCString(href); - - if (href) { - nsILinkHandler *linkHandler = nsnull; - aPresContext->GetLinkHandler(&linkHandler); - if (linkHandler) { - linkHandler->GetLinkState(href, linkState); - NS_RELEASE(linkHandler); - } - else { - // no link handler? then all links are unvisited - linkState = eLinkState_Unvisited; - } - nsCRT::free(href); - } else { - linkState = eLinkState_NotLink; - } - link->SetLinkState(linkState); - } - if (linkState != eLinkState_NotLink) { - *aState = linkState; - result = PR_TRUE; - } - } - } - - return result; -} - -/*static*/ -PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresContext, nsLinkState *aState) -{ - // XXX PERF This function will cause serious performance problems on - // pages with lots of XLinks. We should be caching the visited - // state of the XLinks. Where??? - - NS_ASSERTION(aContent && aState, "invalid call to IsXlink with null content"); - - PRBool rv = PR_FALSE; - - if (aContent && aState) { - // first see if we have an XML element - nsCOMPtr xml(do_QueryInterface(aContent)); - if (xml) { - // see if it is type=simple (we don't deal with other types) - nsAutoString val; - aContent->GetAttribute(kNameSpaceID_XLink, nsHTMLAtoms::type, val); - if (val == NS_LITERAL_STRING("simple")) { - // see if there is an xlink namespace'd href attribute: - // - get it if there is, if not no big deal, it is not required for xlinks - // is it bad to re-use val here? - aContent->GetAttribute(kNameSpaceID_XLink, nsHTMLAtoms::href, val); - - // It's an XLink. Resolve it relative to its document. - nsCOMPtr baseURI; - nsCOMPtr htmlContent = do_QueryInterface(aContent); - if (htmlContent) { - // XXX why do this? will nsIHTMLContent's - // GetBaseURL() may return something different - // than the URL of the document it lives in? - htmlContent->GetBaseURL(*getter_AddRefs(baseURI)); - } - else { - nsCOMPtr doc; - aContent->GetDocument(*getter_AddRefs(doc)); - if (doc) { - doc->GetBaseURL(*getter_AddRefs(baseURI)); - } - } - - // convert here, rather than twice in NS_MakeAbsoluteURI and - // back again - char * href = val.ToNewCString(); - char * absHREF = nsnull; - (void) NS_MakeAbsoluteURI(&absHREF, href, baseURI); - nsCRT::free(href); - - nsILinkHandler *linkHandler = nsnull; - aPresContext->GetLinkHandler(&linkHandler); - if (linkHandler) { - linkHandler->GetLinkState(absHREF, *aState); - NS_RELEASE(linkHandler); - } - else { - // no link handler? then all links are unvisited - *aState = eLinkState_Unvisited; - } - nsCRT::free(absHREF); - - rv = PR_TRUE; - } - } - } - return rv; -} - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ -#if DUMP_FONT_SIZES -#include "nsIDeviceContext.h" -PRInt32 RoundSize(nscoord aVal, nsIPresContext* aPresContext, bool aWinRounding) -{ - - PRInt32 lfHeight; - nsIDeviceContext* dc; - aPresContext->GetDeviceContext(&dc); - - float app2dev, app2twip, scale; - dc->GetAppUnitsToDevUnits(app2dev); - - if (aWinRounding) - { - dc->GetDevUnitsToTwips(app2twip); - dc->GetCanonicalPixelScale(scale); - app2twip *= app2dev * scale; - - // This interesting bit of code rounds the font size off to the floor point - // value. This is necessary for proper font scaling under windows. - PRInt32 sizePoints = NSTwipsToFloorIntPoints(nscoord(aVal*app2twip)); - float rounded = ((float)NSIntPointsToTwips(sizePoints)) / app2twip; - - // round font size off to floor point size to be windows compatible - // this is proper (windows) rounding - // lfHeight = NSToIntRound(rounded * app2dev); - - // this floor rounding is to make ours compatible with Nav 4.0 - lfHeight = long(rounded * app2dev); - return lfHeight; - } - else - return NSToIntRound(aVal*app2dev); -} -#endif - - -//------------------------------------------------------------------------------ -// -//------------------------------------------------------------------------------ -#if DUMP_FONT_SIZES -void DumpFontSizes(nsIPresContext* aPresContext) -{ - static gOnce = true; - if (gOnce) - { - gOnce = false; - - PRInt32 baseSize; - PRInt32 htmlSize; - PRInt32 cssSize; - nscoord val; - nscoord oldVal; - - nsIDeviceContext* dc; - aPresContext->GetDeviceContext(&dc); - float dev2app; - dc->GetDevUnitsToAppUnits(dev2app); - - bool doWinRounding = true; - for (short i=0; i<2; i ++) - { - doWinRounding ^= true; - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" CSS \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); - for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); - for (cssSize = 0; cssSize <= 6; cssSize++) { - val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); - printf("%2d ", RoundSize(val, aPresContext, false)); - } - printf("\n"); - } - - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); - for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); - for (cssSize = 0; cssSize <= 6; cssSize++) { - val = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); - } - printf("\n"); - } - - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" xx-small x-small small medium large x-large xx-large\n"); - for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); - for (cssSize = 0; cssSize <= 6; cssSize++) { - oldVal = OldCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f); - val = NewCalcFontPointSize(cssSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_CSS); - if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); - else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); - } - printf("\n"); - } - - - - printf("\n\n\n"); - printf("---------------------------------------------------------------\n"); - printf(" HTML \n"); - printf(" Rounding %s\n", (doWinRounding ? "ON" : "OFF")); - printf("---------------------------------------------------------------\n"); - printf("\n"); - printf("NEW SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); - for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); - for (htmlSize = 1; htmlSize <= 7; htmlSize++) { - val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); - printf("%2d ", RoundSize(val, aPresContext, false)); - } - printf("\n"); - } - - printf("\n"); - printf("OLD SIZES:\n"); - printf("----------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); - for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); - for (htmlSize = 1; htmlSize <= 7; htmlSize++) { - val = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); - printf("%2d ", RoundSize(val, aPresContext, doWinRounding)); - } - printf("\n"); - } - - printf("\n"); - printf("DIFFS:\n"); - printf("------\n"); - printf(" #1 #2 #3 #4 #5 #6 #7\n"); - for (baseSize = 9; baseSize <= 20; baseSize++) { - printf("%2d: ", baseSize); - for (htmlSize = 1; htmlSize <= 7; htmlSize++) { - oldVal = OldCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f); - val = NewCalcFontPointSize(htmlSize, baseSize*dev2app, 1.0f, aPresContext, eFontSize_HTML); - if (RoundSize(oldVal, aPresContext, doWinRounding) <= 8) - printf(" ."); - else - printf("%2d", (RoundSize(val, aPresContext, false)-RoundSize(oldVal, aPresContext, doWinRounding))); - printf(" "); - } - printf("\n"); - } - printf("\n\n\n"); - } - } -} -#endif diff --git a/mozilla/layout/html/tests/Makefile.in b/mozilla/layout/html/tests/Makefile.in index e95563aeb3a..debfeeb346f 100644 --- a/mozilla/layout/html/tests/Makefile.in +++ b/mozilla/layout/html/tests/Makefile.in @@ -53,7 +53,7 @@ LIBS = \ $(DIST)/lib/libgkconxmlcon_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkconxmldoc_s.$(LIB_SUFFIX) \ $(DIST)/lib/libgkxulbase_s.$(LIB_SUFFIX) \ - $(DIST)/lib/libgkxulcon_s.$(LIB_SUFFIX) \ + $(DIST)/lib/libgkconshared_s.$(LIB_SUFFIX) \ $(MOZ_JS_LIBS) \ $(EXTRA_DSO_LIBS) \ $(TK_LIBS) \ diff --git a/mozilla/layout/html/tests/makefile.win b/mozilla/layout/html/tests/makefile.win index 1680af63314..4afb1ef5a3f 100644 --- a/mozilla/layout/html/tests/makefile.win +++ b/mozilla/layout/html/tests/makefile.win @@ -54,7 +54,7 @@ LLIBS= \ $(DIST)\lib\layoutbase_s.lib \ $(DIST)\lib\gkgfxwin.lib \ $(DIST)\lib\layoutxulbase_s.lib \ - $(DIST)\lib\layoutxulcontent_s.lib \ + $(DIST)\lib\contentshared_s.lib \ !ifdef MOZ_MATHML $(DIST)\lib\layoutmathmlbase_s.lib \ $(DIST)\lib\layoutmathmlcontent_s.lib \ diff --git a/mozilla/layout/style/nsStyleCoord.cpp b/mozilla/layout/style/nsStyleCoord.cpp new file mode 100644 index 00000000000..7d5263e5ab5 --- /dev/null +++ b/mozilla/layout/style/nsStyleCoord.cpp @@ -0,0 +1,284 @@ +/* -*- 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.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/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +#include "nsStyleCoord.h" +#include "nsString.h" +#include "nsCRT.h" + +nsStyleCoord::nsStyleCoord(nsStyleUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit"); + if (aUnit >= eStyleUnit_Percent) { + mUnit = eStyleUnit_Null; + } + mValue.mInt = 0; +} + +nsStyleCoord::nsStyleCoord(nscoord aValue) + : mUnit(eStyleUnit_Coord) +{ + mValue.mInt = aValue; +} + +nsStyleCoord::nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit) + : mUnit(aUnit) +{ + //if you want to pass in eStyleUnit_Coord, don't. instead, use the + //constructor just above this one... MMP + NS_ASSERTION((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Integer), "not an int value"); + if ((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Integer)) { + mValue.mInt = aValue; + } + else { + mUnit = eStyleUnit_Null; + mValue.mInt = 0; + } +} + +nsStyleCoord::nsStyleCoord(float aValue, nsStyleUnit aUnit) + : mUnit(aUnit) +{ + NS_ASSERTION((aUnit == eStyleUnit_Percent) || + (aUnit == eStyleUnit_Factor), "not a float value"); + if ((aUnit == eStyleUnit_Percent) || + (aUnit == eStyleUnit_Factor)) { + mValue.mFloat = aValue; + } + else { + mUnit = eStyleUnit_Null; + mValue.mInt = 0; + } +} + +nsStyleCoord::nsStyleCoord(const nsStyleCoord& aCopy) + : mUnit(aCopy.mUnit) +{ + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + mValue.mFloat = aCopy.mValue.mFloat; + } + else { + mValue.mInt = aCopy.mValue.mInt; + } +} + +nsStyleCoord& nsStyleCoord::operator=(const nsStyleCoord& aCopy) +{ + mUnit = aCopy.mUnit; + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + mValue.mFloat = aCopy.mValue.mFloat; + } + else { + mValue.mInt = aCopy.mValue.mInt; + } + return *this; +} + +PRBool nsStyleCoord::operator==(const nsStyleCoord& aOther) const +{ + if (mUnit == aOther.mUnit) { + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + return PRBool(mValue.mFloat == aOther.mValue.mFloat); + } + else { + return PRBool(mValue.mInt == aOther.mValue.mInt); + } + } + return PR_FALSE; +} + +void nsStyleCoord::Reset(void) +{ + mUnit = eStyleUnit_Null; + mValue.mInt = 0; +} + +void nsStyleCoord::SetCoordValue(nscoord aValue) +{ + mUnit = eStyleUnit_Coord; + mValue.mInt = aValue; +} + +void nsStyleCoord::SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) +{ + NS_ASSERTION((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Chars) || + (aUnit == eStyleUnit_Integer), "not an int value"); + if ((aUnit == eStyleUnit_Proportional) || + (aUnit == eStyleUnit_Enumerated) || + (aUnit == eStyleUnit_Chars) || + (aUnit == eStyleUnit_Integer)) { + mUnit = aUnit; + mValue.mInt = aValue; + } + else { + Reset(); + } +} + +void nsStyleCoord::SetPercentValue(float aValue) +{ + mUnit = eStyleUnit_Percent; + mValue.mFloat = aValue; +} + +void nsStyleCoord::SetFactorValue(float aValue) +{ + mUnit = eStyleUnit_Factor; + mValue.mFloat = aValue; +} + +void nsStyleCoord::SetNormalValue(void) +{ + mUnit = eStyleUnit_Normal; + mValue.mInt = 0; +} + +void nsStyleCoord::SetAutoValue(void) +{ + mUnit = eStyleUnit_Auto; + mValue.mInt = 0; +} + +void nsStyleCoord::SetInheritValue(void) +{ + mUnit = eStyleUnit_Inherit; + mValue.mInt = 0; +} + +void nsStyleCoord::SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) +{ + mUnit = aUnit; +#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT + mValue.mInt = aValue.mInt; +#else + nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion)); +#endif +} + +void nsStyleCoord::AppendToString(nsString& aBuffer) const +{ + if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { + aBuffer.AppendFloat(mValue.mFloat); + } + else if ((eStyleUnit_Coord == mUnit) || + (eStyleUnit_Proportional == mUnit) || + (eStyleUnit_Enumerated == mUnit) || + (eStyleUnit_Integer == mUnit)) { + aBuffer.AppendInt(mValue.mInt, 10); + aBuffer.AppendWithConversion("[0x"); + aBuffer.AppendInt(mValue.mInt, 16); + aBuffer.AppendWithConversion(']'); + } + + switch (mUnit) { + case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break; + case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break; + case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break; + case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break; + case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break; + case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break; + case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break; + case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break; + case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; + case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break; + case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break; + } + aBuffer.AppendWithConversion(' '); +} + +void nsStyleCoord::ToString(nsString& aBuffer) const +{ + aBuffer.Truncate(); + AppendToString(aBuffer); +} + + + + +nsStyleSides::nsStyleSides(void) +{ + nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); +} + +#define COMPARE_SIDE(side) \ + if ((eStyleUnit_Percent <= m##side##Unit) && (m##side##Unit < eStyleUnit_Coord)) { \ + if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \ + return PR_FALSE; \ + } \ + else { \ + if (m##side##Value.mInt != aOther.m##side##Value.mInt) \ + return PR_FALSE; \ + } + +PRBool nsStyleSides::operator==(const nsStyleSides& aOther) const +{ + if ((mLeftUnit == aOther.mLeftUnit) && + (mTopUnit == aOther.mTopUnit) && + (mRightUnit == aOther.mRightUnit) && + (mBottomUnit == aOther.mBottomUnit)) { + COMPARE_SIDE(Left); + COMPARE_SIDE(Top); + COMPARE_SIDE(Right); + COMPARE_SIDE(Bottom); + return PR_TRUE; + } + return PR_FALSE; +} + +void nsStyleSides::Reset(void) +{ + nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); +} + +void nsStyleSides::AppendToString(nsString& aBuffer) const +{ + nsStyleCoord temp; + + GetLeft(temp); + aBuffer.AppendWithConversion("left: "); + temp.AppendToString(aBuffer); + + GetTop(temp); + aBuffer.AppendWithConversion("top: "); + temp.AppendToString(aBuffer); + + GetRight(temp); + aBuffer.AppendWithConversion("right: "); + temp.AppendToString(aBuffer); + + GetBottom(temp); + aBuffer.AppendWithConversion("bottom: "); + temp.AppendToString(aBuffer); +} + +void nsStyleSides::ToString(nsString& aBuffer) const +{ + aBuffer.Truncate(); + AppendToString(aBuffer); +} + diff --git a/mozilla/layout/style/nsStyleCoord.h b/mozilla/layout/style/nsStyleCoord.h index 067e0b3112c..bb97cd0a9cd 100644 --- a/mozilla/layout/style/nsStyleCoord.h +++ b/mozilla/layout/style/nsStyleCoord.h @@ -25,7 +25,7 @@ #include "nscore.h" #include "nsCoord.h" #include "nsCRT.h" -#include "nsString.h" +class nsString; enum nsStyleUnit { eStyleUnit_Null = 0, // (no value) value is not specified @@ -48,86 +48,15 @@ typedef union { class nsStyleCoord { public: - nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null) - : mUnit(aUnit) { - NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit"); - if (aUnit >= eStyleUnit_Percent) { - mUnit = eStyleUnit_Null; - } - mValue.mInt = 0; - } + nsStyleCoord(nsStyleUnit aUnit = eStyleUnit_Null); + nsStyleCoord(nscoord aValue); + nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit); + nsStyleCoord(float aValue, nsStyleUnit aUnit); + nsStyleCoord(const nsStyleCoord& aCopy); - nsStyleCoord(nscoord aValue) - : mUnit(eStyleUnit_Coord) { - mValue.mInt = aValue; - } - - nsStyleCoord(PRInt32 aValue, nsStyleUnit aUnit) - : mUnit(aUnit) { - //if you want to pass in eStyleUnit_Coord, don't. instead, use the - //constructor just above this one... MMP - NS_ASSERTION((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Integer), "not an int value"); - if ((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Integer)) { - mValue.mInt = aValue; - } - else { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } - } - - nsStyleCoord(float aValue, nsStyleUnit aUnit) - : mUnit(aUnit) { - NS_ASSERTION((aUnit == eStyleUnit_Percent) || - (aUnit == eStyleUnit_Factor), "not a float value"); - if ((aUnit == eStyleUnit_Percent) || - (aUnit == eStyleUnit_Factor)) { - mValue.mFloat = aValue; - } - else { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } - } - - nsStyleCoord(const nsStyleCoord& aCopy) - : mUnit(aCopy.mUnit) { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } - } - - nsStyleCoord& operator=(const nsStyleCoord& aCopy) { - mUnit = aCopy.mUnit; - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - mValue.mFloat = aCopy.mValue.mFloat; - } - else { - mValue.mInt = aCopy.mValue.mInt; - } - return *this; - } - - PRBool operator==(const nsStyleCoord& aOther) const { - if (mUnit == aOther.mUnit) { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - return PRBool(mValue.mFloat == aOther.mValue.mFloat); - } - else { - return PRBool(mValue.mInt == aOther.mValue.mInt); - } - } - return PR_FALSE; - } - - PRBool operator!=(const nsStyleCoord& aOther) const; + nsStyleCoord& operator=(const nsStyleCoord& aCopy); + PRBool operator==(const nsStyleCoord& aOther) const; + PRBool operator!=(const nsStyleCoord& aOther) const; nsStyleUnit GetUnit(void) const { return mUnit; } nscoord GetCoordValue(void) const; @@ -136,98 +65,18 @@ public: float GetFactorValue(void) const; void GetUnionValue(nsStyleUnion& aValue) const; - void Reset(void) { - mUnit = eStyleUnit_Null; - mValue.mInt = 0; - } + void Reset(void); // sets to null + void SetCoordValue(nscoord aValue); + void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit); + void SetPercentValue(float aValue); + void SetFactorValue(float aValue); + void SetNormalValue(void); + void SetAutoValue(void); + void SetInheritValue(void); + void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit); - void SetCoordValue(nscoord aValue) { - mUnit = eStyleUnit_Coord; - mValue.mInt = aValue; - } - - void SetIntValue(PRInt32 aValue, nsStyleUnit aUnit) { - if ((aUnit == eStyleUnit_Proportional) || - (aUnit == eStyleUnit_Enumerated) || - (aUnit == eStyleUnit_Chars) || - (aUnit == eStyleUnit_Integer)) { - mUnit = aUnit; - mValue.mInt = aValue; - } - else { - NS_WARNING("not an int value"); - Reset(); - } - } - - void SetPercentValue(float aValue) { - mUnit = eStyleUnit_Percent; - mValue.mFloat = aValue; - } - - void SetFactorValue(float aValue) { - mUnit = eStyleUnit_Factor; - mValue.mFloat = aValue; - } - - void SetNormalValue(void) { - mUnit = eStyleUnit_Normal; - mValue.mInt = 0; - } - - void SetAutoValue(void) { - mUnit = eStyleUnit_Auto; - mValue.mInt = 0; - } - - void SetInheritValue(void) { - mUnit = eStyleUnit_Inherit; - mValue.mInt = 0; - } - - void SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) { - mUnit = aUnit; -#if PR_BYTES_PER_INT == PR_BYTES_PER_FLOAT - mValue.mInt = aValue.mInt; -#else - nsCRT::memcpy(&mValue, &aValue, sizeof(nsStyleUnion)); -#endif - } - - void AppendToString(nsString& aBuffer) const { - if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - aBuffer.AppendFloat(mValue.mFloat); - } - else if ((eStyleUnit_Coord == mUnit) || - (eStyleUnit_Proportional == mUnit) || - (eStyleUnit_Enumerated == mUnit) || - (eStyleUnit_Integer == mUnit)) { - aBuffer.AppendInt(mValue.mInt, 10); - aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendInt(mValue.mInt, 16); - aBuffer.AppendWithConversion(']'); - } - - switch (mUnit) { - case eStyleUnit_Null: aBuffer.AppendWithConversion("Null"); break; - case eStyleUnit_Coord: aBuffer.AppendWithConversion("tw"); break; - case eStyleUnit_Percent: aBuffer.AppendWithConversion("%"); break; - case eStyleUnit_Factor: aBuffer.AppendWithConversion("f"); break; - case eStyleUnit_Normal: aBuffer.AppendWithConversion("Normal"); break; - case eStyleUnit_Auto: aBuffer.AppendWithConversion("Auto"); break; - case eStyleUnit_Inherit: aBuffer.AppendWithConversion("Inherit"); break; - case eStyleUnit_Proportional: aBuffer.AppendWithConversion("*"); break; - case eStyleUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; - case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break; - case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break; - } - aBuffer.AppendWithConversion(' '); - } - - void ToString(nsString& aBuffer) const { - aBuffer.Truncate(); - AppendToString(aBuffer); - } + void AppendToString(nsString& aBuffer) const; + void ToString(nsString& aBuffer) const; public: nsStyleUnit mUnit; @@ -235,38 +84,12 @@ public: }; -#define COMPARE_SIDE(side) \ - if ((eStyleUnit_Percent <= m##side##Unit) && \ - (m##side##Unit < eStyleUnit_Coord)) { \ - if (m##side##Value.mFloat != aOther.m##side##Value.mFloat) \ - return PR_FALSE; \ - } \ - else { \ - if (m##side##Value.mInt != aOther.m##side##Value.mInt) \ - return PR_FALSE; \ - } - class nsStyleSides { public: - nsStyleSides(void) { - nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); - } + nsStyleSides(void); // nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version - PRBool operator==(const nsStyleSides& aOther) const { - if ((mLeftUnit == aOther.mLeftUnit) && - (mTopUnit == aOther.mTopUnit) && - (mRightUnit == aOther.mRightUnit) && - (mBottomUnit == aOther.mBottomUnit)) { - COMPARE_SIDE(Left); - COMPARE_SIDE(Top); - COMPARE_SIDE(Right); - COMPARE_SIDE(Bottom); - return PR_TRUE; - } - return PR_FALSE; - } - + PRBool operator==(const nsStyleSides& aOther) const; PRBool operator!=(const nsStyleSides& aOther) const; nsStyleUnit GetLeftUnit(void) const; @@ -279,39 +102,14 @@ public: nsStyleCoord& GetRight(nsStyleCoord& aCoord) const; nsStyleCoord& GetBottom(nsStyleCoord& aCoord) const; - void Reset(void) { - nsCRT::memset(this, 0x00, sizeof(nsStyleSides)); - } - + void Reset(void); void SetLeft(const nsStyleCoord& aCoord); void SetTop(const nsStyleCoord& aCoord); void SetRight(const nsStyleCoord& aCoord); void SetBottom(const nsStyleCoord& aCoord); - void AppendToString(nsString& aBuffer) const { - nsStyleCoord temp; - - GetLeft(temp); - aBuffer.AppendWithConversion("left: "); - temp.AppendToString(aBuffer); - - GetTop(temp); - aBuffer.AppendWithConversion("top: "); - temp.AppendToString(aBuffer); - - GetRight(temp); - aBuffer.AppendWithConversion("right: "); - temp.AppendToString(aBuffer); - - GetBottom(temp); - aBuffer.AppendWithConversion("bottom: "); - temp.AppendToString(aBuffer); - } - - void ToString(nsString& aBuffer) const { - aBuffer.Truncate(); - AppendToString(aBuffer); - } + void AppendToString(nsString& aBuffer) const; + void ToString(nsString& aBuffer) const; protected: PRUint8 mLeftUnit; diff --git a/mozilla/layout/xul/Makefile.in b/mozilla/layout/xul/Makefile.in index 99462291edc..29d9e870f7e 100644 --- a/mozilla/layout/xul/Makefile.in +++ b/mozilla/layout/xul/Makefile.in @@ -26,7 +26,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = content base +DIRS = base include $(topsrcdir)/config/rules.mk diff --git a/mozilla/layout/xul/content/makefile.win b/mozilla/layout/xul/content/makefile.win deleted file mode 100644 index 841cfcbc222..00000000000 --- a/mozilla/layout/xul/content/makefile.win +++ /dev/null @@ -1,26 +0,0 @@ -#!nmake -# -# The contents of this file are subject to the Netscape 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/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\.. - -DIRS=src - -include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/layout/xul/content/src/makefile.win b/mozilla/layout/xul/content/src/makefile.win deleted file mode 100644 index b6b82fcc117..00000000000 --- a/mozilla/layout/xul/content/src/makefile.win +++ /dev/null @@ -1,54 +0,0 @@ -#!nmake -# -# The contents of this file are subject to the Netscape 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/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\..\.. - -LIBRARY_NAME=layoutxulcontent_s -MODULE=raptor - -DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN - -CPPSRCS= \ - nsXULAtoms.cpp \ - $(NULL) - -CPP_OBJS= \ - .\$(OBJDIR)\nsXULAtoms.obj \ - $(NULL) - -EXPORTS = \ - $(NULL) - -LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor -I$(PUBLIC)\js \ - -I$(PUBLIC)\dom -I$(PUBLIC)\netlib -I$(PUBLIC)\pref - -LCFLAGS = \ - $(LCFLAGS) \ - $(DEFINES) \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> - -install:: $(LIBRARY) - $(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib - -clobber:: - rm -f $(DIST)\lib\$(LIBRARY_NAME).lib diff --git a/mozilla/layout/xul/content/src/nsXULAtomList.h b/mozilla/layout/xul/content/src/nsXULAtomList.h deleted file mode 100644 index a79157c6d14..00000000000 --- a/mozilla/layout/xul/content/src/nsXULAtomList.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: David W. Hyatt (hyatt@netscape.com) - * - * Contributor(s): - */ - -/****** - - This file contains the list of all XUL nsIAtoms and their values - - It is designed to be used as inline input to nsXULAtoms.cpp *only* - through the magic of C preprocessing. - - All entires must be enclosed in the macro XUL_ATOM which will have cruel - and unusual things done to it - - It is recommended (but not strictly necessary) to keep all entries - in alphabetical order - - The first argument to XUL_ATOM is the C++ identifier of the atom - The second argument is the string value of the atom - - ******/ - - -XUL_ATOM(button, "button") -XUL_ATOM(spinner, "spinner") -XUL_ATOM(scrollbar, "scrollbar") -XUL_ATOM(slider, "slider") -XUL_ATOM(palettename, "palettename") -XUL_ATOM(fontpicker, "fontpicker") -XUL_ATOM(text, "text") -XUL_ATOM(toolbar, "toolbar") -XUL_ATOM(toolbaritem, "toolbaritem") -XUL_ATOM(toolbox, "toolbox") -XUL_ATOM(image, "image") - - // The tree atoms -XUL_ATOM(tree, "tree") // The start of a tree view -XUL_ATOM(treecaption, "treecaption") // The caption of a tree view -XUL_ATOM(treehead, "treehead") // The header of the tree view -XUL_ATOM(treerow, "treerow") // A row in the tree view -XUL_ATOM(treerows, "treerows") // A row in the tree view -XUL_ATOM(treecell, "treecell") // An item in the tree view -XUL_ATOM(treeitem, "treeitem") // A cell in the tree view -XUL_ATOM(treechildren, "treechildren") // The children of an item in the tree view -XUL_ATOM(treeindentation, "treeindentation") // Specifies that the indentation for the level should occur here. -XUL_ATOM(allowevents, "allowevents") // Lets events be handled on the cell contents or in menus. -XUL_ATOM(treecol, "treecol") // A column in the tree view -XUL_ATOM(treecolgroup, "treecolgroup") // A column group in the tree view -XUL_ATOM(treecols, "treecols") // A column group in the tree view -XUL_ATOM(treefoot, "treefoot") // The footer of the tree view -XUL_ATOM(scrollbarlist, "scrollbarlist") // An atom for internal use by the tree view -XUL_ATOM(indent, "indent") // indicates that a cell should be indented -XUL_ATOM(outer, "outer") // indicates that a treechildren is the outermost rowgroup -XUL_ATOM(sizemode, "sizemode") // when set, measure strings to determine preferred width - -XUL_ATOM(open, "open") // Whether or not a menu, tree, etc. is open -XUL_ATOM(focus, "focus") - -XUL_ATOM(outliner, "outliner") -XUL_ATOM(outlinerbody, "outlinerbody") -XUL_ATOM(outlinercol, "outlinercol") - -XUL_ATOM(cycler, "cycler") -XUL_ATOM(primary, "primary") -XUL_ATOM(current, "current") -XUL_ATOM(mozoutlinerrow, ":-moz-outliner-row") -XUL_ATOM(mozoutlinercell, ":-moz-outliner-cell") -XUL_ATOM(mozoutlinercolumn, ":-moz-outliner-column") -XUL_ATOM(mozoutlinercelltext, ":-moz-outliner-cell-text") -XUL_ATOM(mozoutlinertwisty, ":-moz-outliner-twisty") -XUL_ATOM(mozoutlinerindentation, ":-moz-outliner-indentation") -XUL_ATOM(mozoutlinerline, ":-moz-outliner-line") - -XUL_ATOM(menubar, "menubar") // An XP menu bar. -XUL_ATOM(menu, "menu") // Represents an XP menu -XUL_ATOM(menuitem, "menuitem") // Represents an XP menu item -XUL_ATOM(menupopup, "menupopup") // The XP menu's children. -XUL_ATOM(menutobedisplayed, "menutobedisplayed") // The menu is about to be displayed at the next sync w/ frame -XUL_ATOM(menuactive, "menuactive") // Whether or not a menu is active (without necessarily being open) -XUL_ATOM(accesskey, "accesskey") // The shortcut key for a menu or menu item -XUL_ATOM(acceltext, "acceltext") // Text to use for the accelerator -XUL_ATOM(popupset, "popupset") // Contains popup menus, context menus, and tooltips -XUL_ATOM(popup, "popup") // The popup for a context menu, popup menu, or tooltip -XUL_ATOM(menugenerated, "menugenerated") // Internal -XUL_ATOM(popupanchor, "popupanchor") // Anchor for popups -XUL_ATOM(popupalign, "popupalign") // Alignment for popups -XUL_ATOM(ignorekeys, "ignorekeys") // Alignment for popups -XUL_ATOM(sizetopopup, "sizetopopup") // Whether or not menus size to their popup children (used by menulists) - -XUL_ATOM(key, "key") // The key element / attribute -XUL_ATOM(keycode, "keycode") // The keycode attribute -XUL_ATOM(keytext, "keytext") // The keytext attribute -XUL_ATOM(modifiers, "modifiers") // The modifiers attribute -XUL_ATOM(broadcaster, "broadcaster") // A broadcaster -XUL_ATOM(observes, "observes") // The observes element -XUL_ATOM(templateAtom, "template") // A XUL template - -XUL_ATOM(progressbar, "progressbar") -XUL_ATOM(crop, "crop") - -XUL_ATOM(mode, "mode") -XUL_ATOM(equalsize, "equalsize") -XUL_ATOM(box, "box") -XUL_ATOM(hbox, "hbox") -XUL_ATOM(vbox, "vbox") -XUL_ATOM(scrollbox, "scrollbox") -XUL_ATOM(mousethrough, "mousethrough") -XUL_ATOM(flex, "flex") -XUL_ATOM(spring, "spring") -XUL_ATOM(orient, "orient") -XUL_ATOM(autostretch, "autostretch") -XUL_ATOM(minwidth, "min-width") -XUL_ATOM(minheight, "min-height") - -XUL_ATOM(autorepeatbutton, "autorepeatbutton") - -XUL_ATOM(bulletinboard, "bulletinboard") - -XUL_ATOM(titledbox, "titledbox") -XUL_ATOM(title, "title") -XUL_ATOM(titledboxContentPseudo, ":titledbox-content") - -XUL_ATOM(stack, "stack") -XUL_ATOM(deck, "deck") -XUL_ATOM(tabcontrol, "tabcontrol") -XUL_ATOM(tab, "tab") -XUL_ATOM(tabpanel, "tabpanel") -XUL_ATOM(tabpage, "tabpage") -XUL_ATOM(tabbox, "tabbox") -XUL_ATOM(index, "index") -XUL_ATOM(maxpos, "maxpos") -XUL_ATOM(curpos, "curpos") -XUL_ATOM(scrollbarbutton, "scrollbarbutton") -XUL_ATOM(increment, "increment") -XUL_ATOM(pageincrement, "pageincrement") -XUL_ATOM(thumb, "thumb") -XUL_ATOM(toggled, "toggled") -XUL_ATOM(grippy, "grippy") -XUL_ATOM(splitter, "splitter") -XUL_ATOM(collapse, "collapse") -XUL_ATOM(collapsed, "collapsed") -XUL_ATOM(resizebefore, "resizebefore") -XUL_ATOM(resizeafter, "resizeafter") -XUL_ATOM(state, "state") -XUL_ATOM(debug, "debug") - -XUL_ATOM(fixed, "fixed") - -// grid -XUL_ATOM(grid, "grid") -XUL_ATOM(rows, "rows") -XUL_ATOM(columns, "columns") -XUL_ATOM(row, "row") -XUL_ATOM(column, "column") - -// toolbar & toolbar d&d atoms -XUL_ATOM(ddDropLocation, "dd-droplocation") -XUL_ATOM(ddDropLocationCoord, "dd-droplocationcoord") -XUL_ATOM(ddDropOn, "dd-dropon") -XUL_ATOM(ddTriggerRepaintSorted, "dd-triggerrepaintsorted") -XUL_ATOM(ddTriggerRepaintRestore, "dd-triggerrepaintrestore") -XUL_ATOM(ddTriggerRepaint, "dd-triggerrepaint") -XUL_ATOM(ddNoDropBetweenRows, "dd-nodropbetweenrows") -XUL_ATOM(container, "container") -XUL_ATOM(ddDragDropArea, "dragdroparea") -XUL_ATOM(ddDropMarker, ":-moz-drop-marker") - -XUL_ATOM(widget, "widget") -XUL_ATOM(window, "window") - -XUL_ATOM(iframe, "iframe") -XUL_ATOM(browser, "browser") -XUL_ATOM(editor, "editor") - -// - -XUL_ATOM(checkbox, "checkbox") -XUL_ATOM(radio, "radio") -XUL_ATOM(radiogroup, "radiogroup") -XUL_ATOM(menulist, "menulist") -XUL_ATOM(menubutton, "menubutton") -XUL_ATOM(textfield, "textfield") -XUL_ATOM(textarea, "textarea") -XUL_ATOM(listbox, "listbox") - -XUL_ATOM(blankrow, "blankrow") -XUL_ATOM(titlebar, "titlebar") -XUL_ATOM(resizer, "resizer") -XUL_ATOM(dir, "dir") - diff --git a/mozilla/layout/xul/content/src/nsXULAtoms.cpp b/mozilla/layout/xul/content/src/nsXULAtoms.cpp deleted file mode 100644 index 0f7f2441a0e..00000000000 --- a/mozilla/layout/xul/content/src/nsXULAtoms.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: David W. Hyatt (hyatt@netscape.com) - * - * Contributor(s): - */ - -#include "nsString.h" -#include "nsINameSpaceManager.h" -#include "nsXULAtoms.h" -#include "nsContentCID.h" -static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID); - -static const char kXULNameSpace[] = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - -PRInt32 nsXULAtoms::nameSpaceID; - -// define storage for all atoms -#define XUL_ATOM(_name, _value) nsIAtom* nsXULAtoms::_name; -#include "nsXULAtomList.h" -#undef XUL_ATOM - - -static nsrefcnt gRefCnt = 0; -static nsINameSpaceManager* gNameSpaceManager; - -void nsXULAtoms::AddRefAtoms() { - - if (gRefCnt == 0) { - /* XUL Atoms registers the XUL name space ID because it's a convenient - place to do this, if you don't want a permanent, "well-known" ID. - */ - if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kNameSpaceManagerCID,nsnull,NS_GET_IID(nsINameSpaceManager),(void**)&gNameSpaceManager))) { -// gNameSpaceManager->CreateRootNameSpace(namespace); - nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace); - gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID); - } else { - NS_ASSERTION(0, "failed to create xul atoms namespace manager"); - } - - // now register the atoms -#define XUL_ATOM(_name, _value) _name = NS_NewAtom(_value); -#include "nsXULAtomList.h" -#undef XUL_ATOM - } - ++gRefCnt; -} - -void nsXULAtoms::ReleaseAtoms() { - - NS_PRECONDITION(gRefCnt != 0, "bad release of xul atoms"); - if (--gRefCnt == 0) { -#define XUL_ATOM(_name, _value) NS_RELEASE(_name); -#include "nsXULAtomList.h" -#undef XUL_ATOM - - NS_IF_RELEASE(gNameSpaceManager); - } -} diff --git a/mozilla/layout/xul/content/src/nsXULAtoms.h b/mozilla/layout/xul/content/src/nsXULAtoms.h deleted file mode 100644 index 93b2b7d53e9..00000000000 --- a/mozilla/layout/xul/content/src/nsXULAtoms.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- 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.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/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: David W. Hyatt (hyatt@netscape.com) - * - * Contributor(s): - */ -#ifndef nsXULAtoms_h___ -#define nsXULAtoms_h___ - -#include "prtypes.h" -#include "nsIAtom.h" - -class nsINameSpaceManager; - -/** - * This class wraps up the creation and destruction of the standard - * set of xul atoms used during normal xul handling. This object - * is created when the first xul content object is created, and - * destroyed when the last such content object is destroyed. - */ -class nsXULAtoms { -public: - - static void AddRefAtoms(); - static void ReleaseAtoms(); - - // XUL namespace ID, good for the life of the nsXULAtoms object - static PRInt32 nameSpaceID; - - /* Declare all atoms - - The atom names and values are stored in nsCSSAtomList.h and - are brought to you by the magic of C preprocessing - - Add new atoms to nsCSSAtomList and all support logic will be auto-generated - */ -#define XUL_ATOM(_name, _value) static nsIAtom* _name; -#include "nsXULAtomList.h" -#undef XUL_ATOM - -}; - -#endif /* nsXULAtoms_h___ */ diff --git a/mozilla/layout/xul/makefile.win b/mozilla/layout/xul/makefile.win index ad181aa813c..81a019fb1b1 100644 --- a/mozilla/layout/xul/makefile.win +++ b/mozilla/layout/xul/makefile.win @@ -21,6 +21,6 @@ DEPTH=..\.. -DIRS = base content +DIRS = base include <$(DEPTH)\config\rules.mak>