Classes | Defines | Functions

nsStyleContext.h File Reference

#include "nsRuleNode.h"
#include "nsIAtom.h"
#include "nsCSSPseudoElements.h"
#include "nsStyleStructList.h"
Include dependency graph for nsStyleContext.h:
This graph shows which files directly or indirectly include this file:

Classes

class  nsStyleContext
 An nsStyleContext represents the computed style data for an element. More...
struct  nsStyleContext::AllocationHeader

Defines

#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_, ctor_args_)
#define STYLE_STRUCT_RESET(name_, checkdata_cb_, ctor_args_)
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_)
 Define typesafe getter functions for each style struct by preprocessing the list of style structs.
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_)
 Define typesafe getter functions for each style struct by preprocessing the list of style structs.
#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_, ctor_args_)
#define STYLE_STRUCT_RESET(name_, checkdata_cb_, ctor_args_)

Functions

already_AddRefed< nsStyleContextNS_NewStyleContext (nsStyleContext *aParentContext, nsIAtom *aPseudoTag, nsCSSPseudoElements::Type aPseudoType, nsRuleNode *aRuleNode, nsPresContext *aPresContext)

Define Documentation

#define STYLE_STRUCT (   name_,
  checkdata_cb_,
  ctor_args_ 
)
Value:
const nsStyle##name_ * GetStyle##name_() {            \
      return DoGetStyle##name_(PR_TRUE);                  \
    }

Define typesafe getter functions for each style struct by preprocessing the list of style structs.

PeekStyle* is like GetStyle* but doesn't trigger style computation if the data is not cached on either the style context or the rule node.

These functions are the preferred way to get style data. The macro creates functions like: const nsStyleBorder* GetStyleBorder(); const nsStyleColor* GetStyleColor();

Perhaps this shouldn't be a public nsStyleContext API.

#define STYLE_STRUCT (   name_,
  checkdata_cb_,
  ctor_args_ 
)
Value:
const nsStyle##name_ * PeekStyle##name_() {           \
      return DoGetStyle##name_(PR_FALSE);                 \
    }

Define typesafe getter functions for each style struct by preprocessing the list of style structs.

PeekStyle* is like GetStyle* but doesn't trigger style computation if the data is not cached on either the style context or the rule node.

These functions are the preferred way to get style data. The macro creates functions like: const nsStyleBorder* GetStyleBorder(); const nsStyleColor* GetStyleColor();

Perhaps this shouldn't be a public nsStyleContext API.

#define STYLE_STRUCT_INHERITED (   name_,
  checkdata_cb_,
  ctor_args_ 
)
Value:
const nsStyle##name_ * DoGetStyle##name_(PRBool aComputeData) {     \
      const nsStyle##name_ * cachedData =                               \
        mCachedInheritedData.m##name_##Data;                            \
      if (cachedData) /* Have it cached already, yay */                 \
        return cachedData;                                              \
      /* Have the rulenode deal */                                      \
      return mRuleNode->GetStyle##name_(this, aComputeData);            \
    }
#define STYLE_STRUCT_INHERITED (   name_,
  checkdata_cb_,
  ctor_args_ 
)
Value:
void SetStyle##name_ (nsStyle##name_ * aStruct) {                       \
      NS_ASSERTION(!mCachedInheritedData.m##name_##Data ||                  \
                   (mBits &                                                 \
                    nsCachedStyleData::GetBitForSID(eStyleStruct_##name_)), \
                   "Going to leak styledata");                              \
      mCachedInheritedData.m##name_##Data = aStruct;                        \
    }
#define STYLE_STRUCT_RESET (   name_,
  checkdata_cb_,
  ctor_args_ 
)
#define STYLE_STRUCT_RESET (   name_,
  checkdata_cb_,
  ctor_args_ 
)
Value:
const nsStyle##name_ * DoGetStyle##name_(PRBool aComputeData) {     \
      const nsStyle##name_ * cachedData =                               \
        mCachedResetData ? mCachedResetData->m##name_##Data : nsnull;   \
      if (cachedData) /* Have it cached already, yay */                 \
        return cachedData;                                              \
      /* Have the rulenode deal */                                      \
      return mRuleNode->GetStyle##name_(this, aComputeData);            \
    }

Function Documentation

already_AddRefed<nsStyleContext> NS_NewStyleContext ( nsStyleContext aParentContext,
nsIAtom aPseudoTag,
nsCSSPseudoElements::Type  aPseudoType,
nsRuleNode aRuleNode,
nsPresContext aPresContext 
)