Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / events / TextClause.h
blob18a3c8939227f8381d702ed2b234042a2bd766c2
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/. */
7 #ifndef mozilla_dom_TextClause_h
8 #define mozilla_dom_TextClause_h
10 #include "js/TypeDecls.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/dom/BindingDeclarations.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "nsPIDOMWindow.h"
15 #include "nsWrapperCache.h"
17 namespace mozilla::dom {
19 class TextClause final : public nsISupports, public nsWrapperCache {
20 public:
21 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
22 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(TextClause)
24 nsPIDOMWindowInner* GetParentObject() const { return mOwner; }
26 TextClause(nsPIDOMWindowInner* aWindow, const TextRange& aRange,
27 const TextRange* targetRange);
29 virtual JSObject* WrapObject(JSContext* aCx,
30 JS::Handle<JSObject*> aGivenProto) override;
32 inline uint32_t StartOffset() const { return mStartOffset; }
34 inline uint32_t EndOffset() const { return mEndOffset; }
36 inline bool IsCaret() const { return mIsCaret; }
38 inline bool IsTargetClause() const { return mIsTargetClause; }
40 private:
41 ~TextClause();
42 nsCOMPtr<nsPIDOMWindowInner> mOwner;
44 // Following members, please take look at widget/TextRange.h.
45 uint32_t mStartOffset;
46 uint32_t mEndOffset;
47 bool mIsCaret;
48 bool mIsTargetClause;
51 } // namespace mozilla::dom
53 #endif // mozilla_dom_TextClause_h