Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions | Variables
nsRuleNode.cpp File Reference
#include "nsRuleNode.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIDeviceContext.h"
#include "nsILookAndFeel.h"
#include "nsIPresShell.h"
#include "nsIFontMetrics.h"
#include "nsIDocShellTreeItem.h"
#include "nsStyleUtil.h"
#include "nsCSSPseudoElements.h"
#include "nsThemeConstants.h"
#include "nsITheme.h"
#include "pldhash.h"
#include "nsStyleContext.h"
#include "nsStyleSet.h"
#include "nsSize.h"
#include "imgIRequest.h"
#include "nsRuleData.h"
#include "nsILanguageAtomService.h"
#include "nsIStyleRule.h"
#include "nsCSSPropList.h"
#include "nsStyleStructList.h"

Go to the source code of this file.

Classes

struct  nsRuleList
struct  ChildrenHashEntry
struct  PropertyCheckData
struct  StructCheckData

Defines

#define SETCOORD_NORMAL   0x01
#define SETCOORD_AUTO   0x02
#define SETCOORD_INHERIT   0x04
#define SETCOORD_PERCENT   0x08
#define SETCOORD_FACTOR   0x10
#define SETCOORD_LENGTH   0x20
#define SETCOORD_INTEGER   0x40
#define SETCOORD_ENUMERATED   0x80
#define SETCOORD_LP   (SETCOORD_LENGTH | SETCOORD_PERCENT)
#define SETCOORD_LH   (SETCOORD_LENGTH | SETCOORD_INHERIT)
#define SETCOORD_AH   (SETCOORD_AUTO | SETCOORD_INHERIT)
#define SETCOORD_LAH   (SETCOORD_AUTO | SETCOORD_LENGTH | SETCOORD_INHERIT)
#define SETCOORD_LPH   (SETCOORD_LP | SETCOORD_INHERIT)
#define SETCOORD_LPAH   (SETCOORD_LP | SETCOORD_AH)
#define SETCOORD_LPEH   (SETCOORD_LP | SETCOORD_ENUMERATED | SETCOORD_INHERIT)
#define SETCOORD_LE   (SETCOORD_LENGTH | SETCOORD_ENUMERATED)
#define SETCOORD_LEH   (SETCOORD_LE | SETCOORD_INHERIT)
#define SETCOORD_IA   (SETCOORD_INTEGER | SETCOORD_AUTO)
#define SETCOORD_LAE   (SETCOORD_LENGTH | SETCOORD_AUTO | SETCOORD_ENUMERATED)
#define CSS_PROP_INCLUDE_NOT_CSS
#define CSS_PROP_FONT(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_DISPLAY(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_VISIBILITY(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_MARGIN(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_BORDER(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_PADDING(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_OUTLINE(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_LIST(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_COLOR(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_BACKGROUND(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_POSITION(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TABLE(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TABLEBORDER(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_CONTENT(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_QUOTES(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TEXT(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TEXTRESET(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_USERINTERFACE(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_UIRESET(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_XUL(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_COLUMN(name_, id_, method_, datastruct_, member_, type_, kwtable_)   { offsetof(nsRuleData##datastruct_, member_), type_ },
#define STYLE_STRUCT(name, checkdata_cb, ctor_args)
#define STYLE_STRUCT_TEST   aSID
#define STYLE_STRUCT(name, checkdata_cb, ctor_args)
#define STYLE_STRUCT_TEST   aSID
#define STYLE_STRUCT(name, checkdata_cb, ctor_args)   data = Get##name##Data(aContext);

Typedefs

typedef nsRuleNode::RuleDetail(* PR_CALLBACK )(const nsRuleDataStruct &aData)

Functions

 ChildrenHashGetKey (PLDHashTable *table, PLDHashEntryHdr *hdr)
 ChildrenHashMatchEntry (PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key)
