michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsHtml5Speculation_h michael@0: #define nsHtml5Speculation_h michael@0: michael@0: #include "nsHtml5OwningUTF16Buffer.h" michael@0: #include "nsAHtml5TreeBuilderState.h" michael@0: #include "nsHtml5TreeOperation.h" michael@0: #include "nsAHtml5TreeOpSink.h" michael@0: #include "nsTArray.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsHtml5Speculation MOZ_FINAL : public nsAHtml5TreeOpSink michael@0: { michael@0: public: michael@0: nsHtml5Speculation(nsHtml5OwningUTF16Buffer* aBuffer, michael@0: int32_t aStart, michael@0: int32_t aStartLineNumber, michael@0: nsAHtml5TreeBuilderState* aSnapshot); michael@0: michael@0: ~nsHtml5Speculation(); michael@0: michael@0: nsHtml5OwningUTF16Buffer* GetBuffer() michael@0: { michael@0: return mBuffer; michael@0: } michael@0: michael@0: int32_t GetStart() michael@0: { michael@0: return mStart; michael@0: } michael@0: michael@0: int32_t GetStartLineNumber() michael@0: { michael@0: return mStartLineNumber; michael@0: } michael@0: michael@0: nsAHtml5TreeBuilderState* GetSnapshot() michael@0: { michael@0: return mSnapshot; michael@0: } michael@0: michael@0: /** michael@0: * Flush the operations from the tree operations from the argument michael@0: * queue unconditionally. michael@0: */ michael@0: virtual void MoveOpsFrom(nsTArray& aOpQueue); michael@0: michael@0: void FlushToSink(nsAHtml5TreeOpSink* aSink); michael@0: michael@0: private: michael@0: /** michael@0: * The first buffer in the pending UTF-16 buffer queue michael@0: */ michael@0: nsRefPtr mBuffer; michael@0: michael@0: /** michael@0: * The start index of this speculation in the first buffer michael@0: */ michael@0: int32_t mStart; michael@0: michael@0: /** michael@0: * The current line number at the start of the speculation michael@0: */ michael@0: int32_t mStartLineNumber; michael@0: michael@0: nsAutoPtr mSnapshot; michael@0: michael@0: nsTArray mOpQueue; michael@0: }; michael@0: michael@0: #endif // nsHtml5Speculation_h