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 "GridTrack.h"
8 
9 #include "GridTracks.h"
10 #include "mozilla/dom/GridBinding.h"
11 
12 namespace mozilla {
13 namespace dom {
14 
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridTrack,mParent)15 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridTrack, mParent)
16 NS_IMPL_CYCLE_COLLECTING_ADDREF(GridTrack)
17 NS_IMPL_CYCLE_COLLECTING_RELEASE(GridTrack)
18 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridTrack)
19   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
20   NS_INTERFACE_MAP_ENTRY(nsISupports)
21 NS_INTERFACE_MAP_END
22 
23 GridTrack::GridTrack(GridTracks* aParent)
24     : mParent(aParent),
25       mStart(0.0),
26       mBreadth(0.0),
27       mType(GridDeclaration::Implicit),
28       mState(GridTrackState::Static) {
29   MOZ_ASSERT(aParent, "Should never be instantiated with a null GridTracks");
30 }
31 
~GridTrack()32 GridTrack::~GridTrack() {}
33 
WrapObject(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)34 JSObject* GridTrack::WrapObject(JSContext* aCx,
35                                 JS::Handle<JSObject*> aGivenProto) {
36   return GridTrackBinding::Wrap(aCx, this, aGivenProto);
37 }
38 
Start() const39 double GridTrack::Start() const { return mStart; }
40 
Breadth() const41 double GridTrack::Breadth() const { return mBreadth; }
42 
Type() const43 GridDeclaration GridTrack::Type() const { return mType; }
44 
State() const45 GridTrackState GridTrack::State() const { return mState; }
46 
SetTrackValues(double aStart,double aBreadth,GridDeclaration aType,GridTrackState aState)47 void GridTrack::SetTrackValues(double aStart, double aBreadth,
48                                GridDeclaration aType, GridTrackState aState) {
49   mStart = aStart;
50   mBreadth = aBreadth;
51   mType = aType;
52   mState = aState;
53 }
54 
55 }  // namespace dom
56 }  // namespace mozilla
57