static void EnsureBlockDisplay (PRUint8 &display)
nsStringUnquote (nsString &aString)
nscoord CalcLength (const nsCSSValue &aValue, const nsFont *aFont, nsStyleContext *aStyleContext, nsPresContext *aPresContext, PRBool &aInherited)
static PRBool SetCoord (const nsCSSValue &aValue, nsStyleCoord &aCoord, const nsStyleCoord &aParentCoord, PRInt32 aMask, nsStyleContext *aStyleContext, nsPresContext *aPresContext, PRBool &aInherited)
static PRBool SetColor (const nsCSSValue &aValue, const nscolor aParentColor, nsPresContext *aPresContext, nsStyleContext *aContext, nscolor &aResult, PRBool &aInherited)
 DeleteRuleNodeChildren (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
 ClearStyleDataHelper (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
void ExamineCSSValue (const nsCSSValue &aValue, PRUint32 &aSpecifiedCount, PRUint32 &aInheritedCount)
static void ExamineCSSValuePair (const nsCSSValuePair *aValuePair, PRUint32 &aSpecifiedCount, PRUint32 &aInheritedCount)
static void ExamineCSSRect (const nsCSSRect *aRect, PRUint32 &aSpecifiedCount, PRUint32 &aInheritedCount)
 CheckFontCallback (const nsRuleDataStruct &aData)
const nsCSSValueValueAtOffset (const nsRuleDataStruct &aRuleDataStruct, size_t aOffset)
const nsCSSRectRectAtOffset (const nsRuleDataStruct &aRuleDataStruct, size_t aOffset)
const nsCSSValuePairValuePairAtOffset (const nsRuleDataStruct &aRuleDataStruct, size_t aOffset)
const nsCSSValueListValueListAtOffset (const nsRuleDataStruct &aRuleDataStruct, size_t aOffset)
const nsCSSValueList ** ValueListArrayAtOffset (const nsRuleDataStruct &aRuleDataStruct, size_t aOffset)
const nsCSSCounterDataCounterDataAtOffset (const nsRuleDataStruct &aRuleDataStruct, size_t aOffset)
const nsCSSQuotesQuotesAtOffset (const nsRuleDataStruct &aRuleDataStruct, size_t aOffset)
static PRBool IsChrome (nsPresContext *aPresContext)
 SweepRuleNodeChildren (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)

Variables

static PLDHashTableOps ChildrenHashOps
static const PropertyCheckData FontCheckProperties []
static const PropertyCheckData DisplayCheckProperties []
static const PropertyCheckData VisibilityCheckProperties []
static const PropertyCheckData MarginCheckProperties []
static const PropertyCheckData BorderCheckProperties []
static const PropertyCheckData PaddingCheckProperties []
static const PropertyCheckData OutlineCheckProperties []
static const PropertyCheckData ListCheckProperties []
static const PropertyCheckData ColorCheckProperties []
static const PropertyCheckData BackgroundCheckProperties []
static const PropertyCheckData PositionCheckProperties []
static const PropertyCheckData TableCheckProperties []
static const PropertyCheckData TableBorderCheckProperties []
static const PropertyCheckData ContentCheckProperties []
static const PropertyCheckData QuotesCheckProperties []
static const PropertyCheckData TextCheckProperties []
static const PropertyCheckData TextResetCheckProperties []
static const PropertyCheckData UserInterfaceCheckProperties []
static const PropertyCheckData UIResetCheckProperties []
static const PropertyCheckData XULCheckProperties []
static const PropertyCheckData ColumnCheckProperties []
static const StructCheckData gCheckProperties []

Class Documentation

struct PropertyCheckData

Definition at line 580 of file nsRuleNode.cpp.

Class Members
size_t offset
nsCSSType type
struct StructCheckData

Definition at line 590 of file nsRuleNode.cpp.

Collaboration diagram for StructCheckData:
Class Members
CheckCallbackFn callback
PRInt32 nprops
const PropertyCheckData * props

Define Documentation

#define CSS_PROP_BACKGROUND (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_BORDER (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_COLOR (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_COLUMN (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_CONTENT (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_DISPLAY (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_FONT (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },

Definition at line 670 of file nsRuleNode.cpp.

#define CSS_PROP_LIST (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_MARGIN (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_OUTLINE (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_PADDING (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_POSITION (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_QUOTES (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TABLE (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TABLEBORDER (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TEXT (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_TEXTRESET (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_UIRESET (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_USERINTERFACE (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_VISIBILITY (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },
#define CSS_PROP_XUL (   name_,
  id_,
  method_,
  datastruct_,
  member_,
  type_,
  kwtable_ 
)    { offsetof(nsRuleData##datastruct_, member_), type_ },

Definition at line 252 of file nsRuleNode.cpp.

#define SETCOORD_AUTO   0x02

Definition at line 242 of file nsRuleNode.cpp.

Definition at line 248 of file nsRuleNode.cpp.

#define SETCOORD_FACTOR   0x10

Definition at line 245 of file nsRuleNode.cpp.

Definition at line 259 of file nsRuleNode.cpp.

Definition at line 243 of file nsRuleNode.cpp.

Definition at line 247 of file nsRuleNode.cpp.

Definition at line 260 of file nsRuleNode.cpp.

Definition at line 253 of file nsRuleNode.cpp.

Definition at line 257 of file nsRuleNode.cpp.

Definition at line 258 of file nsRuleNode.cpp.

#define SETCOORD_LENGTH   0x20

Definition at line 246 of file nsRuleNode.cpp.

Definition at line 251 of file nsRuleNode.cpp.

Definition at line 250 of file nsRuleNode.cpp.

Definition at line 255 of file nsRuleNode.cpp.

Definition at line 256 of file nsRuleNode.cpp.

Definition at line 254 of file nsRuleNode.cpp.

#define SETCOORD_NORMAL   0x01

Definition at line 241 of file nsRuleNode.cpp.

Definition at line 244 of file nsRuleNode.cpp.

#define STYLE_STRUCT (   name,
  checkdata_cb,
  ctor_args 
)
Value:
{name##CheckProperties, \
   sizeof(name##CheckProperties)/sizeof(PropertyCheckData), \
   checkdata_cb},
#define STYLE_STRUCT (   name,
  checkdata_cb,
  ctor_args 
)
Value:
res = Compute##name##Data(startStruct, *aSpecificData, aContext,            \
                      highestNode, detail, !aRuleData->mCanStoreInRuleTree);
#define STYLE_STRUCT (   name,
  checkdata_cb,
  ctor_args 
)    data = Get##name##Data(aContext);

