1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/nsDOMCSSRect.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,78 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* DOM object representing rectangle values in DOM computed style */ 1.10 + 1.11 +#include "mozilla/dom/RectBinding.h" 1.12 +#include "nsROCSSPrimitiveValue.h" 1.13 +#include "nsDOMCSSRect.h" 1.14 + 1.15 +using namespace mozilla; 1.16 + 1.17 +nsDOMCSSRect::nsDOMCSSRect(nsROCSSPrimitiveValue* aTop, 1.18 + nsROCSSPrimitiveValue* aRight, 1.19 + nsROCSSPrimitiveValue* aBottom, 1.20 + nsROCSSPrimitiveValue* aLeft) 1.21 + : mTop(aTop), mRight(aRight), mBottom(aBottom), mLeft(aLeft) 1.22 +{ 1.23 + SetIsDOMBinding(); 1.24 +} 1.25 + 1.26 +nsDOMCSSRect::~nsDOMCSSRect(void) 1.27 +{ 1.28 +} 1.29 + 1.30 +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSRect) 1.31 + NS_INTERFACE_MAP_ENTRY(nsIDOMRect) 1.32 + NS_INTERFACE_MAP_ENTRY(nsISupports) 1.33 + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY 1.34 +NS_INTERFACE_MAP_END 1.35 + 1.36 +NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSRect) 1.37 +NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSRect) 1.38 + 1.39 +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_4(nsDOMCSSRect, mTop, mBottom, mLeft, mRight) 1.40 + 1.41 +JSObject* 1.42 +nsDOMCSSRect::WrapObject(JSContext* cx) 1.43 +{ 1.44 + return dom::RectBinding::Wrap(cx, this); 1.45 +} 1.46 + 1.47 +NS_IMETHODIMP 1.48 +nsDOMCSSRect::GetTop(nsIDOMCSSPrimitiveValue** aTop) 1.49 +{ 1.50 + NS_ENSURE_TRUE(mTop, NS_ERROR_NOT_INITIALIZED); 1.51 + *aTop = mTop; 1.52 + NS_ADDREF(*aTop); 1.53 + return NS_OK; 1.54 +} 1.55 + 1.56 +NS_IMETHODIMP 1.57 +nsDOMCSSRect::GetRight(nsIDOMCSSPrimitiveValue** aRight) 1.58 +{ 1.59 + NS_ENSURE_TRUE(mRight, NS_ERROR_NOT_INITIALIZED); 1.60 + *aRight = mRight; 1.61 + NS_ADDREF(*aRight); 1.62 + return NS_OK; 1.63 +} 1.64 + 1.65 +NS_IMETHODIMP 1.66 +nsDOMCSSRect::GetBottom(nsIDOMCSSPrimitiveValue** aBottom) 1.67 +{ 1.68 + NS_ENSURE_TRUE(mBottom, NS_ERROR_NOT_INITIALIZED); 1.69 + *aBottom = mBottom; 1.70 + NS_ADDREF(*aBottom); 1.71 + return NS_OK; 1.72 +} 1.73 + 1.74 +NS_IMETHODIMP 1.75 +nsDOMCSSRect::GetLeft(nsIDOMCSSPrimitiveValue** aLeft) 1.76 +{ 1.77 + NS_ENSURE_TRUE(mLeft, NS_ERROR_NOT_INITIALIZED); 1.78 + *aLeft = mLeft; 1.79 + NS_ADDREF(*aLeft); 1.80 + return NS_OK; 1.81 +}