summaryrefslogtreecommitdiffstats
path: root/parser/html/nsHtml5TreeOperation.h
diff options
context:
space:
mode:
Diffstat (limited to 'parser/html/nsHtml5TreeOperation.h')
-rw-r--r--parser/html/nsHtml5TreeOperation.h63
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;
};