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