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_Grid_h
8 #define mozilla_dom_Grid_h
9 
10 #include "GridArea.h"
11 #include "mozilla/dom/Element.h"
12 #include "nsGridContainerFrame.h"
13 #include "nsISupports.h"
14 #include "nsWrapperCache.h"
15 
16 namespace mozilla {
17 namespace dom {
18 
19 class GridDimension;
20 
21 class Grid : public nsISupports, public nsWrapperCache {
22  public:
23   explicit Grid(nsISupports* aParent, nsGridContainerFrame* aFrame);
24 
25  protected:
26   virtual ~Grid();
27 
28  public:
29   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Grid)
31 
32   virtual JSObject* WrapObject(JSContext* aCx,
33                                JS::Handle<JSObject*> aGivenProto) override;
GetParentObject()34   Element* GetParentObject() { return mParent; }
35 
36   GridDimension* Rows() const;
37   GridDimension* Cols() const;
38   void GetAreas(nsTArray<RefPtr<GridArea>>& aAreas) const;
39 
40  protected:
41   nsCOMPtr<Element> mParent;
42   RefPtr<GridDimension> mRows;
43   RefPtr<GridDimension> mCols;
44   nsTArray<RefPtr<GridArea>> mAreas;
45 };
46 
47 }  // namespace dom
48 }  // namespace mozilla
49 
50 #endif /* mozilla_dom_Grid_h */
51