Typedef Documentation

Definition at line 588 of file nsRuleNode.cpp.


Function Documentation

nscoord CalcLength ( const nsCSSValue aValue,
const nsFont aFont,
nsStyleContext aStyleContext,
nsPresContext aPresContext,
PRBool aInherited 
)

Definition at line 191 of file nsRuleNode.cpp.

{
  NS_ASSERTION(aValue.IsLengthUnit(), "not a length unit");
  if (aValue.IsFixedLengthUnit()) {
    return aValue.GetLengthTwips();
  }
  nsCSSUnit unit = aValue.GetUnit();
  if (unit == eCSSUnit_Pixel) {
    return NSFloatPixelsToTwips(aValue.GetFloatValue(),
                                aPresContext->ScaledPixelsToTwips());
  }
  // Common code for all units other than pixels:
  aInherited = PR_TRUE;
  const nsFont* font;
  if (aStyleContext) {
    font = &aStyleContext->GetStyleFont()->mFont;
  } else {
    font = aFont;
  }
  switch (unit) {
    case eCSSUnit_EM:
    case eCSSUnit_Char: {
      return NSToCoordRound(aValue.GetFloatValue() * (float)font->size);
      // XXX scale against font metrics height instead?
    }
    case eCSSUnit_EN: {
      return NSToCoordRound((aValue.GetFloatValue() * (float)font->size) / 2.0f);
    }
    case eCSSUnit_XHeight: {
      nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(*font);
      nscoord xHeight;
      fm->GetXHeight(xHeight);
      return NSToCoordRound(aValue.GetFloatValue() * (float)xHeight);
    }
    case eCSSUnit_CapHeight: {
      NS_NOTYETIMPLEMENTED("cap height unit");
      nscoord capHeight = ((font->size / 3) * 2); // XXX HACK!
      return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
    }
    default:
      NS_NOTREACHED("unexpected unit");
      break;
  }
  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 637 of file nsRuleNode.cpp.

{
  const nsRuleDataFont& fontData =
      NS_STATIC_CAST(const nsRuleDataFont&, aData);
  if (eCSSUnit_Enumerated == fontData.mFamily.GetUnit()) {
    // A special case. We treat this as a fully specified font,
    // since no other font props are legal with a system font.
    PRInt32 family = fontData.mFamily.GetIntValue();
    if ((family == NS_STYLE_FONT_CAPTION) ||
        (family == NS_STYLE_FONT_ICON) ||
        (family == NS_STYLE_FONT_MENU) ||
        (family == NS_STYLE_FONT_MESSAGE_BOX) ||
        (family == NS_STYLE_FONT_SMALL_CAPTION) ||
        (family == NS_STYLE_FONT_STATUS_BAR) ||
        (family == NS_STYLE_FONT_WINDOW) ||
        (family == NS_STYLE_FONT_DOCUMENT) ||
        (family == NS_STYLE_FONT_WORKSPACE) ||
        (family == NS_STYLE_FONT_DESKTOP) ||
        (family == NS_STYLE_FONT_INFO) ||
        (family == NS_STYLE_FONT_DIALOG) ||
        (family == NS_STYLE_FONT_BUTTON) ||
        (family == NS_STYLE_FONT_PULL_DOWN_MENU) ||
        (family == NS_STYLE_FONT_LIST) ||
        (family == NS_STYLE_FONT_FIELD))
      // Mixed rather than Reset in case another sub-property has
      // an explicit 'inherit'.   XXXperf Could check them.
      return nsRuleNode::eRuleFullMixed;
  }
  return nsRuleNode::eRuleUnknown;
}

Here is the call graph for this function:

Definition at line 114 of file nsRuleNode.cpp.

Here is the call graph for this function:

Definition at line 121 of file nsRuleNode.cpp.

{
  const ChildrenHashEntry *entry =
    NS_STATIC_CAST(const ChildrenHashEntry*, hdr);
  return entry->mRuleNode->GetRule() == key;
}

Here is the call graph for this function:

ClearStyleDataHelper ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
)

