michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* DOM object representing rectangle values in DOM computed style */ michael@0: michael@0: #include "mozilla/dom/RectBinding.h" michael@0: #include "nsROCSSPrimitiveValue.h" michael@0: #include "nsDOMCSSRect.h" michael@0: michael@0: using namespace mozilla; michael@0: michael@0: nsDOMCSSRect::nsDOMCSSRect(nsROCSSPrimitiveValue* aTop, michael@0: nsROCSSPrimitiveValue* aRight, michael@0: nsROCSSPrimitiveValue* aBottom, michael@0: nsROCSSPrimitiveValue* aLeft) michael@0: : mTop(aTop), mRight(aRight), mBottom(aBottom), mLeft(aLeft) michael@0: { michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: nsDOMCSSRect::~nsDOMCSSRect(void) michael@0: { michael@0: } michael@0: michael@0: NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSRect) michael@0: NS_INTERFACE_MAP_ENTRY(nsIDOMRect) michael@0: NS_INTERFACE_MAP_ENTRY(nsISupports) michael@0: NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY michael@0: NS_INTERFACE_MAP_END michael@0: michael@0: NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSRect) michael@0: NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSRect) michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_4(nsDOMCSSRect, mTop, mBottom, mLeft, mRight) michael@0: michael@0: JSObject* michael@0: nsDOMCSSRect::WrapObject(JSContext* cx) michael@0: { michael@0: return dom::RectBinding::Wrap(cx, this); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsDOMCSSRect::GetTop(nsIDOMCSSPrimitiveValue** aTop) michael@0: { michael@0: NS_ENSURE_TRUE(mTop, NS_ERROR_NOT_INITIALIZED); michael@0: *aTop = mTop; michael@0: NS_ADDREF(*aTop); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsDOMCSSRect::GetRight(nsIDOMCSSPrimitiveValue** aRight) michael@0: { michael@0: NS_ENSURE_TRUE(mRight, NS_ERROR_NOT_INITIALIZED); michael@0: *aRight = mRight; michael@0: NS_ADDREF(*aRight); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsDOMCSSRect::GetBottom(nsIDOMCSSPrimitiveValue** aBottom) michael@0: { michael@0: NS_ENSURE_TRUE(mBottom, NS_ERROR_NOT_INITIALIZED); michael@0: *aBottom = mBottom; michael@0: NS_ADDREF(*aBottom); michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsDOMCSSRect::GetLeft(nsIDOMCSSPrimitiveValue** aLeft) michael@0: { michael@0: NS_ENSURE_TRUE(mLeft, NS_ERROR_NOT_INITIALIZED); michael@0: *aLeft = mLeft; michael@0: NS_ADDREF(*aLeft); michael@0: return NS_OK; michael@0: }