for potentially highlighting characters potentially
+ * appearing next.
+ */
+ void FinishTag();
+
+ /**
+ * Adds a class attribute to the current node.
+ *
+ * @param aClass the class to set (MUST be a static string that does not
+ * need to be released!)
+ */
+ void AddClass(const char16_t* aClass);
+
+ /**
+ * Allocates a handle for an element.
+ *
+ * See the documentation for nsHtml5TreeBuilder::AllocateContentHandle()
+ * in nsHtml5TreeBuilderHSupplement.h.
+ *
+ * @return the handle
+ */
+ nsIContent** AllocateContentHandle();
+
+ /**
+ * Enqueues an element creation tree operation.
+ *
+ * @param aName the name of the element
+ * @param aAttributes the attribute holder (ownership will be taken) or
+ * nullptr for no attributes
+ * @return the handle for the element that will be created
+ */
+ nsIContent** CreateElement(nsIAtom* aName,
+ nsHtml5HtmlAttributes* aAttributes);
+
+ /**
+ * Gets the handle for the current node. May be called only after the
+ * root element has been set.
+ *
+ * @return the handle for the current node
+ */
+ nsIContent** CurrentNode();
+
+ /**
+ * Create an element and push it (its handle) on the stack.
+ *
+ * @param aName the name of the element
+ * @param aAttributes the attribute holder (ownership will be taken) or
+ * nullptr for no attributes
+ */
+ void Push(nsIAtom* aName, nsHtml5HtmlAttributes* aAttributes);
+
+ /**
+ * Pops the current node off the stack.
+ */
+ void Pop();
+
+ /**
+ * Appends text content to the current node.
+ *
+ * @param aBuffer the buffer to copy from
+ * @param aStart the index of the first code unit to copy
+ * @param aLength the number of code units to copy
+ */
+ void AppendCharacters(const char16_t* aBuffer,
+ int32_t aStart,
+ int32_t aLength);
+
+ /**
+ * Enqueues a tree op for adding an href attribute with the view-source:
+ * URL scheme to the current node.
+ *
+ * @param aValue the (potentially relative) URL to link to
+ */
+ void AddViewSourceHref(const nsString& aValue);
+
+ /**
+ * The state we are transitioning away from.
+ */
+ int32_t mState;
+
+ /**
+ * The index of the first UTF-16 code unit in mBuffer that hasn't been
+ * flushed yet.
+ */
+ int32_t mCStart;
+
+ /**
+ * The position of the code unit in mBuffer that caused the current
+ * transition.
+ */
+ int32_t mPos;
+
+ /**
+ * The current line number.
+ */
+ int32_t mLineNumber;
+
+ /**
+ * The number of inline elements open inside the excluding the
+ * span potentially wrapping a run of characters.
+ */
+ int32_t mInlinesOpen;
+
+ /**
+ * Whether there's a span wrapping a run of characters (excluding CDATA
+ * section) open.
+ */
+ bool mInCharacters;
+
+ /**
+ * The current buffer being tokenized.
+ */
+ nsHtml5UTF16Buffer* mBuffer;
+
+ /**
+ * Whether to highlight syntax visibly initially.
+ */
+ bool mSyntaxHighlight;
+
+ /**
+ * The outgoing tree op queue.
+ */
+ nsTArray mOpQueue;
+
+ /**
+ * The tree op stage for the tree op executor.
+ */
+ nsAHtml5TreeOpSink* mOpSink;
+
+ /**
+ * The most recently opened markup declaration/tag or run of characters.
+ */
+ nsIContent** mCurrentRun;
+
+ /**
+ * The most recent ampersand in a place where character references were
+ * allowed.
+ */
+ nsIContent** mAmpersand;
+
+ /**
+ * The most recent slash that might become a self-closing slash.
+ */
+ nsIContent** mSlash;
+
+ /**
+ * Memory for element handles.
+ */
+ nsAutoArrayPtr mHandles;
+
+ /**
+ * Number of handles used in mHandles
+ */
+ int32_t mHandlesUsed;
+
+ /**
+ * A holder for old contents of mHandles
+ */
+ nsTArray > mOldHandles;
+
+ /**
+ * The element stack.
+ */
+ nsTArray mStack;
+
+ /**
+ * The string "comment"
+ */
+ static char16_t sComment[];
+
+ /**
+ * The string "cdata"
+ */
+ static char16_t sCdata[];
+
+ /**
+ * The string "start-tag"
+ */
+ static char16_t sStartTag[];
+
+ /**
+ * The string "attribute-name"
+ */
+ static char16_t sAttributeName[];
+
+ /**
+ * The string "attribute-value"
+ */
+ static char16_t sAttributeValue[];
+
+ /**
+ * The string "end-tag"
+ */
+ static char16_t sEndTag[];
+
+ /**
+ * The string "doctype"
+ */
+ static char16_t sDoctype[];
+
+ /**
+ * The string "entity"
+ */
+ static char16_t sEntity[];
+
+ /**
+ * The string "pi"
+ */
+ static char16_t sPi[];
+};
+
+#endif // nsHtml5Highlighter_h