Line data Source code
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 : /* DOM object representing rectangle values in DOM computed style */
7 :
8 : #include "nsDOMCSSRect.h"
9 :
10 : #include "mozilla/dom/RectBinding.h"
11 : #include "nsROCSSPrimitiveValue.h"
12 :
13 : using namespace mozilla;
14 :
15 0 : nsDOMCSSRect::nsDOMCSSRect(nsROCSSPrimitiveValue* aTop,
16 : nsROCSSPrimitiveValue* aRight,
17 : nsROCSSPrimitiveValue* aBottom,
18 0 : nsROCSSPrimitiveValue* aLeft)
19 0 : : mTop(aTop), mRight(aRight), mBottom(aBottom), mLeft(aLeft)
20 : {
21 0 : }
22 :
23 0 : nsDOMCSSRect::~nsDOMCSSRect(void)
24 : {
25 0 : }
26 :
27 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSRect)
28 0 : NS_INTERFACE_MAP_ENTRY(nsIDOMRect)
29 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
30 0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
31 0 : NS_INTERFACE_MAP_END
32 :
33 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSRect)
34 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSRect)
35 :
36 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsDOMCSSRect, mTop, mBottom, mLeft, mRight)
37 :
38 : JSObject*
39 0 : nsDOMCSSRect::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto)
40 : {
41 0 : return dom::RectBinding::Wrap(cx, this, aGivenProto);
42 : }
43 :
44 : NS_IMETHODIMP
45 0 : nsDOMCSSRect::GetTop(nsIDOMCSSPrimitiveValue** aTop)
46 : {
47 0 : NS_ENSURE_TRUE(mTop, NS_ERROR_NOT_INITIALIZED);
48 0 : *aTop = mTop;
49 0 : NS_ADDREF(*aTop);
50 0 : return NS_OK;
51 : }
52 :
53 : NS_IMETHODIMP
54 0 : nsDOMCSSRect::GetRight(nsIDOMCSSPrimitiveValue** aRight)
55 : {
56 0 : NS_ENSURE_TRUE(mRight, NS_ERROR_NOT_INITIALIZED);
57 0 : *aRight = mRight;
58 0 : NS_ADDREF(*aRight);
59 0 : return NS_OK;
60 : }
61 :
62 : NS_IMETHODIMP
63 0 : nsDOMCSSRect::GetBottom(nsIDOMCSSPrimitiveValue** aBottom)
64 : {
65 0 : NS_ENSURE_TRUE(mBottom, NS_ERROR_NOT_INITIALIZED);
66 0 : *aBottom = mBottom;
67 0 : NS_ADDREF(*aBottom);
68 0 : return NS_OK;
69 : }
70 :
71 : NS_IMETHODIMP
72 0 : nsDOMCSSRect::GetLeft(nsIDOMCSSPrimitiveValue** aLeft)
73 : {
74 0 : NS_ENSURE_TRUE(mLeft, NS_ERROR_NOT_INITIALIZED);
75 0 : *aLeft = mLeft;
76 0 : NS_ADDREF(*aLeft);
77 0 : return NS_OK;
78 : }
|