1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_GridTracks_h 8 #define mozilla_dom_GridTracks_h 9 10 #include "nsTArray.h" 11 #include "nsWrapperCache.h" 12 13 namespace mozilla { 14 15 struct ComputedGridTrackInfo; 16 17 namespace dom { 18 19 class GridDimension; 20 class GridTrack; 21 22 class GridTracks : public nsISupports 23 , public nsWrapperCache 24 { 25 public: 26 explicit GridTracks(GridDimension* aParent); 27 28 protected: 29 virtual ~GridTracks(); 30 31 public: 32 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 33 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GridTracks) 34 35 virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; GetParentObject()36 GridDimension* GetParentObject() 37 { 38 return mParent; 39 } 40 41 uint32_t Length() const; 42 GridTrack* Item(uint32_t aIndex); 43 GridTrack* IndexedGetter(uint32_t aIndex, bool& aFound); 44 45 void SetTrackInfo(const mozilla::ComputedGridTrackInfo* aTrackInfo); 46 47 protected: 48 RefPtr<GridDimension> mParent; 49 nsTArray<RefPtr<GridTrack>> mTracks; 50 }; 51 52 } // namespace dom 53 } // namespace mozilla 54 55 #endif /* mozilla_dom_GridTracks_h */ 56