Bug 1929968 - Ensure the search unit tests use add_setup correctly. r=search-reviewer...
[gecko.git] / layout / inspector / InspectorFontFace.h
blob2356ec7b9a59de0ad0bea7999153c478fa2d65c3
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
10 #include "gfxTypes.h"
11 #include "mozilla/dom/CSSFontFaceRule.h"
12 #include "mozilla/dom/InspectorUtilsBinding.h"
13 #include "mozilla/dom/NonRefcountedDOMObject.h"
14 #include "nsRange.h"
16 class gfxFontEntry;
17 class gfxFontGroup;
19 namespace mozilla::dom {
21 /**
22 * Information on font face usage by a given DOM Range, as returned by
23 * InspectorUtils.getUsedFontFaces.
25 class InspectorFontFace final : public NonRefcountedDOMObject {
26 public:
27 InspectorFontFace(gfxFontEntry* aFontEntry, gfxFontGroup* aFontGroup,
28 FontMatchType aMatchType);
30 ~InspectorFontFace();
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(); }
38 // Web IDL
39 bool FromFontGroup();
40 bool FromLanguagePrefs();
41 bool FromSystemFallback();
42 void GetName(nsAString& aName);
43 void GetCSSFamilyName(nsAString& aCSSFamilyName);
44 void GetCSSGeneric(nsAString& aGeneric);
45 CSSFontFaceRule* GetRule();
46 int32_t SrcIndex();
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,
53 ErrorResult& aRV);
54 void GetVariationInstances(nsTArray<InspectorVariationInstance>& aResult,
55 ErrorResult& aRV);
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);
65 protected:
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