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 "GridArea.h"
8 #include "mozilla/dom/GridBinding.h"
9 #include "Grid.h"
10
11 namespace mozilla {
12 namespace dom {
13
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridArea,mParent)14 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridArea, mParent)
15 NS_IMPL_CYCLE_COLLECTING_ADDREF(GridArea)
16 NS_IMPL_CYCLE_COLLECTING_RELEASE(GridArea)
17 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridArea)
18 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
19 NS_INTERFACE_MAP_ENTRY(nsISupports)
20 NS_INTERFACE_MAP_END
21
22 GridArea::GridArea(Grid* aParent, nsAtom* aName, GridDeclaration aType,
23 uint32_t aRowStart, uint32_t aRowEnd, uint32_t aColumnStart,
24 uint32_t aColumnEnd)
25 : mParent(aParent),
26 mName(aName),
27 mType(aType),
28 mRowStart(aRowStart),
29 mRowEnd(aRowEnd),
30 mColumnStart(aColumnStart),
31 mColumnEnd(aColumnEnd) {}
32
33 GridArea::~GridArea() = default;
34
WrapObject(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)35 JSObject* GridArea::WrapObject(JSContext* aCx,
36 JS::Handle<JSObject*> aGivenProto) {
37 return GridArea_Binding::Wrap(aCx, this, aGivenProto);
38 }
39
GetName(nsString & aName) const40 void GridArea::GetName(nsString& aName) const { mName->ToString(aName); }
41
Type() const42 GridDeclaration GridArea::Type() const { return mType; }
43
RowStart() const44 uint32_t GridArea::RowStart() const { return mRowStart; }
45
RowEnd() const46 uint32_t GridArea::RowEnd() const { return mRowEnd; }
47
ColumnStart() const48 uint32_t GridArea::ColumnStart() const { return mColumnStart; }
49
ColumnEnd() const50 uint32_t GridArea::ColumnEnd() const { return mColumnEnd; }
51
52 } // namespace dom
53 } // namespace mozilla
54