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