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 #ifndef nsDOMCSSRect_h_ 9 #define nsDOMCSSRect_h_ 10 11 #include "mozilla/Attributes.h" 12 #include "nsIDOMRect.h" 13 #include "nsCycleCollectionParticipant.h" 14 #include "nsWrapperCache.h" 15 16 class nsROCSSPrimitiveValue; 17 18 class nsDOMCSSRect final : public nsIDOMRect, 19 public nsWrapperCache 20 { 21 public: 22 nsDOMCSSRect(nsROCSSPrimitiveValue* aTop, 23 nsROCSSPrimitiveValue* aRight, 24 nsROCSSPrimitiveValue* aBottom, 25 nsROCSSPrimitiveValue* aLeft); 26 27 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 28 NS_DECL_NSIDOMRECT 29 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCSSRect)30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCSSRect) 31 32 nsROCSSPrimitiveValue* Top() const { return mTop; } Right()33 nsROCSSPrimitiveValue* Right() const { return mRight; } Bottom()34 nsROCSSPrimitiveValue* Bottom() const { return mBottom; } Left()35 nsROCSSPrimitiveValue* Left() const { return mLeft; } 36 GetParentObject()37 nsISupports* GetParentObject() const { return nullptr; } 38 39 virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) 40 override final; 41 42 protected: 43 virtual ~nsDOMCSSRect(void); 44 45 private: 46 RefPtr<nsROCSSPrimitiveValue> mTop; 47 RefPtr<nsROCSSPrimitiveValue> mRight; 48 RefPtr<nsROCSSPrimitiveValue> mBottom; 49 RefPtr<nsROCSSPrimitiveValue> mLeft; 50 }; 51 52 #endif /* nsDOMCSSRect_h_ */ 53