/src/mozilla-central/dom/svg/SVGPolylineElement.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/SVGPolylineElement.h" |
8 | | #include "mozilla/dom/SVGPolylineElementBinding.h" |
9 | | #include "mozilla/gfx/2D.h" |
10 | | |
11 | | using namespace mozilla; |
12 | | using namespace mozilla::gfx; |
13 | | |
14 | | NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Polyline) |
15 | | |
16 | | namespace mozilla { |
17 | | namespace dom { |
18 | | |
19 | | JSObject* |
20 | | SVGPolylineElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) |
21 | 0 | { |
22 | 0 | return SVGPolylineElement_Binding::Wrap(aCx, this, aGivenProto); |
23 | 0 | } |
24 | | |
25 | | //---------------------------------------------------------------------- |
26 | | // Implementation |
27 | | |
28 | | SVGPolylineElement::SVGPolylineElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) |
29 | | : SVGPolylineElementBase(std::move(aNodeInfo)) |
30 | 0 | { |
31 | 0 | } |
32 | | |
33 | | //---------------------------------------------------------------------- |
34 | | // nsINode methods |
35 | | |
36 | | NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPolylineElement) |
37 | | |
38 | | //---------------------------------------------------------------------- |
39 | | // SVGGeometryElement methods |
40 | | |
41 | | already_AddRefed<Path> |
42 | | SVGPolylineElement::BuildPath(PathBuilder* aBuilder) |
43 | 0 | { |
44 | 0 | const SVGPointList &points = mPoints.GetAnimValue(); |
45 | 0 |
|
46 | 0 | if (points.IsEmpty()) { |
47 | 0 | return nullptr; |
48 | 0 | } |
49 | 0 | |
50 | 0 | aBuilder->MoveTo(points[0]); |
51 | 0 | for (uint32_t i = 1; i < points.Length(); ++i) { |
52 | 0 | aBuilder->LineTo(points[i]); |
53 | 0 | } |
54 | 0 |
|
55 | 0 | return aBuilder->Finish(); |
56 | 0 | } |
57 | | |
58 | | } // namespace dom |
59 | | } // namespace mozilla |