2012-05-29 19:52:43 +04:00
|
|
|
/* 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/. */
|
2009-06-29 02:44:22 +04:00
|
|
|
|
|
|
|
#ifndef nsHtml5TreeOperation_h__
|
|
|
|
#define nsHtml5TreeOperation_h__
|
|
|
|
|
2009-09-18 13:21:47 +04:00
|
|
|
#include "nsHtml5DocumentMode.h"
|
2009-09-21 15:43:43 +04:00
|
|
|
#include "nsHtml5HtmlAttributes.h"
|
2010-02-02 10:43:18 +03:00
|
|
|
#include "nsXPCOMStrings.h"
|
2009-06-29 02:44:22 +04:00
|
|
|
|
2010-08-24 11:06:07 +04:00
|
|
|
class nsIContent;
|
2009-09-18 13:21:47 +04:00
|
|
|
class nsHtml5TreeOpExecutor;
|
2009-09-21 17:18:20 +04:00
|
|
|
class nsHtml5StateSnapshot;
|
2009-06-29 02:44:22 +04:00
|
|
|
|
|
|
|
enum eHtml5TreeOperation {
|
2009-09-21 17:18:20 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
eTreeOpUninitialized,
|
|
|
|
#endif
|
2009-06-29 02:44:22 +04:00
|
|
|
// main HTML5 ops
|
|
|
|
eTreeOpAppend,
|
|
|
|
eTreeOpDetach,
|
|
|
|
eTreeOpAppendChildrenToNewParent,
|
|
|
|
eTreeOpFosterParent,
|
|
|
|
eTreeOpAppendToDocument,
|
|
|
|
eTreeOpAddAttributes,
|
2009-09-18 13:21:47 +04:00
|
|
|
eTreeOpDocumentMode,
|
2010-06-09 10:44:25 +04:00
|
|
|
eTreeOpCreateElementNetwork,
|
|
|
|
eTreeOpCreateElementNotNetwork,
|
2009-09-21 15:43:43 +04:00
|
|
|
eTreeOpSetFormElement,
|
2009-11-17 11:52:30 +03:00
|
|
|
eTreeOpAppendText,
|
2010-06-11 19:08:13 +04:00
|
|
|
eTreeOpAppendIsindexPrompt,
|
2009-11-17 11:52:30 +03:00
|
|
|
eTreeOpFosterParentText,
|
|
|
|
eTreeOpAppendComment,
|
|
|
|
eTreeOpAppendCommentToDocument,
|
|
|
|
eTreeOpAppendDoctypeToDocument,
|
2009-06-29 02:44:22 +04:00
|
|
|
// Gecko-specific on-pop ops
|
2011-09-28 16:45:17 +04:00
|
|
|
eTreeOpMarkAsBroken,
|
2009-09-21 15:43:43 +04:00
|
|
|
eTreeOpRunScript,
|
2009-11-17 11:52:30 +03:00
|
|
|
eTreeOpRunScriptAsyncDefer,
|
2012-06-20 11:05:39 +04:00
|
|
|
eTreeOpPreventScriptExecution,
|
2009-06-29 02:44:22 +04:00
|
|
|
eTreeOpDoneAddingChildren,
|
|
|
|
eTreeOpDoneCreatingElement,
|
2009-11-06 16:06:48 +03:00
|
|
|
eTreeOpFlushPendingAppendNotifications,
|
2011-11-01 15:33:11 +04:00
|
|
|
eTreeOpSetDocumentCharset,
|
2009-09-21 17:18:20 +04:00
|
|
|
eTreeOpNeedsCharsetSwitchTo,
|
2009-06-29 02:44:22 +04:00
|
|
|
eTreeOpUpdateStyleSheet,
|
|
|
|
eTreeOpProcessMeta,
|
|
|
|
eTreeOpProcessOfflineManifest,
|
2009-09-21 15:43:43 +04:00
|
|
|
eTreeOpMarkMalformedIfScript,
|
2009-09-21 17:18:20 +04:00
|
|
|
eTreeOpStreamEnded,
|
2009-10-28 16:48:37 +03:00
|
|
|
eTreeOpSetStyleLineNumber,
|
2009-11-17 11:52:30 +03:00
|
|
|
eTreeOpSetScriptLineNumberAndFreeze,
|
2010-07-19 02:07:54 +04:00
|
|
|
eTreeOpSvgLoad,
|
2012-03-24 15:34:42 +04:00
|
|
|
eTreeOpMaybeComplainAboutCharset,
|
2010-07-30 14:15:38 +04:00
|
|
|
eTreeOpAddClass,
|
|
|
|
eTreeOpAddViewSourceHref,
|
2011-11-01 15:33:11 +04:00
|
|
|
eTreeOpAddError,
|
2011-11-01 15:33:11 +04:00
|
|
|
eTreeOpAddLineNumberId,
|
2011-11-01 15:33:11 +04:00
|
|
|
eTreeOpAddErrorAtom,
|
|
|
|
eTreeOpAddErrorTwoAtoms,
|
2009-06-29 02:44:22 +04:00
|
|
|
eTreeOpStartLayout
|
|
|
|
};
|
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
class nsHtml5TreeOperationStringPair {
|
|
|
|
private:
|
|
|
|
nsString mPublicId;
|
|
|
|
nsString mSystemId;
|
|
|
|
public:
|
|
|
|
nsHtml5TreeOperationStringPair(const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId)
|
|
|
|
: mPublicId(aPublicId)
|
|
|
|
, mSystemId(aSystemId) {
|
|
|
|
MOZ_COUNT_CTOR(nsHtml5TreeOperationStringPair);
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsHtml5TreeOperationStringPair() {
|
|
|
|
MOZ_COUNT_DTOR(nsHtml5TreeOperationStringPair);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Get(nsAString& aPublicId, nsAString& aSystemId) {
|
|
|
|
aPublicId.Assign(mPublicId);
|
|
|
|
aSystemId.Assign(mSystemId);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-06-29 02:44:22 +04:00
|
|
|
class nsHtml5TreeOperation {
|
|
|
|
|
|
|
|
public:
|
|
|
|
nsHtml5TreeOperation();
|
|
|
|
|
|
|
|
~nsHtml5TreeOperation();
|
|
|
|
|
2009-09-21 17:18:20 +04:00
|
|
|
inline void Init(eHtml5TreeOperation aOpCode) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
mOpCode = aOpCode;
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
inline void Init(eHtml5TreeOperation aOpCode, nsIContent** aNode) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
|
2009-06-29 02:44:22 +04:00
|
|
|
mOpCode = aOpCode;
|
2009-09-21 15:43:43 +04:00
|
|
|
mOne.node = aNode;
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent** aNode,
|
|
|
|
nsIContent** aParent) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
|
|
|
|
NS_PRECONDITION(aParent, "Initialized tree op with null parent.");
|
2009-06-29 02:44:22 +04:00
|
|
|
mOpCode = aOpCode;
|
2009-09-21 15:43:43 +04:00
|
|
|
mOne.node = aNode;
|
|
|
|
mTwo.node = aParent;
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
2010-03-09 15:39:32 +03:00
|
|
|
|
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
|
|
|
const nsACString& aString,
|
|
|
|
PRInt32 aInt32) {
|
2011-02-11 13:33:32 +03:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
|
|
|
|
PRInt32 len = aString.Length();
|
|
|
|
char* str = new char[len + 1];
|
|
|
|
const char* start = aString.BeginReading();
|
|
|
|
for (PRInt32 i = 0; i < len; ++i) {
|
|
|
|
str[i] = start[i];
|
|
|
|
}
|
|
|
|
str[len] = '\0';
|
|
|
|
|
|
|
|
mOpCode = aOpCode;
|
|
|
|
mOne.charPtr = str;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aInt32;
|
2010-03-09 15:39:32 +03:00
|
|
|
}
|
2009-06-29 02:44:22 +04:00
|
|
|
|
2012-03-24 15:34:42 +04:00
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
|
|
|
const nsACString& aString,
|
|
|
|
PRInt32 aInt32,
|
|
|
|
PRInt32 aLineNumber) {
|
|
|
|
Init(aOpCode, aString, aInt32);
|
|
|
|
mTwo.integer = aLineNumber;
|
|
|
|
}
|
|
|
|
|
2009-06-29 02:44:22 +04:00
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent** aNode,
|
|
|
|
nsIContent** aParent,
|
|
|
|
nsIContent** aTable) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
|
|
|
|
NS_PRECONDITION(aParent, "Initialized tree op with null parent.");
|
|
|
|
NS_PRECONDITION(aTable, "Initialized tree op with null table.");
|
2009-06-29 02:44:22 +04:00
|
|
|
mOpCode = aOpCode;
|
2009-09-21 15:43:43 +04:00
|
|
|
mOne.node = aNode;
|
|
|
|
mTwo.node = aParent;
|
|
|
|
mThree.node = aTable;
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
2009-09-18 13:21:47 +04:00
|
|
|
|
|
|
|
inline void Init(nsHtml5DocumentMode aMode) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-09-18 13:21:47 +04:00
|
|
|
mOpCode = eTreeOpDocumentMode;
|
2009-09-21 15:43:43 +04:00
|
|
|
mOne.mode = aMode;
|
|
|
|
}
|
|
|
|
|
2009-10-12 17:08:04 +04:00
|
|
|
inline void InitScript(nsIContent** aNode) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
|
2009-10-12 17:08:04 +04:00
|
|
|
mOpCode = eTreeOpRunScript;
|
|
|
|
mOne.node = aNode;
|
|
|
|
mTwo.state = nsnull;
|
|
|
|
}
|
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
inline void Init(PRInt32 aNamespace,
|
|
|
|
nsIAtom* aName,
|
|
|
|
nsHtml5HtmlAttributes* aAttributes,
|
2010-06-09 10:44:25 +04:00
|
|
|
nsIContent** aTarget,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aFromNetwork) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aName, "Initialized tree op with null name.");
|
|
|
|
NS_PRECONDITION(aTarget, "Initialized tree op with null target node.");
|
2010-06-09 10:44:25 +04:00
|
|
|
mOpCode = aFromNetwork ?
|
|
|
|
eTreeOpCreateElementNetwork :
|
|
|
|
eTreeOpCreateElementNotNetwork;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aNamespace;
|
2009-09-21 15:43:43 +04:00
|
|
|
mOne.node = aTarget;
|
|
|
|
mTwo.atom = aName;
|
|
|
|
if (aAttributes == nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES) {
|
|
|
|
mThree.attributes = nsnull;
|
|
|
|
} else {
|
|
|
|
mThree.attributes = aAttributes;
|
|
|
|
}
|
2009-09-18 13:21:47 +04:00
|
|
|
}
|
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
|
|
|
PRUnichar* aBuffer,
|
|
|
|
PRInt32 aLength,
|
2009-11-17 11:52:30 +03:00
|
|
|
nsIContent** aStackParent,
|
|
|
|
nsIContent** aTable) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
|
|
|
|
mOpCode = aOpCode;
|
|
|
|
mOne.node = aStackParent;
|
|
|
|
mTwo.unicharPtr = aBuffer;
|
|
|
|
mThree.node = aTable;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aLength;
|
2009-11-17 11:52:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
|
|
|
PRUnichar* aBuffer,
|
|
|
|
PRInt32 aLength,
|
|
|
|
nsIContent** aParent) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
|
|
|
|
mOpCode = aOpCode;
|
|
|
|
mOne.node = aParent;
|
|
|
|
mTwo.unicharPtr = aBuffer;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aLength;
|
2009-11-17 11:52:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
|
|
|
PRUnichar* aBuffer,
|
|
|
|
PRInt32 aLength) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aBuffer, "Initialized tree op with null buffer.");
|
2009-09-21 15:43:43 +04:00
|
|
|
mOpCode = aOpCode;
|
|
|
|
mTwo.unicharPtr = aBuffer;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aLength;
|
2009-09-21 15:43:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Init(nsIContent** aElement,
|
|
|
|
nsHtml5HtmlAttributes* aAttributes) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aElement, "Initialized tree op with null element.");
|
2009-09-21 15:43:43 +04:00
|
|
|
mOpCode = eTreeOpAddAttributes;
|
|
|
|
mOne.node = aElement;
|
|
|
|
mTwo.attributes = aAttributes;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Init(nsIAtom* aName,
|
|
|
|
const nsAString& aPublicId,
|
2009-11-17 11:52:30 +03:00
|
|
|
const nsAString& aSystemId) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-11-17 11:52:30 +03:00
|
|
|
mOpCode = eTreeOpAppendDoctypeToDocument;
|
2009-09-21 15:43:43 +04:00
|
|
|
mOne.atom = aName;
|
|
|
|
mTwo.stringPair = new nsHtml5TreeOperationStringPair(aPublicId, aSystemId);
|
|
|
|
}
|
2009-09-21 17:18:20 +04:00
|
|
|
|
2011-11-01 15:33:11 +04:00
|
|
|
inline void Init(nsIContent** aElement,
|
2011-11-01 15:33:11 +04:00
|
|
|
const char* aMsgId,
|
|
|
|
nsIAtom* aAtom,
|
|
|
|
nsIAtom* aOtherAtom) {
|
2011-11-01 15:33:11 +04:00
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
mOpCode = eTreeOpAddError;
|
|
|
|
mOne.node = aElement;
|
|
|
|
mTwo.charPtr = (char*)aMsgId;
|
2011-11-01 15:33:11 +04:00
|
|
|
mThree.atom = aAtom;
|
|
|
|
mFour.atom = aOtherAtom;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Init(nsIContent** aElement,
|
|
|
|
const char* aMsgId,
|
|
|
|
nsIAtom* aAtom) {
|
|
|
|
Init(aElement, aMsgId, aAtom, nsnull);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Init(nsIContent** aElement,
|
|
|
|
const char* aMsgId) {
|
|
|
|
Init(aElement, aMsgId, nsnull, nsnull);
|
2011-11-01 15:33:11 +04:00
|
|
|
}
|
|
|
|
|
2012-03-24 15:34:42 +04:00
|
|
|
inline void Init(const char* aMsgId,
|
|
|
|
bool aError,
|
|
|
|
PRInt32 aLineNumber) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
mOpCode = eTreeOpMaybeComplainAboutCharset;
|
|
|
|
mOne.charPtr = const_cast<char*>(aMsgId);
|
|
|
|
mTwo.integer = aError;
|
|
|
|
mThree.integer = aLineNumber;
|
|
|
|
}
|
|
|
|
|
2010-02-02 10:43:18 +03:00
|
|
|
inline void Init(eHtml5TreeOperation aOpCode, const nsAString& aString) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
|
|
|
|
PRUnichar* str = NS_StringCloneData(aString);
|
|
|
|
mOpCode = aOpCode;
|
|
|
|
mOne.unicharPtr = str;
|
|
|
|
}
|
|
|
|
|
2009-10-28 16:48:37 +03:00
|
|
|
inline void Init(eHtml5TreeOperation aOpCode,
|
|
|
|
nsIContent** aNode,
|
|
|
|
PRInt32 aInt) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
|
2009-10-28 16:48:37 +03:00
|
|
|
mOpCode = aOpCode;
|
|
|
|
mOne.node = aNode;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aInt;
|
2009-10-28 16:48:37 +03:00
|
|
|
}
|
|
|
|
|
2010-07-30 14:15:38 +04:00
|
|
|
inline void InitAddClass(nsIContent** aNode, const PRUnichar* aClass) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
|
|
|
|
NS_PRECONDITION(aClass, "Initialized tree op with null string.");
|
|
|
|
// aClass must be a literal string that does not need freeing
|
|
|
|
mOpCode = eTreeOpAddClass;
|
|
|
|
mOne.node = aNode;
|
|
|
|
mTwo.unicharPtr = (PRUnichar*)aClass;
|
|
|
|
}
|
|
|
|
|
2011-11-01 15:33:11 +04:00
|
|
|
inline void InitAddLineNumberId(nsIContent** aNode,
|
|
|
|
const PRInt32 aLineNumber) {
|
|
|
|
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
|
|
|
|
"Op code must be uninitialized when initializing.");
|
|
|
|
NS_PRECONDITION(aNode, "Initialized tree op with null node.");
|
|
|
|
NS_PRECONDITION(aLineNumber > 0, "Initialized tree op with line number.");
|
|
|
|
// aClass must be a literal string that does not need freeing
|
|
|
|
mOpCode = eTreeOpAddLineNumberId;
|
|
|
|
mOne.node = aNode;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aLineNumber;
|
2011-11-01 15:33:11 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool IsRunScript() {
|
2009-09-21 15:43:43 +04:00
|
|
|
return mOpCode == eTreeOpRunScript;
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
2009-09-21 17:18:20 +04:00
|
|
|
|
2009-10-28 16:48:37 +03:00
|
|
|
inline void SetSnapshot(nsAHtml5TreeBuilderState* aSnapshot, PRInt32 aLine) {
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_ASSERTION(IsRunScript(),
|
|
|
|
"Setting a snapshot for a tree operation other than eTreeOpRunScript!");
|
2009-10-30 14:47:17 +03:00
|
|
|
NS_PRECONDITION(aSnapshot, "Initialized tree op with null snapshot.");
|
2009-09-21 17:18:20 +04:00
|
|
|
mTwo.state = aSnapshot;
|
2011-11-01 15:33:11 +04:00
|
|
|
mFour.integer = aLine;
|
2009-09-21 17:18:20 +04:00
|
|
|
}
|
2009-06-29 02:44:22 +04:00
|
|
|
|
2009-11-06 16:06:48 +03:00
|
|
|
nsresult Perform(nsHtml5TreeOpExecutor* aBuilder, nsIContent** aScriptElement);
|
2009-06-29 02:44:22 +04:00
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
inline already_AddRefed<nsIAtom> Reget(nsIAtom* aAtom) {
|
|
|
|
if (!aAtom || aAtom->IsStaticAtom()) {
|
|
|
|
return aAtom;
|
|
|
|
}
|
|
|
|
nsAutoString str;
|
|
|
|
aAtom->ToString(str);
|
|
|
|
return do_GetAtom(str);
|
|
|
|
}
|
|
|
|
|
2009-06-29 02:44:22 +04:00
|
|
|
private:
|
2009-11-17 11:52:30 +03:00
|
|
|
|
2010-06-11 19:08:13 +04:00
|
|
|
nsresult AppendTextToTextNode(const PRUnichar* aBuffer,
|
2011-08-22 23:35:19 +04:00
|
|
|
PRUint32 aLength,
|
2009-11-17 11:52:30 +03:00
|
|
|
nsIContent* aTextNode,
|
|
|
|
nsHtml5TreeOpExecutor* aBuilder);
|
|
|
|
|
2010-06-11 19:08:13 +04:00
|
|
|
nsresult AppendText(const PRUnichar* aBuffer,
|
2011-08-22 23:35:19 +04:00
|
|
|
PRUint32 aLength,
|
2009-11-17 11:52:30 +03:00
|
|
|
nsIContent* aParent,
|
|
|
|
nsHtml5TreeOpExecutor* aBuilder);
|
|
|
|
|
|
|
|
nsresult Append(nsIContent* aNode,
|
|
|
|
nsIContent* aParent,
|
|
|
|
nsHtml5TreeOpExecutor* aBuilder);
|
|
|
|
|
|
|
|
nsresult AppendToDocument(nsIContent* aNode,
|
|
|
|
nsHtml5TreeOpExecutor* aBuilder);
|
2009-09-21 15:43:43 +04:00
|
|
|
|
|
|
|
// possible optimization:
|
|
|
|
// Make the queue take items the size of pointer and make the op code
|
|
|
|
// decide how many operands it dequeues after it.
|
2009-06-29 02:44:22 +04:00
|
|
|
eHtml5TreeOperation mOpCode;
|
2009-09-21 15:43:43 +04:00
|
|
|
union {
|
|
|
|
nsIContent** node;
|
|
|
|
nsIAtom* atom;
|
|
|
|
nsHtml5HtmlAttributes* attributes;
|
|
|
|
nsHtml5DocumentMode mode;
|
|
|
|
PRUnichar* unicharPtr;
|
2009-09-21 17:18:20 +04:00
|
|
|
char* charPtr;
|
2009-09-21 15:43:43 +04:00
|
|
|
nsHtml5TreeOperationStringPair* stringPair;
|
2009-09-21 17:18:20 +04:00
|
|
|
nsAHtml5TreeBuilderState* state;
|
2011-11-01 15:33:11 +04:00
|
|
|
PRInt32 integer;
|
|
|
|
} mOne, mTwo, mThree, mFour;
|
2009-06-29 02:44:22 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsHtml5TreeOperation_h__
|