Back to index

lightning-sunbird  0.9+nobinonly
nsCSSStruct.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Daniel Glazman <glazman@netscape.com>
00024  *   Mats Palmgren <mats.palmgren@bredband.net>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 #include "nscore.h"
00040 #include "nsCSSStruct.h"
00041 #include "nsString.h"
00042 #include "nsIAtom.h"
00043 #include "nsUnicharUtils.h"
00044 #include "nsCRT.h"
00045 #include "nsCSSProps.h"
00046 #include "nsUnitConversion.h"
00047 #include "nsVoidArray.h"
00048 #include "nsFont.h"
00049 
00050 #include "nsStyleConsts.h"
00051 
00052 #include "nsCOMPtr.h"
00053 #include "nsReadableUtils.h"
00054 #include "nsPrintfCString.h"
00055 
00056 #define CSS_IF_DELETE(ptr)  if (nsnull != ptr)  { delete ptr; ptr = nsnull; }
00057 
00058 // --- nsCSSFont -----------------
00059 
00060 nsCSSFont::nsCSSFont(void)
00061 {
00062   MOZ_COUNT_CTOR(nsCSSFont);
00063 }
00064 
00065 nsCSSFont::nsCSSFont(const nsCSSFont& aCopy)
00066   : mFamily(aCopy.mFamily),
00067     mStyle(aCopy.mStyle),
00068     mVariant(aCopy.mVariant),
00069     mWeight(aCopy.mWeight),
00070     mSize(aCopy.mSize),
00071     mSizeAdjust(aCopy.mSizeAdjust),
00072     mStretch(aCopy.mStretch)
00073 {
00074   MOZ_COUNT_CTOR(nsCSSFont);
00075 }
00076 
00077 nsCSSFont::~nsCSSFont(void)
00078 {
00079   MOZ_COUNT_DTOR(nsCSSFont);
00080 }
00081 
00082 #ifdef DEBUG
00083 void nsCSSFont::List(FILE* out, PRInt32 aIndent) const
00084 {
00085   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00086 
00087   nsAutoString buffer;
00088 
00089   mFamily.AppendToString(buffer, eCSSProperty_font_family);
00090   mStyle.AppendToString(buffer, eCSSProperty_font_style);
00091   mVariant.AppendToString(buffer, eCSSProperty_font_variant);
00092   mWeight.AppendToString(buffer, eCSSProperty_font_weight);
00093   mSize.AppendToString(buffer, eCSSProperty_font_size);
00094   mSizeAdjust.AppendToString(buffer, eCSSProperty_font_size_adjust);
00095   mStretch.AppendToString(buffer, eCSSProperty_font_stretch);
00096   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00097 }
00098 #endif
00099 
00100 // --- support -----------------
00101 
00102 #define CSS_IF_COPY(val, type) \
00103   if (aCopy.val) (val) = new type(*(aCopy.val));
00104 
00105 nsCSSValueList::nsCSSValueList(void)
00106   : mValue(),
00107     mNext(nsnull)
00108 {
00109   MOZ_COUNT_CTOR(nsCSSValueList);
00110 }
00111 
00112 nsCSSValueList::nsCSSValueList(const nsCSSValueList& aCopy)
00113   : mValue(aCopy.mValue),
00114     mNext(nsnull)
00115 {
00116   MOZ_COUNT_CTOR(nsCSSValueList);
00117   CSS_IF_COPY(mNext, nsCSSValueList);
00118 }
00119 
00120 nsCSSValueList::~nsCSSValueList(void)
00121 {
00122   MOZ_COUNT_DTOR(nsCSSValueList);
00123   CSS_IF_DELETE(mNext);
00124 }
00125 
00126 /* static */ PRBool
00127 nsCSSValueList::Equal(nsCSSValueList* aList1, nsCSSValueList* aList2)
00128 {
00129   if (aList1 == aList2)
00130     return PR_TRUE;
00131     
00132   nsCSSValueList *p1 = aList1, *p2 = aList2;
00133   for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
00134     if (p1->mValue != p2->mValue)
00135       return PR_FALSE;
00136   }
00137   return !p1 && !p2; // true if same length, false otherwise
00138 }
00139 
00140 // --- nsCSSColor -----------------
00141 
00142 nsCSSColor::nsCSSColor(void)
00143 {
00144   MOZ_COUNT_CTOR(nsCSSColor);
00145 }
00146 
00147 nsCSSColor::nsCSSColor(const nsCSSColor& aCopy)
00148   : mColor(aCopy.mColor),
00149     mBackColor(aCopy.mBackColor),
00150     mBackImage(aCopy.mBackImage),
00151     mBackRepeat(aCopy.mBackRepeat),
00152     mBackAttachment(aCopy.mBackAttachment),
00153     mBackPositionX(aCopy.mBackPositionX),
00154     mBackPositionY(aCopy.mBackPositionY),
00155     mBackClip(aCopy.mBackClip),
00156     mBackOrigin(aCopy.mBackOrigin),
00157     mBackInlinePolicy(aCopy.mBackInlinePolicy)
00158 
00159 {
00160   MOZ_COUNT_CTOR(nsCSSColor);
00161 }
00162 
00163 nsCSSColor::~nsCSSColor(void)
00164 {
00165   MOZ_COUNT_DTOR(nsCSSColor);
00166 }
00167 
00168 #ifdef DEBUG
00169 void nsCSSColor::List(FILE* out, PRInt32 aIndent) const
00170 {
00171   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00172 
00173   nsAutoString buffer;
00174 
00175   mColor.AppendToString(buffer, eCSSProperty_color);
00176   mBackColor.AppendToString(buffer, eCSSProperty_background_color);
00177   mBackImage.AppendToString(buffer, eCSSProperty_background_image);
00178   mBackRepeat.AppendToString(buffer, eCSSProperty_background_repeat);
00179   mBackAttachment.AppendToString(buffer, eCSSProperty_background_attachment);
00180   mBackPositionX.AppendToString(buffer, eCSSProperty_background_x_position);
00181   mBackPositionY.AppendToString(buffer, eCSSProperty_background_y_position);
00182   mBackClip.AppendToString(buffer, eCSSProperty__moz_background_clip);
00183   mBackOrigin.AppendToString(buffer, eCSSProperty__moz_background_origin);
00184   mBackInlinePolicy.AppendToString(buffer, eCSSProperty__moz_background_inline_policy);
00185   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00186 }
00187 #endif
00188 
00189 // --- nsCSSText support -----------------
00190 
00191 nsCSSShadow::nsCSSShadow(void)
00192   : mNext(nsnull)
00193 {
00194   MOZ_COUNT_CTOR(nsCSSShadow);
00195 }
00196 
00197 nsCSSShadow::nsCSSShadow(const nsCSSShadow& aCopy)
00198   : mColor(aCopy.mColor),
00199     mXOffset(aCopy.mXOffset),
00200     mYOffset(aCopy.mYOffset),
00201     mRadius(aCopy.mRadius),
00202     mNext(nsnull)
00203 {
00204   MOZ_COUNT_CTOR(nsCSSShadow);
00205   CSS_IF_COPY(mNext, nsCSSShadow);
00206 }
00207 
00208 nsCSSShadow::~nsCSSShadow(void)
00209 {
00210   MOZ_COUNT_DTOR(nsCSSShadow);
00211   CSS_IF_DELETE(mNext);
00212 }
00213 
00214 /* static */ PRBool
00215 nsCSSShadow::Equal(nsCSSShadow* aList1, nsCSSShadow* aList2)
00216 {
00217   if (aList1 == aList2)
00218     return PR_TRUE;
00219 
00220   nsCSSShadow *p1 = aList1, *p2 = aList2;
00221   for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
00222     if (p1->mColor != p2->mColor ||
00223         p1->mXOffset != p2->mXOffset ||
00224         p1->mYOffset != p2->mYOffset ||
00225         p1->mRadius != p2->mRadius)
00226       return PR_FALSE;
00227   }
00228   return !p1 && !p2; // true if same length, false otherwise
00229 }
00230 
00231 // --- nsCSSText -----------------
00232 
00233 nsCSSText::nsCSSText(void)
00234   : mTextShadow(nsnull)
00235 {
00236   MOZ_COUNT_CTOR(nsCSSText);
00237 }
00238 
00239 nsCSSText::nsCSSText(const nsCSSText& aCopy)
00240   : mWordSpacing(aCopy.mWordSpacing),
00241     mLetterSpacing(aCopy.mLetterSpacing),
00242     mVerticalAlign(aCopy.mVerticalAlign),
00243     mTextTransform(aCopy.mTextTransform),
00244     mTextAlign(aCopy.mTextAlign),
00245     mTextIndent(aCopy.mTextIndent),
00246     mDecoration(aCopy.mDecoration),
00247     mTextShadow(nsnull),
00248     mUnicodeBidi(aCopy.mUnicodeBidi),
00249     mLineHeight(aCopy.mLineHeight),
00250     mWhiteSpace(aCopy.mWhiteSpace)
00251 {
00252   MOZ_COUNT_CTOR(nsCSSText);
00253 }
00254 
00255 nsCSSText::~nsCSSText(void)
00256 {
00257   MOZ_COUNT_DTOR(nsCSSText);
00258   CSS_IF_DELETE(mTextShadow);
00259 }
00260 
00261 #ifdef DEBUG
00262 void nsCSSText::List(FILE* out, PRInt32 aIndent) const
00263 {
00264   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00265 
00266   nsAutoString buffer;
00267 
00268   mWordSpacing.AppendToString(buffer, eCSSProperty_word_spacing);
00269   mLetterSpacing.AppendToString(buffer, eCSSProperty_letter_spacing);
00270   mDecoration.AppendToString(buffer, eCSSProperty_text_decoration);
00271   mVerticalAlign.AppendToString(buffer, eCSSProperty_vertical_align);
00272   mTextTransform.AppendToString(buffer, eCSSProperty_text_transform);
00273   mTextAlign.AppendToString(buffer, eCSSProperty_text_align);
00274   mTextIndent.AppendToString(buffer, eCSSProperty_text_indent);
00275   if (nsnull != mTextShadow) {
00276     if (mTextShadow->mXOffset.IsLengthUnit()) {
00277       nsCSSShadow*  shadow = mTextShadow;
00278       // XXX This prints the property name many times, but nobody cares.
00279       while (nsnull != shadow) {
00280         shadow->mColor.AppendToString(buffer, eCSSProperty_text_shadow);
00281         shadow->mXOffset.AppendToString(buffer, eCSSProperty_text_shadow);
00282         shadow->mYOffset.AppendToString(buffer, eCSSProperty_text_shadow);
00283         shadow->mRadius.AppendToString(buffer, eCSSProperty_text_shadow);
00284         shadow = shadow->mNext;
00285       }
00286     }
00287     else {
00288       mTextShadow->mXOffset.AppendToString(buffer, eCSSProperty_text_shadow);
00289     }
00290   }
00291   mUnicodeBidi.AppendToString(buffer, eCSSProperty_unicode_bidi);
00292   mLineHeight.AppendToString(buffer, eCSSProperty_line_height);
00293   mWhiteSpace.AppendToString(buffer, eCSSProperty_white_space);
00294   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00295 }
00296 #endif
00297 
00298 // --- nsCSSRect -----------------
00299 
00300 nsCSSRect::nsCSSRect(void)
00301 {
00302   MOZ_COUNT_CTOR(nsCSSRect);
00303 }
00304 
00305 nsCSSRect::nsCSSRect(const nsCSSRect& aCopy)
00306   : mTop(aCopy.mTop),
00307     mRight(aCopy.mRight),
00308     mBottom(aCopy.mBottom),
00309     mLeft(aCopy.mLeft)
00310 {
00311   MOZ_COUNT_CTOR(nsCSSRect);
00312 }
00313 
00314 nsCSSRect::~nsCSSRect()
00315 {
00316   MOZ_COUNT_DTOR(nsCSSRect);
00317 }
00318 
00319 void nsCSSRect::SetAllSidesTo(const nsCSSValue& aValue)
00320 {
00321   mTop = aValue;
00322   mRight = aValue;
00323   mBottom = aValue;
00324   mLeft = aValue;
00325 }
00326 
00327 #if (NS_SIDE_TOP != 0) || (NS_SIDE_RIGHT != 1) || (NS_SIDE_BOTTOM != 2) || (NS_SIDE_LEFT != 3)
00328 #error "Somebody changed the side constants."
00329 #endif
00330 
00331 /* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
00332   &nsCSSRect::mTop,
00333   &nsCSSRect::mRight,
00334   &nsCSSRect::mBottom,
00335   &nsCSSRect::mLeft,
00336 };
00337 
00338 #ifdef DEBUG
00339 void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const
00340 {
00341   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00342 
00343   nsAutoString buffer;
00344 
00345   if (eCSSProperty_UNKNOWN < aPropID) {
00346     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID).get());
00347     buffer.AppendLiteral(": ");
00348   }
00349 
00350   mTop.AppendToString(buffer);
00351   mRight.AppendToString(buffer);
00352   mBottom.AppendToString(buffer); 
00353   mLeft.AppendToString(buffer);
00354   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00355 }
00356 
00357 void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const
00358 {
00359   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00360 
00361   nsAutoString buffer;
00362 
00363   if (eCSSUnit_Null != mTop.GetUnit()) {
00364     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0]).get());
00365     buffer.AppendLiteral(": ");
00366     mTop.AppendToString(buffer);
00367   }
00368   if (eCSSUnit_Null != mRight.GetUnit()) {
00369     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1]).get());
00370     buffer.AppendLiteral(": ");
00371     mRight.AppendToString(buffer);
00372   }
00373   if (eCSSUnit_Null != mBottom.GetUnit()) {
00374     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2]).get());
00375     buffer.AppendLiteral(": ");
00376     mBottom.AppendToString(buffer); 
00377   }
00378   if (eCSSUnit_Null != mLeft.GetUnit()) {
00379     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3]).get());
00380     buffer.AppendLiteral(": ");
00381     mLeft.AppendToString(buffer);
00382   }
00383 
00384   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00385 }
00386 #endif
00387 
00388 // --- nsCSSValuePair -------------------
00389 #ifdef DEBUG
00390 void nsCSSValuePair::AppendToString(nsAString& aString,
00391                                     nsCSSProperty aPropName) const
00392 {
00393   if (mXValue.GetUnit() != eCSSUnit_Null) {
00394     AppendUTF8toUTF16(nsCSSProps::GetStringValue(aPropName), aString);
00395     aString.Append(NS_LITERAL_STRING(": "));
00396     mXValue.AppendToString(aString);
00397     NS_ASSERTION(mYValue.GetUnit() != eCSSUnit_Null,
00398                  nsPrintfCString("Parsed half of a %s?",
00399                                  nsCSSProps::GetStringValue(aPropName).get()).get());
00400     aString.Append(PRUnichar(' '));
00401     mYValue.AppendToString(aString);
00402   }
00403 }
00404 #endif
00405 
00406 
00407 // --- nsCSSValueListRect -----------------
00408 
00409 MOZ_DECL_CTOR_COUNTER(nsCSSValueListRect)
00410 
00411 nsCSSValueListRect::nsCSSValueListRect(void)
00412   : mTop(nsnull),
00413     mRight(nsnull),
00414     mBottom(nsnull),
00415     mLeft(nsnull)
00416 {
00417   MOZ_COUNT_CTOR(nsCSSValueListRect);
00418 }
00419 
00420 nsCSSValueListRect::nsCSSValueListRect(const nsCSSValueListRect& aCopy)
00421   : mTop(aCopy.mTop),
00422     mRight(aCopy.mRight),
00423     mBottom(aCopy.mBottom),
00424     mLeft(aCopy.mLeft)
00425 {
00426   MOZ_COUNT_CTOR(nsCSSValueListRect);
00427 }
00428 
00429 nsCSSValueListRect::~nsCSSValueListRect()
00430 {
00431   MOZ_COUNT_DTOR(nsCSSValueListRect);
00432 }
00433 
00434 /* static */ const nsCSSValueListRect::side_type
00435 nsCSSValueListRect::sides[4] = {
00436   &nsCSSValueListRect::mTop,
00437   &nsCSSValueListRect::mRight,
00438   &nsCSSValueListRect::mBottom,
00439   &nsCSSValueListRect::mLeft,
00440 };
00441 
00442 #ifdef DEBUG
00443 void nsCSSValueListRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const
00444 {
00445 #if 0
00446   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00447 
00448   nsAutoString buffer;
00449 
00450   if (eCSSProperty_UNKNOWN < aPropID) {
00451     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID).get());
00452     buffer.AppendLiteral(": ");
00453   }
00454 
00455   mTop.AppendToString(buffer);
00456   mRight.AppendToString(buffer);
00457   mBottom.AppendToString(buffer); 
00458   mLeft.AppendToString(buffer);
00459   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00460 #endif
00461 }
00462 
00463 void nsCSSValueListRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) const
00464 {
00465 #if 0
00466   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00467 
00468   nsAutoString buffer;
00469 
00470   if (eCSSUnit_Null != mTop.GetUnit()) {
00471     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0]).get());
00472     buffer.AppendLiteral(": ");
00473     mTop.AppendToString(buffer);
00474   }
00475   if (eCSSUnit_Null != mRight.GetUnit()) {
00476     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1]).get());
00477     buffer.AppendLiteral(": ");
00478     mRight.AppendToString(buffer);
00479   }
00480   if (eCSSUnit_Null != mBottom.GetUnit()) {
00481     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2]).get());
00482     buffer.AppendLiteral(": ");
00483     mBottom.AppendToString(buffer); 
00484   }
00485   if (eCSSUnit_Null != mLeft.GetUnit()) {
00486     buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3]).get());
00487     buffer.AppendLiteral(": ");
00488     mLeft.AppendToString(buffer);
00489   }
00490 
00491   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00492 #endif
00493 }
00494 #endif
00495 
00496 // --- nsCSSDisplay -----------------
00497 
00498 nsCSSDisplay::nsCSSDisplay(void)
00499 {
00500   MOZ_COUNT_CTOR(nsCSSDisplay);
00501 }
00502 
00503 nsCSSDisplay::nsCSSDisplay(const nsCSSDisplay& aCopy)
00504   : mDirection(aCopy.mDirection),
00505     mDisplay(aCopy.mDisplay),
00506     mBinding(aCopy.mBinding),
00507     mAppearance(aCopy.mAppearance),
00508     mPosition(aCopy.mPosition),
00509     mFloat(aCopy.mFloat),
00510     mClear(aCopy.mClear),
00511     mClip(aCopy.mClip),
00512     mOverflowX(aCopy.mOverflowX),
00513     mOverflowY(aCopy.mOverflowY),
00514     mVisibility(aCopy.mVisibility),
00515     mOpacity(aCopy.mOpacity),
00516     // temp fix for bug 24000
00517     mBreakBefore(aCopy.mBreakBefore),
00518     mBreakAfter(aCopy.mBreakAfter)
00519     // end temp
00520 {
00521   MOZ_COUNT_CTOR(nsCSSDisplay);
00522 }
00523 
00524 nsCSSDisplay::~nsCSSDisplay(void)
00525 {
00526   MOZ_COUNT_DTOR(nsCSSDisplay);
00527 }
00528 
00529 #ifdef DEBUG
00530 void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const
00531 {
00532   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00533 
00534   nsAutoString buffer;
00535 
00536   mAppearance.AppendToString(buffer, eCSSProperty_appearance);
00537   mDirection.AppendToString(buffer, eCSSProperty_direction);
00538   mDisplay.AppendToString(buffer, eCSSProperty_display);
00539   mBinding.AppendToString(buffer, eCSSProperty_binding);
00540   mPosition.AppendToString(buffer, eCSSProperty_position);
00541   mFloat.AppendToString(buffer, eCSSProperty_float);
00542   mClear.AppendToString(buffer, eCSSProperty_clear);
00543   mVisibility.AppendToString(buffer, eCSSProperty_visibility);
00544   mOpacity.AppendToString(buffer, eCSSProperty_opacity);
00545 
00546   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00547   mClip.List(out, eCSSProperty_clip);
00548   buffer.SetLength(0);
00549   mOverflowX.AppendToString(buffer, eCSSProperty_overflow_x);
00550   mOverflowY.AppendToString(buffer, eCSSProperty_overflow_y);
00551   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00552 }
00553 #endif
00554 
00555 // --- nsCSSMargin -----------------
00556 
00557 nsCSSMargin::nsCSSMargin(void)
00558 {
00559   MOZ_COUNT_CTOR(nsCSSMargin);
00560 }
00561 
00562 nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy)
00563   : mMargin(aCopy.mMargin),
00564     mMarginStart(aCopy.mMarginStart),
00565     mMarginEnd(aCopy.mMarginEnd),
00566     mMarginLeftLTRSource(aCopy.mMarginLeftLTRSource),
00567     mMarginLeftRTLSource(aCopy.mMarginLeftRTLSource),
00568     mMarginRightLTRSource(aCopy.mMarginRightLTRSource),
00569     mMarginRightRTLSource(aCopy.mMarginRightRTLSource),
00570     mPadding(aCopy.mPadding), 
00571     mPaddingStart(aCopy.mPaddingStart),
00572     mPaddingEnd(aCopy.mPaddingEnd),
00573     mPaddingLeftLTRSource(aCopy.mPaddingLeftLTRSource),
00574     mPaddingLeftRTLSource(aCopy.mPaddingLeftRTLSource),
00575     mPaddingRightLTRSource(aCopy.mPaddingRightLTRSource),
00576     mPaddingRightRTLSource(aCopy.mPaddingRightRTLSource),
00577     mBorderWidth(aCopy.mBorderWidth),
00578     mBorderColor(aCopy.mBorderColor),
00579     mBorderColors(aCopy.mBorderColors),
00580     mBorderStyle(aCopy.mBorderStyle),
00581     mBorderRadius(aCopy.mBorderRadius),
00582     mOutlineWidth(aCopy.mOutlineWidth),
00583     mOutlineColor(aCopy.mOutlineColor),
00584     mOutlineStyle(aCopy.mOutlineStyle),
00585     mOutlineOffset(aCopy.mOutlineOffset),
00586     mOutlineRadius(aCopy.mOutlineRadius),
00587     mFloatEdge(aCopy.mFloatEdge)
00588 {
00589   MOZ_COUNT_CTOR(nsCSSMargin);
00590 }
00591 
00592 nsCSSMargin::~nsCSSMargin(void)
00593 {
00594   MOZ_COUNT_DTOR(nsCSSMargin);
00595 }
00596 
00597 #ifdef DEBUG
00598 void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
00599 {
00600   {
00601     static const nsCSSProperty trbl[] = {
00602       eCSSProperty_margin_top,
00603       eCSSProperty_margin_right,
00604       eCSSProperty_margin_bottom,
00605       eCSSProperty_margin_left
00606     };
00607     mMargin.List(out, aIndent, trbl);
00608   }
00609   {
00610     static const nsCSSProperty trbl[] = {
00611       eCSSProperty_padding_top,
00612       eCSSProperty_padding_right,
00613       eCSSProperty_padding_bottom,
00614       eCSSProperty_padding_left
00615     };
00616     mPadding.List(out, aIndent, trbl);
00617   }
00618   {
00619     static const nsCSSProperty trbl[] = {
00620       eCSSProperty_border_top_width,
00621       eCSSProperty_border_right_width,
00622       eCSSProperty_border_bottom_width,
00623       eCSSProperty_border_left_width
00624     };
00625     mBorderWidth.List(out, aIndent, trbl);
00626   }
00627   mBorderColor.List(out, eCSSProperty_border_color, aIndent);
00628   mBorderStyle.List(out, eCSSProperty_border_style, aIndent);
00629   {
00630     static const nsCSSProperty trbl[] = {
00631       eCSSProperty__moz_border_radius_topLeft,
00632       eCSSProperty__moz_border_radius_topRight,
00633       eCSSProperty__moz_border_radius_bottomRight,
00634       eCSSProperty__moz_border_radius_bottomLeft
00635     };
00636     mBorderRadius.List(out, aIndent, trbl);
00637   }
00638 
00639   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00640  
00641   nsAutoString  buffer;
00642   mOutlineWidth.AppendToString(buffer, eCSSProperty_outline_width);
00643   mOutlineColor.AppendToString(buffer, eCSSProperty_outline_color);
00644   mOutlineOffset.AppendToString(buffer, eCSSProperty_outline_offset);
00645   mOutlineStyle.AppendToString(buffer, eCSSProperty_outline_style);
00646   {
00647     static const nsCSSProperty trbl[] = {
00648       eCSSProperty__moz_outline_radius_topLeft,
00649       eCSSProperty__moz_outline_radius_topRight,
00650       eCSSProperty__moz_outline_radius_bottomRight,
00651       eCSSProperty__moz_outline_radius_bottomLeft
00652     };
00653     mOutlineRadius.List(out, aIndent, trbl);
00654   }
00655   mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge);
00656   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00657 }
00658 #endif
00659 
00660 // --- nsCSSPosition -----------------
00661 
00662 nsCSSPosition::nsCSSPosition(void)
00663 {
00664   MOZ_COUNT_CTOR(nsCSSPosition);
00665 }
00666 
00667 nsCSSPosition::nsCSSPosition(const nsCSSPosition& aCopy)
00668   : mWidth(aCopy.mWidth),
00669     mMinWidth(aCopy.mMinWidth),
00670     mMaxWidth(aCopy.mMaxWidth),
00671     mHeight(aCopy.mHeight),
00672     mMinHeight(aCopy.mMinHeight),
00673     mMaxHeight(aCopy.mMaxHeight),
00674     mBoxSizing(aCopy.mBoxSizing),
00675     mOffset(aCopy.mOffset),
00676     mZIndex(aCopy.mZIndex)
00677 {
00678   MOZ_COUNT_CTOR(nsCSSPosition);
00679 }
00680 
00681 nsCSSPosition::~nsCSSPosition(void)
00682 {
00683   MOZ_COUNT_DTOR(nsCSSPosition);
00684 }
00685 
00686 #ifdef DEBUG
00687 void nsCSSPosition::List(FILE* out, PRInt32 aIndent) const
00688 {
00689   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00690 
00691   nsAutoString buffer;
00692 
00693   mWidth.AppendToString(buffer, eCSSProperty_width);
00694   mMinWidth.AppendToString(buffer, eCSSProperty_min_width);
00695   mMaxWidth.AppendToString(buffer, eCSSProperty_max_width);
00696   mHeight.AppendToString(buffer, eCSSProperty_height);
00697   mMinHeight.AppendToString(buffer, eCSSProperty_min_height);
00698   mMaxHeight.AppendToString(buffer, eCSSProperty_max_height);
00699   mBoxSizing.AppendToString(buffer, eCSSProperty_box_sizing);
00700   mZIndex.AppendToString(buffer, eCSSProperty_z_index);
00701   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00702 
00703   static const nsCSSProperty trbl[] = {
00704     eCSSProperty_top,
00705     eCSSProperty_right,
00706     eCSSProperty_bottom,
00707     eCSSProperty_left
00708   };
00709   mOffset.List(out, aIndent, trbl);
00710 }
00711 #endif
00712 
00713 // --- nsCSSList -----------------
00714 
00715 nsCSSList::nsCSSList(void)
00716 {
00717   MOZ_COUNT_CTOR(nsCSSList);
00718 }
00719 
00720 nsCSSList::nsCSSList(const nsCSSList& aCopy)
00721   : mType(aCopy.mType),
00722     mImage(aCopy.mImage),
00723     mPosition(aCopy.mPosition),
00724     mImageRegion(aCopy.mImageRegion)
00725 {
00726   MOZ_COUNT_CTOR(nsCSSList);
00727 }
00728 
00729 nsCSSList::~nsCSSList(void)
00730 {
00731   MOZ_COUNT_DTOR(nsCSSList);
00732 }
00733 
00734 #ifdef DEBUG
00735 void nsCSSList::List(FILE* out, PRInt32 aIndent) const
00736 {
00737   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00738 
00739   nsAutoString buffer;
00740 
00741   mType.AppendToString(buffer, eCSSProperty_list_style_type);
00742   mImage.AppendToString(buffer, eCSSProperty_list_style_image);
00743   mPosition.AppendToString(buffer, eCSSProperty_list_style_position);
00744   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00745 
00746   static const nsCSSProperty trbl[] = {
00747     eCSSProperty_top,
00748     eCSSProperty_right,
00749     eCSSProperty_bottom,
00750     eCSSProperty_left
00751   };
00752   mImageRegion.List(out, aIndent, trbl);
00753 }
00754 #endif
00755 
00756 // --- nsCSSTable -----------------
00757 
00758 nsCSSTable::nsCSSTable(void)
00759 {
00760   MOZ_COUNT_CTOR(nsCSSTable);
00761 }
00762 
00763 nsCSSTable::nsCSSTable(const nsCSSTable& aCopy)
00764   : mBorderCollapse(aCopy.mBorderCollapse),
00765     mBorderSpacing(aCopy.mBorderSpacing),
00766     mCaptionSide(aCopy.mCaptionSide),
00767     mEmptyCells(aCopy.mEmptyCells),
00768     mLayout(aCopy.mLayout)
00769 {
00770   MOZ_COUNT_CTOR(nsCSSTable);
00771 }
00772 
00773 nsCSSTable::~nsCSSTable(void)
00774 {
00775   MOZ_COUNT_DTOR(nsCSSTable);
00776 }
00777 
00778 #ifdef DEBUG
00779 void nsCSSTable::List(FILE* out, PRInt32 aIndent) const
00780 {
00781   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00782 
00783   nsAutoString buffer;
00784 
00785   mBorderCollapse.AppendToString(buffer, eCSSProperty_border_collapse);
00786   mBorderSpacing.AppendToString(buffer, eCSSProperty_border_spacing);
00787   mCaptionSide.AppendToString(buffer, eCSSProperty_caption_side);
00788   mEmptyCells.AppendToString(buffer, eCSSProperty_empty_cells);
00789   mLayout.AppendToString(buffer, eCSSProperty_table_layout);
00790 
00791   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00792 }
00793 #endif
00794 
00795 // --- nsCSSBreaks -----------------
00796 
00797 nsCSSBreaks::nsCSSBreaks(void)
00798 {
00799   MOZ_COUNT_CTOR(nsCSSBreaks);
00800 }
00801 
00802 nsCSSBreaks::nsCSSBreaks(const nsCSSBreaks& aCopy)
00803   : mOrphans(aCopy.mOrphans),
00804     mWidows(aCopy.mWidows),
00805     mPage(aCopy.mPage),
00806     // temp fix for bug 24000
00807     //mPageBreakAfter(aCopy.mPageBreakAfter),
00808     //mPageBreakBefore(aCopy.mPageBreakBefore),
00809     mPageBreakInside(aCopy.mPageBreakInside)
00810 {
00811   MOZ_COUNT_CTOR(nsCSSBreaks);
00812 }
00813 
00814 nsCSSBreaks::~nsCSSBreaks(void)
00815 {
00816   MOZ_COUNT_DTOR(nsCSSBreaks);
00817 }
00818 
00819 #ifdef DEBUG
00820 void nsCSSBreaks::List(FILE* out, PRInt32 aIndent) const
00821 {
00822   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00823 
00824   nsAutoString buffer;
00825 
00826   mOrphans.AppendToString(buffer, eCSSProperty_orphans);
00827   mWidows.AppendToString(buffer, eCSSProperty_widows);
00828   mPage.AppendToString(buffer, eCSSProperty_page);
00829   // temp fix for bug 24000
00830   //mPageBreakAfter.AppendToString(buffer, eCSSProperty_page_break_after);
00831   //mPageBreakBefore.AppendToString(buffer, eCSSProperty_page_break_before);
00832   mPageBreakInside.AppendToString(buffer, eCSSProperty_page_break_inside);
00833 
00834   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00835 }
00836 #endif
00837 
00838 // --- nsCSSPage -----------------
00839 
00840 nsCSSPage::nsCSSPage(void)
00841 {
00842   MOZ_COUNT_CTOR(nsCSSPage);
00843 }
00844 
00845 nsCSSPage::nsCSSPage(const nsCSSPage& aCopy)
00846   : mMarks(aCopy.mMarks),
00847     mSize(aCopy.mSize)
00848 {
00849   MOZ_COUNT_CTOR(nsCSSPage);
00850 }
00851 
00852 nsCSSPage::~nsCSSPage(void)
00853 {
00854   MOZ_COUNT_DTOR(nsCSSPage);
00855 }
00856 
00857 #ifdef DEBUG
00858 void nsCSSPage::List(FILE* out, PRInt32 aIndent) const
00859 {
00860   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00861 
00862   nsAutoString buffer;
00863 
00864   mMarks.AppendToString(buffer, eCSSProperty_marks);
00865   mSize.AppendToString(buffer, eCSSProperty_size);
00866 
00867   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
00868 }
00869 #endif
00870 
00871 // --- nsCSSContent support -----------------
00872 
00873 nsCSSCounterData::nsCSSCounterData(void)
00874   : mNext(nsnull)
00875 {
00876   MOZ_COUNT_CTOR(nsCSSCounterData);
00877 }
00878 
00879 nsCSSCounterData::nsCSSCounterData(const nsCSSCounterData& aCopy)
00880   : mCounter(aCopy.mCounter),
00881     mValue(aCopy.mValue),
00882     mNext(nsnull)
00883 {
00884   MOZ_COUNT_CTOR(nsCSSCounterData);
00885   CSS_IF_COPY(mNext, nsCSSCounterData);
00886 }
00887 
00888 nsCSSCounterData::~nsCSSCounterData(void)
00889 {
00890   MOZ_COUNT_DTOR(nsCSSCounterData);
00891   CSS_IF_DELETE(mNext);
00892 }
00893 
00894 /* static */ PRBool
00895 nsCSSCounterData::Equal(nsCSSCounterData* aList1, nsCSSCounterData* aList2)
00896 {
00897   if (aList1 == aList2)
00898     return PR_TRUE;
00899 
00900   nsCSSCounterData *p1 = aList1, *p2 = aList2;
00901   for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
00902     if (p1->mCounter != p2->mCounter ||
00903         p1->mValue != p2->mValue)
00904       return PR_FALSE;
00905   }
00906   return !p1 && !p2; // true if same length, false otherwise
00907 }
00908 
00909 nsCSSQuotes::nsCSSQuotes(void)
00910   : mNext(nsnull)
00911 {
00912   MOZ_COUNT_CTOR(nsCSSQuotes);
00913 }
00914 
00915 nsCSSQuotes::nsCSSQuotes(const nsCSSQuotes& aCopy)
00916   : mOpen(aCopy.mOpen),
00917     mClose(aCopy.mClose),
00918     mNext(nsnull)
00919 {
00920   MOZ_COUNT_CTOR(nsCSSQuotes);
00921   CSS_IF_COPY(mNext, nsCSSQuotes);
00922 }
00923 
00924 nsCSSQuotes::~nsCSSQuotes(void)
00925 {
00926   MOZ_COUNT_DTOR(nsCSSQuotes);
00927   CSS_IF_DELETE(mNext);
00928 }
00929 
00930 /* static */ PRBool
00931 nsCSSQuotes::Equal(nsCSSQuotes* aList1, nsCSSQuotes* aList2)
00932 {
00933   if (aList1 == aList2)
00934     return PR_TRUE;
00935 
00936   nsCSSQuotes *p1 = aList1, *p2 = aList2;
00937   for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) {
00938     if (p1->mOpen != p2->mOpen ||
00939         p1->mClose != p2->mClose)
00940       return PR_FALSE;
00941   }
00942   return !p1 && !p2; // true if same length, false otherwise
00943 }
00944 
00945 // --- nsCSSContent -----------------
00946 
00947 nsCSSContent::nsCSSContent(void)
00948   : mContent(nsnull),
00949     mCounterIncrement(nsnull),
00950     mCounterReset(nsnull),
00951     mQuotes(nsnull)
00952 {
00953   MOZ_COUNT_CTOR(nsCSSContent);
00954 }
00955 
00956 nsCSSContent::nsCSSContent(const nsCSSContent& aCopy)
00957   : mContent(nsnull),
00958     mCounterIncrement(nsnull),
00959     mCounterReset(nsnull),
00960     mMarkerOffset(aCopy.mMarkerOffset),
00961     mQuotes(nsnull)
00962 {
00963   MOZ_COUNT_CTOR(nsCSSContent);
00964   CSS_IF_COPY(mContent, nsCSSValueList);
00965   CSS_IF_COPY(mCounterIncrement, nsCSSCounterData);
00966   CSS_IF_COPY(mCounterReset, nsCSSCounterData);
00967   CSS_IF_COPY(mQuotes, nsCSSQuotes);
00968 }
00969 
00970 nsCSSContent::~nsCSSContent(void)
00971 {
00972   MOZ_COUNT_DTOR(nsCSSContent);
00973   CSS_IF_DELETE(mContent);
00974   CSS_IF_DELETE(mCounterIncrement);
00975   CSS_IF_DELETE(mCounterReset);
00976   CSS_IF_DELETE(mQuotes);
00977 }
00978 
00979 #ifdef DEBUG
00980 void nsCSSContent::List(FILE* out, PRInt32 aIndent) const
00981 {
00982   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
00983 
00984   nsAutoString buffer;
00985 
00986   nsCSSValueList*  content = mContent;
00987   while (nsnull != content) {
00988     content->mValue.AppendToString(buffer, eCSSProperty_content);
00989     content = content->mNext;
00990   }
00991   nsCSSCounterData* counter = mCounterIncrement;
00992   while (nsnull != counter) {
00993     counter->mCounter.AppendToString(buffer, eCSSProperty_counter_increment);
00994     counter->mValue.AppendToString(buffer, eCSSProperty_UNKNOWN);
00995     counter = counter->mNext;
00996   }
00997   counter = mCounterReset;
00998   while (nsnull != counter) {
00999     counter->mCounter.AppendToString(buffer, eCSSProperty_counter_reset);
01000     counter->mValue.AppendToString(buffer, eCSSProperty_UNKNOWN);
01001     counter = counter->mNext;
01002   }
01003   mMarkerOffset.AppendToString(buffer, eCSSProperty_marker_offset);
01004   // XXX This prints the property name many times, but nobody cares.
01005   nsCSSQuotes*  quotes = mQuotes;
01006   while (nsnull != quotes) {
01007     quotes->mOpen.AppendToString(buffer, eCSSProperty_quotes);
01008     quotes->mClose.AppendToString(buffer, eCSSProperty_quotes);
01009     quotes = quotes->mNext;
01010   }
01011 
01012   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
01013 }
01014 #endif
01015 
01016 // --- nsCSSUserInterface -----------------
01017 
01018 nsCSSUserInterface::nsCSSUserInterface(void)
01019   : mCursor(nsnull)
01020 {
01021   MOZ_COUNT_CTOR(nsCSSUserInterface);
01022 }
01023 
01024 nsCSSUserInterface::nsCSSUserInterface(const nsCSSUserInterface& aCopy)
01025   : mUserInput(aCopy.mUserInput),
01026     mUserModify(aCopy.mUserModify),
01027     mUserSelect(aCopy.mUserSelect),
01028     mUserFocus(aCopy.mUserFocus),
01029     mCursor(nsnull),
01030     mForceBrokenImageIcon(aCopy.mForceBrokenImageIcon)
01031 {
01032   MOZ_COUNT_CTOR(nsCSSUserInterface);
01033   CSS_IF_COPY(mCursor, nsCSSValueList);
01034 }
01035 
01036 nsCSSUserInterface::~nsCSSUserInterface(void)
01037 {
01038   MOZ_COUNT_DTOR(nsCSSUserInterface);
01039   CSS_IF_DELETE(mCursor);
01040 }
01041 
01042 #ifdef DEBUG
01043 void nsCSSUserInterface::List(FILE* out, PRInt32 aIndent) const
01044 {
01045   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
01046 
01047   nsAutoString buffer;
01048 
01049   mUserInput.AppendToString(buffer, eCSSProperty_user_input);
01050   mUserModify.AppendToString(buffer, eCSSProperty_user_modify);
01051   mUserSelect.AppendToString(buffer, eCSSProperty_user_select);
01052   mUserFocus.AppendToString(buffer, eCSSProperty_user_focus);
01053   
01054   nsCSSValueList*  cursor = mCursor;
01055   while (nsnull != cursor) {
01056     cursor->mValue.AppendToString(buffer, eCSSProperty_cursor);
01057     cursor = cursor->mNext;
01058   }
01059 
01060   mForceBrokenImageIcon.AppendToString(buffer,eCSSProperty_force_broken_image_icon);
01061 
01062   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
01063 }
01064 #endif
01065 
01066 // --- nsCSSAural -----------------
01067 
01068 nsCSSAural::nsCSSAural(void)
01069 {
01070   MOZ_COUNT_CTOR(nsCSSAural);
01071 }
01072 
01073 nsCSSAural::nsCSSAural(const nsCSSAural& aCopy)
01074   : mAzimuth(aCopy.mAzimuth),
01075     mElevation(aCopy.mElevation),
01076     mCueAfter(aCopy.mCueAfter),
01077     mCueBefore(aCopy.mCueBefore),
01078     mPauseAfter(aCopy.mPauseAfter),
01079     mPauseBefore(aCopy.mPauseBefore),
01080     mPitch(aCopy.mPitch),
01081     mPitchRange(aCopy.mPitchRange),
01082     mRichness(aCopy.mRichness),
01083     mSpeak(aCopy.mSpeak),
01084     mSpeakHeader(aCopy.mSpeakHeader),
01085     mSpeakNumeral(aCopy.mSpeakNumeral),
01086     mSpeakPunctuation(aCopy.mSpeakPunctuation),
01087     mSpeechRate(aCopy.mSpeechRate),
01088     mStress(aCopy.mStress),
01089     mVoiceFamily(aCopy.mVoiceFamily),
01090     mVolume(aCopy.mVolume)
01091 {
01092   MOZ_COUNT_CTOR(nsCSSAural);
01093 }
01094 
01095 nsCSSAural::~nsCSSAural(void)
01096 {
01097   MOZ_COUNT_DTOR(nsCSSAural);
01098 }
01099 
01100 #ifdef DEBUG
01101 void nsCSSAural::List(FILE* out, PRInt32 aIndent) const
01102 {
01103   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
01104 
01105   nsAutoString buffer;
01106 
01107   mAzimuth.AppendToString(buffer, eCSSProperty_azimuth);
01108   mElevation.AppendToString(buffer, eCSSProperty_elevation);
01109   mCueAfter.AppendToString(buffer, eCSSProperty_cue_after);
01110   mCueBefore.AppendToString(buffer, eCSSProperty_cue_before);
01111   mPauseAfter.AppendToString(buffer, eCSSProperty_pause_after);
01112   mPauseBefore.AppendToString(buffer, eCSSProperty_pause_before);
01113   mPitch.AppendToString(buffer, eCSSProperty_pitch);
01114   mPitchRange.AppendToString(buffer, eCSSProperty_pitch_range);
01115   mRichness.AppendToString(buffer, eCSSProperty_richness);
01116   mSpeak.AppendToString(buffer, eCSSProperty_speak);
01117   mSpeakHeader.AppendToString(buffer, eCSSProperty_speak_header);
01118   mSpeakNumeral.AppendToString(buffer, eCSSProperty_speak_numeral);
01119   mSpeakPunctuation.AppendToString(buffer, eCSSProperty_speak_punctuation);
01120   mSpeechRate.AppendToString(buffer, eCSSProperty_speech_rate);
01121   mStress.AppendToString(buffer, eCSSProperty_stress);
01122   mVoiceFamily.AppendToString(buffer, eCSSProperty_voice_family);
01123   mVolume.AppendToString(buffer, eCSSProperty_volume);
01124 
01125   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
01126 }
01127 #endif
01128 
01129 // --- nsCSSXUL -----------------
01130 
01131 nsCSSXUL::nsCSSXUL(void)
01132 {
01133   MOZ_COUNT_CTOR(nsCSSXUL);
01134 }
01135 
01136 nsCSSXUL::nsCSSXUL(const nsCSSXUL& aCopy)
01137   : mBoxAlign(aCopy.mBoxAlign), mBoxDirection(aCopy.mBoxDirection),
01138     mBoxFlex(aCopy.mBoxFlex), mBoxOrient(aCopy.mBoxOrient),
01139     mBoxPack(aCopy.mBoxPack), mBoxOrdinal(aCopy.mBoxOrdinal)
01140 {
01141   MOZ_COUNT_CTOR(nsCSSXUL);
01142 }
01143 
01144 nsCSSXUL::~nsCSSXUL(void)
01145 {
01146   MOZ_COUNT_DTOR(nsCSSXUL);
01147 }
01148 
01149 #ifdef DEBUG
01150 void nsCSSXUL::List(FILE* out, PRInt32 aIndent) const
01151 {
01152   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
01153 
01154   nsAutoString buffer;
01155 
01156   mBoxAlign.AppendToString(buffer, eCSSProperty_box_align);
01157   mBoxDirection.AppendToString(buffer, eCSSProperty_box_direction);
01158   mBoxFlex.AppendToString(buffer, eCSSProperty_box_flex);
01159   mBoxOrient.AppendToString(buffer, eCSSProperty_box_orient);
01160   mBoxPack.AppendToString(buffer, eCSSProperty_box_pack);
01161   mBoxOrdinal.AppendToString(buffer, eCSSProperty_box_ordinal_group);
01162   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
01163 }
01164 #endif
01165 
01166 // --- nsCSSColumn -----------------
01167 
01168 nsCSSColumn::nsCSSColumn(void)
01169 {
01170   MOZ_COUNT_CTOR(nsCSSColumn);
01171 }
01172 
01173 nsCSSColumn::nsCSSColumn(const nsCSSColumn& aCopy)
01174   : mColumnCount(aCopy.mColumnCount), mColumnWidth(aCopy.mColumnWidth),
01175     mColumnGap(aCopy.mColumnGap)
01176 {
01177   MOZ_COUNT_CTOR(nsCSSColumn);
01178 }
01179 
01180 nsCSSColumn::~nsCSSColumn(void)
01181 {
01182   MOZ_COUNT_DTOR(nsCSSColumn);
01183 }
01184 
01185 #ifdef DEBUG
01186 void nsCSSColumn::List(FILE* out, PRInt32 aIndent) const
01187 {
01188   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
01189 
01190   nsAutoString buffer;
01191 
01192   mColumnWidth.AppendToString(buffer, eCSSProperty__moz_column_width);
01193   mColumnGap.AppendToString(buffer, eCSSProperty__moz_column_gap);
01194   mColumnCount.AppendToString(buffer, eCSSProperty__moz_column_count);
01195   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
01196 }
01197 #endif
01198 
01199 #ifdef MOZ_SVG
01200 // --- nsCSSSVG -----------------
01201 
01202 nsCSSSVG::nsCSSSVG(void) : mStrokeDasharray(nsnull)
01203 {
01204   MOZ_COUNT_CTOR(nsCSSSVG);
01205 }
01206 
01207 nsCSSSVG::nsCSSSVG(const nsCSSSVG& aCopy)
01208     : mClipPath(aCopy.mClipPath),
01209       mClipRule(aCopy.mClipRule),
01210       mDominantBaseline(aCopy.mDominantBaseline),
01211       mFill(aCopy.mFill),
01212       mFillOpacity(aCopy.mFillOpacity),
01213       mFillRule(aCopy.mFillRule),
01214       mMarkerEnd(aCopy.mMarkerEnd),
01215       mMarkerMid(aCopy.mMarkerMid),
01216       mMarkerStart(aCopy.mMarkerStart),
01217       mPointerEvents(aCopy.mPointerEvents),
01218       mShapeRendering(aCopy.mShapeRendering),
01219       mStopColor(aCopy.mStopColor),
01220       mStopOpacity(aCopy.mStopOpacity),
01221       mStroke(aCopy.mStroke),
01222       mStrokeDasharray(nsnull),
01223       mStrokeDashoffset(aCopy.mStrokeDashoffset),
01224       mStrokeLinecap(aCopy.mStrokeLinecap),
01225       mStrokeLinejoin(aCopy.mStrokeLinejoin),
01226       mStrokeMiterlimit(aCopy.mStrokeMiterlimit),
01227       mStrokeOpacity(aCopy.mStrokeOpacity),
01228       mStrokeWidth(aCopy.mStrokeWidth),
01229       mTextAnchor(aCopy.mTextAnchor),
01230       mTextRendering(aCopy.mTextRendering)
01231 {
01232   MOZ_COUNT_CTOR(nsCSSSVG);
01233   CSS_IF_COPY(mStrokeDasharray, nsCSSValueList);
01234 }
01235 
01236 nsCSSSVG::~nsCSSSVG(void)
01237 {
01238   MOZ_COUNT_DTOR(nsCSSSVG);
01239   CSS_IF_DELETE(mStrokeDasharray);
01240 }
01241 
01242 #ifdef DEBUG
01243 void nsCSSSVG::List(FILE* out, PRInt32 aIndent) const
01244 {
01245   for (PRInt32 index = aIndent; --index >= 0; ) fputs("  ", out);
01246 
01247   nsAutoString buffer;
01248 
01249   mClipPath.AppendToString(buffer, eCSSProperty_clip_path);
01250   mClipRule.AppendToString(buffer, eCSSProperty_clip_rule);
01251   mDominantBaseline.AppendToString(buffer, eCSSProperty_dominant_baseline);
01252   mFill.AppendToString(buffer, eCSSProperty_fill);
01253   mFillOpacity.AppendToString(buffer, eCSSProperty_fill_opacity);
01254   mFillRule.AppendToString(buffer, eCSSProperty_fill_rule);
01255   mMarkerEnd.AppendToString(buffer, eCSSProperty_marker_end);
01256   mMarkerMid.AppendToString(buffer, eCSSProperty_marker_mid);
01257   mMarkerStart.AppendToString(buffer, eCSSProperty_marker_start);
01258   mPointerEvents.AppendToString(buffer, eCSSProperty_pointer_events);
01259   mShapeRendering.AppendToString(buffer, eCSSProperty_shape_rendering);
01260   mStopColor.AppendToString(buffer, eCSSProperty_stop_color);
01261   mStopOpacity.AppendToString(buffer, eCSSProperty_stop_opacity);
01262   mStroke.AppendToString(buffer, eCSSProperty_stroke);
01263 
01264   // XXX This prints the property name many times, but nobody cares.
01265   nsCSSValueList *value = mStrokeDasharray;
01266   while (value) {
01267     value->mValue.AppendToString(buffer, eCSSProperty_stroke_dasharray);
01268     value = value->mNext;
01269     if (value)
01270       buffer.AppendLiteral(",");
01271   }
01272 
01273   mStrokeDashoffset.AppendToString(buffer, eCSSProperty_stroke_dashoffset);
01274   mStrokeLinecap.AppendToString(buffer, eCSSProperty_stroke_linecap);
01275   mStrokeLinejoin.AppendToString(buffer, eCSSProperty_stroke_linejoin);
01276   mStrokeMiterlimit.AppendToString(buffer, eCSSProperty_stroke_miterlimit);
01277   mStrokeOpacity.AppendToString(buffer, eCSSProperty_stroke_opacity);
01278   mStrokeWidth.AppendToString(buffer, eCSSProperty_stroke_width);
01279   mTextAnchor.AppendToString(buffer, eCSSProperty_text_anchor);
01280   mTextRendering.AppendToString(buffer, eCSSProperty_text_rendering);
01281   fputs(NS_LossyConvertUCS2toASCII(buffer).get(), out);
01282 }
01283 #endif
01284 
01285 #endif // MOZ_SVG