diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-19 09:57:36 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:42 -0500 |
commit | d163c367d9ee5f13769b8580b97bcc511fdd13cd (patch) | |
tree | d8fba280f76b3ff92d5bf1c4d574731ab956f662 /dom/svg/SVGElementFactory.cpp | |
parent | 9bf83c6a785ba7463822a159cdaf9eb06ece3690 (diff) | |
download | UXP-d163c367d9ee5f13769b8580b97bcc511fdd13cd.tar UXP-d163c367d9ee5f13769b8580b97bcc511fdd13cd.tar.gz UXP-d163c367d9ee5f13769b8580b97bcc511fdd13cd.tar.lz UXP-d163c367d9ee5f13769b8580b97bcc511fdd13cd.tar.xz UXP-d163c367d9ee5f13769b8580b97bcc511fdd13cd.zip |
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 #1344
Diffstat (limited to 'dom/svg/SVGElementFactory.cpp')
-rw-r--r-- | dom/svg/SVGElementFactory.cpp | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/dom/svg/SVGElementFactory.cpp b/dom/svg/SVGElementFactory.cpp index abbb0a865..d3e922ee5 100644 --- a/dom/svg/SVGElementFactory.cpp +++ b/dom/svg/SVGElementFactory.cpp @@ -15,31 +15,28 @@ using namespace mozilla; using namespace mozilla::dom; // Hash table that maps nsIAtom* SVG tags to an offset index -// within the array sContentCreatorCallbacks (offset by TABLE_VALUE_OFFSET) +// within the array sSVGContentCreatorFunctions (offset by TABLE_VALUE_OFFSET) static PLHashTable* sTagAtomTable = nullptr; // We don't want to store 0 in the hash table as a return value of 0 from // PL_HashTableLookupConst indicates that the value is not found #define TABLE_VALUE_OFFSET 1 -#define SVG_TAG(_tag, _classname) \ -nsresult \ -NS_NewSVG##_classname##Element(nsIContent** aResult, \ - already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); \ -\ -static inline nsresult \ -Create##_classname##Element(nsIContent** aResult, \ - already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \ - FromParser aFromParser) \ -{ \ - return NS_NewSVG##_classname##Element(aResult, mozilla::Move(aNodeInfo)); \ -} +#define SVG_TAG(_tag, _classname) \ + nsresult NS_NewSVG##_classname##Element( \ + nsIContent** aResult, \ + already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); \ + \ + nsresult NS_NewSVG##_classname##Element( \ + nsIContent** aResult, \ + already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \ + FromParser aFromParser) \ + { \ + return NS_NewSVG##_classname##Element(aResult, mozilla::Move(aNodeInfo)); \ + } + +#define SVG_FROM_PARSER_TAG(_tag, _classname) -#define SVG_FROM_PARSER_TAG(_tag, _classname) \ -nsresult \ -NS_NewSVG##_classname##Element(nsIContent** aResult, \ - already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \ - FromParser aFromParser); #include "SVGTagList.h" #undef SVG_TAG #undef SVG_FROM_PARSER_TAG @@ -48,13 +45,8 @@ nsresult NS_NewSVGElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); -typedef nsresult - (*contentCreatorCallback)(nsIContent** aResult, - already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, - FromParser aFromParser); - -static const contentCreatorCallback sContentCreatorCallbacks[] = { -#define SVG_TAG(_tag, _classname) Create##_classname##Element, +static const SVGContentCreatorFunction sSVGContentCreatorFunctions[] = { +#define SVG_TAG(_tag, _classname) NS_NewSVG##_classname##Element, #define SVG_FROM_PARSER_TAG(_tag, _classname) NS_NewSVG##_classname##Element, #include "SVGTagList.h" #undef SVG_TAG @@ -124,7 +116,7 @@ NS_NewSVGElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& a MOZ_CRASH(); } - contentCreatorCallback cb = sContentCreatorCallbacks[index]; + SVGContentCreatorFunction cb = sSVGContentCreatorFunctions[index]; nsCOMPtr<nsIContent> content; nsresult rv = cb(getter_AddRefs(content), ni.forget(), aFromParser); @@ -135,3 +127,15 @@ NS_NewSVGElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& a // if we don't know what to create, just create a standard svg element: return NS_NewSVGElement(aResult, ni.forget()); } + +nsresult +NS_NewSVGUnknownElement(nsIContent** aResult, + already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, + FromParser aFromParser) +{ + RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo; + nsCOMPtr<Element> element; + nsresult rv = NS_NewSVGElement(getter_AddRefs(element), ni.forget()); + element.forget(aResult); + return rv; +} |