1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/parser/html/nsHtml5Speculation.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef nsHtml5Speculation_h 1.9 +#define nsHtml5Speculation_h 1.10 + 1.11 +#include "nsHtml5OwningUTF16Buffer.h" 1.12 +#include "nsAHtml5TreeBuilderState.h" 1.13 +#include "nsHtml5TreeOperation.h" 1.14 +#include "nsAHtml5TreeOpSink.h" 1.15 +#include "nsTArray.h" 1.16 +#include "nsAutoPtr.h" 1.17 +#include "mozilla/Attributes.h" 1.18 + 1.19 +class nsHtml5Speculation MOZ_FINAL : public nsAHtml5TreeOpSink 1.20 +{ 1.21 + public: 1.22 + nsHtml5Speculation(nsHtml5OwningUTF16Buffer* aBuffer, 1.23 + int32_t aStart, 1.24 + int32_t aStartLineNumber, 1.25 + nsAHtml5TreeBuilderState* aSnapshot); 1.26 + 1.27 + ~nsHtml5Speculation(); 1.28 + 1.29 + nsHtml5OwningUTF16Buffer* GetBuffer() 1.30 + { 1.31 + return mBuffer; 1.32 + } 1.33 + 1.34 + int32_t GetStart() 1.35 + { 1.36 + return mStart; 1.37 + } 1.38 + 1.39 + int32_t GetStartLineNumber() 1.40 + { 1.41 + return mStartLineNumber; 1.42 + } 1.43 + 1.44 + nsAHtml5TreeBuilderState* GetSnapshot() 1.45 + { 1.46 + return mSnapshot; 1.47 + } 1.48 + 1.49 + /** 1.50 + * Flush the operations from the tree operations from the argument 1.51 + * queue unconditionally. 1.52 + */ 1.53 + virtual void MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue); 1.54 + 1.55 + void FlushToSink(nsAHtml5TreeOpSink* aSink); 1.56 + 1.57 + private: 1.58 + /** 1.59 + * The first buffer in the pending UTF-16 buffer queue 1.60 + */ 1.61 + nsRefPtr<nsHtml5OwningUTF16Buffer> mBuffer; 1.62 + 1.63 + /** 1.64 + * The start index of this speculation in the first buffer 1.65 + */ 1.66 + int32_t mStart; 1.67 + 1.68 + /** 1.69 + * The current line number at the start of the speculation 1.70 + */ 1.71 + int32_t mStartLineNumber; 1.72 + 1.73 + nsAutoPtr<nsAHtml5TreeBuilderState> mSnapshot; 1.74 + 1.75 + nsTArray<nsHtml5TreeOperation> mOpQueue; 1.76 +}; 1.77 + 1.78 +#endif // nsHtml5Speculation_h