|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "mozilla/dom/DOMPoint.h" |
|
7 |
|
8 #include "mozilla/dom/DOMPointBinding.h" |
|
9 #include "mozilla/dom/BindingDeclarations.h" |
|
10 #include "nsAutoPtr.h" |
|
11 |
|
12 using namespace mozilla; |
|
13 using namespace mozilla::dom; |
|
14 |
|
15 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(DOMPoint, mParent) |
|
16 |
|
17 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMPoint, AddRef) |
|
18 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMPoint, Release) |
|
19 |
|
20 already_AddRefed<DOMPoint> |
|
21 DOMPoint::Constructor(const GlobalObject& aGlobal, const DOMPointInit& aParams, |
|
22 ErrorResult& aRV) |
|
23 { |
|
24 nsRefPtr<DOMPoint> obj = |
|
25 new DOMPoint(aGlobal.GetAsSupports(), aParams.mX, aParams.mY, |
|
26 aParams.mZ, aParams.mW); |
|
27 return obj.forget(); |
|
28 } |
|
29 |
|
30 already_AddRefed<DOMPoint> |
|
31 DOMPoint::Constructor(const GlobalObject& aGlobal, double aX, double aY, |
|
32 double aZ, double aW, ErrorResult& aRV) |
|
33 { |
|
34 nsRefPtr<DOMPoint> obj = |
|
35 new DOMPoint(aGlobal.GetAsSupports(), aX, aY, aZ, aW); |
|
36 return obj.forget(); |
|
37 } |
|
38 |
|
39 JSObject* |
|
40 DOMPoint::WrapObject(JSContext* aCx) |
|
41 { |
|
42 return DOMPointBinding::Wrap(aCx, this); |
|
43 } |