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/. */
7 #include "GridDimension.h"
10 #include "GridLines.h"
11 #include "GridTracks.h"
12 #include "mozilla/dom/GridBinding.h"
13 #include "nsGridContainerFrame.h"
15 namespace mozilla::dom
{
17 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridDimension
, mParent
, mLines
, mTracks
)
18 NS_IMPL_CYCLE_COLLECTING_ADDREF(GridDimension
)
19 NS_IMPL_CYCLE_COLLECTING_RELEASE(GridDimension
)
20 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridDimension
)
21 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
22 NS_INTERFACE_MAP_ENTRY(nsISupports
)
25 GridDimension::GridDimension(Grid
* aParent
)
27 mLines(new GridLines(this)),
28 mTracks(new GridTracks(this)) {
29 MOZ_ASSERT(aParent
, "Should never be instantiated with a null Grid");
32 GridDimension::~GridDimension() = default;
34 JSObject
* GridDimension::WrapObject(JSContext
* aCx
,
35 JS::Handle
<JSObject
*> aGivenProto
) {
36 return GridDimension_Binding::Wrap(aCx
, this, aGivenProto
);
39 GridLines
* GridDimension::Lines() const { return mLines
; }
41 GridTracks
* GridDimension::Tracks() const { return mTracks
; }
43 void GridDimension::SetTrackInfo(const ComputedGridTrackInfo
* aTrackInfo
) {
44 mTracks
->SetTrackInfo(aTrackInfo
);
47 void GridDimension::SetLineInfo(const ComputedGridTrackInfo
* aTrackInfo
,
48 const ComputedGridLineInfo
* aLineInfo
,
49 const nsTArray
<RefPtr
<GridArea
>>& aAreas
,
51 mLines
->SetLineInfo(aTrackInfo
, aLineInfo
, aAreas
, aIsRow
);
54 } // namespace mozilla::dom