2012-05-29 08:52:43 -07: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-10-12 06:08:04 -07:00
|
|
|
|
|
|
|
#ifndef nsHtml5Speculation_h__
|
|
|
|
#define nsHtml5Speculation_h__
|
|
|
|
|
2011-09-28 05:45:17 -07:00
|
|
|
#include "nsHtml5OwningUTF16Buffer.h"
|
2009-10-12 06:08:04 -07:00
|
|
|
#include "nsAHtml5TreeBuilderState.h"
|
|
|
|
#include "nsHtml5TreeOperation.h"
|
|
|
|
#include "nsAHtml5TreeOpSink.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2012-06-12 21:07:59 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2009-10-12 06:08:04 -07:00
|
|
|
|
2012-06-12 21:07:59 -07:00
|
|
|
class nsHtml5Speculation MOZ_FINAL : public nsAHtml5TreeOpSink
|
2009-10-12 06:08:04 -07:00
|
|
|
{
|
|
|
|
public:
|
2011-09-28 05:45:17 -07:00
|
|
|
nsHtml5Speculation(nsHtml5OwningUTF16Buffer* aBuffer,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStart,
|
|
|
|
int32_t aStartLineNumber,
|
2009-10-12 06:08:04 -07:00
|
|
|
nsAHtml5TreeBuilderState* aSnapshot);
|
|
|
|
|
|
|
|
~nsHtml5Speculation();
|
|
|
|
|
2011-09-28 05:45:17 -07:00
|
|
|
nsHtml5OwningUTF16Buffer* GetBuffer() {
|
2009-10-12 06:08:04 -07:00
|
|
|
return mBuffer;
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetStart() {
|
2009-10-12 06:08:04 -07:00
|
|
|
return mStart;
|
|
|
|
}
|
2009-10-28 06:48:37 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetStartLineNumber() {
|
2009-10-28 06:48:37 -07:00
|
|
|
return mStartLineNumber;
|
|
|
|
}
|
2009-10-12 06:08:04 -07:00
|
|
|
|
|
|
|
nsAHtml5TreeBuilderState* GetSnapshot() {
|
|
|
|
return mSnapshot;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flush the operations from the tree operations from the argument
|
|
|
|
* queue unconditionally.
|
|
|
|
*/
|
2009-11-17 00:52:30 -08:00
|
|
|
virtual void MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue);
|
2009-10-12 06:08:04 -07:00
|
|
|
|
|
|
|
void FlushToSink(nsAHtml5TreeOpSink* aSink);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* The first buffer in the pending UTF-16 buffer queue
|
|
|
|
*/
|
2011-09-28 05:45:17 -07:00
|
|
|
nsRefPtr<nsHtml5OwningUTF16Buffer> mBuffer;
|
2009-10-12 06:08:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The start index of this speculation in the first buffer
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mStart;
|
2009-10-28 06:48:37 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The current line number at the start of the speculation
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mStartLineNumber;
|
2009-10-12 06:08:04 -07:00
|
|
|
|
|
|
|
nsAutoPtr<nsAHtml5TreeBuilderState> mSnapshot;
|
|
|
|
|
|
|
|
nsTArray<nsHtml5TreeOperation> mOpQueue;
|
|
|
|
};
|
|
|
|
|
2011-08-02 12:10:29 -07:00
|
|
|
#endif // nsHtml5Speculation_h__
|