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_GridLine_h
8 #define mozilla_dom_GridLine_h
9 
10 #include "mozilla/dom/GridBinding.h"
11 #include "nsString.h"
12 #include "nsTArray.h"
13 #include "nsWrapperCache.h"
14 
15 namespace mozilla {
16 namespace dom {
17 
18 class GridLines;
19 
20 class GridLine : public nsISupports, public nsWrapperCache {
21  public:
22   explicit GridLine(GridLines* aParent);
23 
24  protected:
25   virtual ~GridLine();
26 
27  public:
28   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GridLine)
30 
31   void GetNames(nsTArray<nsString>& aNames) const;
Names()32   const nsTArray<RefPtr<nsAtom>>& Names() const { return mNames; }
33 
34   virtual JSObject* WrapObject(JSContext* aCx,
35                                JS::Handle<JSObject*> aGivenProto) override;
GetParentObject()36   GridLines* GetParentObject() { return mParent; }
37 
38   double Start() const;
39   double Breadth() const;
40   GridDeclaration Type() const;
41   uint32_t Number() const;
42   int32_t NegativeNumber() const;
43 
44   void SetLineValues(const nsTArray<RefPtr<nsAtom>>& aNames, double aStart,
45                      double aBreadth, uint32_t aNumber, int32_t aNegativeNumber,
46                      GridDeclaration aType);
47 
48   void SetLineNames(const nsTArray<RefPtr<nsAtom>>& aNames);
49 
50  protected:
51   RefPtr<GridLines> mParent;
52   nsTArray<RefPtr<nsAtom>> mNames;
53   double mStart;
54   double mBreadth;
55   GridDeclaration mType;
56   uint32_t mNumber;
57   int32_t mNegativeNumber;
58 };
59 
60 }  // namespace dom
61 }  // namespace mozilla
62 
63 #endif /* mozilla_dom_GridLine_h */
64