Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/DOMPoint.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_DOMPOINT_H_
8
#define MOZILLA_DOMPOINT_H_
9
10
#include "nsWrapperCache.h"
11
#include "nsISupports.h"
12
#include "nsCycleCollectionParticipant.h"
13
#include "mozilla/Attributes.h"
14
#include "mozilla/ErrorResult.h"
15
#include "nsCOMPtr.h"
16
#include "mozilla/dom/BindingDeclarations.h"
17
18
namespace mozilla {
19
namespace dom {
20
21
class GlobalObject;
22
struct DOMPointInit;
23
24
class DOMPointReadOnly : public nsWrapperCache
25
{
26
public:
27
  DOMPointReadOnly(nsISupports* aParent, double aX, double aY,
28
                   double aZ, double aW)
29
    : mParent(aParent)
30
    , mX(aX)
31
    , mY(aY)
32
    , mZ(aZ)
33
    , mW(aW)
34
0
  {
35
0
  }
36
37
  static already_AddRefed<DOMPointReadOnly>
38
  FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams);
39
  static already_AddRefed<DOMPointReadOnly>
40
  Constructor(const GlobalObject& aGlobal, double aX, double aY,
41
              double aZ, double aW, ErrorResult& aRV);
42
43
  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMPointReadOnly)
44
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMPointReadOnly)
45
46
0
  double X() const { return mX; }
47
0
  double Y() const { return mY; }
48
0
  double Z() const { return mZ; }
49
0
  double W() const { return mW; }
50
51
0
  nsISupports* GetParentObject() const { return mParent; }
52
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
53
54
protected:
55
0
  virtual ~DOMPointReadOnly() {}
56
57
  nsCOMPtr<nsISupports> mParent;
58
  double mX, mY, mZ, mW;
59
};
60
61
class DOMPoint final : public DOMPointReadOnly
62
{
63
public:
64
  explicit DOMPoint(nsISupports* aParent, double aX = 0.0, double aY = 0.0,
65
                    double aZ = 0.0, double aW = 1.0)
66
    : DOMPointReadOnly(aParent, aX, aY, aZ, aW)
67
0
  {}
68
69
  static already_AddRefed<DOMPoint>
70
  FromPoint(const GlobalObject& aGlobal, const DOMPointInit& aParams);
71
  static already_AddRefed<DOMPoint>
72
  Constructor(const GlobalObject& aGlobal, double aX, double aY,
73
              double aZ, double aW, ErrorResult& aRV);
74
75
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
76
77
0
  void SetX(double aX) { mX = aX; }
78
0
  void SetY(double aY) { mY = aY; }
79
0
  void SetZ(double aZ) { mZ = aZ; }
80
0
  void SetW(double aW) { mW = aW; }
81
};
82
83
} // namespace dom
84
} // namespace mozilla
85
86
#endif /*MOZILLA_DOMPOINT_H_*/