Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes
nsCachedStyleData Struct Reference

#include <nsRuleNode.h>

Collaboration diagram for nsCachedStyleData:
Collaboration graph

List of all members.


struct  StyleStructInfo

Public Member Functions

 NS_HIDDEN_ (nsStyleStruct *) NS_FASTCALL GetStyleData(const nsStyleStructID &aSID)
 NS_HIDDEN_ (void) ClearInheritedData(PRUint32 aBits)
 NS_HIDDEN_ (void) Destroy(PRUint32 aBits
 mResetData (nsnull)
 ~nsCachedStyleData ()

Static Public Member Functions

static PRBool IsReset (const nsStyleStructID &aSID)
static PRUint32 GetBitForSID (const nsStyleStructID &aSID)

Public Attributes


Static Public Attributes

static StyleStructInfo gInfo []

Detailed Description

Definition at line 170 of file nsRuleNode.h.

Class Documentation

struct nsCachedStyleData::StyleStructInfo

Definition at line 172 of file nsRuleNode.h.

Class Members
ptrdiff_t mCachedStyleDataOffset
ptrdiff_t mInheritResetOffset
PRBool mIsReset

Constructor & Destructor Documentation

Definition at line 239 of file nsRuleNode.h.


Member Function Documentation

static PRUint32 nsCachedStyleData::GetBitForSID ( const nsStyleStructID aSID) [inline, static]

Definition at line 187 of file nsRuleNode.h.

    return 1 << aSID;

Here is the caller graph for this function:

static PRBool nsCachedStyleData::IsReset ( const nsStyleStructID aSID) [inline, static]

Definition at line 183 of file nsRuleNode.h.

    return gInfo[aSID].mIsReset;

Here is the caller graph for this function:

Definition at line 238 of file nsRuleNode.h.

Definition at line 191 of file nsRuleNode.h.

    // Each struct is stored at this.m##type##Data->m##name##Data where
    // |type| is either Inherit or Reset, and |name| is the name of the
    // style struct.  The |gInfo| stores the offset of the appropriate
    // m##type##Data for the struct within nsCachedStyleData (|this|)
    // and the offset of the appropriate m##name##Data within the
    // m##type##Data.  Note that if we don't have any reset structs,
    // then mResetData is null, and likewise for mInheritedData.  This
    // saves us from having to go through the long if-else cascade into
    // which most compilers will turn a case statement.

    // NOTE:  nsStyleContext::SetStyle works roughly the same way.

    const StyleStructInfo& info = gInfo[aSID];

    // Get either &mInheritedData or &mResetData.
    char* resetOrInheritSlot = NS_REINTERPRET_CAST(char*, this) + info.mCachedStyleDataOffset;

    // Get either mInheritedData or mResetData.
    char* resetOrInherit = NS_REINTERPRET_CAST(char*, *NS_REINTERPRET_CAST(void**, resetOrInheritSlot));

    nsStyleStruct* data = nsnull;
    if (resetOrInherit) {
      // If we have the mInheritedData or mResetData, then we might have
      // the struct, so get it.
      char* dataSlot = resetOrInherit + info.mInheritResetOffset;
      data = *NS_REINTERPRET_CAST(nsStyleStruct**, dataSlot);
    return data;

Definition at line 222 of file nsRuleNode.h.

Here is the call graph for this function:

Member Data Documentation

Definition at line 178 of file nsRuleNode.h.

Definition at line 180 of file nsRuleNode.h.

Definition at line 181 of file nsRuleNode.h.

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