Bug 1472338: part 2) Change `clipboard.readText()` to read from the clipboard asynchr...
[gecko.git] / dom / grid / GridLine.cpp
blobce65b5bbd81a42e065c10ba749656035d652cd1a
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/. */
7 #include "GridLine.h"
9 #include "GridLines.h"
10 #include "mozilla/dom/GridBinding.h"
11 #include "nsAtom.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)
21 NS_INTERFACE_MAP_END
23 GridLine::GridLine(GridLines* aParent)
24 : mParent(aParent),
25 mStart(0.0),
26 mBreadth(0.0),
27 mType(GridDeclaration::Implicit),
28 mNumber(0),
29 mNegativeNumber(0) {
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();
61 mStart = aStart;
62 mBreadth = aBreadth;
63 mNumber = aNumber;
64 mNegativeNumber = aNegativeNumber;
65 mType = aType;
68 void GridLine::SetLineNames(const nsTArray<RefPtr<nsAtom>>& aNames) {
69 mNames = aNames.Clone();
72 } // namespace mozilla::dom