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 "GridLine.h"
8 
9 #include "GridLines.h"
10 #include "mozilla/dom/GridBinding.h"
11 
12 namespace mozilla {
13 namespace dom {
14 
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridLine,mParent)15 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridLine, mParent)
16 NS_IMPL_CYCLE_COLLECTING_ADDREF(GridLine)
17 NS_IMPL_CYCLE_COLLECTING_RELEASE(GridLine)
18 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridLine)
19   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
20   NS_INTERFACE_MAP_ENTRY(nsISupports)
21 NS_INTERFACE_MAP_END
22 
23 GridLine::GridLine(GridLines* aParent)
24     : mParent(aParent),
25       mStart(0.0),
26       mBreadth(0.0),
27       mType(GridDeclaration::Implicit),
28       mNumber(0) {
29   MOZ_ASSERT(aParent, "Should never be instantiated with a null GridLines");
30 }
31 
~GridLine()32 GridLine::~GridLine() {}
33 
GetNames(nsTArray<nsString> & aNames) const34 void GridLine::GetNames(nsTArray<nsString>& aNames) const { aNames = mNames; }
35 
WrapObject(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)36 JSObject* GridLine::WrapObject(JSContext* aCx,
37                                JS::Handle<JSObject*> aGivenProto) {
38   return GridLineBinding::Wrap(aCx, this, aGivenProto);
39 }
40 
Start() const41 double GridLine::Start() const { return mStart; }
42 
Breadth() const43 double GridLine::Breadth() const { return mBreadth; }
44 
Type() const45 GridDeclaration GridLine::Type() const { return mType; }
46 
Number() const47 uint32_t GridLine::Number() const { return mNumber; }
48 
NegativeNumber() const49 int32_t GridLine::NegativeNumber() const { return mNegativeNumber; }
50 
SetLineValues(const nsTArray<nsString> & aNames,double aStart,double aBreadth,uint32_t aNumber,int32_t aNegativeNumber,GridDeclaration aType)51 void GridLine::SetLineValues(const nsTArray<nsString>& aNames, double aStart,
52                              double aBreadth, uint32_t aNumber,
53                              int32_t aNegativeNumber, GridDeclaration aType) {
54   mNames = aNames;
55   mStart = aStart;
56   mBreadth = aBreadth;
57   mNumber = aNumber;
58   mNegativeNumber = aNegativeNumber;
59   mType = aType;
60 }
61 
62 }  // namespace dom
63 }  // namespace mozilla
64