2018-01-11 07:38:01 +03: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
|
|
|
|
|
2018-06-05 02:55:11 +03:00
|
|
|
#include "mozilla/dom/CSSFontFaceRule.h"
|
2018-01-11 07:38:01 +03:00
|
|
|
#include "mozilla/dom/InspectorUtilsBinding.h"
|
|
|
|
#include "mozilla/dom/NonRefcountedDOMObject.h"
|
2018-02-15 21:48:22 +03:00
|
|
|
#include "nsRange.h"
|
2018-01-11 07:38:01 +03:00
|
|
|
|
2019-04-01 17:32:06 +03:00
|
|
|
class gfxFontEntry;
|
2018-01-11 07:38:01 +03:00
|
|
|
class gfxFontGroup;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 17:32:06 +03:00
|
|
|
FontMatchType aMatchType);
|
2018-01-11 07:38:01 +03:00
|
|
|
|
2019-04-01 17:32:06 +03:00
|
|
|
~InspectorFontFace();
|
2018-01-11 07:38:01 +03:00
|
|
|
|
|
|
|
gfxFontEntry* GetFontEntry() const { return mFontEntry; }
|
2019-04-01 17:32:06 +03:00
|
|
|
void AddMatchType(FontMatchType aMatchType) { mMatchType |= aMatchType; }
|
2018-01-11 07:38:01 +03:00
|
|
|
|
2018-02-15 21:48:22 +03:00
|
|
|
void AddRange(nsRange* aRange);
|
|
|
|
size_t RangeCount() const { return mRanges.Length(); }
|
|
|
|
|
2018-01-11 07:38:01 +03:00
|
|
|
// Web IDL
|
|
|
|
bool FromFontGroup();
|
|
|
|
bool FromLanguagePrefs();
|
|
|
|
bool FromSystemFallback();
|
|
|
|
void GetName(nsAString& aName);
|
|
|
|
void GetCSSFamilyName(nsAString& aCSSFamilyName);
|
2018-05-25 16:07:57 +03:00
|
|
|
void GetCSSGeneric(nsAString& aGeneric);
|
2018-06-05 02:55:11 +03:00
|
|
|
CSSFontFaceRule* GetRule();
|
2018-01-11 07:38:01 +03:00
|
|
|
int32_t SrcIndex();
|
|
|
|
void GetURI(nsAString& aURI);
|
|
|
|
void GetLocalName(nsAString& aLocalName);
|
|
|
|
void GetFormat(nsAString& aFormat);
|
|
|
|
void GetMetadata(nsAString& aMetadata);
|
|
|
|
|
2018-01-29 16:24:11 +03:00
|
|
|
void GetVariationAxes(nsTArray<InspectorVariationAxis>& aResult,
|
|
|
|
ErrorResult& aRV);
|
|
|
|
void GetVariationInstances(nsTArray<InspectorVariationInstance>& aResult,
|
|
|
|
ErrorResult& aRV);
|
2018-01-30 12:57:39 +03:00
|
|
|
void GetFeatures(nsTArray<InspectorFontFeature>& aResult, ErrorResult& aRV);
|
2018-01-26 18:47:20 +03:00
|
|
|
|
2018-02-15 21:48:22 +03:00
|
|
|
void GetRanges(nsTArray<RefPtr<nsRange>>& aResult);
|
|
|
|
|
2018-01-11 07:38:01 +03:00
|
|
|
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
|
|
|
|
JS::MutableHandle<JSObject*> aReflector) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return InspectorFontFace_Binding::Wrap(aCx, this, aGivenProto, aReflector);
|
2018-01-11 07:38:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
RefPtr<gfxFontEntry> mFontEntry;
|
|
|
|
RefPtr<gfxFontGroup> mFontGroup;
|
2018-06-05 02:55:11 +03:00
|
|
|
RefPtr<CSSFontFaceRule> mRule;
|
2019-04-01 17:32:06 +03:00
|
|
|
FontMatchType mMatchType;
|
2018-02-15 21:48:22 +03:00
|
|
|
|
|
|
|
nsTArray<RefPtr<nsRange>> mRanges;
|
2018-01-11 07:38:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_InspectorFontFace_h
|