Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
nsROCSSPrimitiveValue Class Reference

#include <nsROCSSPrimitiveValue.h>

Inheritance diagram for nsROCSSPrimitiveValue:
Inheritance graph
[legend]
Collaboration diagram for nsROCSSPrimitiveValue:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSPRIMITIVEVALUE
NS_DECL_NSIDOMCSSVALUE 
nsROCSSPrimitiveValue (float aP2T)
virtual ~nsROCSSPrimitiveValue ()
void SetNumber (float aValue)
void SetNumber (PRInt32 aValue)
void SetNumber (PRUint32 aValue)
void SetPercent (float aValue)
void SetTwips (nscoord aValue)
void SetTwips (float aValue)
void SetIdent (nsIAtom *aAtom)
void SetIdent (const nsACString &aString)
void SetString (const nsACString &aString)
void SetString (const nsAString &aString)
void SetURI (nsIURI *aURI)
void SetColor (nsIDOMRGBColor *aColor)
void SetRect (nsIDOMRect *aRect)
void Reset (void)
void setFloatValue (in unsigned short unitType, in float floatValue) raises (DOMException)
float getFloatValue (in unsigned short unitType) raises (DOMException)
void setStringValue (in unsigned short stringType, in DOMString stringValue) raises (DOMException)
DOMString getStringValue () raises (DOMException)
nsIDOMCounter getCounterValue () raises (DOMException)
nsIDOMRect getRectValue () raises (DOMException)
nsIDOMRGBColor getRGBColorValue () raises (DOMException)

Public Attributes

const unsigned short CSS_UNKNOWN = 0
const unsigned short CSS_NUMBER = 1
const unsigned short CSS_PERCENTAGE = 2
const unsigned short CSS_EMS = 3
const unsigned short CSS_EXS = 4
const unsigned short CSS_PX = 5
const unsigned short CSS_CM = 6
const unsigned short CSS_MM = 7
const unsigned short CSS_IN = 8
const unsigned short CSS_PT = 9
const unsigned short CSS_PC = 10
const unsigned short CSS_DEG = 11
const unsigned short CSS_RAD = 12
const unsigned short CSS_GRAD = 13
const unsigned short CSS_MS = 14
const unsigned short CSS_S = 15
const unsigned short CSS_HZ = 16
const unsigned short CSS_KHZ = 17
const unsigned short CSS_DIMENSION = 18
const unsigned short CSS_STRING = 19
const unsigned short CSS_URI = 20
const unsigned short CSS_IDENT = 21
const unsigned short CSS_ATTR = 22
const unsigned short CSS_COUNTER = 23
const unsigned short CSS_RECT = 24
const unsigned short CSS_RGBCOLOR = 25
readonly attribute unsigned short primitiveType
const unsigned short CSS_INHERIT = 0
const unsigned short CSS_PRIMITIVE_VALUE = 1
const unsigned short CSS_VALUE_LIST = 2
const unsigned short CSS_CUSTOM = 3
attribute DOMString cssText
readonly attribute unsigned short cssValueType

Private Member Functions

void GetEscapedURI (nsIURI *aURI, PRUnichar **aReturn)

Private Attributes

PRUint16 mType
union {
nscoord mTwips
float mFloat
nsIDOMRGBColormColor
nsIDOMRectmRect
PRUnicharmString
nsIURImURI
nsIAtommAtom
mValue
float mT2P

Detailed Description

Definition at line 54 of file nsROCSSPrimitiveValue.h.


Constructor & Destructor Documentation

Definition at line 47 of file nsROCSSPrimitiveValue.cpp.

