Logo Search packages:      
Sourcecode: xulrunner version File versions  Download package

PRBool nsContentList::Match ( nsIContent aContent  )  [protected]

Returns whether the content element matches our criterion

Parameters:
aContent the content to attempt to match
Returns:
whether we match

Definition at line 687 of file nsContentList.cpp.

References nsIContent::eELEMENT, nsIContent::GetNodeInfo(), nsIContent::IsContentOfType(), mData, mFunc, and mMatchAll.

Referenced by MatchSelf(), and PopulateWith().

{
  if (!aContent)
    return PR_FALSE;

  if (mFunc) {
    return (*mFunc)(aContent, mMatchNameSpaceId, mMatchAtom, *mData);
  }

  if (mMatchAtom) {
    if (!aContent->IsContentOfType(nsIContent::eELEMENT)) {
      return PR_FALSE;
    }

    nsINodeInfo *ni = aContent->GetNodeInfo();
    NS_ASSERTION(ni, "Element without nodeinfo!");

    if (mMatchNameSpaceId == kNameSpaceID_Unknown) {
      return (mMatchAll || ni->Equals(mMatchAtom));
    }

    return ((mMatchAll && ni->NamespaceEquals(mMatchNameSpaceId)) ||
            ni->Equals(mMatchAtom, mMatchNameSpaceId));
  }

  return PR_FALSE;
}


Generated by  Doxygen 1.6.0   Back to index