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_GridDimension_h
8 #define mozilla_dom_GridDimension_h
9 
10 #include "nsWrapperCache.h"
11 #include "nsTArray.h"
12 
13 namespace mozilla {
14 
15 struct ComputedGridLineInfo;
16 struct ComputedGridTrackInfo;
17 
18 namespace dom {
19 
20 class Grid;
21 class GridArea;
22 class GridLines;
23 class GridTracks;
24 
25 class GridDimension : public nsISupports, public nsWrapperCache {
26  public:
27   explicit GridDimension(Grid* aParent);
28 
29  protected:
30   virtual ~GridDimension();
31 
32  public:
33   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
34   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GridDimension)
35 
36   virtual JSObject* WrapObject(JSContext* aCx,
37                                JS::Handle<JSObject*> aGivenProto) override;
GetParentObject()38   Grid* GetParentObject() { return mParent; }
39 
40   GridLines* Lines() const;
41   GridTracks* Tracks() const;
42 
43   void SetTrackInfo(const ComputedGridTrackInfo* aTrackInfo);
44   void SetLineInfo(const ComputedGridTrackInfo* aTrackInfo,
45                    const ComputedGridLineInfo* aLineInfo,
46                    const nsTArray<RefPtr<GridArea>>& aAreas, bool aIsRow);
47 
48  protected:
49   RefPtr<Grid> mParent;
50   RefPtr<GridLines> mLines;
51   RefPtr<GridTracks> mTracks;
52 };
53 
54 }  // namespace dom
55 }  // namespace mozilla
56 
57 #endif /* mozilla_dom_GridDimension_h */
58