2018-01-11 04:38:01 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_InspectorFontFace_h
|
|
|
|
#define mozilla_InspectorFontFace_h
|
|
|
|
|
2020-02-05 09:12:23 +00:00
|
|
|
#include "gfxTypes.h"
|
2018-06-04 23:55:11 +00:00
|
|
|
#include "mozilla/dom/CSSFontFaceRule.h"
|
2018-01-11 04:38:01 +00:00
|
|
|
#include "mozilla/dom/InspectorUtilsBinding.h"
|
|
|
|
#include "mozilla/dom/NonRefcountedDOMObject.h"
|
2018-02-15 18:48:22 +00:00
|
|
|
#include "nsRange.h"
|
2018-01-11 04:38:01 +00:00
|
|
|
|
2019-04-01 14:32:06 +00:00
|
|
|
class gfxFontEntry;
|
2018-01-11 04:38:01 +00:00
|
|
|
class gfxFontGroup;
|
|
|
|
|
2022-05-09 20:41:21 +00:00
|
|
|
namespace mozilla::dom {
|
2018-01-11 04:38:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Information on font face usage by a given DOM Range, as returned by
|
|
|
|
* InspectorUtils.getUsedFontFaces.
|
|
|
|
*/
|
|
|
|
class InspectorFontFace final : public NonRefcountedDOMObject {
|
|
|
|
public:
|
|
|
|
InspectorFontFace(gfxFontEntry* aFontEntry, gfxFontGroup* aFontGroup,
|
2019-04-01 14:32:06 +00:00
|
|
|
FontMatchType aMatchType);
|
2018-01-11 04:38:01 +00:00
|
|
|
|
2019-04-01 14:32:06 +00:00
|
|
|
~InspectorFontFace();
|
2018-01-11 04:38:01 +00:00
|
|
|
|
|
|
|
gfxFontEntry* GetFontEntry() const { return mFontEntry; }
|
2019-04-01 14:32:06 +00:00
|
|
|
void AddMatchType(FontMatchType aMatchType) { mMatchType |= aMatchType; }
|
2018-01-11 04:38:01 +00:00
|
|
|
|
2018-02-15 18:48:22 +00:00
|
|
|
void AddRange(nsRange* aRange);
|
|
|
|
size_t RangeCount() const { return mRanges.Length(); }
|
|
|
|
|
2018-01-11 04:38:01 +00:00
|
|
|
// Web IDL
|
|
|
|
bool FromFontGroup();
|
|
|
|
bool FromLanguagePrefs();
|
|
|
|
bool FromSystemFallback();
|
|
|
|
void GetName(nsAString& aName);
|
|
|
|
void GetCSSFamilyName(nsAString& aCSSFamilyName);
|
2018-05-25 13:07:57 +00:00
|
|
|
void GetCSSGeneric(nsAString& aGeneric);
|
2018-06-04 23:55:11 +00:00
|
|
|
CSSFontFaceRule* GetRule();
|
2018-01-11 04:38:01 +00:00
|
|
|
int32_t SrcIndex();
|
|
|
|
void GetURI(nsAString& aURI);
|
|
|
|
void GetLocalName(nsAString& aLocalName);
|
|
|
|
void GetFormat(nsAString& aFormat);
|
|
|
|
void GetMetadata(nsAString& aMetadata);
|
|
|
|
|
2018-01-29 13:24:11 +00:00
|
|
|
void GetVariationAxes(nsTArray<InspectorVariationAxis>& aResult,
|
|
|
|
ErrorResult& aRV);
|
|
|
|
void GetVariationInstances(nsTArray<InspectorVariationInstance>& aResult,
|
|
|
|
ErrorResult& aRV);
|
2018-01-30 09:57:39 +00:00
|
|
|
void GetFeatures(nsTArray<InspectorFontFeature>& aResult, ErrorResult& aRV);
|
2018-01-26 15:47:20 +00:00
|
|
|
|
2018-02-15 18:48:22 +00:00
|
|
|
void GetRanges(nsTArray<RefPtr<nsRange>>& aResult);
|
|
|
|
|
2018-01-11 04:38:01 +00:00
|
|
|
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
|
|
|
|
JS::MutableHandle<JSObject*> aReflector) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return InspectorFontFace_Binding::Wrap(aCx, this, aGivenProto, aReflector);
|
2018-01-11 04:38:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
RefPtr<gfxFontEntry> mFontEntry;
|
|
|
|
RefPtr<gfxFontGroup> mFontGroup;
|
2018-06-04 23:55:11 +00:00
|
|
|
RefPtr<CSSFontFaceRule> mRule;
|
2019-04-01 14:32:06 +00:00
|
|
|
FontMatchType mMatchType;
|
2018-02-15 18:48:22 +00:00
|
|
|
|
|
|
|
nsTArray<RefPtr<nsRange>> mRanges;
|
2018-01-11 04:38:01 +00:00
|
|
|
};
|
|
|
|
|
2022-05-09 20:41:21 +00:00
|
|
|
} // namespace mozilla::dom
|
2018-01-11 04:38:01 +00:00
|
|
|
|
|
|
|
#endif // mozilla_InspectorFontFace_h
|