Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
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/Attributes.h"
12 : #include "mozilla/ErrorResult.h"
13 : #include "mozilla/dom/BindingDeclarations.h"
14 : #include "nsCycleCollectionParticipant.h"
15 : #include "nsWrapperCache.h"
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : class TextClause final : public nsISupports
21 : , public nsWrapperCache
22 : {
23 : public:
24 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TextClause)
26 :
27 0 : nsPIDOMWindowInner* GetParentObject() const { return mOwner; }
28 :
29 : TextClause(nsPIDOMWindowInner* aWindow, const TextRange& aRange,
30 : const TextRange* targetRange);
31 :
32 : virtual JSObject* WrapObject(JSContext* aCx,
33 : JS::Handle<JSObject*> aGivenProto) override;
34 :
35 0 : inline uint32_t StartOffset() const { return mStartOffset; }
36 :
37 0 : inline uint32_t EndOffset() const { return mEndOffset; }
38 :
39 0 : inline bool IsCaret() const { return mIsCaret; }
40 :
41 0 : inline bool IsTargetClause() const { return mIsTargetClause; }
42 :
43 : private:
44 : ~TextClause();
45 : nsCOMPtr<nsPIDOMWindowInner> mOwner;
46 :
47 : // Following members, please take look at widget/TextRange.h.
48 : uint32_t mStartOffset;
49 : uint32_t mEndOffset;
50 : bool mIsCaret;
51 : bool mIsTargetClause;
52 : };
53 :
54 : } // namespace dom
55 : } // namespace mozilla
56 :
57 : #endif // mozilla_dom_TextClause_h
|