nsContentCreatorFunctions.h (2734B)
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/. */ 6 7 #ifndef nsContentCreatorFunctions_h__ 8 #define nsContentCreatorFunctions_h__ 9 10 #include "mozilla/dom/FromParser.h" 11 #include "nsCOMPtr.h" 12 #include "nsError.h" 13 14 /** 15 * Functions to create content, to be used only inside Gecko 16 * (mozilla/content and mozilla/layout). 17 */ 18 19 class nsAtom; 20 class nsIContent; 21 22 class imgRequestProxy; 23 class nsGenericHTMLElement; 24 25 namespace mozilla::dom { 26 class Element; 27 class NodeInfo; 28 struct CustomElementDefinition; 29 } // namespace mozilla::dom 30 31 nsresult NS_NewElement(mozilla::dom::Element** aResult, 32 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, 33 mozilla::dom::FromParser aFromParser, 34 const nsAString* aIs); 35 36 nsresult NS_NewElement( 37 mozilla::dom::Element** aResult, 38 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, 39 mozilla::dom::FromParser aFromParser, nsAtom* aIsAtom = nullptr, 40 mozilla::dom::CustomElementDefinition* aDefinition = nullptr); 41 42 nsresult NS_NewXMLElement(mozilla::dom::Element** aResult, 43 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 44 45 nsresult NS_NewHTMLElement( 46 mozilla::dom::Element** aResult, 47 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, 48 mozilla::dom::FromParser aFromParser, nsAtom* aIsAtom = nullptr, 49 mozilla::dom::CustomElementDefinition* aDefinition = nullptr); 50 51 // First argument should be nsHTMLTag, but that adds dependency to parser 52 // for a bunch of files. 53 already_AddRefed<nsGenericHTMLElement> CreateHTMLElement( 54 uint32_t aNodeType, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, 55 mozilla::dom::FromParser aFromParser); 56 57 nsresult NS_NewMathMLElement( 58 mozilla::dom::Element** aResult, 59 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 60 61 nsresult NS_NewXULElement( 62 mozilla::dom::Element** aResult, 63 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, 64 mozilla::dom::FromParser aFromParser, nsAtom* aIsAtom = nullptr, 65 mozilla::dom::CustomElementDefinition* aDefinition = nullptr); 66 67 void NS_TrustedNewXULElement( 68 mozilla::dom::Element** aResult, 69 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 70 71 nsresult NS_NewSVGElement(mozilla::dom::Element** aResult, 72 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, 73 mozilla::dom::FromParser aFromParser); 74 75 #endif // nsContentCreatorFunctions_h__