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 /parser/html/nsHtml5TreeOperation.h | |
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 'parser/html/nsHtml5TreeOperation.h')
-rw-r--r-- | parser/html/nsHtml5TreeOperation.h | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/parser/html/nsHtml5TreeOperation.h b/parser/html/nsHtml5TreeOperation.h index a93f44c46..0cdb08e2e 100644 --- a/parser/html/nsHtml5TreeOperation.h +++ b/parser/html/nsHtml5TreeOperation.h @@ -14,7 +14,8 @@ class nsIContent; class nsHtml5TreeOpExecutor; class nsHtml5DocumentBuilder; -enum eHtml5TreeOperation { +enum eHtml5TreeOperation +{ eTreeOpUninitialized, // main HTML5 ops eTreeOpAppend, @@ -24,8 +25,11 @@ enum eHtml5TreeOperation { eTreeOpAppendToDocument, eTreeOpAddAttributes, eTreeOpDocumentMode, - eTreeOpCreateElementNetwork, - eTreeOpCreateElementNotNetwork, + eTreeOpCreateHTMLElementNetwork, + eTreeOpCreateHTMLElementNotNetwork, + eTreeOpCreateSVGElementNetwork, + eTreeOpCreateSVGElementNotNetwork, + eTreeOpCreateMathMLElement, eTreeOpSetFormElement, eTreeOpAppendText, eTreeOpAppendIsindexPrompt, @@ -143,12 +147,26 @@ class nsHtml5TreeOperation { nsHtml5HtmlAttributes* aAttributes, nsHtml5DocumentBuilder* aBuilder); - static nsIContent* CreateElement(int32_t aNs, - nsIAtom* aName, - nsHtml5HtmlAttributes* aAttributes, - mozilla::dom::FromParser aFromParser, - nsNodeInfoManager* aNodeInfoManager, - nsHtml5DocumentBuilder* aBuilder); + static nsIContent* CreateHTMLElement( + nsIAtom* aName, + nsHtml5HtmlAttributes* aAttributes, + mozilla::dom::FromParser aFromParser, + nsNodeInfoManager* aNodeInfoManager, + nsHtml5DocumentBuilder* aBuilder, + mozilla::dom::HTMLContentCreatorFunction aCreator); + + static nsIContent* CreateSVGElement( + nsIAtom* aName, + nsHtml5HtmlAttributes* aAttributes, + mozilla::dom::FromParser aFromParser, + nsNodeInfoManager* aNodeInfoManager, + nsHtml5DocumentBuilder* aBuilder, + mozilla::dom::SVGContentCreatorFunction aCreator); + + static nsIContent* CreateMathMLElement(nsIAtom* aName, + nsHtml5HtmlAttributes* aAttributes, + nsNodeInfoManager* aNodeInfoManager, + nsHtml5DocumentBuilder* aBuilder); static void SetFormElement(nsIContent* aNode, nsIContent* aParent); @@ -284,22 +302,31 @@ class nsHtml5TreeOperation { mOne.node = static_cast<nsIContent**>(aNode); mTwo.state = nullptr; } - - inline void Init(int32_t aNamespace, - nsIAtom* aName, + + inline void Init(int32_t aNamespace, + nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes, nsIContentHandle* aTarget, nsIContentHandle* aIntendedParent, - bool aFromNetwork) + bool aFromNetwork, + nsHtml5ContentCreatorFunction aCreator) { NS_PRECONDITION(mOpCode == eTreeOpUninitialized, "Op code must be uninitialized when initializing."); NS_PRECONDITION(aName, "Initialized tree op with null name."); NS_PRECONDITION(aTarget, "Initialized tree op with null target node."); - mOpCode = aFromNetwork ? - eTreeOpCreateElementNetwork : - eTreeOpCreateElementNotNetwork; - mFour.integer = aNamespace; + if (aNamespace == kNameSpaceID_XHTML) { + mOpCode = aFromNetwork ? eTreeOpCreateHTMLElementNetwork + : eTreeOpCreateHTMLElementNotNetwork; + mFour.htmlCreator = aCreator.html; + } else if (aNamespace == kNameSpaceID_SVG) { + mOpCode = aFromNetwork ? eTreeOpCreateSVGElementNetwork + : eTreeOpCreateSVGElementNotNetwork; + mFour.svgCreator = aCreator.svg; + } else { + MOZ_ASSERT(aNamespace == kNameSpaceID_MathML); + mOpCode = eTreeOpCreateMathMLElement; + } mFive.node = static_cast<nsIContent**>(aIntendedParent); mOne.node = static_cast<nsIContent**>(aTarget); mTwo.atom = aName; @@ -507,6 +534,8 @@ class nsHtml5TreeOperation { nsAHtml5TreeBuilderState* state; int32_t integer; nsresult result; + mozilla::dom::HTMLContentCreatorFunction htmlCreator; + mozilla::dom::SVGContentCreatorFunction svgCreator; } mOne, mTwo, mThree, mFour, mFive; }; |