Bug 1610775 [wpt PR 21336] - Update urllib3 to 1.25.8, a=testonly
[gecko.git] / dom / canvas / TextMetrics.h
blobe079695b68fe0d9ff2f33e74f0800507460e3a8b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_TextMetrics_h
7 #define mozilla_dom_TextMetrics_h
9 #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
10 #include "mozilla/dom/NonRefcountedDOMObject.h"
12 namespace mozilla {
13 namespace dom {
15 class TextMetrics final : public NonRefcountedDOMObject {
16 public:
17 explicit TextMetrics(double aWidth, double aActualBoundingBoxLeft,
18 double aActualBoundingBoxRight,
19 double aFontBoundingBoxAscent,
20 double aFontBoundingBoxDescent,
21 double aActualBoundingBoxAscent,
22 double aActualBoundingBoxDescent, double aEmHeightAscent,
23 double aEmHeightDescent, double aHangingBaseline,
24 double aAlphabeticBaseline, double aIdeographicBaseline)
25 : width(aWidth),
26 actualBoundingBoxLeft(aActualBoundingBoxLeft),
27 actualBoundingBoxRight(aActualBoundingBoxRight),
28 fontBoundingBoxAscent(aFontBoundingBoxAscent),
29 fontBoundingBoxDescent(aFontBoundingBoxDescent),
30 actualBoundingBoxAscent(aActualBoundingBoxAscent),
31 actualBoundingBoxDescent(aActualBoundingBoxDescent),
32 emHeightAscent(aEmHeightAscent),
33 emHeightDescent(aEmHeightDescent),
34 hangingBaseline(aHangingBaseline),
35 alphabeticBaseline(aAlphabeticBaseline),
36 ideographicBaseline(aIdeographicBaseline) {
37 MOZ_COUNT_CTOR(TextMetrics);
40 ~TextMetrics() { MOZ_COUNT_DTOR(TextMetrics); }
42 double Width() const { return width; }
44 double ActualBoundingBoxLeft() const { return actualBoundingBoxLeft; }
46 double ActualBoundingBoxRight() const { return actualBoundingBoxRight; }
48 // y-direction
50 double FontBoundingBoxAscent() const { return fontBoundingBoxAscent; }
52 double FontBoundingBoxDescent() const { return fontBoundingBoxDescent; }
54 double ActualBoundingBoxAscent() const { return actualBoundingBoxAscent; }
56 double ActualBoundingBoxDescent() const { return actualBoundingBoxDescent; }
58 double EmHeightAscent() const { return emHeightAscent; }
60 double EmHeightDescent() const { return emHeightDescent; }
62 double HangingBaseline() const { return hangingBaseline; }
64 double AlphabeticBaseline() const { return alphabeticBaseline; }
66 double IdeographicBaseline() const { return ideographicBaseline; }
68 bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
69 JS::MutableHandle<JSObject*> aReflector) {
70 return TextMetrics_Binding::Wrap(aCx, this, aGivenProto, aReflector);
73 private:
74 double width;
75 double actualBoundingBoxLeft;
76 double actualBoundingBoxRight;
77 double fontBoundingBoxAscent;
78 double fontBoundingBoxDescent;
79 double actualBoundingBoxAscent;
80 double actualBoundingBoxDescent;
81 double emHeightAscent;
82 double emHeightDescent;
83 double hangingBaseline;
84 double alphabeticBaseline;
85 double ideographicBaseline;
88 } // namespace dom
89 } // namespace mozilla
91 #endif // mozilla_dom_TextMetrics_h