tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsHtml5Speculation.h (1896B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef nsHtml5Speculation_h
      6 #define nsHtml5Speculation_h
      7 
      8 #include "nsHtml5OwningUTF16Buffer.h"
      9 #include "nsAHtml5TreeBuilderState.h"
     10 #include "nsHtml5TreeOperation.h"
     11 #include "nsAHtml5TreeOpSink.h"
     12 #include "nsTArray.h"
     13 #include "mozilla/UniquePtr.h"
     14 
     15 class nsHtml5Speculation final : public nsAHtml5TreeOpSink {
     16 public:
     17  nsHtml5Speculation(nsHtml5OwningUTF16Buffer* aBuffer, int32_t aStart,
     18                     int32_t aStartLineNumber, int32_t aStartColumnNumber,
     19                     nsAHtml5TreeBuilderState* aSnapshot);
     20 
     21  ~nsHtml5Speculation();
     22 
     23  nsHtml5OwningUTF16Buffer* GetBuffer() { return mBuffer; }
     24 
     25  int32_t GetStart() { return mStart; }
     26 
     27  int32_t GetStartLineNumber() { return mStartLineNumber; }
     28 
     29  int32_t GetStartColumnNumber() { return mStartColumnNumber; }
     30 
     31  nsAHtml5TreeBuilderState* GetSnapshot() { return mSnapshot.get(); }
     32 
     33  /**
     34   * Flush the operations from the tree operations from the argument
     35   * queue unconditionally.
     36   */
     37  [[nodiscard]] virtual bool MoveOpsFrom(
     38      nsTArray<nsHtml5TreeOperation>& aOpQueue) override;
     39 
     40  [[nodiscard]] bool FlushToSink(nsAHtml5TreeOpSink* aSink);
     41 
     42 private:
     43  /**
     44   * The first buffer in the pending UTF-16 buffer queue
     45   */
     46  RefPtr<nsHtml5OwningUTF16Buffer> mBuffer;
     47 
     48  /**
     49   * The start index of this speculation in the first buffer
     50   */
     51  int32_t mStart;
     52 
     53  /**
     54   * The current line number at the start of the speculation
     55   */
     56  int32_t mStartLineNumber;
     57 
     58  /**
     59   * The current line number at the start of the speculation.
     60   */
     61  int32_t mStartColumnNumber;
     62 
     63  mozilla::UniquePtr<nsAHtml5TreeBuilderState> mSnapshot;
     64 
     65  nsTArray<nsHtml5TreeOperation> mOpQueue;
     66 };
     67 
     68 #endif  // nsHtml5Speculation_h