GridDimension.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "GridDimension.h"
  6. #include "Grid.h"
  7. #include "GridLines.h"
  8. #include "GridTracks.h"
  9. #include "mozilla/dom/GridBinding.h"
  10. #include "nsGridContainerFrame.h"
  11. namespace mozilla {
  12. namespace dom {
  13. NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridDimension, mParent, mLines, mTracks)
  14. NS_IMPL_CYCLE_COLLECTING_ADDREF(GridDimension)
  15. NS_IMPL_CYCLE_COLLECTING_RELEASE(GridDimension)
  16. NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridDimension)
  17. NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
  18. NS_INTERFACE_MAP_ENTRY(nsISupports)
  19. NS_INTERFACE_MAP_END
  20. GridDimension::GridDimension(Grid* aParent)
  21. : mParent(aParent)
  22. , mLines(new GridLines(this))
  23. , mTracks(new GridTracks(this))
  24. {
  25. MOZ_ASSERT(aParent, "Should never be instantiated with a null Grid");
  26. }
  27. GridDimension::~GridDimension()
  28. {
  29. }
  30. JSObject*
  31. GridDimension::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
  32. {
  33. return GridDimensionBinding::Wrap(aCx, this, aGivenProto);
  34. }
  35. GridLines*
  36. GridDimension::Lines() const
  37. {
  38. return mLines;
  39. }
  40. GridTracks*
  41. GridDimension::Tracks() const
  42. {
  43. return mTracks;
  44. }
  45. void
  46. GridDimension::SetTrackInfo(const ComputedGridTrackInfo* aTrackInfo)
  47. {
  48. mTracks->SetTrackInfo(aTrackInfo);
  49. }
  50. void
  51. GridDimension::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo,
  52. const ComputedGridLineInfo* aLineInfo,
  53. const nsTArray<RefPtr<GridArea>>& aAreas,
  54. bool aIsRow)
  55. {
  56. mLines->SetLineInfo(aTrackInfo, aLineInfo, aAreas, aIsRow);
  57. }
  58. } // namespace dom
  59. } // namespace mozilla