Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Attributes
RuleProcessorData Struct Reference

#include <nsIStyleRuleProcessor.h>

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

List of all members.

Public Member Functions

 RuleProcessorData (nsPresContext *aPresContext, nsIContent *aContent, nsRuleWalker *aRuleWalker, nsCompatibility *aCompat=nsnull)
 ~RuleProcessorData ()
voidoperator new (size_t sz, nsPresContext *aContext) CPP_THROW_NEW
void Destroy (nsPresContext *aContext)
const nsStringGetLang ()

Public Attributes

nsPresContextmPresContext
nsIContentmContent
nsIContentmParentContent
nsRuleWalkermRuleWalker
nsIContentmScopedRoot
nsIAtommContentTag
nsIAtommContentID
nsIStyledContentmStyledContent
PRPackedBool mIsHTMLContent
PRPackedBool mIsHTMLLink
PRPackedBool mIsSimpleXLink
nsCompatibility mCompatMode
PRPackedBool mHasAttributes
nsLinkState mLinkState
PRInt32 mEventState
PRInt32 mNameSpaceID
RuleProcessorDatamPreviousSiblingData
RuleProcessorDatamParentData

Protected Attributes

nsAutoStringmLanguage

Detailed Description

Definition at line 60 of file nsIStyleRuleProcessor.h.


Constructor & Destructor Documentation

RuleProcessorData::RuleProcessorData ( nsPresContext aPresContext,
nsIContent aContent,
nsRuleWalker aRuleWalker,
nsCompatibility aCompat = nsnull 
)

Definition at line 2645 of file nsCSSStyleSheet.cpp.

{
  MOZ_COUNT_CTOR(RuleProcessorData);

  NS_PRECONDITION(aPresContext, "null pointer");
  NS_ASSERTION(!aContent || aContent->IsContentOfType(nsIContent::eELEMENT),
               "non-element leaked into SelectorMatches");

  mPresContext = aPresContext;
  mContent = aContent;
  mParentContent = nsnull;
  mRuleWalker = aRuleWalker;
  mScopedRoot = nsnull;

  mContentTag = nsnull;
  mContentID = nsnull;
  mStyledContent = nsnull;
  mIsHTMLContent = PR_FALSE;
  mIsHTMLLink = PR_FALSE;
  mIsSimpleXLink = PR_FALSE;
  mLinkState = eLinkState_Unknown;
  mEventState = 0;
  mNameSpaceID = kNameSpaceID_Unknown;
  mPreviousSiblingData = nsnull;
  mParentData = nsnull;
  mLanguage = nsnull;

  // get the compat. mode (unless it is provided)
  if(!aCompat) {
    mCompatMode = mPresContext->CompatibilityMode();
  } else {
    mCompatMode = *aCompat;
  }


  if(aContent){
    // we hold no ref to the content...
    mContent = aContent;

    // get the tag and parent
    mContentTag = aContent->Tag();
    mParentContent = aContent->GetParent();

    // get the event state
    mPresContext->EventStateManager()->GetContentState(aContent, mEventState);

    // get the styledcontent interface and the ID
    if (NS_SUCCEEDED(aContent->QueryInterface(NS_GET_IID(nsIStyledContent), (void**)&mStyledContent))) {
      NS_ASSERTION(mStyledContent, "Succeeded but returned null");
      mContentID = mStyledContent->GetID();
    }

    // see if there are attributes for the content
    mHasAttributes = aContent->GetAttrCount() > 0;

    // check for HTMLContent and Link status
    if (aContent->IsContentOfType(nsIContent::eHTML)) {
      mIsHTMLContent = PR_TRUE;
      // Note that we want to treat non-XML HTML content as XHTML for namespace
      // purposes, since html.css has that namespace declared.
      mNameSpaceID = kNameSpaceID_XHTML;
    } else {
      // get the namespace
      mNameSpaceID = aContent->GetNameSpaceID();
    }



    // if HTML content and it has some attributes, check for an HTML link
    // NOTE: optimization: cannot be a link if no attributes (since it needs an href)
    if (mIsHTMLContent && mHasAttributes) {
      // check if it is an HTML Link
      if(nsStyleUtil::IsHTMLLink(aContent, mContentTag, mPresContext, &mLinkState)) {
        mIsHTMLLink = PR_TRUE;
      }
    } 

    // if not an HTML link, check for a simple xlink (cannot be both HTML link and xlink)
    // NOTE: optimization: cannot be an XLink if no attributes (since it needs an 
    if(!mIsHTMLLink &&
       mHasAttributes && 
       !(mIsHTMLContent || aContent->IsContentOfType(nsIContent::eXUL)) && 
       nsStyleUtil::IsSimpleXlink(aContent, mPresContext, &mLinkState)) {
      mIsSimpleXLink = PR_TRUE;
    } 
  }
}

