/work/obj-fuzz/dist/include/mozilla/dom/PaintRequest.h
Line | Count | Source (jump to first uncovered line) |
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_PaintRequest_h_ |
8 | | #define mozilla_dom_PaintRequest_h_ |
9 | | |
10 | | #include "nsPresContext.h" |
11 | | #include "mozilla/Attributes.h" |
12 | | #include "mozilla/RefPtr.h" |
13 | | #include "mozilla/dom/Event.h" |
14 | | #include "nsWrapperCache.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | class DOMRect; |
20 | | |
21 | | class PaintRequest final : public nsISupports |
22 | | , public nsWrapperCache |
23 | | { |
24 | | public: |
25 | | explicit PaintRequest(Event* aParent) |
26 | | : mParent(aParent) |
27 | 0 | { |
28 | 0 | } |
29 | | |
30 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
31 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequest) |
32 | | |
33 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
34 | | |
35 | | Event* GetParentObject() const |
36 | 0 | { |
37 | 0 | return mParent; |
38 | 0 | } |
39 | | |
40 | | already_AddRefed<DOMRect> ClientRect(); |
41 | | void GetReason(nsAString& aResult) const |
42 | 0 | { |
43 | 0 | aResult.AssignLiteral("repaint"); |
44 | 0 | } |
45 | | |
46 | | void SetRequest(const nsRect& aRequest) |
47 | 0 | { mRequest = aRequest; } |
48 | | |
49 | | private: |
50 | 0 | ~PaintRequest() {} |
51 | | |
52 | | RefPtr<Event> mParent; |
53 | | nsRect mRequest; |
54 | | }; |
55 | | |
56 | | class PaintRequestList final : public nsISupports, |
57 | | public nsWrapperCache |
58 | | { |
59 | | public: |
60 | | explicit PaintRequestList(Event *aParent) : mParent(aParent) |
61 | 0 | { |
62 | 0 | } |
63 | | |
64 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
65 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequestList) |
66 | | |
67 | | virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
68 | | nsISupports* GetParentObject() |
69 | 0 | { |
70 | 0 | return mParent; |
71 | 0 | } |
72 | | |
73 | | void Append(PaintRequest* aElement) |
74 | 0 | { |
75 | 0 | mArray.AppendElement(aElement); |
76 | 0 | } |
77 | | |
78 | | uint32_t Length() |
79 | 0 | { |
80 | 0 | return mArray.Length(); |
81 | 0 | } |
82 | | |
83 | | PaintRequest* Item(uint32_t aIndex) |
84 | 0 | { |
85 | 0 | return mArray.SafeElementAt(aIndex); |
86 | 0 | } |
87 | | PaintRequest* IndexedGetter(uint32_t aIndex, bool& aFound) |
88 | 0 | { |
89 | 0 | aFound = aIndex < mArray.Length(); |
90 | 0 | if (!aFound) { |
91 | 0 | return nullptr; |
92 | 0 | } |
93 | 0 | return mArray.ElementAt(aIndex); |
94 | 0 | } |
95 | | |
96 | | private: |
97 | 0 | ~PaintRequestList() {} |
98 | | |
99 | | nsTArray< RefPtr<PaintRequest> > mArray; |
100 | | RefPtr<Event> mParent; |
101 | | }; |
102 | | |
103 | | } // namespace dom |
104 | | } // namespace mozilla |
105 | | |
106 | | #endif // mozilla_dom_PaintRequest_h_ |