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::dom {
12
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridArea,mParent)13 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridArea, mParent)
14 NS_IMPL_CYCLE_COLLECTING_ADDREF(GridArea)
15 NS_IMPL_CYCLE_COLLECTING_RELEASE(GridArea)
16 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridArea)
17 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
18 NS_INTERFACE_MAP_ENTRY(nsISupports)
19 NS_INTERFACE_MAP_END
20
21 GridArea::GridArea(Grid* aParent, nsAtom* aName, GridDeclaration aType,
22 uint32_t aRowStart, uint32_t aRowEnd, uint32_t aColumnStart,
23 uint32_t aColumnEnd)
24 : mParent(aParent),
25 mName(aName),
26 mType(aType),
27 mRowStart(aRowStart),
28 mRowEnd(aRowEnd),
29 mColumnStart(aColumnStart),
30 mColumnEnd(aColumnEnd) {}
31
32 GridArea::~GridArea() = default;
33
WrapObject(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)34 JSObject* GridArea::WrapObject(JSContext* aCx,
35 JS::Handle<JSObject*> aGivenProto) {
36 return GridArea_Binding::Wrap(aCx, this, aGivenProto);
37 }
38
GetName(nsString & aName) const39 void GridArea::GetName(nsString& aName) const { mName->ToString(aName); }
40
Type() const41 GridDeclaration GridArea::Type() const { return mType; }
42
RowStart() const43 uint32_t GridArea::RowStart() const { return mRowStart; }
44
RowEnd() const45 uint32_t GridArea::RowEnd() const { return mRowEnd; }
46
ColumnStart() const47 uint32_t GridArea::ColumnStart() const { return mColumnStart; }
48
ColumnEnd() const49 uint32_t GridArea::ColumnEnd() const { return mColumnEnd; }
50
51 } // namespace mozilla::dom
52