Bug 959150 part 1 - Represent nodes as void* in the portable part of the parser. r=smaug.

This commit is contained in:
Henri Sivonen 2014-03-05 21:38:49 +02:00
parent 6136d94c75
commit ccbe381144
25 changed files with 197 additions and 172 deletions

View File

@ -44,6 +44,7 @@ EXPORTS += [
'nsHtml5UTF16Buffer.h', 'nsHtml5UTF16Buffer.h',
'nsHtml5UTF16BufferHSupplement.h', 'nsHtml5UTF16BufferHSupplement.h',
'nsHtml5ViewSourceUtils.h', 'nsHtml5ViewSourceUtils.h',
'nsIContentHandle.h',
'nsParserUtils.h', 'nsParserUtils.h',
] ]

View File

@ -5,6 +5,8 @@
#ifndef nsAHtml5TreeBuilderState_h #ifndef nsAHtml5TreeBuilderState_h
#define nsAHtml5TreeBuilderState_h #define nsAHtml5TreeBuilderState_h
#include "nsIContentHandle.h"
/** /**
* Interface for exposing the internal state of the HTML5 tree builder. * Interface for exposing the internal state of the HTML5 tree builder.
* For more documentation, please see * For more documentation, please see
@ -25,11 +27,11 @@ class nsAHtml5TreeBuilderState {
virtual int32_t getTemplateModeStackLength() = 0; virtual int32_t getTemplateModeStackLength() = 0;
virtual nsIContent** getFormPointer() = 0; virtual nsIContentHandle* getFormPointer() = 0;
virtual nsIContent** getHeadPointer() = 0; virtual nsIContentHandle* getHeadPointer() = 0;
virtual nsIContent** getDeepTreeSurrogateParent() = 0; virtual nsIContentHandle* getDeepTreeSurrogateParent() = 0;
virtual int32_t getMode() = 0; virtual int32_t getMode() = 0;

View File

@ -32,7 +32,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -40,6 +40,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h" #include "nsHtml5TreeBuilder.h"

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View File

@ -32,7 +32,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -40,6 +40,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h" #include "nsHtml5TreeBuilder.h"

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h" #include "nsHtml5TreeBuilder.h"

View File

@ -34,7 +34,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -42,6 +42,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h" #include "nsHtml5TreeBuilder.h"

View File

@ -34,7 +34,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -42,6 +42,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h" #include "nsHtml5TreeBuilder.h"
@ -85,7 +86,7 @@ nsHtml5StackNode::isHtmlIntegrationPoint()
} }
nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContent** node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes) nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes)
: flags(flags), : flags(flags),
name(name), name(name),
popName(popName), popName(popName),
@ -98,7 +99,7 @@ nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsI
} }
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node) nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node)
: flags(elementName->getFlags()), : flags(elementName->getFlags()),
name(elementName->name), name(elementName->name),
popName(elementName->name), popName(elementName->name),
@ -112,7 +113,7 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent**
} }
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsHtml5HtmlAttributes* attributes) nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes)
: flags(elementName->getFlags()), : flags(elementName->getFlags()),
name(elementName->name), name(elementName->name),
popName(elementName->name), popName(elementName->name),
@ -126,7 +127,7 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent**
} }
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsIAtom* popName) nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName)
: flags(elementName->getFlags()), : flags(elementName->getFlags()),
name(elementName->name), name(elementName->name),
popName(popName), popName(popName),
@ -139,7 +140,7 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent**
} }
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContent** node) nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContentHandle* node)
: flags(prepareSvgFlags(elementName->getFlags())), : flags(prepareSvgFlags(elementName->getFlags())),
name(elementName->name), name(elementName->name),
popName(popName), popName(popName),
@ -152,7 +153,7 @@ nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* pop
} }
nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsIAtom* popName, bool markAsIntegrationPoint) nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName, bool markAsIntegrationPoint)
: flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint)), : flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint)),
name(elementName->name), name(elementName->name),
popName(popName), popName(popName),

View File

@ -34,7 +34,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -42,6 +42,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;
@ -63,7 +64,7 @@ class nsHtml5StackNode
nsIAtom* name; nsIAtom* name;
nsIAtom* popName; nsIAtom* popName;
int32_t ns; int32_t ns;
nsIContent** node; nsIContentHandle* node;
nsHtml5HtmlAttributes* attributes; nsHtml5HtmlAttributes* attributes;
private: private:
int32_t refcount; int32_t refcount;
@ -78,12 +79,12 @@ class nsHtml5StackNode
bool isSpecial(); bool isSpecial();
bool isFosterParenting(); bool isFosterParenting();
bool isHtmlIntegrationPoint(); bool isHtmlIntegrationPoint();
nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContent** node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes); nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsHtml5HtmlAttributes* attributes); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsIAtom* popName); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContent** node); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContentHandle* node);
nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsIAtom* popName, bool markAsIntegrationPoint); nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName, bool markAsIntegrationPoint);
private: private:
static int32_t prepareSvgFlags(int32_t flags); static int32_t prepareSvgFlags(int32_t flags);
static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint); static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint);

View File

@ -32,7 +32,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -40,6 +40,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h" #include "nsHtml5TreeBuilder.h"
@ -54,7 +55,7 @@
#include "nsHtml5StateSnapshot.h" #include "nsHtml5StateSnapshot.h"
nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContent** formPointer, nsIContent** headPointer, nsIContent** deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks) nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContentHandle* formPointer, nsIContentHandle* headPointer, nsIContentHandle* deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks)
: stack(stack), : stack(stack),
listOfActiveFormattingElements(listOfActiveFormattingElements), listOfActiveFormattingElements(listOfActiveFormattingElements),
templateModeStack(templateModeStack), templateModeStack(templateModeStack),
@ -88,19 +89,19 @@ nsHtml5StateSnapshot::getListOfActiveFormattingElements()
return listOfActiveFormattingElements; return listOfActiveFormattingElements;
} }
nsIContent** nsIContentHandle*
nsHtml5StateSnapshot::getFormPointer() nsHtml5StateSnapshot::getFormPointer()
{ {
return formPointer; return formPointer;
} }
nsIContent** nsIContentHandle*
nsHtml5StateSnapshot::getHeadPointer() nsHtml5StateSnapshot::getHeadPointer()
{ {
return headPointer; return headPointer;
} }
nsIContent** nsIContentHandle*
nsHtml5StateSnapshot::getDeepTreeSurrogateParent() nsHtml5StateSnapshot::getDeepTreeSurrogateParent()
{ {
return deepTreeSurrogateParent; return deepTreeSurrogateParent;

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;
@ -60,22 +61,22 @@ class nsHtml5StateSnapshot : public nsAHtml5TreeBuilderState
autoJArray<nsHtml5StackNode*,int32_t> stack; autoJArray<nsHtml5StackNode*,int32_t> stack;
autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements; autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements;
autoJArray<int32_t,int32_t> templateModeStack; autoJArray<int32_t,int32_t> templateModeStack;
nsIContent** formPointer; nsIContentHandle* formPointer;
nsIContent** headPointer; nsIContentHandle* headPointer;
nsIContent** deepTreeSurrogateParent; nsIContentHandle* deepTreeSurrogateParent;
int32_t mode; int32_t mode;
int32_t originalMode; int32_t originalMode;
bool framesetOk; bool framesetOk;
bool needToDropLF; bool needToDropLF;
bool quirks; bool quirks;
public: public:
nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContent** formPointer, nsIContent** headPointer, nsIContent** deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks); nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContentHandle* formPointer, nsIContentHandle* headPointer, nsIContentHandle* deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks);
jArray<nsHtml5StackNode*,int32_t> getStack(); jArray<nsHtml5StackNode*,int32_t> getStack();
jArray<int32_t,int32_t> getTemplateModeStack(); jArray<int32_t,int32_t> getTemplateModeStack();
jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements(); jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements();
nsIContent** getFormPointer(); nsIContentHandle* getFormPointer();
nsIContent** getHeadPointer(); nsIContentHandle* getHeadPointer();
nsIContent** getDeepTreeSurrogateParent(); nsIContentHandle* getDeepTreeSurrogateParent();
int32_t getMode(); int32_t getMode();
int32_t getOriginalMode(); int32_t getOriginalMode();
bool isFramesetOk(); bool isFramesetOk();

View File

@ -34,7 +34,7 @@
#include "nsHtml5AtomTable.h" #include "nsHtml5AtomTable.h"
#include "nsString.h" #include "nsString.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -35,7 +35,7 @@
#include "nsHtml5AtomTable.h" #include "nsHtml5AtomTable.h"
#include "nsString.h" #include "nsString.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -36,7 +36,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -53,6 +53,7 @@
#include "nsHtml5PlainTextUtils.h" #include "nsHtml5PlainTextUtils.h"
#include "nsHtml5ViewSourceUtils.h" #include "nsHtml5ViewSourceUtils.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5MetaScanner.h" #include "nsHtml5MetaScanner.h"
@ -89,7 +90,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self)
charBuffer = jArray<char16_t,int32_t>::newJArray(1024); charBuffer = jArray<char16_t,int32_t>::newJArray(1024);
framesetOk = true; framesetOk = true;
if (fragment) { if (fragment) {
nsIContent** elt; nsIContentHandle* elt;
if (contextNode) { if (contextNode) {
elt = contextNode; elt = contextNode;
} else { } else {
@ -119,7 +120,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self)
} else { } else {
mode = NS_HTML5TREE_BUILDER_INITIAL; mode = NS_HTML5TREE_BUILDER_INITIAL;
if (tokenizer->isViewingXmlSource()) { if (tokenizer->isViewingXmlSource()) {
nsIContent** elt = createElement(kNameSpaceID_SVG, nsHtml5Atoms::svg, tokenizer->emptyAttributes()); nsIContentHandle* elt = createElement(kNameSpaceID_SVG, nsHtml5Atoms::svg, tokenizer->emptyAttributes());
nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_SVG, nsHtml5Atoms::svg, elt); nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_SVG, nsHtml5Atoms::svg, elt);
currentPtr++; currentPtr++;
stack[currentPtr] = node; stack[currentPtr] = node;
@ -3583,7 +3584,7 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
} }
MOZ_ASSERT(node == listOfActiveFormattingElements[nodeListPos]); MOZ_ASSERT(node == listOfActiveFormattingElements[nodeListPos]);
MOZ_ASSERT(node == stack[nodePos]); MOZ_ASSERT(node == stack[nodePos]);
nsIContent** clone = createElement(kNameSpaceID_XHTML, node->name, node->attributes->cloneAttributes(nullptr)); nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, node->name, node->attributes->cloneAttributes(nullptr));
nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, clone, node->popName, node->attributes); nsHtml5StackNode* newNode = new nsHtml5StackNode(node->getFlags(), node->ns, node->name, clone, node->popName, node->attributes);
node->dropAttributes(); node->dropAttributes();
stack[nodePos] = newNode; stack[nodePos] = newNode;
@ -3604,7 +3605,7 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag(nsIAtom* name)
detachFromParent(lastNode->node); detachFromParent(lastNode->node);
appendElement(lastNode->node, commonAncestor->node); appendElement(lastNode->node, commonAncestor->node);
} }
nsIContent** clone = createElement(kNameSpaceID_XHTML, formattingElt->name, formattingElt->attributes->cloneAttributes(nullptr)); nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, formattingElt->name, formattingElt->attributes->cloneAttributes(nullptr));
nsHtml5StackNode* formattingClone = new nsHtml5StackNode(formattingElt->getFlags(), formattingElt->ns, formattingElt->name, clone, formattingElt->popName, formattingElt->attributes); nsHtml5StackNode* formattingClone = new nsHtml5StackNode(formattingElt->getFlags(), formattingElt->ns, formattingElt->name, clone, formattingElt->popName, formattingElt->attributes);
formattingElt->dropAttributes(); formattingElt->dropAttributes();
appendChildrenToNewParent(furthestBlock->node, clone); appendChildrenToNewParent(furthestBlock->node, clone);
@ -3765,7 +3766,7 @@ nsHtml5TreeBuilder::reconstructTheActiveFormattingElements()
while (entryPos < listPtr) { while (entryPos < listPtr) {
entryPos++; entryPos++;
nsHtml5StackNode* entry = listOfActiveFormattingElements[entryPos]; nsHtml5StackNode* entry = listOfActiveFormattingElements[entryPos];
nsIContent** clone = createElement(kNameSpaceID_XHTML, entry->name, entry->attributes->cloneAttributes(nullptr)); nsIContentHandle* clone = createElement(kNameSpaceID_XHTML, entry->name, entry->attributes->cloneAttributes(nullptr));
nsHtml5StackNode* entryClone = new nsHtml5StackNode(entry->getFlags(), entry->ns, entry->name, clone, entry->popName, entry->attributes); nsHtml5StackNode* entryClone = new nsHtml5StackNode(entry->getFlags(), entry->ns, entry->name, clone, entry->popName, entry->attributes);
entry->dropAttributes(); entry->dropAttributes();
nsHtml5StackNode* currentNode = stack[currentPtr]; nsHtml5StackNode* currentNode = stack[currentPtr];
@ -3782,7 +3783,7 @@ nsHtml5TreeBuilder::reconstructTheActiveFormattingElements()
} }
void void
nsHtml5TreeBuilder::insertIntoFosterParent(nsIContent** child) nsHtml5TreeBuilder::insertIntoFosterParent(nsIContentHandle* child)
{ {
int32_t tablePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE); int32_t tablePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TABLE);
int32_t templatePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TEMPLATE); int32_t templatePos = findLastOrRoot(NS_HTML5TREE_BUILDER_TEMPLATE);
@ -3844,7 +3845,7 @@ nsHtml5TreeBuilder::popOnEof()
void void
nsHtml5TreeBuilder::appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes)
{ {
nsIContent** elt = createHtmlElementSetAsRoot(attributes); nsIContentHandle* elt = createHtmlElementSetAsRoot(attributes);
nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HTML, elt); nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HTML, elt);
push(node); push(node);
} }
@ -3858,7 +3859,7 @@ nsHtml5TreeBuilder::appendHtmlElementToDocumentAndPush()
void void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::head, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::head, attributes);
appendElement(elt, stack[currentPtr]->node); appendElement(elt, stack[currentPtr]->node);
headPointer = elt; headPointer = elt;
nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HEAD, elt); nsHtml5StackNode* node = new nsHtml5StackNode(nsHtml5ElementName::ELT_HEAD, elt);
@ -3880,7 +3881,7 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushBodyElement()
void void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAttributes* attributes)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes);
if (!isTemplateContents()) { if (!isTemplateContents()) {
formPointer = elt; formPointer = elt;
} }
@ -3898,7 +3899,7 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAt
void void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -3915,7 +3916,7 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5
void void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes);
appendElement(elt, stack[currentPtr]->node); appendElement(elt, stack[currentPtr]->node);
if (nsHtml5ElementName::ELT_TEMPLATE == elementName) { if (nsHtml5ElementName::ELT_TEMPLATE == elementName) {
elt = getDocumentFragmentForTemplate(elt); elt = getDocumentFragmentForTemplate(elt);
@ -3928,7 +3929,7 @@ void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIAtom* popName = elementName->name; nsIAtom* popName = elementName->name;
nsIContent** elt = createElement(kNameSpaceID_XHTML, popName, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, popName, attributes);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -3944,7 +3945,7 @@ void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIAtom* popName = elementName->name; nsIAtom* popName = elementName->name;
nsIContent** elt = createElement(kNameSpaceID_MathML, popName, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_MathML, popName, attributes);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -3974,7 +3975,7 @@ void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIAtom* popName = elementName->camelCaseName; nsIAtom* popName = elementName->camelCaseName;
nsIContent** elt = createElement(kNameSpaceID_SVG, popName, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_SVG, popName, attributes);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -3987,9 +3988,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5Element
} }
void void
nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContent** form) nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes, !form || fragment || isTemplateContents() ? nullptr : form); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, elementName->name, attributes, !form || fragment || isTemplateContents() ? nullptr : form);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -4002,9 +4003,9 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementNam
} }
void void
nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form) nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, name, attributes, !form || fragment || isTemplateContents() ? nullptr : form); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, name, attributes, !form || fragment || isTemplateContents() ? nullptr : form);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -4020,7 +4021,7 @@ void
nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIAtom* popName = elementName->name; nsIAtom* popName = elementName->name;
nsIContent** elt = createElement(kNameSpaceID_XHTML, popName, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, popName, attributes);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -4036,7 +4037,7 @@ void
nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIAtom* popName = elementName->camelCaseName; nsIAtom* popName = elementName->camelCaseName;
nsIContent** elt = createElement(kNameSpaceID_SVG, popName, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_SVG, popName, attributes);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -4052,7 +4053,7 @@ void
nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes)
{ {
nsIAtom* popName = elementName->name; nsIAtom* popName = elementName->name;
nsIContent** elt = createElement(kNameSpaceID_MathML, popName, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_MathML, popName, attributes);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
if (current->isFosterParenting()) { if (current->isFosterParenting()) {
@ -4065,9 +4066,9 @@ nsHtml5TreeBuilder::appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName
} }
void void
nsHtml5TreeBuilder::appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form) nsHtml5TreeBuilder::appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, name, attributes, !form || fragment || isTemplateContents() ? nullptr : form); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, name, attributes, !form || fragment || isTemplateContents() ? nullptr : form);
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
appendElement(elt, current->node); appendElement(elt, current->node);
elementPushed(kNameSpaceID_XHTML, name, elt); elementPushed(kNameSpaceID_XHTML, name, elt);
@ -4077,7 +4078,7 @@ nsHtml5TreeBuilder::appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttribu
void void
nsHtml5TreeBuilder::appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes) nsHtml5TreeBuilder::appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes)
{ {
nsIContent** elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes); nsIContentHandle* elt = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::form, attributes);
formPointer = elt; formPointer = elt;
nsHtml5StackNode* current = stack[currentPtr]; nsHtml5StackNode* current = stack[currentPtr];
appendElement(elt, current->node); appendElement(elt, current->node);
@ -4107,7 +4108,7 @@ nsHtml5TreeBuilder::isInForeignButNotHtmlOrMathTextIntegrationPoint()
} }
void void
nsHtml5TreeBuilder::setFragmentContext(nsIAtom* context, int32_t ns, nsIContent** node, bool quirks) nsHtml5TreeBuilder::setFragmentContext(nsIAtom* context, int32_t ns, nsIContentHandle* node, bool quirks)
{ {
this->contextName = context; this->contextName = context;
this->contextNamespace = ns; this->contextNamespace = ns;
@ -4116,7 +4117,7 @@ nsHtml5TreeBuilder::setFragmentContext(nsIAtom* context, int32_t ns, nsIContent*
this->quirks = quirks; this->quirks = quirks;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::currentNode() nsHtml5TreeBuilder::currentNode()
{ {
return stack[currentPtr]->node; return stack[currentPtr]->node;
@ -4325,19 +4326,19 @@ nsHtml5TreeBuilder::findInArray(nsHtml5StackNode* node, jArray<nsHtml5StackNode*
return -1; return -1;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::getFormPointer() nsHtml5TreeBuilder::getFormPointer()
{ {
return formPointer; return formPointer;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::getHeadPointer() nsHtml5TreeBuilder::getHeadPointer()
{ {
return headPointer; return headPointer;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::getDeepTreeSurrogateParent() nsHtml5TreeBuilder::getDeepTreeSurrogateParent()
{ {
return deepTreeSurrogateParent; return deepTreeSurrogateParent;

View File

@ -37,7 +37,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -54,6 +54,7 @@
#include "nsHtml5PlainTextUtils.h" #include "nsHtml5PlainTextUtils.h"
#include "nsHtml5ViewSourceUtils.h" #include "nsHtml5ViewSourceUtils.h"
#include "mozilla/Likely.h" #include "mozilla/Likely.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;
@ -83,16 +84,16 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
bool fragment; bool fragment;
nsIAtom* contextName; nsIAtom* contextName;
int32_t contextNamespace; int32_t contextNamespace;
nsIContent** contextNode; nsIContentHandle* contextNode;
autoJArray<int32_t,int32_t> templateModeStack; autoJArray<int32_t,int32_t> templateModeStack;
int32_t templateModePtr; int32_t templateModePtr;
autoJArray<nsHtml5StackNode*,int32_t> stack; autoJArray<nsHtml5StackNode*,int32_t> stack;
int32_t currentPtr; int32_t currentPtr;
autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements; autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements;
int32_t listPtr; int32_t listPtr;
nsIContent** formPointer; nsIContentHandle* formPointer;
nsIContent** headPointer; nsIContentHandle* headPointer;
nsIContent** deepTreeSurrogateParent; nsIContentHandle* deepTreeSurrogateParent;
protected: protected:
autoJArray<char16_t,int32_t> charBuffer; autoJArray<char16_t,int32_t> charBuffer;
int32_t charBufferLen; int32_t charBufferLen;
@ -174,7 +175,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
void addAttributesToHtml(nsHtml5HtmlAttributes* attributes); void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
void pushHeadPointerOntoStack(); void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements(); void reconstructTheActiveFormattingElements();
void insertIntoFosterParent(nsIContent** child); void insertIntoFosterParent(nsIContentHandle* child);
bool isInStack(nsHtml5StackNode* node); bool isInStack(nsHtml5StackNode* node);
void popTemplateMode(); void popTemplateMode();
void pop(); void pop();
@ -192,36 +193,36 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
void appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes); bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContent** form); void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form); void appendVoidElementToCurrentMayFoster(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes); void appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form); void appendVoidElementToCurrent(nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes); void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected: protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length); void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension(); void requestSuspension();
nsIContent** createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes); nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes);
nsIContent** createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContent** form); nsIContentHandle* createElement(int32_t ns, nsIAtom* name, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
nsIContent** createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes); nsIContentHandle* createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes);
void detachFromParent(nsIContent** element); void detachFromParent(nsIContentHandle* element);
bool hasChildren(nsIContent** element); bool hasChildren(nsIContentHandle* element);
void appendElement(nsIContent** child, nsIContent** newParent); void appendElement(nsIContentHandle* child, nsIContentHandle* newParent);
void appendChildrenToNewParent(nsIContent** oldParent, nsIContent** newParent); void appendChildrenToNewParent(nsIContentHandle* oldParent, nsIContentHandle* newParent);
void insertFosterParentedChild(nsIContent** child, nsIContent** table, nsIContent** stackParent); void insertFosterParentedChild(nsIContentHandle* child, nsIContentHandle* table, nsIContentHandle* stackParent);
void insertFosterParentedCharacters(char16_t* buf, int32_t start, int32_t length, nsIContent** table, nsIContent** stackParent); void insertFosterParentedCharacters(char16_t* buf, int32_t start, int32_t length, nsIContentHandle* table, nsIContentHandle* stackParent);
void appendCharacters(nsIContent** parent, char16_t* buf, int32_t start, int32_t length); void appendCharacters(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendIsindexPrompt(nsIContent** parent); void appendIsindexPrompt(nsIContentHandle* parent);
void appendComment(nsIContent** parent, char16_t* buf, int32_t start, int32_t length); void appendComment(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length); void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length);
void addAttributesToElement(nsIContent** element, nsHtml5HtmlAttributes* attributes); void addAttributesToElement(nsIContentHandle* element, nsHtml5HtmlAttributes* attributes);
void markMalformedIfScript(nsIContent** elt); void markMalformedIfScript(nsIContentHandle* elt);
void start(bool fragmentMode); void start(bool fragmentMode);
void end(); void end();
void appendDoctypeToDocument(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier); void appendDoctypeToDocument(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier);
void elementPushed(int32_t ns, nsIAtom* name, nsIContent** node); void elementPushed(int32_t ns, nsIAtom* name, nsIContentHandle* node);
void elementPopped(int32_t ns, nsIAtom* name, nsIContent** node); void elementPopped(int32_t ns, nsIAtom* name, nsIContentHandle* node);
public: public:
inline bool cdataSectionAllowed() inline bool cdataSectionAllowed()
{ {
@ -232,9 +233,9 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
bool isInForeign(); bool isInForeign();
bool isInForeignButNotHtmlOrMathTextIntegrationPoint(); bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
public: public:
void setFragmentContext(nsIAtom* context, int32_t ns, nsIContent** node, bool quirks); void setFragmentContext(nsIAtom* context, int32_t ns, nsIContentHandle* node, bool quirks);
protected: protected:
nsIContent** currentNode(); nsIContentHandle* currentNode();
public: public:
bool isScriptingEnabled(); bool isScriptingEnabled();
void setScriptingEnabled(bool scriptingEnabled); void setScriptingEnabled(bool scriptingEnabled);
@ -249,9 +250,9 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
private: private:
int32_t findInArray(nsHtml5StackNode* node, jArray<nsHtml5StackNode*,int32_t> arr); int32_t findInArray(nsHtml5StackNode* node, jArray<nsHtml5StackNode*,int32_t> arr);
public: public:
nsIContent** getFormPointer(); nsIContentHandle* getFormPointer();
nsIContent** getHeadPointer(); nsIContentHandle* getHeadPointer();
nsIContent** getDeepTreeSurrogateParent(); nsIContentHandle* getDeepTreeSurrogateParent();
jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements(); jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements();
jArray<nsHtml5StackNode*,int32_t> getStack(); jArray<nsHtml5StackNode*,int32_t> getStack();
jArray<int32_t,int32_t> getTemplateModeStack(); jArray<int32_t,int32_t> getTemplateModeStack();

View File

@ -41,7 +41,7 @@ nsHtml5TreeBuilder::~nsHtml5TreeBuilder()
mOpQueue.Clear(); mOpQueue.Clear();
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes) nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes)
{ {
NS_PRECONDITION(aAttributes, "Got null attributes."); NS_PRECONDITION(aAttributes, "Got null attributes.");
@ -51,7 +51,7 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, nsHtml5Htm
aNamespace == kNameSpaceID_MathML, aNamespace == kNameSpaceID_MathML,
"Bogus namespace."); "Bogus namespace.");
nsIContent** content = AllocateContentHandle(); nsIContentHandle* content = AllocateContentHandle();
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed."); NS_ASSERTION(treeOp, "Tree op allocation failed.");
treeOp->Init(aNamespace, treeOp->Init(aNamespace,
@ -209,10 +209,10 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, nsHtml5Htm
return content; return content;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes, nsIContent** aFormElement) nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes, nsIContentHandle* aFormElement)
{ {
nsIContent** content = createElement(aNamespace, aName, aAttributes); nsIContentHandle* content = createElement(aNamespace, aName, aAttributes);
if (aFormElement) { if (aFormElement) {
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed."); NS_ASSERTION(treeOp, "Tree op allocation failed.");
@ -221,10 +221,10 @@ nsHtml5TreeBuilder::createElement(int32_t aNamespace, nsIAtom* aName, nsHtml5Htm
return content; return content;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* aAttributes) nsHtml5TreeBuilder::createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* aAttributes)
{ {
nsIContent** content = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::html, aAttributes); nsIContentHandle* content = createElement(kNameSpaceID_XHTML, nsHtml5Atoms::html, aAttributes);
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed."); NS_ASSERTION(treeOp, "Tree op allocation failed.");
treeOp->Init(eTreeOpAppendToDocument, content); treeOp->Init(eTreeOpAppendToDocument, content);
@ -232,7 +232,7 @@ nsHtml5TreeBuilder::createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* aAttribute
} }
void void
nsHtml5TreeBuilder::detachFromParent(nsIContent** aElement) nsHtml5TreeBuilder::detachFromParent(nsIContentHandle* aElement)
{ {
NS_PRECONDITION(aElement, "Null element"); NS_PRECONDITION(aElement, "Null element");
@ -242,7 +242,7 @@ nsHtml5TreeBuilder::detachFromParent(nsIContent** aElement)
} }
void void
nsHtml5TreeBuilder::appendElement(nsIContent** aChild, nsIContent** aParent) nsHtml5TreeBuilder::appendElement(nsIContentHandle* aChild, nsIContentHandle* aParent)
{ {
NS_PRECONDITION(aChild, "Null child"); NS_PRECONDITION(aChild, "Null child");
NS_PRECONDITION(aParent, "Null parent"); NS_PRECONDITION(aParent, "Null parent");
@ -255,7 +255,7 @@ nsHtml5TreeBuilder::appendElement(nsIContent** aChild, nsIContent** aParent)
} }
void void
nsHtml5TreeBuilder::appendChildrenToNewParent(nsIContent** aOldParent, nsIContent** aNewParent) nsHtml5TreeBuilder::appendChildrenToNewParent(nsIContentHandle* aOldParent, nsIContentHandle* aNewParent)
{ {
NS_PRECONDITION(aOldParent, "Null old parent"); NS_PRECONDITION(aOldParent, "Null old parent");
NS_PRECONDITION(aNewParent, "Null new parent"); NS_PRECONDITION(aNewParent, "Null new parent");
@ -266,7 +266,7 @@ nsHtml5TreeBuilder::appendChildrenToNewParent(nsIContent** aOldParent, nsIConten
} }
void void
nsHtml5TreeBuilder::insertFosterParentedCharacters(char16_t* aBuffer, int32_t aStart, int32_t aLength, nsIContent** aTable, nsIContent** aStackParent) nsHtml5TreeBuilder::insertFosterParentedCharacters(char16_t* aBuffer, int32_t aStart, int32_t aLength, nsIContentHandle* aTable, nsIContentHandle* aStackParent)
{ {
NS_PRECONDITION(aBuffer, "Null buffer"); NS_PRECONDITION(aBuffer, "Null buffer");
NS_PRECONDITION(aTable, "Null table"); NS_PRECONDITION(aTable, "Null table");
@ -281,7 +281,7 @@ nsHtml5TreeBuilder::insertFosterParentedCharacters(char16_t* aBuffer, int32_t aS
} }
void void
nsHtml5TreeBuilder::insertFosterParentedChild(nsIContent** aChild, nsIContent** aTable, nsIContent** aStackParent) nsHtml5TreeBuilder::insertFosterParentedChild(nsIContentHandle* aChild, nsIContentHandle* aTable, nsIContentHandle* aStackParent)
{ {
NS_PRECONDITION(aChild, "Null child"); NS_PRECONDITION(aChild, "Null child");
NS_PRECONDITION(aTable, "Null table"); NS_PRECONDITION(aTable, "Null table");
@ -293,7 +293,7 @@ nsHtml5TreeBuilder::insertFosterParentedChild(nsIContent** aChild, nsIContent**
} }
void void
nsHtml5TreeBuilder::appendCharacters(nsIContent** aParent, char16_t* aBuffer, int32_t aStart, int32_t aLength) nsHtml5TreeBuilder::appendCharacters(nsIContentHandle* aParent, char16_t* aBuffer, int32_t aStart, int32_t aLength)
{ {
NS_PRECONDITION(aBuffer, "Null buffer"); NS_PRECONDITION(aBuffer, "Null buffer");
NS_PRECONDITION(aParent, "Null parent"); NS_PRECONDITION(aParent, "Null parent");
@ -308,7 +308,7 @@ nsHtml5TreeBuilder::appendCharacters(nsIContent** aParent, char16_t* aBuffer, in
} }
void void
nsHtml5TreeBuilder::appendIsindexPrompt(nsIContent** aParent) nsHtml5TreeBuilder::appendIsindexPrompt(nsIContentHandle* aParent)
{ {
NS_PRECONDITION(aParent, "Null parent"); NS_PRECONDITION(aParent, "Null parent");
@ -318,7 +318,7 @@ nsHtml5TreeBuilder::appendIsindexPrompt(nsIContent** aParent)
} }
void void
nsHtml5TreeBuilder::appendComment(nsIContent** aParent, char16_t* aBuffer, int32_t aStart, int32_t aLength) nsHtml5TreeBuilder::appendComment(nsIContentHandle* aParent, char16_t* aBuffer, int32_t aStart, int32_t aLength)
{ {
NS_PRECONDITION(aBuffer, "Null buffer"); NS_PRECONDITION(aBuffer, "Null buffer");
NS_PRECONDITION(aParent, "Null parent"); NS_PRECONDITION(aParent, "Null parent");
@ -348,7 +348,7 @@ nsHtml5TreeBuilder::appendCommentToDocument(char16_t* aBuffer, int32_t aStart, i
} }
void void
nsHtml5TreeBuilder::addAttributesToElement(nsIContent** aElement, nsHtml5HtmlAttributes* aAttributes) nsHtml5TreeBuilder::addAttributesToElement(nsIContentHandle* aElement, nsHtml5HtmlAttributes* aAttributes)
{ {
NS_PRECONDITION(aElement, "Null element"); NS_PRECONDITION(aElement, "Null element");
NS_PRECONDITION(aAttributes, "Null attributes"); NS_PRECONDITION(aAttributes, "Null attributes");
@ -362,7 +362,7 @@ nsHtml5TreeBuilder::addAttributesToElement(nsIContent** aElement, nsHtml5HtmlAtt
} }
void void
nsHtml5TreeBuilder::markMalformedIfScript(nsIContent** aElement) nsHtml5TreeBuilder::markMalformedIfScript(nsIContentHandle* aElement)
{ {
NS_PRECONDITION(aElement, "Null element"); NS_PRECONDITION(aElement, "Null element");
@ -403,7 +403,7 @@ nsHtml5TreeBuilder::appendDoctypeToDocument(nsIAtom* aName, nsString* aPublicId,
} }
void void
nsHtml5TreeBuilder::elementPushed(int32_t aNamespace, nsIAtom* aName, nsIContent** aElement) nsHtml5TreeBuilder::elementPushed(int32_t aNamespace, nsIAtom* aName, nsIContentHandle* aElement)
{ {
NS_ASSERTION(aNamespace == kNameSpaceID_XHTML || aNamespace == kNameSpaceID_SVG || aNamespace == kNameSpaceID_MathML, "Element isn't HTML, SVG or MathML!"); NS_ASSERTION(aNamespace == kNameSpaceID_XHTML || aNamespace == kNameSpaceID_SVG || aNamespace == kNameSpaceID_MathML, "Element isn't HTML, SVG or MathML!");
NS_ASSERTION(aName, "Element doesn't have local name!"); NS_ASSERTION(aName, "Element doesn't have local name!");
@ -467,7 +467,7 @@ nsHtml5TreeBuilder::elementPushed(int32_t aNamespace, nsIAtom* aName, nsIContent
} }
void void
nsHtml5TreeBuilder::elementPopped(int32_t aNamespace, nsIAtom* aName, nsIContent** aElement) nsHtml5TreeBuilder::elementPopped(int32_t aNamespace, nsIAtom* aName, nsIContentHandle* aElement)
{ {
NS_ASSERTION(aNamespace == kNameSpaceID_XHTML || aNamespace == kNameSpaceID_SVG || aNamespace == kNameSpaceID_MathML, "Element isn't HTML, SVG or MathML!"); NS_ASSERTION(aNamespace == kNameSpaceID_XHTML || aNamespace == kNameSpaceID_SVG || aNamespace == kNameSpaceID_MathML, "Element isn't HTML, SVG or MathML!");
NS_ASSERTION(aName, "Element doesn't have local name!"); NS_ASSERTION(aName, "Element doesn't have local name!");
@ -568,7 +568,7 @@ nsHtml5TreeBuilder::accumulateCharacters(const char16_t* aBuf, int32_t aStart, i
charBufferLen = newFillLen; charBufferLen = newFillLen;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::AllocateContentHandle() nsHtml5TreeBuilder::AllocateContentHandle()
{ {
if (mHandlesUsed == NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH) { if (mHandlesUsed == NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH) {
@ -751,18 +751,18 @@ nsHtml5TreeBuilder::documentMode(nsHtml5DocumentMode m)
treeOp->Init(m); treeOp->Init(m);
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::getDocumentFragmentForTemplate(nsIContent** aTemplate) nsHtml5TreeBuilder::getDocumentFragmentForTemplate(nsIContentHandle* aTemplate)
{ {
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(); nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed."); NS_ASSERTION(treeOp, "Tree op allocation failed.");
nsIContent** fragHandle = AllocateContentHandle(); nsIContentHandle* fragHandle = AllocateContentHandle();
treeOp->Init(eTreeOpGetDocumentFragmentForTemplate, aTemplate, fragHandle); treeOp->Init(eTreeOpGetDocumentFragmentForTemplate, aTemplate, fragHandle);
return fragHandle; return fragHandle;
} }
nsIContent** nsIContentHandle*
nsHtml5TreeBuilder::getFormPointerForContext(nsIContent** aContext) nsHtml5TreeBuilder::getFormPointerForContext(nsIContentHandle* aContext)
{ {
if (!aContext) { if (!aContext) {
return nullptr; return nullptr;
@ -772,7 +772,7 @@ nsHtml5TreeBuilder::getFormPointerForContext(nsIContent** aContext)
// aContext must always be a handle to an element that already exists // aContext must always be a handle to an element that already exists
// in the document. It must never be an empty handle. // in the document. It must never be an empty handle.
nsIContent* contextNode = *aContext; nsIContent* contextNode = *(static_cast<nsIContent**>(aContext));
nsIContent* currentAncestor = contextNode; nsIContent* currentAncestor = contextNode;
// We traverse the ancestors of the context node to find the nearest // We traverse the ancestors of the context node to find the nearest
@ -790,8 +790,8 @@ nsHtml5TreeBuilder::getFormPointerForContext(nsIContent** aContext)
return nullptr; return nullptr;
} }
nsIContent** formPointer = AllocateContentHandle(); nsIContentHandle* formPointer = AllocateContentHandle();
*formPointer = nearestForm; *(static_cast<nsIContent**>(formPointer)) = nearestForm;
return formPointer; return formPointer;
} }

View File

@ -26,9 +26,9 @@
*/ */
void documentMode(nsHtml5DocumentMode m); void documentMode(nsHtml5DocumentMode m);
nsIContent** getDocumentFragmentForTemplate(nsIContent** aTemplate); nsIContentHandle* getDocumentFragmentForTemplate(nsIContentHandle* aTemplate);
nsIContent** getFormPointerForContext(nsIContent** aContext); nsIContentHandle* getFormPointerForContext(nsIContentHandle* aContext);
/** /**
* Using nsIContent** instead of nsIContent* is the parser deals with DOM * Using nsIContent** instead of nsIContent* is the parser deals with DOM
@ -49,11 +49,11 @@
* run before tree ops that try to further operate on the node that the * run before tree ops that try to further operate on the node that the
* nsIContent** is a handle to. * nsIContent** is a handle to.
* *
* On-the-main-thread parts of the parser use the same mechanism in order * On-the-main-thread parts of the parser use nsIContent* instead of
* to avoid having to have duplicate code paths for on-the-main-thread and * nsIContent**. Since both cases share the same parser core, the parser
* off-the-main-thread tree builder instances.) * core casts both to nsIContentHandle*.
*/ */
nsIContent** AllocateContentHandle(); nsIContentHandle* AllocateContentHandle();
void accumulateCharactersForced(const char16_t* aBuf, int32_t aStart, int32_t aLength) void accumulateCharactersForced(const char16_t* aBuf, int32_t aStart, int32_t aLength)
{ {

View File

@ -98,24 +98,24 @@ class nsHtml5TreeOperation {
mOpCode = aOpCode; mOpCode = aOpCode;
} }
inline void Init(eHtml5TreeOperation aOpCode, nsIContent** aNode) { inline void Init(eHtml5TreeOperation aOpCode, nsIContentHandle* aNode) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node."); NS_PRECONDITION(aNode, "Initialized tree op with null node.");
mOpCode = aOpCode; mOpCode = aOpCode;
mOne.node = aNode; mOne.node = static_cast<nsIContent**>(aNode);
} }
inline void Init(eHtml5TreeOperation aOpCode, inline void Init(eHtml5TreeOperation aOpCode,
nsIContent** aNode, nsIContentHandle* aNode,
nsIContent** aParent) { nsIContentHandle* aParent) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node."); NS_PRECONDITION(aNode, "Initialized tree op with null node.");
NS_PRECONDITION(aParent, "Initialized tree op with null parent."); NS_PRECONDITION(aParent, "Initialized tree op with null parent.");
mOpCode = aOpCode; mOpCode = aOpCode;
mOne.node = aNode; mOne.node = static_cast<nsIContent**>(aNode);
mTwo.node = aParent; mTwo.node = static_cast<nsIContent**>(aParent);
} }
inline void Init(eHtml5TreeOperation aOpCode, inline void Init(eHtml5TreeOperation aOpCode,
@ -146,18 +146,18 @@ class nsHtml5TreeOperation {
} }
inline void Init(eHtml5TreeOperation aOpCode, inline void Init(eHtml5TreeOperation aOpCode,
nsIContent** aNode, nsIContentHandle* aNode,
nsIContent** aParent, nsIContentHandle* aParent,
nsIContent** aTable) { nsIContentHandle* aTable) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node."); NS_PRECONDITION(aNode, "Initialized tree op with null node.");
NS_PRECONDITION(aParent, "Initialized tree op with null parent."); NS_PRECONDITION(aParent, "Initialized tree op with null parent.");
NS_PRECONDITION(aTable, "Initialized tree op with null table."); NS_PRECONDITION(aTable, "Initialized tree op with null table.");
mOpCode = aOpCode; mOpCode = aOpCode;
mOne.node = aNode; mOne.node = static_cast<nsIContent**>(aNode);
mTwo.node = aParent; mTwo.node = static_cast<nsIContent**>(aParent);
mThree.node = aTable; mThree.node = static_cast<nsIContent**>(aTable);
} }
inline void Init(nsHtml5DocumentMode aMode) { inline void Init(nsHtml5DocumentMode aMode) {
@ -167,19 +167,19 @@ class nsHtml5TreeOperation {
mOne.mode = aMode; mOne.mode = aMode;
} }
inline void InitScript(nsIContent** aNode) { inline void InitScript(nsIContentHandle* aNode) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node."); NS_PRECONDITION(aNode, "Initialized tree op with null node.");
mOpCode = eTreeOpRunScript; mOpCode = eTreeOpRunScript;
mOne.node = aNode; mOne.node = static_cast<nsIContent**>(aNode);
mTwo.state = nullptr; mTwo.state = nullptr;
} }
inline void Init(int32_t aNamespace, inline void Init(int32_t aNamespace,
nsIAtom* aName, nsIAtom* aName,
nsHtml5HtmlAttributes* aAttributes, nsHtml5HtmlAttributes* aAttributes,
nsIContent** aTarget, nsIContentHandle* aTarget,
bool aFromNetwork) { bool aFromNetwork) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
@ -189,7 +189,7 @@ class nsHtml5TreeOperation {
eTreeOpCreateElementNetwork : eTreeOpCreateElementNetwork :
eTreeOpCreateElementNotNetwork; eTreeOpCreateElementNotNetwork;
mFour.integer = aNamespace; mFour.integer = aNamespace;
mOne.node = aTarget; mOne.node = static_cast<nsIContent**>(aTarget);
mTwo.atom = aName; mTwo.atom = aName;
if (aAttributes == nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES) { if (aAttributes == nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES) {
mThree.attributes = nullptr; mThree.attributes = nullptr;
@ -201,27 +201,27 @@ class nsHtml5TreeOperation {
inline void Init(eHtml5TreeOperation aOpCode, inline void Init(eHtml5TreeOperation aOpCode,
char16_t* aBuffer, char16_t* aBuffer,
int32_t aLength, int32_t aLength,
nsIContent** aStackParent, nsIContentHandle* aStackParent,
nsIContent** aTable) { nsIContentHandle* aTable) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer."); NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
mOpCode = aOpCode; mOpCode = aOpCode;
mOne.node = aStackParent; mOne.node = static_cast<nsIContent**>(aStackParent);
mTwo.unicharPtr = aBuffer; mTwo.unicharPtr = aBuffer;
mThree.node = aTable; mThree.node = static_cast<nsIContent**>(aTable);
mFour.integer = aLength; mFour.integer = aLength;
} }
inline void Init(eHtml5TreeOperation aOpCode, inline void Init(eHtml5TreeOperation aOpCode,
char16_t* aBuffer, char16_t* aBuffer,
int32_t aLength, int32_t aLength,
nsIContent** aParent) { nsIContentHandle* aParent) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer."); NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
mOpCode = aOpCode; mOpCode = aOpCode;
mOne.node = aParent; mOne.node = static_cast<nsIContent**>(aParent);
mTwo.unicharPtr = aBuffer; mTwo.unicharPtr = aBuffer;
mFour.integer = aLength; mFour.integer = aLength;
} }
@ -237,13 +237,13 @@ class nsHtml5TreeOperation {
mFour.integer = aLength; mFour.integer = aLength;
} }
inline void Init(nsIContent** aElement, inline void Init(nsIContentHandle* aElement,
nsHtml5HtmlAttributes* aAttributes) { nsHtml5HtmlAttributes* aAttributes) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aElement, "Initialized tree op with null element."); NS_PRECONDITION(aElement, "Initialized tree op with null element.");
mOpCode = eTreeOpAddAttributes; mOpCode = eTreeOpAddAttributes;
mOne.node = aElement; mOne.node = static_cast<nsIContent**>(aElement);
mTwo.attributes = aAttributes; mTwo.attributes = aAttributes;
} }
@ -257,26 +257,26 @@ class nsHtml5TreeOperation {
mTwo.stringPair = new nsHtml5TreeOperationStringPair(aPublicId, aSystemId); mTwo.stringPair = new nsHtml5TreeOperationStringPair(aPublicId, aSystemId);
} }
inline void Init(nsIContent** aElement, inline void Init(nsIContentHandle* aElement,
const char* aMsgId, const char* aMsgId,
nsIAtom* aAtom, nsIAtom* aAtom,
nsIAtom* aOtherAtom) { nsIAtom* aOtherAtom) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
mOpCode = eTreeOpAddError; mOpCode = eTreeOpAddError;
mOne.node = aElement; mOne.node = static_cast<nsIContent**>(aElement);
mTwo.charPtr = (char*)aMsgId; mTwo.charPtr = (char*)aMsgId;
mThree.atom = aAtom; mThree.atom = aAtom;
mFour.atom = aOtherAtom; mFour.atom = aOtherAtom;
} }
inline void Init(nsIContent** aElement, inline void Init(nsIContentHandle* aElement,
const char* aMsgId, const char* aMsgId,
nsIAtom* aAtom) { nsIAtom* aAtom) {
Init(aElement, aMsgId, aAtom, nullptr); Init(aElement, aMsgId, aAtom, nullptr);
} }
inline void Init(nsIContent** aElement, inline void Init(nsIContentHandle* aElement,
const char* aMsgId) { const char* aMsgId) {
Init(aElement, aMsgId, nullptr, nullptr); Init(aElement, aMsgId, nullptr, nullptr);
} }
@ -302,28 +302,28 @@ class nsHtml5TreeOperation {
} }
inline void Init(eHtml5TreeOperation aOpCode, inline void Init(eHtml5TreeOperation aOpCode,
nsIContent** aNode, nsIContentHandle* aNode,
int32_t aInt) { int32_t aInt) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node."); NS_PRECONDITION(aNode, "Initialized tree op with null node.");
mOpCode = aOpCode; mOpCode = aOpCode;
mOne.node = aNode; mOne.node = static_cast<nsIContent**>(aNode);
mFour.integer = aInt; mFour.integer = aInt;
} }
inline void InitAddClass(nsIContent** aNode, const char16_t* aClass) { inline void InitAddClass(nsIContentHandle* aNode, const char16_t* aClass) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
NS_PRECONDITION(aNode, "Initialized tree op with null node."); NS_PRECONDITION(aNode, "Initialized tree op with null node.");
NS_PRECONDITION(aClass, "Initialized tree op with null string."); NS_PRECONDITION(aClass, "Initialized tree op with null string.");
// aClass must be a literal string that does not need freeing // aClass must be a literal string that does not need freeing
mOpCode = eTreeOpAddClass; mOpCode = eTreeOpAddClass;
mOne.node = aNode; mOne.node = static_cast<nsIContent**>(aNode);
mTwo.unicharPtr = (char16_t*)aClass; mTwo.unicharPtr = (char16_t*)aClass;
} }
inline void InitAddLineNumberId(nsIContent** aNode, inline void InitAddLineNumberId(nsIContentHandle* aNode,
const int32_t aLineNumber) { const int32_t aLineNumber) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized, NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing."); "Op code must be uninitialized when initializing.");
@ -331,7 +331,7 @@ class nsHtml5TreeOperation {
NS_PRECONDITION(aLineNumber > 0, "Initialized tree op with line number."); NS_PRECONDITION(aLineNumber > 0, "Initialized tree op with line number.");
// aClass must be a literal string that does not need freeing // aClass must be a literal string that does not need freeing
mOpCode = eTreeOpAddLineNumberId; mOpCode = eTreeOpAddLineNumberId;
mOne.node = aNode; mOne.node = static_cast<nsIContent**>(aNode);
mFour.integer = aLineNumber; mFour.integer = aLineNumber;
} }

View File

@ -32,7 +32,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -40,6 +40,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
#include "nsHtml5Tokenizer.h" #include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h" #include "nsHtml5TreeBuilder.h"

View File

@ -33,7 +33,7 @@
#include "nsString.h" #include "nsString.h"
#include "nsNameSpaceManager.h" #include "nsNameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsISupportsImpl.h" #include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
#include "nsAHtml5TreeBuilderState.h" #include "nsAHtml5TreeBuilderState.h"
@ -41,6 +41,7 @@
#include "nsHtml5ByteReadable.h" #include "nsHtml5ByteReadable.h"
#include "nsIUnicodeDecoder.h" #include "nsIUnicodeDecoder.h"
#include "nsHtml5Macros.h" #include "nsHtml5Macros.h"
#include "nsIContentHandle.h"
class nsHtml5StreamParser; class nsHtml5StreamParser;

View File

@ -0,0 +1,5 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
typedef void nsIContentHandle;