Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsStyleChangeList Class Reference

#include <nsStyleChangeList.h>

Collaboration diagram for nsStyleChangeList:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsStyleChangeList (void)
 ~nsStyleChangeList (void)
PRInt32 Count (void) const
nsresult ChangeAt (PRInt32 aIndex, nsIFrame *&aFrame, nsIContent *&aContent, nsChangeHint &aHint) const
nsresult ChangeAt (PRInt32 aIndex, const nsStyleChangeData **aChangeData) const
nsresult AppendChange (nsIFrame *aFrame, nsIContent *aContent, nsChangeHint aHint)
void Clear (void)

Protected Member Functions

nsStyleChangeListoperator= (const nsStyleChangeList &aCopy)
PRBool operator== (const nsStyleChangeList &aOther) const

Protected Attributes

nsStyleChangeDatamArray
PRInt32 mArraySize
PRInt32 mCount
nsStyleChangeData mBuffer [kStyleChangeBufferSize]

Detailed Description

Definition at line 55 of file nsStyleChangeList.h.


Constructor & Destructor Documentation

Definition at line 56 of file nsStyleChangeList.cpp.

Here is the call graph for this function:


Member Function Documentation

nsresult nsStyleChangeList::AppendChange ( nsIFrame aFrame,
nsIContent aContent,
nsChangeHint  aHint 
)

Definition at line 86 of file nsStyleChangeList.cpp.

{
  NS_ASSERTION(aFrame || (aHint & nsChangeHint_ReconstructFrame),
               "must have frame");
  NS_ASSERTION(aContent || !(aHint & nsChangeHint_ReconstructFrame),
               "must have content");
  NS_ASSERTION(!aContent || aContent->IsContentOfType(nsIContent::eELEMENT),
               "Shouldn't be trying to restyle non-elements directly");

  if ((0 < mCount) && (aHint & nsChangeHint_ReconstructFrame)) { // filter out all other changes for same content
    if (aContent) {
      PRInt32 index = mCount;
      while (0 < index--) {
        if (aContent == mArray[index].mContent) { // remove this change
          mCount--;
          if (index < mCount) { // move later changes down
            ::memmove(&mArray[index], &mArray[index + 1], 
                      (mCount - index) * sizeof(nsStyleChangeData));
          }
        }
      }
    }
  }

  PRInt32 last = mCount - 1;
  if ((0 < mCount) && aFrame && (aFrame == mArray[last].mFrame)) { // same as last frame
    NS_UpdateHint(mArray[last].mHint, aHint);
  }
  else {
    if (mCount == mArraySize) {
      PRInt32 newSize = mArraySize + kGrowArrayBy;
      nsStyleChangeData* newArray = new nsStyleChangeData[newSize];
      if (newArray) {
        memcpy(newArray, mArray, mCount * sizeof(nsStyleChangeData));
        if (mArray != mBuffer) {
          delete [] mArray;
        }
        mArray = newArray;
        mArraySize = newSize;
      }
      else {
        return NS_ERROR_OUT_OF_MEMORY;
      }
    }
    mArray[mCount].mFrame = aFrame;
    mArray[mCount].mContent = aContent;
    mArray[mCount].mHint = aHint;
    mCount++;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsStyleChangeList::ChangeAt ( PRInt32  aIndex,
nsIFrame *&  aFrame,
nsIContent *&  aContent,
nsChangeHint aHint 
) const

Definition at line 63 of file nsStyleChangeList.cpp.

{
  if ((0 <= aIndex) && (aIndex < mCount)) {
    aFrame = mArray[aIndex].mFrame;
    aContent = mArray[aIndex].mContent;
    aHint = mArray[aIndex].mHint;
    return NS_OK;
  }
  return NS_ERROR_ILLEGAL_VALUE;
}

Here is the caller graph for this function:

nsresult nsStyleChangeList::ChangeAt ( PRInt32  aIndex,
const nsStyleChangeData **  aChangeData 
) const

Definition at line 76 of file nsStyleChangeList.cpp.

{
  if ((0 <= aIndex) && (aIndex < mCount)) {
    *aChangeData = &mArray[aIndex];
    return NS_OK;
  }
  return NS_ERROR_ILLEGAL_VALUE;
}

Definition at line 139 of file nsStyleChangeList.cpp.

Here is the caller graph for this function:

PRInt32 nsStyleChangeList::Count ( void  ) const [inline]

Definition at line 60 of file nsStyleChangeList.h.

                            {
    return mCount;
  }

Here is the caller graph for this function:

nsStyleChangeList& nsStyleChangeList::operator= ( const nsStyleChangeList aCopy) [protected]
PRBool nsStyleChangeList::operator== ( const nsStyleChangeList aOther) const [protected]

Member Data Documentation

Definition at line 77 of file nsStyleChangeList.h.

Definition at line 78 of file nsStyleChangeList.h.

Definition at line 80 of file nsStyleChangeList.h.

Definition at line 79 of file nsStyleChangeList.h.


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