GridTrack.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 "GridTrack.h"
  6. #include "GridTracks.h"
  7. #include "mozilla/dom/GridBinding.h"
  8. namespace mozilla {
  9. namespace dom {
  10. NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridTrack, mParent)
  11. NS_IMPL_CYCLE_COLLECTING_ADDREF(GridTrack)
  12. NS_IMPL_CYCLE_COLLECTING_RELEASE(GridTrack)
  13. NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridTrack)
  14. NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
  15. NS_INTERFACE_MAP_ENTRY(nsISupports)
  16. NS_INTERFACE_MAP_END
  17. GridTrack::GridTrack(GridTracks* aParent)
  18. : mParent(aParent)
  19. , mStart(0.0)
  20. , mBreadth(0.0)
  21. , mType(GridDeclaration::Implicit)
  22. , mState(GridTrackState::Static)
  23. {
  24. MOZ_ASSERT(aParent, "Should never be instantiated with a null GridTracks");
  25. }
  26. GridTrack::~GridTrack()
  27. {
  28. }
  29. JSObject*
  30. GridTrack::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
  31. {
  32. return GridTrackBinding::Wrap(aCx, this, aGivenProto);
  33. }
  34. double
  35. GridTrack::Start() const
  36. {
  37. return mStart;
  38. }
  39. double
  40. GridTrack::Breadth() const
  41. {
  42. return mBreadth;
  43. }
  44. GridDeclaration
  45. GridTrack::Type() const
  46. {
  47. return mType;
  48. }
  49. GridTrackState
  50. GridTrack::State() const
  51. {
  52. return mState;
  53. }
  54. void
  55. GridTrack::SetTrackValues(double aStart,
  56. double aBreadth,
  57. GridDeclaration aType,
  58. GridTrackState aState)
  59. {
  60. mStart = aStart;
  61. mBreadth = aBreadth;
  62. mType = aType;
  63. mState = aState;
  64. }
  65. } // namespace dom
  66. } // namespace mozilla