Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/svg/SVGViewElement.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 "mozilla/dom/SVGViewElement.h"
8
#include "mozilla/dom/SVGViewElementBinding.h"
9
10
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(View)
11
12
namespace mozilla {
13
namespace dom {
14
15
using namespace SVGViewElement_Binding;
16
17
JSObject*
18
SVGViewElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
19
0
{
20
0
  return SVGViewElement_Binding::Wrap(aCx, this, aGivenProto);
21
0
}
22
23
nsSVGEnumMapping SVGViewElement::sZoomAndPanMap[] = {
24
  {&nsGkAtoms::disable, SVG_ZOOMANDPAN_DISABLE},
25
  {&nsGkAtoms::magnify, SVG_ZOOMANDPAN_MAGNIFY},
26
  {nullptr, 0}
27
};
28
29
nsSVGElement::EnumInfo SVGViewElement::sEnumInfo[1] =
30
{
31
  { &nsGkAtoms::zoomAndPan,
32
    sZoomAndPanMap,
33
    SVG_ZOOMANDPAN_MAGNIFY
34
  }
35
};
36
37
//----------------------------------------------------------------------
38
// Implementation
39
40
SVGViewElement::SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
41
  : SVGViewElementBase(std::move(aNodeInfo))
42
0
{
43
0
}
44
45
//----------------------------------------------------------------------
46
// nsINode methods
47
48
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGViewElement)
49
50
void
51
SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
52
0
{
53
0
  if (aZoomAndPan == SVG_ZOOMANDPAN_DISABLE ||
54
0
      aZoomAndPan == SVG_ZOOMANDPAN_MAGNIFY) {
55
0
    mEnumAttributes[ZOOMANDPAN].SetBaseValue(aZoomAndPan, this);
56
0
    return;
57
0
  }
58
0
59
0
  rv.ThrowRangeError<MSG_INVALID_ZOOMANDPAN_VALUE_ERROR>();
60
0
}
61
62
//----------------------------------------------------------------------
63
64
already_AddRefed<SVGAnimatedRect>
65
SVGViewElement::ViewBox()
66
0
{
67
0
  return mViewBox.ToSVGAnimatedRect(this);
68
0
}
69
70
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
71
SVGViewElement::PreserveAspectRatio()
72
0
{
73
0
  return mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(this);
74
0
}
75
76
//----------------------------------------------------------------------
77
// nsSVGElement methods
78
79
nsSVGElement::EnumAttributesInfo
80
SVGViewElement::GetEnumInfo()
81
0
{
82
0
  return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
83
0
                            ArrayLength(sEnumInfo));
84
0
}
85
86
nsSVGViewBox *
87
SVGViewElement::GetViewBox()
88
0
{
89
0
  return &mViewBox;
90
0
}
91
92
SVGAnimatedPreserveAspectRatio *
93
SVGViewElement::GetPreserveAspectRatio()
94
0
{
95
0
  return &mPreserveAspectRatio;
96
0
}
97
98
} // namespace dom
99
} // namespace mozilla