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, public nsWrapperCache {
23  public:
24   explicit GridTracks(GridDimension* aParent);
25 
26  protected:
27   virtual ~GridTracks();
28 
29  public:
30   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
31   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GridTracks)
32 
33   virtual JSObject* WrapObject(JSContext* aCx,
34                                JS::Handle<JSObject*> aGivenProto) override;
GetParentObject()35   GridDimension* GetParentObject() { return mParent; }
36 
37   uint32_t Length() const;
38   GridTrack* Item(uint32_t aIndex);
39   GridTrack* IndexedGetter(uint32_t aIndex, bool& aFound);
40 
41   void SetTrackInfo(const mozilla::ComputedGridTrackInfo* aTrackInfo);
42 
43  protected:
44   RefPtr<GridDimension> mParent;
45   nsTArray<RefPtr<GridTrack>> mTracks;
46 };
47 
48 }  // namespace dom
49 }  // namespace mozilla
50 
51 #endif /* mozilla_dom_GridTracks_h */
52