  : mType(CSS_PX), mT2P(aT2P)
{
  mValue.mTwips = 0;
}

Definition at line 54 of file nsROCSSPrimitiveValue.cpp.

{
  Reset();
}

Here is the call graph for this function:


Member Function Documentation

nsIDOMCounter nsIDOMCSSPrimitiveValue::getCounterValue ( ) raises (DOMException) [inherited]
void nsROCSSPrimitiveValue::GetEscapedURI ( nsIURI aURI,
PRUnichar **  aReturn 
) [private]

Definition at line 60 of file nsROCSSPrimitiveValue.cpp.

{
  nsCAutoString specUTF8;
  aURI->GetSpec(specUTF8);
  NS_ConvertUTF8toUCS2 spec(specUTF8);

  PRUint16 length = spec.Length();
  PRUnichar *escaped = (PRUnichar *)nsMemory::Alloc(length * 2 * sizeof(PRUnichar) + sizeof(PRUnichar('\0')));

  if (escaped) {
    PRUnichar *ptr = escaped;

    for (PRUint16 i = 0; i < length; ++i) {
      switch (spec[i]) {
        case ' ' : // space
        case '\t': // tab
        case '(' : // opening parenthesis
        case ')' : // closing parenthesis
        case '\'': // single quote
        case '"' : // double quote
        case ',' : // comma
        case '\\': // backslash
          // We have one of the above special characters.
          // Prepend it with a backslash.
          *ptr++ = '\\';
          break;
        default:
          break;
      }
      *ptr++ = spec[i];
    }
    *ptr = 0;
  }
  *aReturn = escaped;
}

Here is the call graph for this function:

float nsIDOMCSSPrimitiveValue::getFloatValue ( in unsigned short  unitType) raises (DOMException) [inherited]
nsIDOMRect nsIDOMCSSPrimitiveValue::getRectValue ( ) raises (DOMException) [inherited]
nsIDOMRGBColor nsIDOMCSSPrimitiveValue::getRGBColorValue ( ) raises (DOMException) [inherited]
DOMString nsIDOMCSSPrimitiveValue::getStringValue ( ) raises (DOMException) [inherited]

Definition at line 191 of file nsROCSSPrimitiveValue.h.

  {
    switch (mType) {
      case CSS_IDENT:
        NS_ASSERTION(mValue.mAtom, "Null atom should never happen");
        NS_RELEASE(mValue.mAtom);
        break;
      case CSS_STRING:
        NS_ASSERTION(mValue.mString, "Null string should never happen");
        nsMemory::Free(mValue.mString);
        mValue.mString = nsnull;
        break;
      case CSS_URI:
        NS_IF_RELEASE(mValue.mURI);
        break;
      case CSS_RECT:
        NS_ASSERTION(mValue.mRect, "Null Rect should never happen");
        NS_RELEASE(mValue.mRect);
        break;
      case CSS_RGBCOLOR:
        NS_ASSERTION(mValue.mColor, "Null RGBColor should never happen");
        NS_RELEASE(mValue.mColor);
        break;
    }
  }

Here is the caller graph for this function:

Definition at line 163 of file nsROCSSPrimitiveValue.h.

  {
    NS_PRECONDITION(aColor, "Null RGBColor being set!");
    Reset();
    mValue.mColor = aColor;
    if (mValue.mColor) {
      NS_ADDREF(mValue.mColor);
      mType = CSS_RGBCOLOR;
    }
    else {
      mType = CSS_UNKNOWN;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIDOMCSSPrimitiveValue::setFloatValue ( in unsigned short  unitType,
in float  floatValue 
) raises (DOMException) [inherited]

Definition at line 111 of file nsROCSSPrimitiveValue.h.

  {
    NS_PRECONDITION(aAtom, "Don't pass in a null atom");
    Reset();
    NS_ADDREF(mValue.mAtom = aAtom);
    mType = CSS_IDENT;
  }

Here is the call graph for this function:

void nsROCSSPrimitiveValue::SetIdent ( const nsACString &  aString) [inline]

Definition at line 119 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mAtom = NS_NewAtom(aString);
    if (mValue.mAtom) {
      mType = CSS_IDENT;
    } else {
      // XXXcaa We should probably let the caller know we are out of memory
      mType = CSS_UNKNOWN;
    }
  }

Here is the call graph for this function:

void nsROCSSPrimitiveValue::SetNumber ( float  aValue) [inline]

Definition at line 69 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mFloat = aValue;
    mType = CSS_NUMBER;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 76 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mFloat = float(aValue);
    mType = CSS_NUMBER;
  }

Here is the call graph for this function:

Definition at line 83 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mFloat = float(aValue);
    mType = CSS_NUMBER;
  }

Here is the call graph for this function:

void nsROCSSPrimitiveValue::SetPercent ( float  aValue) [inline]

