nsDOMCSSRect.h 1.6 KB

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