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 650 of file nsContentList.cpp.

References nsINode::eELEMENT, nsINode::IsNodeOfType(), mData, mFunc, mMatchAll, and nsIContent::NodeInfo().

Referenced by MatchSelf(), and PopulateWith().

{
  if (!aContent)
    return PR_FALSE;

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

  if (mMatchAtom) {
    if (!aContent->IsNodeOfType(nsINode::eELEMENT)) {
      return PR_FALSE;
    }

    nsINodeInfo *ni = aContent->NodeInfo();

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

    if (mMatchNameSpaceId == kNameSpaceID_Wildcard) {
      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