Definition at line 90 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mFloat = aValue;
    mType = CSS_PERCENTAGE;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 177 of file nsROCSSPrimitiveValue.h.

  {
    NS_PRECONDITION(aRect, "Null rect being set!");
    Reset();
    mValue.mRect = aRect;
    if (mValue.mRect) {
      NS_ADDREF(mValue.mRect);
      mType = CSS_RECT;
    }
    else {
      mType = CSS_UNKNOWN;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsROCSSPrimitiveValue::SetString ( const nsACString &  aString) [inline]

Definition at line 131 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mString = ToNewUnicode(aString);
    if (mValue.mString) {
      mType = CSS_STRING;
    } else {
      // XXXcaa We should probably let the caller know we are out of memory
      mType = CSS_UNKNOWN;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsROCSSPrimitiveValue::SetString ( const nsAString &  aString) [inline]

Definition at line 143 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mString = ToNewUnicode(aString);
    if (mValue.mString) {
      mType = CSS_STRING;
    } else {
      // XXXcaa We should probably let the caller know we are out of memory
      mType = CSS_UNKNOWN;
    }
  }

Here is the call graph for this function:

void nsIDOMCSSPrimitiveValue::setStringValue ( in unsigned short  stringType,
in DOMString  stringValue 
) raises (DOMException) [inherited]

Definition at line 97 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mTwips = aValue;
    mType = CSS_PX;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsROCSSPrimitiveValue::SetTwips ( float  aValue) [inline]

Definition at line 104 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mTwips = nscoord(aValue);
    mType = CSS_PX;
  }

Here is the call graph for this function:

Definition at line 155 of file nsROCSSPrimitiveValue.h.

  {
    Reset();
    mValue.mURI = aURI;
    NS_IF_ADDREF(mValue.mURI);
    mType = CSS_URI;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const unsigned short nsIDOMCSSPrimitiveValue::CSS_ATTR = 22 [inherited]

Definition at line 77 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_CM = 6 [inherited]

Definition at line 61 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_COUNTER = 23 [inherited]

Definition at line 78 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSValue::CSS_CUSTOM = 3 [inherited]

Definition at line 58 of file nsIDOMCSSValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_DEG = 11 [inherited]

Definition at line 66 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_DIMENSION = 18 [inherited]

Definition at line 73 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_EMS = 3 [inherited]

Definition at line 58 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_EXS = 4 [inherited]

Definition at line 59 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_GRAD = 13 [inherited]

Definition at line 68 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_HZ = 16 [inherited]

Definition at line 71 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_IDENT = 21 [inherited]

Definition at line 76 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_IN = 8 [inherited]

Definition at line 63 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSValue::CSS_INHERIT = 0 [inherited]

Definition at line 55 of file nsIDOMCSSValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_KHZ = 17 [inherited]

Definition at line 72 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_MM = 7 [inherited]

Definition at line 62 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_MS = 14 [inherited]

Definition at line 69 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_NUMBER = 1 [inherited]

Definition at line 56 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_PC = 10 [inherited]

Definition at line 65 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_PERCENTAGE = 2 [inherited]

Definition at line 57 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSValue::CSS_PRIMITIVE_VALUE = 1 [inherited]

Definition at line 56 of file nsIDOMCSSValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_PT = 9 [inherited]

Definition at line 64 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_PX = 5 [inherited]

Definition at line 60 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_RAD = 12 [inherited]

Definition at line 67 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_RECT = 24 [inherited]

Definition at line 79 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_RGBCOLOR = 25 [inherited]

Definition at line 80 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_S = 15 [inherited]

Definition at line 70 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_STRING = 19 [inherited]

Definition at line 74 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_UNKNOWN = 0 [inherited]

Definition at line 55 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSPrimitiveValue::CSS_URI = 20 [inherited]

Definition at line 75 of file nsIDOMCSSPrimitiveValue.idl.

const unsigned short nsIDOMCSSValue::CSS_VALUE_LIST = 2 [inherited]

Definition at line 57 of file nsIDOMCSSValue.idl.

attribute DOMString nsIDOMCSSValue::cssText [inherited]

Definition at line 60 of file nsIDOMCSSValue.idl.

readonly attribute unsigned short nsIDOMCSSValue::cssValueType [inherited]

Definition at line 63 of file nsIDOMCSSValue.idl.

float nsROCSSPrimitiveValue::mT2P [private]

Definition at line 232 of file nsROCSSPrimitiveValue.h.

Definition at line 220 of file nsROCSSPrimitiveValue.h.

union { ... } nsROCSSPrimitiveValue::mValue [private]
readonly attribute unsigned short nsIDOMCSSPrimitiveValue::primitiveType [inherited]

Definition at line 82 of file nsIDOMCSSPrimitiveValue.idl.


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