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/. */
10 #include "mozilla/dom/GridBinding.h"
13 namespace mozilla::dom
{
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
)
23 GridLine::GridLine(GridLines
* aParent
)
27 mType(GridDeclaration::Implicit
),
30 MOZ_ASSERT(aParent
, "Should never be instantiated with a null GridLines");
33 GridLine::~GridLine() = default;
35 void GridLine::GetNames(nsTArray
<nsString
>& aNames
) const {
36 aNames
.SetCapacity(mNames
.Length());
37 for (auto& name
: mNames
) {
38 aNames
.AppendElement(nsDependentAtomString(name
));
42 JSObject
* GridLine::WrapObject(JSContext
* aCx
,
43 JS::Handle
<JSObject
*> aGivenProto
) {
44 return GridLine_Binding::Wrap(aCx
, this, aGivenProto
);
47 double GridLine::Start() const { return mStart
; }
49 double GridLine::Breadth() const { return mBreadth
; }
51 GridDeclaration
GridLine::Type() const { return mType
; }
53 uint32_t GridLine::Number() const { return mNumber
; }
55 int32_t GridLine::NegativeNumber() const { return mNegativeNumber
; }
57 void GridLine::SetLineValues(const nsTArray
<RefPtr
<nsAtom
>>& aNames
,
58 double aStart
, double aBreadth
, uint32_t aNumber
,
59 int32_t aNegativeNumber
, GridDeclaration aType
) {
60 mNames
= aNames
.Clone();
64 mNegativeNumber
= aNegativeNumber
;
68 void GridLine::SetLineNames(const nsTArray
<RefPtr
<nsAtom
>>& aNames
) {
69 mNames
= aNames
.Clone();
72 } // namespace mozilla::dom