Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/flex/Flex.cpp
Line
Count
Source (jump to first uncovered line)
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 "Flex.h"
8
9
#include "FlexLine.h"
10
#include "mozilla/dom/FlexBinding.h"
11
#include "nsFlexContainerFrame.h"
12
13
namespace mozilla {
14
namespace dom {
15
16
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Flex, mParent, mLines)
17
NS_IMPL_CYCLE_COLLECTING_ADDREF(Flex)
18
NS_IMPL_CYCLE_COLLECTING_RELEASE(Flex)
19
0
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Flex)
20
0
  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
21
0
  NS_INTERFACE_MAP_ENTRY(nsISupports)
22
0
NS_INTERFACE_MAP_END
23
24
Flex::Flex(Element* aParent,
25
           nsFlexContainerFrame* aFrame)
26
  : mParent(aParent)
27
0
{
28
0
  MOZ_ASSERT(aFrame,
29
0
    "Should never be instantiated with a null nsFlexContainerFrame");
30
0
31
0
  // Eagerly create property values from aFrame, because we're not
32
0
  // going to keep it around.
33
0
  const ComputedFlexContainerInfo* containerInfo =
34
0
    aFrame->GetFlexContainerInfo();
35
0
  MOZ_ASSERT(containerInfo, "Should only be passed a frame with info.");
36
0
37
0
  mLines.SetLength(containerInfo->mLines.Length());
38
0
  uint32_t index = 0;
39
0
  for (auto&& l : containerInfo->mLines) {
40
0
    FlexLine* line = new FlexLine(this, &l);
41
0
    mLines.ElementAt(index) = line;
42
0
    index++;
43
0
  }
44
0
}
45
46
JSObject*
47
Flex::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
48
0
{
49
0
  return Flex_Binding::Wrap(aCx, this, aGivenProto);
50
0
}
51
52
void
53
Flex::GetLines(nsTArray<RefPtr<FlexLine>>& aResult)
54
0
{
55
0
  aResult.AppendElements(mLines);
56
0
}
57
58
} // namespace dom
59
} // namespace mozilla