summaryrefslogtreecommitdiff
path: root/dom/html
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-19 09:57:36 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:42 -0500
commita393504e8236869a4e379fd91efb24410734d7f0 (patch)
treed8fba280f76b3ff92d5bf1c4d574731ab956f662 /dom/html
parent385ab5f88e8c44e2273adf5b5b6af4adc1095954 (diff)
downloaduxp-a393504e8236869a4e379fd91efb24410734d7f0.tar.gz
Bug 483155 - Put content creator function pointers onto nsHtml5ElementName.
This is all the manual work for Bug 483155, minus the added functionality to disable SVG and MathML which can be done at any time and are out of scope. Tag UXP Issue mcp-graveyard/UXP#1344
Diffstat (limited to 'dom/html')
-rw-r--r--dom/html/HTMLElement.cpp9
-rw-r--r--dom/html/nsGenericHTMLElement.h16
-rw-r--r--dom/html/nsHTMLContentSink.cpp8
3 files changed, 27 insertions, 6 deletions
diff --git a/dom/html/HTMLElement.cpp b/dom/html/HTMLElement.cpp
index b2f23b9317..d3901bdf31 100644
--- a/dom/html/HTMLElement.cpp
+++ b/dom/html/HTMLElement.cpp
@@ -52,3 +52,12 @@ NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
{
return new mozilla::dom::HTMLElement(aNodeInfo);
}
+
+// Distinct from the above in order to have function pointer that compared unequal
+// to a function pointer to the above.
+nsGenericHTMLElement*
+NS_NewCustomElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
+ mozilla::dom::FromParser aFromParser)
+{
+ return new mozilla::dom::HTMLElement(aNodeInfo);
+}
diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h
index 72039f2661..edef2eeef2 100644
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1590,6 +1590,15 @@ protected:
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, \
mNodeInfo->Equals(nsGkAtoms::_tag))
+namespace mozilla {
+namespace dom {
+
+typedef nsGenericHTMLElement* (*HTMLContentCreatorFunction)(
+ already_AddRefed<mozilla::dom::NodeInfo>&&,
+ mozilla::dom::FromParser aFromParser);
+
+} // namespace dom
+} // namespace mozilla
/**
* A macro to declare the NS_NewHTMLXXXElement() functions.
@@ -1638,6 +1647,13 @@ nsGenericHTMLElement*
NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
+// Distinct from the above in order to have function pointer that compared unequal
+// to a function pointer to the above.
+nsGenericHTMLElement*
+NS_NewCustomElement(
+ already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
+ mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
+
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)
diff --git a/dom/html/nsHTMLContentSink.cpp b/dom/html/nsHTMLContentSink.cpp
index 87ae2a4ac5..2827f5ff6b 100644
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -84,10 +84,6 @@ using namespace mozilla::dom;
//----------------------------------------------------------------------
-typedef nsGenericHTMLElement*
- (*contentCreatorCallback)(already_AddRefed<mozilla::dom::NodeInfo>&&,
- FromParser aFromParser);
-
nsGenericHTMLElement*
NS_NewHTMLNOTUSEDElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
FromParser aFromParser)
@@ -98,7 +94,7 @@ NS_NewHTMLNOTUSEDElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
#define HTML_TAG(_tag, _classname, _interfacename) NS_NewHTML##_classname##Element,
#define HTML_OTHER(_tag) NS_NewHTMLNOTUSEDElement,
-static const contentCreatorCallback sContentCreatorCallbacks[] = {
+static const HTMLContentCreatorFunction sHTMLContentCreatorFunctions[] = {
NS_NewHTMLUnknownElement,
#include "nsHTMLTagList.h"
#undef HTML_TAG
@@ -383,7 +379,7 @@ CreateHTMLElement(uint32_t aNodeType,
aNodeType == eHTMLTag_userdefined,
"aNodeType is out of bounds");
- contentCreatorCallback cb = sContentCreatorCallbacks[aNodeType];
+ HTMLContentCreatorFunction cb = sHTMLContentCreatorFunctions[aNodeType];
NS_ASSERTION(cb != NS_NewHTMLNOTUSEDElement,
"Don't know how to construct tag element!");