Bug 1842999 - Part 25: Support testing elements are present in resizable typed arrays...
[gecko.git] / layout / generic / nsIAnonymousContentCreator.h
blob344d9f0096c68615398495dc6d8806fdc92bd966
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/. */
7 /*
8 * interface for rendering objects that manually create subtrees of
9 * anonymous content
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"
21 class nsIContent;
23 /**
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 {
30 public:
31 NS_DECL_QUERYFRAME_TARGET(nsIAnonymousContentCreator)
33 struct ContentInfo {
34 explicit ContentInfo(
35 nsIContent* aContent,
36 mozilla::AnonymousContentKey aKey = mozilla::AnonymousContentKey::None)
37 : mContent(aContent), mKey(aKey) {}
39 nsIContent* mContent;
40 mozilla::AnonymousContentKey mKey;
43 /**
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
54 * them).
56 virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) = 0;
58 /**
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
64 * this method heeds.
66 virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
67 uint32_t aFilter) = 0;
70 #endif