Here is the call graph for this function:

Definition at line 2736 of file nsCSSStyleSheet.cpp.

{
  MOZ_COUNT_DTOR(RuleProcessorData);

  // Destroy potentially long chains of previous sibling and parent data
  // without more than one level of recursion.
  if (mPreviousSiblingData || mParentData) {
    nsAutoVoidArray destroyQueue;
    destroyQueue.AppendElement(this);

    do {
      RuleProcessorData *d = NS_STATIC_CAST(RuleProcessorData*,
        destroyQueue.FastElementAt(destroyQueue.Count() - 1));
      destroyQueue.RemoveElementAt(destroyQueue.Count() - 1);

      if (d->mPreviousSiblingData) {
        destroyQueue.AppendElement(d->mPreviousSiblingData);
        d->mPreviousSiblingData = nsnull;
      }
      if (d->mParentData) {
        destroyQueue.AppendElement(d->mParentData);
        d->mParentData = nsnull;
      }

      if (d != this)
        d->Destroy(mPresContext);
    } while (destroyQueue.Count());
  }

  NS_IF_RELEASE(mStyledContent);

  delete mLanguage;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

void RuleProcessorData::Destroy ( nsPresContext aContext) [inline]

Definition at line 72 of file nsIStyleRuleProcessor.h.

                                        {
    this->~RuleProcessorData();
    aContext->FreeToShell(sizeof(RuleProcessorData), this);
  };

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2770 of file nsCSSStyleSheet.cpp.

{
  if (!mLanguage) {
    mLanguage = new nsAutoString();
    if (!mLanguage)
      return nsnull;
    for (nsIContent* content = mContent; content;
         content = content->GetParent()) {
      if (content->GetAttrCount() > 0) {
        // xml:lang has precedence over lang on HTML elements (see
        // XHTML1 section C.7).
        nsAutoString value;
        nsresult attrState = content->GetAttr(kNameSpaceID_XML,
                                              nsHTMLAtoms::lang, value);
        if (attrState != NS_CONTENT_ATTR_HAS_VALUE &&
            content->IsContentOfType(nsIContent::eHTML)) {
          attrState = content->GetAttr(kNameSpaceID_None,
                                       nsHTMLAtoms::lang, value);
        }
        if (attrState == NS_CONTENT_ATTR_HAS_VALUE) {
          *mLanguage = value;
          break;
        }
      }
    }
  }
  return mLanguage;
}

Here is the caller graph for this function:

void* RuleProcessorData::operator new ( size_t  sz,
nsPresContext aContext 
) [inline]

Definition at line 69 of file nsIStyleRuleProcessor.h.

                                                                       {
    return aContext->AllocateFromShell(sz);
  }

Member Data Documentation

Definition at line 91 of file nsIStyleRuleProcessor.h.

Definition at line 80 of file nsIStyleRuleProcessor.h.

Definition at line 86 of file nsIStyleRuleProcessor.h.

Definition at line 85 of file nsIStyleRuleProcessor.h.

Definition at line 94 of file nsIStyleRuleProcessor.h.

Definition at line 92 of file nsIStyleRuleProcessor.h.

Definition at line 88 of file nsIStyleRuleProcessor.h.

Definition at line 89 of file nsIStyleRuleProcessor.h.

Definition at line 90 of file nsIStyleRuleProcessor.h.

Definition at line 103 of file nsIStyleRuleProcessor.h.

Definition at line 93 of file nsIStyleRuleProcessor.h.

Definition at line 95 of file nsIStyleRuleProcessor.h.

Definition at line 81 of file nsIStyleRuleProcessor.h.

Definition at line 100 of file nsIStyleRuleProcessor.h.

Definition at line 79 of file nsIStyleRuleProcessor.h.

Definition at line 99 of file nsIStyleRuleProcessor.h.

Definition at line 82 of file nsIStyleRuleProcessor.h.

Definition at line 83 of file nsIStyleRuleProcessor.h.

Definition at line 87 of file nsIStyleRuleProcessor.h.


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