OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 14 matching lines...) Expand all Loading... |
25 */ | 25 */ |
26 | 26 |
27 #ifndef ClientRectList_h | 27 #ifndef ClientRectList_h |
28 #define ClientRectList_h | 28 #define ClientRectList_h |
29 | 29 |
30 #include "bindings/core/v8/ScriptWrappable.h" | 30 #include "bindings/core/v8/ScriptWrappable.h" |
31 #include "core/CoreExport.h" | 31 #include "core/CoreExport.h" |
32 #include "core/dom/ClientRect.h" | 32 #include "core/dom/ClientRect.h" |
33 #include "platform/geometry/FloatQuad.h" | 33 #include "platform/geometry/FloatQuad.h" |
34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
35 #include "wtf/PassRefPtr.h" | |
36 #include "wtf/RefCounted.h" | |
37 #include "wtf/Vector.h" | |
38 | 35 |
39 namespace blink { | 36 namespace blink { |
40 | 37 |
41 class ClientRect; | 38 class ClientRect; |
42 | 39 |
43 class CORE_EXPORT ClientRectList final : public RefCountedWillBeGarbageCollected
<ClientRectList>, public ScriptWrappable { | 40 class CORE_EXPORT ClientRectList final : public GarbageCollected<ClientRectList>
, public ScriptWrappable { |
44 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ClientRectList); | |
45 DEFINE_WRAPPERTYPEINFO(); | 41 DEFINE_WRAPPERTYPEINFO(); |
46 public: | 42 public: |
47 static PassRefPtrWillBeRawPtr<ClientRectList> create() | 43 static ClientRectList* create() |
48 { | 44 { |
49 return adoptRefWillBeNoop(new ClientRectList); | 45 return new ClientRectList; |
50 } | 46 } |
51 static PassRefPtrWillBeRawPtr<ClientRectList> create(const Vector<FloatQuad>
& quads) | 47 static ClientRectList* create(const Vector<FloatQuad>& quads) |
52 { | 48 { |
53 return adoptRefWillBeNoop(new ClientRectList(quads)); | 49 return new ClientRectList(quads); |
54 } | 50 } |
55 | 51 |
56 template<typename Rects> | 52 template<typename Rects> |
57 static PassRefPtrWillBeRawPtr<ClientRectList> create(const Rects& rects) | 53 static ClientRectList* create(const Rects& rects) |
58 { | 54 { |
59 return adoptRefWillBeNoop(new ClientRectList(rects)); | 55 return new ClientRectList(rects); |
60 } | 56 } |
61 | 57 |
62 unsigned length() const; | 58 unsigned length() const; |
63 ClientRect* item(unsigned index); | 59 ClientRect* item(unsigned index); |
64 ClientRect* anonymousIndexedGetter(unsigned index) { return item(index); } | 60 ClientRect* anonymousIndexedGetter(unsigned index) { return item(index); } |
65 | 61 |
66 DECLARE_TRACE(); | 62 DECLARE_TRACE(); |
67 | 63 |
68 private: | 64 private: |
69 ClientRectList(); | 65 ClientRectList(); |
70 | 66 |
71 template<typename Rects> | 67 template<typename Rects> |
72 explicit ClientRectList(const Rects& rects) | 68 explicit ClientRectList(const Rects& rects) |
73 { | 69 { |
74 m_list.reserveInitialCapacity(rects.size()); | 70 m_list.reserveInitialCapacity(rects.size()); |
75 for (const auto& r : rects) | 71 for (const auto& r : rects) |
76 m_list.append(ClientRect::create(FloatRect(r))); | 72 m_list.append(ClientRect::create(FloatRect(r))); |
77 } | 73 } |
78 | 74 |
79 explicit ClientRectList(const Vector<FloatQuad>&); | 75 explicit ClientRectList(const Vector<FloatQuad>&); |
80 | 76 |
81 WillBeHeapVector<RefPtrWillBeMember<ClientRect>> m_list; | 77 HeapVector<Member<ClientRect>> m_list; |
82 }; | 78 }; |
83 | 79 |
84 } // namespace blink | 80 } // namespace blink |
85 | 81 |
86 #endif // ClientRectList_h | 82 #endif // ClientRectList_h |
OLD | NEW |