Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/SVGLineElement.h
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
#ifndef mozilla_dom_SVGLineElement_h
8
#define mozilla_dom_SVGLineElement_h
9
10
#include "SVGGeometryElement.h"
11
#include "nsSVGLength2.h"
12
13
nsresult NS_NewSVGLineElement(nsIContent **aResult,
14
                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
15
16
namespace mozilla {
17
namespace dom {
18
19
typedef SVGGeometryElement SVGLineElementBase;
20
21
class SVGLineElement final : public SVGLineElementBase
22
{
23
protected:
24
  explicit SVGLineElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
25
  virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
26
  friend nsresult (::NS_NewSVGLineElement(nsIContent **aResult,
27
                                          already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
28
  // If the input line has length zero and linecaps aren't butt, adjust |aX2| by
29
  // a tiny amount to a barely-nonzero-length line that all of our draw targets
30
  // will render
31
  void MaybeAdjustForZeroLength(float aX1, float aY1, float& aX2, float aY2);
32
33
public:
34
  // nsIContent interface
35
  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
36
37
  // SVGGeometryElement methods:
38
0
  virtual bool IsMarkable() override { return true; }
39
  virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) override;
40
  virtual void GetAsSimplePath(SimplePath* aSimplePath) override;
41
  virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
42
  virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
43
                                 const Matrix& aToBoundsSpace,
44
                                 const Matrix* aToNonScalingStrokeSpace = nullptr) override;
45
46
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
47
48
  // WebIDL
49
  already_AddRefed<SVGAnimatedLength> X1();
50
  already_AddRefed<SVGAnimatedLength> Y1();
51
  already_AddRefed<SVGAnimatedLength> X2();
52
  already_AddRefed<SVGAnimatedLength> Y2();
53
54
protected:
55
56
  virtual LengthAttributesInfo GetLengthInfo() override;
57
58
  enum { ATTR_X1, ATTR_Y1, ATTR_X2, ATTR_Y2 };
59
  nsSVGLength2 mLengthAttributes[4];
60
  static LengthInfo sLengthInfo[4];
61
};
62
63
} // namespace dom
64
} // namespace mozilla
65
66
#endif // mozilla_dom_SVGLineElement_h