1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 * interface for rendering objects that manually create subtrees of
12 #ifndef nsIAnonymousContentCreator_h___
13 #define nsIAnonymousContentCreator_h___
15 #include "mozilla/AnonymousContentKey.h"
17 #include "nsQueryFrame.h"
18 #include "nsTArrayForwardDeclare.h"
19 #include "X11UndefineNone.h"
24 * Any source for anonymous content can implement this interface to provide it.
25 * HTML frames like nsFileControlFrame currently use this.
27 * @see nsCSSFrameConstructor
29 class nsIAnonymousContentCreator
{
31 NS_DECL_QUERYFRAME_TARGET(nsIAnonymousContentCreator
)
36 mozilla::AnonymousContentKey aKey
= mozilla::AnonymousContentKey::None
)
37 : mContent(aContent
), mKey(aKey
) {}
40 mozilla::AnonymousContentKey mKey
;
44 * Creates "native" anonymous content and adds the created content to
45 * the aElements array. None of the returned elements can be nullptr.
47 * If the anonymous content creator sets the editable flag on some
48 * of the elements that it creates, the flag will be applied to the node
49 * upon being bound to the document.
51 * @note The returned elements are owned by this object. This object is
52 * responsible for calling UnbindFromTree on the elements it returned
53 * from CreateAnonymousContent when appropriate (i.e. before releasing
56 virtual nsresult
CreateAnonymousContent(nsTArray
<ContentInfo
>& aElements
) = 0;
59 * Appends "native" anonymous children created by CreateAnonymousContent()
60 * to the given content list depending on the filter.
62 * @see nsIContent::GetChildren for set of values used for filter. Currently,
63 * eSkipPlaceholderContent is the only flag that any implementation of
66 virtual void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
67 uint32_t aFilter
) = 0;