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/. */
7 #ifndef mozilla_InspectorFontFace_h
8 #define mozilla_InspectorFontFace_h
11 #include "mozilla/dom/CSSFontFaceRule.h"
12 #include "mozilla/dom/InspectorUtilsBinding.h"
13 #include "mozilla/dom/NonRefcountedDOMObject.h"
19 namespace mozilla::dom
{
22 * Information on font face usage by a given DOM Range, as returned by
23 * InspectorUtils.getUsedFontFaces.
25 class InspectorFontFace final
: public NonRefcountedDOMObject
{
27 InspectorFontFace(gfxFontEntry
* aFontEntry
, gfxFontGroup
* aFontGroup
,
28 FontMatchType aMatchType
);
32 gfxFontEntry
* GetFontEntry() const { return mFontEntry
; }
33 void AddMatchType(FontMatchType aMatchType
) { mMatchType
|= aMatchType
; }
35 void AddRange(nsRange
* aRange
);
36 size_t RangeCount() const { return mRanges
.Length(); }
40 bool FromLanguagePrefs();
41 bool FromSystemFallback();
42 void GetName(nsAString
& aName
);
43 void GetCSSFamilyName(nsAString
& aCSSFamilyName
);
44 void GetCSSGeneric(nsAString
& aGeneric
);
45 CSSFontFaceRule
* GetRule();
47 void GetURI(nsAString
& aURI
);
48 void GetLocalName(nsAString
& aLocalName
);
49 void GetFormat(nsAString
& aFormat
);
50 void GetMetadata(nsAString
& aMetadata
);
52 void GetVariationAxes(nsTArray
<InspectorVariationAxis
>& aResult
,
54 void GetVariationInstances(nsTArray
<InspectorVariationInstance
>& aResult
,
56 void GetFeatures(nsTArray
<InspectorFontFeature
>& aResult
, ErrorResult
& aRV
);
58 void GetRanges(nsTArray
<RefPtr
<nsRange
>>& aResult
);
60 bool WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
,
61 JS::MutableHandle
<JSObject
*> aReflector
) {
62 return InspectorFontFace_Binding::Wrap(aCx
, this, aGivenProto
, aReflector
);
66 RefPtr
<gfxFontEntry
> mFontEntry
;
67 RefPtr
<gfxFontGroup
> mFontGroup
;
68 RefPtr
<CSSFontFaceRule
> mRule
;
69 FontMatchType mMatchType
;
71 nsTArray
<RefPtr
<nsRange
>> mRanges
;
74 } // namespace mozilla::dom
76 #endif // mozilla_InspectorFontFace_h