GridLine.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* -*- Mode: C++; tab-width: 8; 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. #include "GridLine.h"
  6. #include "GridLines.h"
  7. #include "mozilla/dom/GridBinding.h"
  8. namespace mozilla {
  9. namespace dom {
  10. NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridLine, mParent)
  11. NS_IMPL_CYCLE_COLLECTING_ADDREF(GridLine)
  12. NS_IMPL_CYCLE_COLLECTING_RELEASE(GridLine)
  13. NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridLine)
  14. NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
  15. NS_INTERFACE_MAP_ENTRY(nsISupports)
  16. NS_INTERFACE_MAP_END
  17. GridLine::GridLine(GridLines *aParent)
  18. : mParent(aParent)
  19. , mStart(0.0)
  20. , mBreadth(0.0)
  21. , mType(GridDeclaration::Implicit)
  22. , mNumber(0)
  23. {
  24. MOZ_ASSERT(aParent, "Should never be instantiated with a null GridLines");
  25. }
  26. GridLine::~GridLine()
  27. {
  28. }
  29. void
  30. GridLine::GetNames(nsTArray<nsString>& aNames) const
  31. {
  32. aNames = mNames;
  33. }
  34. JSObject*
  35. GridLine::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
  36. {
  37. return GridLineBinding::Wrap(aCx, this, aGivenProto);
  38. }
  39. double
  40. GridLine::Start() const
  41. {
  42. return mStart;
  43. }
  44. double
  45. GridLine::Breadth() const
  46. {
  47. return mBreadth;
  48. }
  49. GridDeclaration
  50. GridLine::Type() const
  51. {
  52. return mType;
  53. }
  54. uint32_t
  55. GridLine::Number() const
  56. {
  57. return mNumber;
  58. }
  59. void
  60. GridLine::SetLineValues(const nsTArray<nsString>& aNames,
  61. double aStart,
  62. double aBreadth,
  63. uint32_t aNumber,
  64. GridDeclaration aType)
  65. {
  66. mNames = aNames;
  67. mStart = aStart;
  68. mBreadth = aBreadth;
  69. mNumber = aNumber;
  70. mType = aType;
  71. }
  72. } // namespace dom
  73. } // namespace mozilla