2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-03-17 11:55:10 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef nsContentListDeclarations_h
|
|
|
|
#define nsContentListDeclarations_h
|
|
|
|
|
2013-07-30 18:25:31 +04:00
|
|
|
#include <stdint.h>
|
2013-03-17 11:55:10 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2017-08-17 02:48:52 +03:00
|
|
|
#include "nsStringFwd.h"
|
2013-03-17 11:55:10 +04:00
|
|
|
|
|
|
|
class nsContentList;
|
2017-10-03 01:05:19 +03:00
|
|
|
class nsAtom;
|
2013-03-17 11:55:10 +04:00
|
|
|
class nsIContent;
|
|
|
|
class nsINode;
|
|
|
|
|
2017-02-14 00:06:45 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Element;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-03-17 11:55:10 +04:00
|
|
|
// Magic namespace id that means "match all namespaces". This is
|
|
|
|
// negative so it won't collide with actual namespace constants.
|
|
|
|
#define kNameSpaceID_Wildcard INT32_MIN
|
|
|
|
|
|
|
|
// This is a callback function type that can be used to implement an
|
|
|
|
// arbitrary matching algorithm. aContent is the content that may
|
|
|
|
// match the list, while aNamespaceID, aAtom, and aData are whatever
|
|
|
|
// was passed to the list's constructor.
|
2017-02-14 00:06:45 +03:00
|
|
|
typedef bool (*nsContentListMatchFunc)(mozilla::dom::Element* aElement,
|
2013-03-17 11:55:10 +04:00
|
|
|
int32_t aNamespaceID, nsAtom* aAtom,
|
|
|
|
void* aData);
|
|
|
|
|
|
|
|
typedef void (*nsContentListDestroyFunc)(void* aData);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A function that allocates the matching data for this
|
|
|
|
* FuncStringContentList. Returning aString is perfectly fine; in
|
|
|
|
* that case the destructor function should be a no-op.
|
|
|
|
*/
|
|
|
|
typedef void* (*nsFuncStringContentListDataAllocator)(nsINode* aRootNode,
|
|
|
|
const nsString* aString);
|
|
|
|
|
|
|
|
// If aMatchNameSpaceId is kNameSpaceID_Unknown, this will return a
|
|
|
|
// content list which matches ASCIIToLower(aTagname) against HTML
|
|
|
|
// elements in HTML documents and aTagname against everything else.
|
2016-01-05 23:05:23 +03:00
|
|
|
// For any other value of aMatchNameSpaceId, the list will match
|
|
|
|
// aTagname against all elements.
|
2013-03-17 11:55:10 +04:00
|
|
|
already_AddRefed<nsContentList> NS_GetContentList(nsINode* aRootNode,
|
|
|
|
int32_t aMatchNameSpaceId,
|
|
|
|
const nsAString& aTagname);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-07-26 09:34:00 +03:00
|
|
|
template <class ListType>
|
2013-03-17 11:55:10 +04:00
|
|
|
already_AddRefed<nsContentList> GetFuncStringContentList(
|
2017-07-26 09:34:00 +03:00
|
|
|
nsINode* aRootNode, nsContentListMatchFunc aFunc,
|
2013-03-17 11:55:10 +04:00
|
|
|
nsContentListDestroyFunc aDestroyFunc,
|
|
|
|
nsFuncStringContentListDataAllocator aDataAllocator,
|
|
|
|
const nsAString& aString);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-03-17 11:55:10 +04:00
|
|
|
#endif // nsContentListDeclarations_h
|