Definition at line 513 of file nsRuleNode.cpp.

{
  ChildrenHashEntry *entry = NS_STATIC_CAST(ChildrenHashEntry*, hdr);
  entry->mRuleNode->ClearStyleData();
  return PL_DHASH_NEXT;
}
const nsCSSCounterData* CounterDataAtOffset ( const nsRuleDataStruct aRuleDataStruct,
size_t  aOffset 
) [inline]

Definition at line 889 of file nsRuleNode.cpp.

{
  return * NS_REINTERPRET_CAST(const nsCSSCounterData*const*,
                     NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}

Here is the caller graph for this function:

DeleteRuleNodeChildren ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
)

Definition at line 417 of file nsRuleNode.cpp.

Here is the caller graph for this function:

static void EnsureBlockDisplay ( PRUint8 display) [static]

Definition at line 150 of file nsRuleNode.cpp.

{
  // see if the display value is already a block
  switch (display) {
  case NS_STYLE_DISPLAY_NONE :
    // never change display:none *ever*
  case NS_STYLE_DISPLAY_TABLE :
  case NS_STYLE_DISPLAY_BLOCK :
  case NS_STYLE_DISPLAY_LIST_ITEM :
    // do not muck with these at all - already blocks
    // This is equivalent to nsStyleDisplay::IsBlockLevel.  (XXX Maybe we
    // should just call that?)
    break;

  case NS_STYLE_DISPLAY_INLINE_TABLE :
    // make inline tables into tables
    display = NS_STYLE_DISPLAY_TABLE;
    break;

  default :
    // make it a block
    display = NS_STYLE_DISPLAY_BLOCK;
  }
}

Here is the caller graph for this function:

static void ExamineCSSRect ( const nsCSSRect aRect,
PRUint32 aSpecifiedCount,
PRUint32 aInheritedCount 
) [static]

Definition at line 625 of file nsRuleNode.cpp.

