Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/DOMQuad.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_DOMQUAD_H_
8
#define MOZILLA_DOMQUAD_H_
9
10
#include "nsWrapperCache.h"
11
#include "nsISupports.h"
12
#include "nsCycleCollectionParticipant.h"
13
#include "mozilla/Attributes.h"
14
#include "nsCOMPtr.h"
15
#include "mozilla/dom/BindingDeclarations.h"
16
#include "mozilla/ErrorResult.h"
17
#include "Units.h"
18
19
namespace mozilla {
20
namespace dom {
21
22
class DOMRectReadOnly;
23
class DOMPoint;
24
struct DOMQuadJSON;
25
struct DOMPointInit;
26
27
class DOMQuad final : public nsWrapperCache
28
{
29
  ~DOMQuad();
30
31
public:
32
  DOMQuad(nsISupports* aParent, CSSPoint aPoints[4]);
33
  explicit DOMQuad(nsISupports* aParent);
34
35
  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMQuad)
36
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMQuad)
37
38
0
  nsISupports* GetParentObject() const { return mParent; }
39
  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
40
41
  static already_AddRefed<DOMQuad>
42
  Constructor(const GlobalObject& aGlobal,
43
              const DOMPointInit& aP1,
44
              const DOMPointInit& aP2,
45
              const DOMPointInit& aP3,
46
              const DOMPointInit& aP4,
47
              ErrorResult& aRV);
48
  static already_AddRefed<DOMQuad>
49
  Constructor(const GlobalObject& aGlobal, const DOMRectReadOnly& aRect,
50
              ErrorResult& aRV);
51
52
  DOMRectReadOnly* Bounds();
53
  already_AddRefed<DOMRectReadOnly> GetBounds() const;
54
0
  DOMPoint* P1() const { return mPoints[0]; }
55
0
  DOMPoint* P2() const { return mPoints[1]; }
56
0
  DOMPoint* P3() const { return mPoints[2]; }
57
0
  DOMPoint* P4() const { return mPoints[3]; }
58
59
0
  DOMPoint* Point(uint32_t aIndex) const { return mPoints[aIndex]; }
60
61
  void ToJSON(DOMQuadJSON& aInit);
62
63
protected:
64
  void GetHorizontalMinMax(double* aX1, double* aX2) const;
65
  void GetVerticalMinMax(double* aY1, double* aY2) const;
66
67
  nsCOMPtr<nsISupports> mParent;
68
  RefPtr<DOMPoint> mPoints[4];
69
  RefPtr<DOMRectReadOnly> mBounds;
70
};
71
72
} // namespace dom
73
} // namespace mozilla
74
75
#endif /*MOZILLA_DOMRECT_H_*/