2016-07-06 21:45:18 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "GridLine.h"
|
|
|
|
|
|
|
|
#include "GridLines.h"
|
|
|
|
#include "mozilla/dom/GridBinding.h"
|
2020-11-23 19:21:38 +03:00
|
|
|
#include "nsAtom.h"
|
2016-07-06 21:45:18 +03:00
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
namespace mozilla::dom {
|
2016-07-06 21:45:18 +03:00
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(GridLine, mParent)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(GridLine)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(GridLine)
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GridLine)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2018-04-13 16:01:28 +03:00
|
|
|
GridLine::GridLine(GridLines* aParent)
|
2016-07-06 21:45:18 +03:00
|
|
|
: mParent(aParent),
|
|
|
|
mStart(0.0),
|
|
|
|
mBreadth(0.0),
|
2016-08-23 23:34:51 +03:00
|
|
|
mType(GridDeclaration::Implicit),
|
2016-07-06 21:45:18 +03:00
|
|
|
mNumber(0),
|
2018-06-16 17:21:46 +03:00
|
|
|
mNegativeNumber(0) {
|
2016-07-06 21:45:18 +03:00
|
|
|
MOZ_ASSERT(aParent, "Should never be instantiated with a null GridLines");
|
|
|
|
}
|
|
|
|
|
2020-02-20 19:10:39 +03:00
|
|
|
GridLine::~GridLine() = default;
|
2016-07-06 21:45:18 +03:00
|
|
|
|
2019-06-19 01:29:58 +03:00
|
|
|
void GridLine::GetNames(nsTArray<nsString>& aNames) const {
|
|
|
|
aNames.SetCapacity(mNames.Length());
|
|
|
|
for (auto& name : mNames) {
|
2019-06-19 08:58:11 +03:00
|
|
|
aNames.AppendElement(nsDependentAtomString(name));
|
2019-06-19 01:29:58 +03:00
|
|
|
}
|
|
|
|
}
|
2016-07-06 21:45:18 +03:00
|
|
|
|
|
|
|
JSObject* GridLine::WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return GridLine_Binding::Wrap(aCx, this, aGivenProto);
|
2016-07-06 21:45:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
double GridLine::Start() const { return mStart; }
|
|
|
|
|
|
|
|
double GridLine::Breadth() const { return mBreadth; }
|
|
|
|
|
2016-08-23 23:34:51 +03:00
|
|
|
GridDeclaration GridLine::Type() const { return mType; }
|
|
|
|
|
2016-07-06 21:45:18 +03:00
|
|
|
uint32_t GridLine::Number() const { return mNumber; }
|
|
|
|
|
2017-11-09 00:25:16 +03:00
|
|
|
int32_t GridLine::NegativeNumber() const { return mNegativeNumber; }
|
|
|
|
|
2019-06-19 08:58:11 +03:00
|
|
|
void GridLine::SetLineValues(const nsTArray<RefPtr<nsAtom>>& aNames,
|
|
|
|
double aStart, double aBreadth, uint32_t aNumber,
|
2017-11-09 01:06:51 +03:00
|
|
|
int32_t aNegativeNumber, GridDeclaration aType) {
|
2020-05-05 17:13:15 +03:00
|
|
|
mNames = aNames.Clone();
|
2016-07-06 21:45:18 +03:00
|
|
|
mStart = aStart;
|
|
|
|
mBreadth = aBreadth;
|
|
|
|
mNumber = aNumber;
|
2017-11-09 01:06:51 +03:00
|
|
|
mNegativeNumber = aNegativeNumber;
|
2016-08-23 23:34:51 +03:00
|
|
|
mType = aType;
|
2016-07-06 21:45:18 +03:00
|
|
|
}
|
|
|
|
|
2019-06-19 08:58:11 +03:00
|
|
|
void GridLine::SetLineNames(const nsTArray<RefPtr<nsAtom>>& aNames) {
|
2020-05-05 17:13:15 +03:00
|
|
|
mNames = aNames.Clone();
|
2019-04-17 20:19:01 +03:00
|
|
|
}
|
|
|
|
|
2020-11-04 20:04:01 +03:00
|
|
|
} // namespace mozilla::dom
|