TextClause.h (1597B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_TextClause_h 8 #define mozilla_dom_TextClause_h 9 10 #include "js/TypeDecls.h" 11 #include "mozilla/dom/BindingDeclarations.h" 12 #include "nsCycleCollectionParticipant.h" 13 #include "nsPIDOMWindow.h" 14 #include "nsWrapperCache.h" 15 16 namespace mozilla::dom { 17 18 class TextClause final : public nsISupports, public nsWrapperCache { 19 public: 20 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 21 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(TextClause) 22 23 nsPIDOMWindowInner* GetParentObject() const { return mOwner; } 24 25 TextClause(nsPIDOMWindowInner* aWindow, const TextRange& aRange, 26 const TextRange* targetRange); 27 28 virtual JSObject* WrapObject(JSContext* aCx, 29 JS::Handle<JSObject*> aGivenProto) override; 30 31 inline uint32_t StartOffset() const { return mStartOffset; } 32 33 inline uint32_t EndOffset() const { return mEndOffset; } 34 35 inline bool IsCaret() const { return mIsCaret; } 36 37 inline bool IsTargetClause() const { return mIsTargetClause; } 38 39 private: 40 ~TextClause(); 41 nsCOMPtr<nsPIDOMWindowInner> mOwner; 42 43 // Following members, please take look at widget/TextRange.h. 44 uint32_t mStartOffset; 45 uint32_t mEndOffset; 46 bool mIsCaret; 47 bool mIsTargetClause; 48 }; 49 50 } // namespace mozilla::dom 51 52 #endif // mozilla_dom_TextClause_h