Line data Source code
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 : #include "GridDimension.h"
8 :
9 : #include "Grid.h"
10 : #include "GridLines.h"
11 : #include "GridTracks.h"
12 : #include "mozilla/dom/GridBinding.h"
13 : #include "nsGridContainerFrame.h"
14 :
15 : namespace mozilla {
16 : namespace dom {
17 :
18 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridDimension, mParent, mLines, mTracks)
19 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(GridDimension)
20 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(GridDimension)
21 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridDimension)
22 0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
23 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
24 0 : NS_INTERFACE_MAP_END
25 :
26 0 : GridDimension::GridDimension(Grid* aParent)
27 : : mParent(aParent)
28 0 : , mLines(new GridLines(this))
29 0 : , mTracks(new GridTracks(this))
30 : {
31 0 : MOZ_ASSERT(aParent, "Should never be instantiated with a null Grid");
32 0 : }
33 :
34 0 : GridDimension::~GridDimension()
35 : {
36 0 : }
37 :
38 : JSObject*
39 0 : GridDimension::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
40 : {
41 0 : return GridDimensionBinding::Wrap(aCx, this, aGivenProto);
42 : }
43 :
44 : GridLines*
45 0 : GridDimension::Lines() const
46 : {
47 0 : return mLines;
48 : }
49 :
50 : GridTracks*
51 0 : GridDimension::Tracks() const
52 : {
53 0 : return mTracks;
54 : }
55 :
56 : void
57 0 : GridDimension::SetTrackInfo(const ComputedGridTrackInfo* aTrackInfo)
58 : {
59 0 : mTracks->SetTrackInfo(aTrackInfo);
60 0 : }
61 :
62 : void
63 0 : GridDimension::SetLineInfo(const ComputedGridTrackInfo* aTrackInfo,
64 : const ComputedGridLineInfo* aLineInfo,
65 : const nsTArray<RefPtr<GridArea>>& aAreas,
66 : bool aIsRow)
67 : {
68 0 : mLines->SetLineInfo(aTrackInfo, aLineInfo, aAreas, aIsRow);
69 0 : }
70 :
71 : } // namespace dom
72 : } // namespace mozilla
|