{
  NS_PRECONDITION(aRect, "Must have a rect");

  NS_FOR_CSS_SIDES(side) {
    ExamineCSSValue(aRect->*(nsCSSRect::sides[side]),
                    aSpecifiedCount, aInheritedCount);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ExamineCSSValue ( const nsCSSValue aValue,
PRUint32 aSpecifiedCount,
PRUint32 aInheritedCount 
) [inline]
Parameters:
aValuethe value being examined
aSpecifiedCountto be incremented by one if the value is specified
aInheritedto be incremented by one if the value is set to inherit

Definition at line 603 of file nsRuleNode.cpp.

{
  if (aValue.GetUnit() != eCSSUnit_Null) {
    ++aSpecifiedCount;
    if (aValue.GetUnit() == eCSSUnit_Inherit) {
      ++aInheritedCount;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void ExamineCSSValuePair ( const nsCSSValuePair aValuePair,
PRUint32 aSpecifiedCount,
PRUint32 aInheritedCount 
) [static]

Definition at line 615 of file nsRuleNode.cpp.

{
  NS_PRECONDITION(aValuePair, "Must have a value pair");
  
  ExamineCSSValue(aValuePair->mXValue, aSpecifiedCount, aInheritedCount);
  ExamineCSSValue(aValuePair->mYValue, aSpecifiedCount, aInheritedCount);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsChrome ( nsPresContext aPresContext) [static]

Definition at line 1409 of file nsRuleNode.cpp.

{
  PRBool isChrome = PR_FALSE;
  nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
  if (container) {
    nsresult result;
    nsCOMPtr<nsIDocShellTreeItem> docShell(do_QueryInterface(container, &result));
    if (NS_SUCCEEDED(result) && docShell) {
      PRInt32 docShellType;
      result = docShell->GetItemType(&docShellType);
      if (NS_SUCCEEDED(result)) {
        isChrome = nsIDocShellTreeItem::typeChrome == docShellType;
      }
    }
  }
  return isChrome;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const nsCSSQuotes* QuotesAtOffset ( const nsRuleDataStruct aRuleDataStruct,
size_t  aOffset 
) [inline]

Definition at line 896 of file nsRuleNode.cpp.

{
  return * NS_REINTERPRET_CAST(const nsCSSQuotes*const*,
                     NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}

Here is the caller graph for this function:

const nsCSSRect* RectAtOffset ( const nsRuleDataStruct aRuleDataStruct,
size_t  aOffset 
) [inline]

Definition at line 861 of file nsRuleNode.cpp.

{
  return NS_REINTERPRET_CAST(const nsCSSRect*,
                     NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}

Here is the caller graph for this function:

static PRBool SetColor ( const nsCSSValue aValue,
const nscolor  aParentColor,
nsPresContext aPresContext,
nsStyleContext aContext,
nscolor aResult,
PRBool aInherited 
) [static]

Definition at line 314 of file nsRuleNode.cpp.

{
  PRBool  result = PR_FALSE;
  nsCSSUnit unit = aValue.GetUnit();

  if (eCSSUnit_Color == unit) {
    aResult = aValue.GetColorValue();
    result = PR_TRUE;
  }
  else if (eCSSUnit_String == unit) {
    nsAutoString  value;
    aValue.GetStringValue(value);
    nscolor rgba;
    if (NS_ColorNameToRGB(value, &rgba)) {
      aResult = rgba;
      result = PR_TRUE;
    }
  }
  else if (eCSSUnit_Integer == unit) {
    PRInt32 intValue = aValue.GetIntValue();
    if (0 <= intValue) {
      nsILookAndFeel* look = aPresContext->LookAndFeel();
      nsILookAndFeel::nsColorID colorID = (nsILookAndFeel::nsColorID) intValue;
      if (NS_SUCCEEDED(look->GetColor(colorID, aResult))) {
        result = PR_TRUE;
      }
    }
    else {
      switch (intValue) {
        case NS_COLOR_MOZ_HYPERLINKTEXT:
          aResult = aPresContext->DefaultLinkColor();
          break;
        case NS_COLOR_MOZ_VISITEDHYPERLINKTEXT:
          aResult = aPresContext->DefaultVisitedLinkColor();
          break;
        case NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT:
          aResult = aPresContext->DefaultActiveLinkColor();
          break;
        case NS_COLOR_CURRENTCOLOR:
          // The data computed from this can't be shared in the rule tree 
          // because they could be used on a node with a different color
          aInherited = PR_TRUE;
          aResult = aContext->GetStyleColor()->mColor;
          break;
        default:
          NS_NOTREACHED("Should never have an unknown negative colorID.");
          break;
      }
      result = PR_TRUE;
    }
  }
  else if (eCSSUnit_Inherit == unit) {
    aResult = aParentColor;
    result = PR_TRUE;
    aInherited = PR_TRUE;
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool SetCoord ( const nsCSSValue aValue,
nsStyleCoord aCoord,
const nsStyleCoord aParentCoord,
PRInt32  aMask,
nsStyleContext aStyleContext,
nsPresContext aPresContext,
PRBool aInherited 
) [static]

Definition at line 262 of file nsRuleNode.cpp.

{
  PRBool  result = PR_TRUE;
  if (aValue.GetUnit() == eCSSUnit_Null) {
    result = PR_FALSE;
  }
  else if (((aMask & SETCOORD_LENGTH) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Char)) {
    aCoord.SetIntValue(NSToIntFloor(aValue.GetFloatValue()), eStyleUnit_Chars);
  } 
  else if (((aMask & SETCOORD_LENGTH) != 0) && 
           aValue.IsLengthUnit()) {
    aCoord.SetCoordValue(CalcLength(aValue, nsnull, aStyleContext, aPresContext, aInherited));
  } 
  else if (((aMask & SETCOORD_PERCENT) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Percent)) {
    aCoord.SetPercentValue(aValue.GetPercentValue());
  } 
  else if (((aMask & SETCOORD_INTEGER) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Integer)) {
    aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Integer);
  } 
  else if (((aMask & SETCOORD_ENUMERATED) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Enumerated)) {
    aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Enumerated);
  } 
  else if (((aMask & SETCOORD_AUTO) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Auto)) {
    aCoord.SetAutoValue();
  } 
  else if (((aMask & SETCOORD_INHERIT) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Inherit)) {
    aCoord = aParentCoord;  // just inherit value from parent
    aInherited = PR_TRUE;
  }
  else if (((aMask & SETCOORD_NORMAL) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Normal)) {
    aCoord.SetNormalValue();
  }
  else if (((aMask & SETCOORD_FACTOR) != 0) && 
           (aValue.GetUnit() == eCSSUnit_Number)) {
    aCoord.SetFactorValue(aValue.GetFloatValue());
  }
  else {
    result = PR_FALSE;  // didn't set anything
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SweepRuleNodeChildren ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
)

Definition at line 5105 of file nsRuleNode.cpp.

{
  ChildrenHashEntry *entry = NS_STATIC_CAST(ChildrenHashEntry*, hdr);
  if (entry->mRuleNode->Sweep())
    return PL_DHASH_REMOVE; // implies NEXT, unless |ed with STOP
  return PL_DHASH_NEXT;
}
nsString& Unquote ( nsString aString)

Definition at line 176 of file nsRuleNode.cpp.

{
  PRUnichar start = aString.First();
  PRUnichar end = aString.Last();

  if ((start == end) && 
      ((start == PRUnichar('\"')) || 
       (start == PRUnichar('\'')))) {
    PRInt32 length = aString.Length();
    aString.Truncate(length - 1);
    aString.Cut(0, 1);
  }
  return aString;
}

Here is the caller graph for this function:

const nsCSSValue& ValueAtOffset ( const nsRuleDataStruct aRuleDataStruct,
size_t  aOffset 
) [inline]

Definition at line 854 of file nsRuleNode.cpp.

{
  return * NS_REINTERPRET_CAST(const nsCSSValue*,
                     NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}

Here is the caller graph for this function:

const nsCSSValueList** ValueListArrayAtOffset ( const nsRuleDataStruct aRuleDataStruct,
size_t  aOffset 
) [inline]

Definition at line 882 of file nsRuleNode.cpp.

{
  return * NS_REINTERPRET_CAST(const nsCSSValueList**const*,
                     NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}
const nsCSSValueList* ValueListAtOffset ( const nsRuleDataStruct aRuleDataStruct,
size_t  aOffset 
) [inline]

Definition at line 875 of file nsRuleNode.cpp.

{
  return * NS_REINTERPRET_CAST(const nsCSSValueList*const*,
                     NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}

Here is the caller graph for this function:

const nsCSSValuePair* ValuePairAtOffset ( const nsRuleDataStruct aRuleDataStruct,
size_t  aOffset 
) [inline]

Definition at line 868 of file nsRuleNode.cpp.

{
  return NS_REINTERPRET_CAST(const nsCSSValuePair*,
                     NS_REINTERPRET_CAST(const char*, &aRuleDataStruct) + aOffset);
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 735 of file nsRuleNode.cpp.

Definition at line 700 of file nsRuleNode.cpp.

Definition at line 728 of file nsRuleNode.cpp.

Definition at line 828 of file nsRuleNode.cpp.

Definition at line 763 of file nsRuleNode.cpp.

Definition at line 679 of file nsRuleNode.cpp.

Definition at line 672 of file nsRuleNode.cpp.

Definition at line 837 of file nsRuleNode.cpp.

Definition at line 721 of file nsRuleNode.cpp.

Definition at line 693 of file nsRuleNode.cpp.

Definition at line 714 of file nsRuleNode.cpp.

Definition at line 707 of file nsRuleNode.cpp.

Definition at line 742 of file nsRuleNode.cpp.

Definition at line 770 of file nsRuleNode.cpp.

Definition at line 756 of file nsRuleNode.cpp.

Definition at line 749 of file nsRuleNode.cpp.

Definition at line 777 of file nsRuleNode.cpp.

Definition at line 784 of file nsRuleNode.cpp.

Definition at line 798 of file nsRuleNode.cpp.

Definition at line 791 of file nsRuleNode.cpp.

Definition at line 686 of file nsRuleNode.cpp.

Definition at line 805 of file nsRuleNode.cpp.