michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsContentListDeclarations_h michael@0: #define nsContentListDeclarations_h michael@0: michael@0: #include michael@0: #include "nsCOMPtr.h" michael@0: #include "nsStringFwd.h" michael@0: michael@0: class nsContentList; michael@0: class nsIAtom; michael@0: class nsIContent; michael@0: class nsINode; michael@0: michael@0: // Magic namespace id that means "match all namespaces". This is michael@0: // negative so it won't collide with actual namespace constants. michael@0: #define kNameSpaceID_Wildcard INT32_MIN michael@0: michael@0: // This is a callback function type that can be used to implement an michael@0: // arbitrary matching algorithm. aContent is the content that may michael@0: // match the list, while aNamespaceID, aAtom, and aData are whatever michael@0: // was passed to the list's constructor. michael@0: typedef bool (*nsContentListMatchFunc)(nsIContent* aContent, michael@0: int32_t aNamespaceID, michael@0: nsIAtom* aAtom, michael@0: void* aData); michael@0: michael@0: typedef void (*nsContentListDestroyFunc)(void* aData); michael@0: michael@0: /** michael@0: * A function that allocates the matching data for this michael@0: * FuncStringContentList. Returning aString is perfectly fine; in michael@0: * that case the destructor function should be a no-op. michael@0: */ michael@0: typedef void* (*nsFuncStringContentListDataAllocator)(nsINode* aRootNode, michael@0: const nsString* aString); michael@0: michael@0: // If aMatchNameSpaceId is kNameSpaceID_Unknown, this will return a michael@0: // content list which matches ASCIIToLower(aTagname) against HTML michael@0: // elements in HTML documents and aTagname against everything else. michael@0: // For any other value of aMatchNameSpaceId, the list will match michael@0: // aTagname against all elements. michael@0: already_AddRefed michael@0: NS_GetContentList(nsINode* aRootNode, michael@0: int32_t aMatchNameSpaceId, michael@0: const nsAString& aTagname); michael@0: michael@0: already_AddRefed michael@0: NS_GetFuncStringNodeList(nsINode* aRootNode, michael@0: nsContentListMatchFunc aFunc, michael@0: nsContentListDestroyFunc aDestroyFunc, michael@0: nsFuncStringContentListDataAllocator aDataAllocator, michael@0: const nsAString& aString); michael@0: already_AddRefed michael@0: NS_GetFuncStringHTMLCollection(nsINode* aRootNode, michael@0: nsContentListMatchFunc aFunc, michael@0: nsContentListDestroyFunc aDestroyFunc, michael@0: nsFuncStringContentListDataAllocator aDataAllocator, michael@0: const nsAString& aString); michael@0: michael@0: #endif // nsContentListDeclarations_h