Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Public Attributes | Protected Attributes | Friends
nsCSSValue Class Reference

#include <nsCSSValue.h>

List of all members.

Classes

struct  Array
struct  Image
struct  URL

Public Member Functions

 nsCSSValue (nsCSSUnit aUnit=eCSSUnit_Null)
 nsCSSValue (PRInt32 aValue, nsCSSUnit aUnit) NS_HIDDEN
 nsCSSValue (float aValue, nsCSSUnit aUnit) NS_HIDDEN
 nsCSSValue (const nsAString &aValue, nsCSSUnit aUnit) NS_HIDDEN
 nsCSSValue (nscolor aValue) NS_HIDDEN
 nsCSSValue (Array *aArray, nsCSSUnit aUnit) NS_HIDDEN
 nsCSSValue (URL *aValue) NS_HIDDEN
 nsCSSValue (Image *aValue) NS_HIDDEN
 nsCSSValue (const nsCSSValue &aCopy) NS_HIDDEN
NS_FASTCALL ~nsCSSValue () NS_HIDDEN
 NS_HIDDEN_ (nsCSSValue &) operator
nsCSSUnit GetUnit () const
PRBool IsLengthUnit () const
PRBool IsFixedLengthUnit () const
PRBool IsRelativeLengthUnit () const
PRBool IsAngularUnit () const
PRBool IsFrequencyUnit () const
PRBool IsTimeUnit () const
PRInt32 GetIntValue () const
float GetPercentValue () const
float GetFloatValue () const
nsAString & GetStringValue (nsAString &aBuffer) const
const PRUnicharGetStringBufferValue () const
nscolor GetColorValue () const
ArrayGetArrayValue () const
nsIURIGetURLValue () const
const PRUnicharGetOriginalURLValue () const
 NS_HIDDEN_ (imgIRequest *) GetImageValue() const
 NS_HIDDEN_ (nscoord) GetLengthTwips() const
 NS_HIDDEN_ (void) Reset()
 NS_HIDDEN_ (void) SetIntValue(PRInt32 aValue
 NS_HIDDEN_ (void) SetPercentValue(float aValue)
 NS_HIDDEN_ (void) SetFloatValue(float aValue
 NS_HIDDEN_ (void) SetStringValue(const nsAString &aValue
 NS_HIDDEN_ (void) SetColorValue(nscolor aValue)
 NS_HIDDEN_ (void) SetInheritValue()
 NS_HIDDEN_ (void) SetInitialValue()
 NS_HIDDEN_ (void) SetNoneValue()
 NS_HIDDEN_ (void) SetNormalValue()
 NS_HIDDEN_ (void) StartImageLoad(nsIDocument *aDocument

Public Attributes

nsCSSUnit aUnit
PRBool aIsBGImage

Protected Attributes

nsCSSUnit mUnit
union {
PRInt32 mInt
float mFloat
PRUnicharmString
nscolor mColor
ArraymArray
URLmURL
ImagemImage
mValue

Friends

struct Array
struct URL
struct Image

Detailed Description

Definition at line 121 of file nsCSSValue.h.


Constructor & Destructor Documentation

nsCSSValue::nsCSSValue ( nsCSSUnit  aUnit = eCSSUnit_Null) [inline, explicit]

Definition at line 133 of file nsCSSValue.h.

    : mUnit(aUnit)
  {
    NS_ASSERTION(aUnit <= eCSSUnit_Normal, "not a valueless unit");
    if (aUnit > eCSSUnit_Normal) {
      mUnit = eCSSUnit_Null;
    }
    mValue.mInt = 0;
  }

Here is the caller graph for this function:

nsCSSValue::nsCSSValue ( PRInt32  aValue,
nsCSSUnit  aUnit 
)

Definition at line 51 of file nsCSSValue.cpp.

  : mUnit(aUnit)
{
  NS_ASSERTION((eCSSUnit_Integer == aUnit) ||
               (eCSSUnit_Enumerated == aUnit), "not an int value");
  if ((eCSSUnit_Integer == aUnit) ||
      (eCSSUnit_Enumerated == aUnit)) {
    mValue.mInt = aValue;
  }
  else {
    mUnit = eCSSUnit_Null;
    mValue.mInt = 0;
  }
}
nsCSSValue::nsCSSValue ( float  aValue,
nsCSSUnit  aUnit 
)

Definition at line 66 of file nsCSSValue.cpp.

  : mUnit(aUnit)
{
  NS_ASSERTION(eCSSUnit_Percent <= aUnit, "not a float value");
  if (eCSSUnit_Percent <= aUnit) {
    mValue.mFloat = aValue;
  }
  else {
    mUnit = eCSSUnit_Null;
    mValue.mInt = 0;
  }
}
nsCSSValue::nsCSSValue ( const nsAString &  aValue,
nsCSSUnit  aUnit 
)

Definition at line 79 of file nsCSSValue.cpp.

  : mUnit(aUnit)
{
  NS_ASSERTION((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Attr), "not a string value");
  if ((eCSSUnit_String <= aUnit) && (aUnit <= eCSSUnit_Attr)) {
    mValue.mString = ToNewUnicode(aValue);
  }
  else {
    mUnit = eCSSUnit_Null;
    mValue.mInt = 0;
  }
}

Here is the call graph for this function:

nsCSSValue::nsCSSValue ( nscolor  aValue) [explicit]

Definition at line 92 of file nsCSSValue.cpp.

  : mUnit(eCSSUnit_Color)
{
  mValue.mColor = aValue;
}

Definition at line 98 of file nsCSSValue.cpp.

  : mUnit(aUnit)
{
  NS_ASSERTION(eCSSUnit_Array <= aUnit && aUnit <= eCSSUnit_Counters,
               "bad unit");
  mValue.mArray = aValue;
  mValue.mArray->AddRef();
}
nsCSSValue::nsCSSValue ( nsCSSValue::URL aValue) [explicit]

Definition at line 107 of file nsCSSValue.cpp.

  : mUnit(eCSSUnit_URL)
{
  mValue.mURL = aValue;
  mValue.mURL->AddRef();
}
nsCSSValue::nsCSSValue ( nsCSSValue::Image aValue) [explicit]

Definition at line 114 of file nsCSSValue.cpp.

  : mUnit(eCSSUnit_Image)
{
  mValue.mImage = aValue;
  mValue.mImage->AddRef();
}

Definition at line 121 of file nsCSSValue.cpp.

  : mUnit(aCopy.mUnit)
{
  if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Attr)) {
    if (nsnull != aCopy.mValue.mString) {
      mValue.mString = ToNewUnicode(nsDependentString(aCopy.mValue.mString));
    }
    else {
      mValue.mString = nsnull;
    }
  }
  else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
    mValue.mInt = aCopy.mValue.mInt;
  }
  else if (eCSSUnit_Color == mUnit){
    mValue.mColor = aCopy.mValue.mColor;
  }
  else if (eCSSUnit_Array <= mUnit && mUnit <= eCSSUnit_Counters) {
    mValue.mArray = aCopy.mValue.mArray;
    mValue.mArray->AddRef();
  }
  else if (eCSSUnit_URL == mUnit){
    mValue.mURL = aCopy.mValue.mURL;
    mValue.mURL->AddRef();
  }
  else if (eCSSUnit_Image == mUnit){
    mValue.mImage = aCopy.mValue.mImage;
    mValue.mImage->AddRef();
  }
  else {
    mValue.mFloat = aCopy.mValue.mFloat;
  }
}

Here is the call graph for this function:

Definition at line 155 of file nsCSSValue.cpp.

{
  Reset();
}

Here is the caller graph for this function:


Member Function Documentation

Array* nsCSSValue::GetArrayValue ( ) const [inline]

Definition at line 218 of file nsCSSValue.h.

  {
    NS_ASSERTION(eCSSUnit_Array <= mUnit && mUnit <= eCSSUnit_Counters,
                 "not an array value");
    return mValue.mArray;
  }

Here is the caller graph for this function:

nscolor nsCSSValue::GetColorValue ( ) const [inline]

Definition at line 212 of file nsCSSValue.h.

  {
    NS_ASSERTION((mUnit == eCSSUnit_Color), "not a color value");
    return mValue.mColor;
  }

Here is the caller graph for this function:

float nsCSSValue::GetFloatValue ( ) const [inline]

Definition at line 188 of file nsCSSValue.h.

  {
    NS_ASSERTION(eCSSUnit_Number <= mUnit, "not a float value");
    return mValue.mFloat;
  }

Here is the caller graph for this function:

PRInt32 nsCSSValue::GetIntValue ( ) const [inline]

Definition at line 175 of file nsCSSValue.h.

  {
    NS_ASSERTION(mUnit == eCSSUnit_Integer || mUnit == eCSSUnit_Enumerated,
                 "not an int value");
    return mValue.mInt;
  }

Here is the caller graph for this function:

Definition at line 233 of file nsCSSValue.h.

  {
    NS_ASSERTION(mUnit == eCSSUnit_URL || mUnit == eCSSUnit_Image,
                 "not a URL value");
    return mUnit == eCSSUnit_URL ?
      mValue.mURL->mString : mValue.mImage->mString;
  }

Here is the caller graph for this function:

float nsCSSValue::GetPercentValue ( ) const [inline]

Definition at line 182 of file nsCSSValue.h.

  {
    NS_ASSERTION(mUnit == eCSSUnit_Percent, "not a percent value");
    return mValue.mFloat;
  }

Here is the caller graph for this function:

Definition at line 205 of file nsCSSValue.h.

  {
    NS_ASSERTION(eCSSUnit_String <= mUnit && mUnit <= eCSSUnit_Attr,
                 "not a string value");
    return mValue.mString;
  }

Here is the caller graph for this function:

nsAString& nsCSSValue::GetStringValue ( nsAString &  aBuffer) const [inline]

Definition at line 194 of file nsCSSValue.h.

  {
    NS_ASSERTION(eCSSUnit_String <= mUnit && mUnit <= eCSSUnit_Attr,
                 "not a string value");
    aBuffer.Truncate();
    if (nsnull != mValue.mString) {
      aBuffer.Append(mValue.mString);
    }
    return aBuffer;
  }

Here is the caller graph for this function:

nsCSSUnit nsCSSValue::GetUnit ( ) const [inline]

Definition at line 161 of file nsCSSValue.h.

{ return mUnit; };
nsIURI* nsCSSValue::GetURLValue ( ) const [inline]

Definition at line 225 of file nsCSSValue.h.

  {
    NS_ASSERTION(mUnit == eCSSUnit_URL || mUnit == eCSSUnit_Image,
                 "not a URL value");
    return mUnit == eCSSUnit_URL ?
      mValue.mURL->mURI : mValue.mImage->mURI;
  }

Here is the caller graph for this function:

PRBool nsCSSValue::IsAngularUnit ( ) const [inline]

Definition at line 168 of file nsCSSValue.h.

    { return PRBool((eCSSUnit_Degree <= mUnit) && (mUnit <= eCSSUnit_Radian)); }

Definition at line 164 of file nsCSSValue.h.

    { return PRBool((eCSSUnit_Inch <= mUnit) && (mUnit <= eCSSUnit_Cicero)); }

Here is the caller graph for this function:

PRBool nsCSSValue::IsFrequencyUnit ( ) const [inline]

Definition at line 170 of file nsCSSValue.h.

    { return PRBool((eCSSUnit_Hertz <= mUnit) && (mUnit <= eCSSUnit_Kilohertz)); }
PRBool nsCSSValue::IsLengthUnit ( ) const [inline]

Definition at line 162 of file nsCSSValue.h.

Here is the caller graph for this function:

Definition at line 166 of file nsCSSValue.h.

    { return PRBool((eCSSUnit_EM <= mUnit) && (mUnit <= eCSSUnit_Proportional)); }

Here is the caller graph for this function:

PRBool nsCSSValue::IsTimeUnit ( ) const [inline]

Definition at line 172 of file nsCSSValue.h.

Definition at line 153 of file nsCSSValue.h.

  {
    return !(*this == aOther);
  }
nsCSSValue::NS_HIDDEN_ ( void  ) [inline]

Definition at line 248 of file nsCSSValue.h.

  {
    if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Attr) &&
        (nsnull != mValue.mString)) {
      NS_Free(mValue.mString);
    } else if (eCSSUnit_Array <= mUnit && mUnit <= eCSSUnit_Counters) {
      mValue.mArray->Release();
    } else if (eCSSUnit_URL == mUnit) {
      mValue.mURL->Release();
    } else if (eCSSUnit_Image == mUnit) {
      mValue.mImage->Release();
    }
    mUnit = eCSSUnit_Null;
    mValue.mInt = 0;
  }

Here is the call graph for this function:


Friends And Related Function Documentation

friend struct Array [friend]

Definition at line 123 of file nsCSSValue.h.

friend struct Image [friend]

Definition at line 129 of file nsCSSValue.h.

friend struct URL [friend]

Definition at line 126 of file nsCSSValue.h.


Member Data Documentation

Initial value:

Definition at line 278 of file nsCSSValue.h.

Definition at line 264 of file nsCSSValue.h.

Definition at line 453 of file nsCSSValue.h.

union { ... } nsCSSValue::mValue [protected]

The documentation for this class was generated from the following files: