зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset ad43d22e453c (bug 1847529) for causing reftest failures. CLOSED TREE
This commit is contained in:
Родитель
e8ae881ea8
Коммит
f6b7599a3d
|
@ -173,17 +173,17 @@ class FontList {
|
|||
|
||||
uint32_t NumFamilies() { return GetHeader().mFamilyCount; }
|
||||
Family* Families() {
|
||||
return GetHeader().mFamilies.ToArray<Family>(this, NumFamilies());
|
||||
return static_cast<Family*>(GetHeader().mFamilies.ToPtr(this));
|
||||
}
|
||||
|
||||
uint32_t NumAliases() { return GetHeader().mAliasCount; }
|
||||
Family* AliasFamilies() {
|
||||
return GetHeader().mAliases.ToArray<Family>(this, NumAliases());
|
||||
return static_cast<Family*>(GetHeader().mAliases.ToPtr(this));
|
||||
}
|
||||
|
||||
uint32_t NumLocalFaces() { return GetHeader().mLocalFaceCount; }
|
||||
LocalFaceRec* LocalFaces() {
|
||||
return GetHeader().mLocalFaces.ToArray<LocalFaceRec>(this, NumLocalFaces());
|
||||
return static_cast<LocalFaceRec*>(GetHeader().mLocalFaces.ToPtr(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,7 +336,7 @@ class FontList {
|
|||
Header& GetHeader() {
|
||||
// It's invalid to try and access this before the first block exists.
|
||||
MOZ_ASSERT(mBlocks.Length() > 0);
|
||||
return *static_cast<Header*>(mBlocks[0]->Memory());
|
||||
return *static_cast<Header*>(Pointer(0, 0).ToPtr(this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,8 +39,7 @@ static double WSSDistance(const Face* aFace, const gfxFontStyle& aStyle) {
|
|||
weightDist * kWeightFactor;
|
||||
}
|
||||
|
||||
void* Pointer::ToPtr(FontList* aFontList,
|
||||
size_t aSize) const MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
void* Pointer::ToPtr(FontList* aFontList) const MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
if (IsNull()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -56,13 +55,13 @@ void* Pointer::ToPtr(FontList* aFontList,
|
|||
// On failure, we'll return null; callers need to handle this appropriately
|
||||
// (e.g. via fallback).
|
||||
void* result = nullptr;
|
||||
uint32_t blockIndex = Block();
|
||||
uint32_t block = Block();
|
||||
|
||||
// If the Pointer refers to a block we have not yet mapped in this process,
|
||||
// we first need to retrieve new block handle(s) from the parent and update
|
||||
// our mBlocks list.
|
||||
auto& blocks = aFontList->mBlocks;
|
||||
if (blockIndex >= blocks.Length()) {
|
||||
if (block >= blocks.Length()) {
|
||||
if (XRE_IsParentProcess()) {
|
||||
// Shouldn't happen! A content process tried to pass a bad Pointer?
|
||||
goto cleanup;
|
||||
|
@ -78,25 +77,18 @@ void* Pointer::ToPtr(FontList* aFontList,
|
|||
if (!isMainThread || !aFontList->UpdateShmBlocks()) {
|
||||
goto cleanup;
|
||||
}
|
||||
MOZ_ASSERT(blockIndex < blocks.Length(), "failure in UpdateShmBlocks?");
|
||||
MOZ_ASSERT(block < blocks.Length(), "failure in UpdateShmBlocks?");
|
||||
// This is wallpapering bug 1667977; it's unclear if we will always survive
|
||||
// this, as the content process may be unable to shape/render text if all
|
||||
// font lookups are failing.
|
||||
// In at least some cases, however, this can occur transiently while the
|
||||
// font list is being rebuilt by the parent; content will then be notified
|
||||
// that the list has changed, and should refresh everything successfully.
|
||||
if (blockIndex >= blocks.Length()) {
|
||||
if (block >= blocks.Length()) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Don't create a pointer that's outside what the block has allocated!
|
||||
const auto& block = blocks[blockIndex];
|
||||
if (Offset() + aSize <= block->Allocated()) {
|
||||
result = static_cast<char*>(block->Memory()) + Offset();
|
||||
}
|
||||
}
|
||||
result = static_cast<char*>(blocks[block]->Memory()) + Offset();
|
||||
|
||||
cleanup:
|
||||
if (!isMainThread) {
|
||||
|
@ -112,7 +104,7 @@ void String::Assign(const nsACString& aString, FontList* aList) {
|
|||
MOZ_ASSERT(mPointer.IsNull());
|
||||
mLength = aString.Length();
|
||||
mPointer = aList->Alloc(mLength + 1);
|
||||
auto* p = mPointer.ToArray<char>(aList, mLength);
|
||||
char* p = static_cast<char*>(mPointer.ToPtr(aList));
|
||||
std::memcpy(p, aString.BeginReading(), mLength);
|
||||
p[mLength] = '\0';
|
||||
}
|
||||
|
@ -224,14 +216,14 @@ void Family::AddFaces(FontList* aList, const nsTArray<Face::InitData>& aFaces) {
|
|||
// Allocate space for the face records, and initialize them.
|
||||
// coverity[suspicious_sizeof]
|
||||
Pointer p = aList->Alloc(count * sizeof(Pointer));
|
||||
auto* facePtrs = p.ToArray<Pointer>(aList, count);
|
||||
auto facePtrs = static_cast<Pointer*>(p.ToPtr(aList));
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (isSimple && !slots[i]) {
|
||||
facePtrs[i] = Pointer::Null();
|
||||
} else {
|
||||
const auto* initData = isSimple ? slots[i] : &aFaces[i];
|
||||
Pointer fp = aList->Alloc(sizeof(Face));
|
||||
auto* face = fp.ToPtr<Face>(aList);
|
||||
auto* face = static_cast<Face*>(fp.ToPtr(aList));
|
||||
(void)new (face) Face(aList, *initData);
|
||||
facePtrs[i] = fp;
|
||||
if (initData->mCharMap) {
|
||||
|
@ -281,7 +273,7 @@ bool Family::FindAllFacesForStyleInternal(FontList* aList,
|
|||
// whether the size is acceptable.)
|
||||
if (NumFaces() == 1) {
|
||||
MOZ_ASSERT(!facePtrs[0].IsNull());
|
||||
auto* face = facePtrs[0].ToPtr<Face>(aList);
|
||||
Face* face = static_cast<Face*>(facePtrs[0].ToPtr(aList));
|
||||
if (face && face->HasValidDescriptor()) {
|
||||
aFaceList.AppendElement(face);
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
|
@ -312,7 +304,7 @@ bool Family::FindAllFacesForStyleInternal(FontList* aList,
|
|||
(wantItalic ? kItalicMask : 0) | (wantBold ? kBoldMask : 0);
|
||||
|
||||
// If the desired style is available, use it directly.
|
||||
auto* face = facePtrs[faceIndex].ToPtr<Face>(aList);
|
||||
Face* face = static_cast<Face*>(facePtrs[faceIndex].ToPtr(aList));
|
||||
if (face && face->HasValidDescriptor()) {
|
||||
aFaceList.AppendElement(face);
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
|
@ -337,7 +329,7 @@ bool Family::FindAllFacesForStyleInternal(FontList* aList,
|
|||
for (uint8_t trial = 0; trial < 3; ++trial) {
|
||||
// check remaining faces in order of preference to find the first that
|
||||
// actually exists
|
||||
face = facePtrs[order[trial]].ToPtr<Face>(aList);
|
||||
face = static_cast<Face*>(facePtrs[order[trial]].ToPtr(aList));
|
||||
if (face && face->HasValidDescriptor()) {
|
||||
aFaceList.AppendElement(face);
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
|
@ -372,7 +364,7 @@ bool Family::FindAllFacesForStyleInternal(FontList* aList,
|
|||
// the selected set.
|
||||
bool anyNonScalable = false;
|
||||
for (uint32_t i = 0; i < NumFaces(); i++) {
|
||||
auto* face = facePtrs[i].ToPtr<Face>(aList);
|
||||
Face* face = static_cast<Face*>(facePtrs[i].ToPtr(aList));
|
||||
if (face) {
|
||||
// weight/style/stretch priority: stretch >> style >> weight
|
||||
double distance = WSSDistance(face, aStyle);
|
||||
|
@ -473,7 +465,8 @@ Face* Family::FindFaceForStyle(FontList* aList, const gfxFontStyle& aStyle,
|
|||
|
||||
void Family::SearchAllFontsForChar(FontList* aList,
|
||||
GlobalFontMatch* aMatchData) {
|
||||
auto* charmap = mCharacterMap.ToPtr<const SharedBitSet>(aList);
|
||||
const SharedBitSet* charmap =
|
||||
static_cast<const SharedBitSet*>(mCharacterMap.ToPtr(aList));
|
||||
if (!charmap) {
|
||||
// If the face list is not yet initialized, or if character maps have
|
||||
// not been loaded, go ahead and do this now (by sending a message to the
|
||||
|
@ -485,7 +478,7 @@ void Family::SearchAllFontsForChar(FontList* aList,
|
|||
true)) {
|
||||
return;
|
||||
}
|
||||
charmap = mCharacterMap.ToPtr<const SharedBitSet>(aList);
|
||||
charmap = static_cast<const SharedBitSet*>(mCharacterMap.ToPtr(aList));
|
||||
}
|
||||
if (charmap && !charmap->test(aMatchData->mCh)) {
|
||||
return;
|
||||
|
@ -498,13 +491,14 @@ void Family::SearchAllFontsForChar(FontList* aList,
|
|||
return;
|
||||
}
|
||||
for (uint32_t i = 0; i < numFaces; i++) {
|
||||
auto* face = facePtrs[i].ToPtr<Face>(aList);
|
||||
Face* face = static_cast<Face*>(facePtrs[i].ToPtr(aList));
|
||||
if (!face) {
|
||||
continue;
|
||||
}
|
||||
MOZ_ASSERT(face->HasValidDescriptor());
|
||||
// Get the face's character map, if available (may be null!)
|
||||
charmap = face->mCharacterMap.ToPtr<const SharedBitSet>(aList);
|
||||
charmap =
|
||||
static_cast<const SharedBitSet*>(face->mCharacterMap.ToPtr(aList));
|
||||
if (charmap) {
|
||||
++charMapsLoaded;
|
||||
}
|
||||
|
@ -562,7 +556,7 @@ void Family::SetFacePtrs(FontList* aList, nsTArray<Pointer>& aFaces) {
|
|||
Pointer slots[4] = {Pointer::Null(), Pointer::Null(), Pointer::Null(),
|
||||
Pointer::Null()};
|
||||
for (const Pointer& fp : aFaces) {
|
||||
auto* f = fp.ToPtr<const Face>(aList);
|
||||
const Face* f = static_cast<const Face*>(fp.ToPtr(aList));
|
||||
if (!f->mWeight.IsSingle() || !f->mStyle.IsSingle() ||
|
||||
!f->mStretch.IsSingle()) {
|
||||
isSimple = false;
|
||||
|
@ -588,7 +582,7 @@ void Family::SetFacePtrs(FontList* aList, nsTArray<Pointer>& aFaces) {
|
|||
if (isSimple) {
|
||||
size_t size = 4 * sizeof(Pointer);
|
||||
mFaces = aList->Alloc(size);
|
||||
memcpy(mFaces.ToPtr(aList, size), slots, size);
|
||||
memcpy(mFaces.ToPtr(aList), slots, size);
|
||||
mFaceCount.store(4);
|
||||
mIsSimple = true;
|
||||
return;
|
||||
|
@ -596,7 +590,7 @@ void Family::SetFacePtrs(FontList* aList, nsTArray<Pointer>& aFaces) {
|
|||
}
|
||||
size_t size = aFaces.Length() * sizeof(Pointer);
|
||||
mFaces = aList->Alloc(size);
|
||||
memcpy(mFaces.ToPtr(aList, size), aFaces.Elements(), size);
|
||||
memcpy(mFaces.ToPtr(aList), aFaces.Elements(), size);
|
||||
mFaceCount.store(aFaces.Length());
|
||||
}
|
||||
|
||||
|
@ -623,18 +617,18 @@ void Family::SetupFamilyCharMap(FontList* aList) {
|
|||
}
|
||||
gfxSparseBitSet familyMap;
|
||||
Pointer firstMapShmPointer;
|
||||
const SharedBitSet* firstMap = nullptr;
|
||||
SharedBitSet* firstMap = nullptr;
|
||||
bool merged = false;
|
||||
Pointer* faces = Faces(aList);
|
||||
if (!faces) {
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < NumFaces(); i++) {
|
||||
auto* f = faces[i].ToPtr<const Face>(aList);
|
||||
auto f = static_cast<Face*>(faces[i].ToPtr(aList));
|
||||
if (!f) {
|
||||
continue; // Skip missing face (in an incomplete "simple" family)
|
||||
}
|
||||
auto* faceMap = f->mCharacterMap.ToPtr<const SharedBitSet>(aList);
|
||||
auto faceMap = static_cast<SharedBitSet*>(f->mCharacterMap.ToPtr(aList));
|
||||
if (!faceMap) {
|
||||
continue; // If there's a face where setting up the cmap failed, we skip
|
||||
// it as unusable.
|
||||
|
@ -959,9 +953,7 @@ void FontList::SetFamilyNames(nsTArray<Family::InitData>& aFamilies) {
|
|||
return;
|
||||
}
|
||||
|
||||
// We can't call Families() here because the mFamilyCount field has not yet
|
||||
// been set!
|
||||
auto* families = header.mFamilies.ToArray<Family>(this, count);
|
||||
Family* families = static_cast<Family*>(header.mFamilies.ToPtr(this));
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
(void)new (&families[i]) Family(this, aFamilies[i]);
|
||||
LOG_FONTLIST(("(shared-fontlist) family %u (%s)", (unsigned)i,
|
||||
|
@ -996,7 +988,7 @@ void FontList::SetAliases(
|
|||
return;
|
||||
}
|
||||
fontlist::Pointer ptr = Alloc(count * sizeof(Family));
|
||||
auto* aliases = ptr.ToArray<Family>(this, count);
|
||||
Family* aliases = static_cast<Family*>(ptr.ToPtr(this));
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
(void)new (&aliases[i]) Family(this, aliasArray[i]);
|
||||
LOG_FONTLIST(("(shared-fontlist) alias family %u (%s: %s)", (unsigned)i,
|
||||
|
@ -1005,7 +997,7 @@ void FontList::SetAliases(
|
|||
if (LOG_FONTLIST_ENABLED()) {
|
||||
const auto& faces = aAliasTable.Get(aliasArray[i].mKey)->mFaces;
|
||||
for (unsigned j = 0; j < faces.Length(); j++) {
|
||||
auto* face = faces[j].ToPtr<const Face>(this);
|
||||
auto face = static_cast<const fontlist::Face*>(faces[j].ToPtr(this));
|
||||
const nsCString& desc = face->mDescriptor.AsString(this);
|
||||
nsAutoCString weight, style, stretch;
|
||||
face->mWeight.ToString(weight);
|
||||
|
@ -1038,7 +1030,7 @@ void FontList::SetLocalNames(
|
|||
size_t count = faceArray.Length();
|
||||
Family* families = Families();
|
||||
fontlist::Pointer ptr = Alloc(count * sizeof(LocalFaceRec));
|
||||
auto* faces = ptr.ToArray<LocalFaceRec>(this, count);
|
||||
LocalFaceRec* faces = static_cast<LocalFaceRec*>(ptr.ToPtr(this));
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
(void)new (&faces[i]) LocalFaceRec();
|
||||
const auto& rec = aLocalNameTable.Get(faceArray[i]);
|
||||
|
@ -1059,7 +1051,7 @@ void FontList::SetLocalNames(
|
|||
static_cast<const Pointer*>(family->Faces(this));
|
||||
for (uint32_t j = 0; j < family->NumFaces(); j++) {
|
||||
if (!faceList[j].IsNull()) {
|
||||
auto* f = faceList[j].ToPtr<const Face>(this);
|
||||
const Face* f = static_cast<const Face*>(faceList[j].ToPtr(this));
|
||||
if (f && rec.mFaceDescriptor == f->mDescriptor.AsString(this)) {
|
||||
faces[i].mFaceIndex = j;
|
||||
break;
|
||||
|
@ -1116,7 +1108,7 @@ Family* FontList::FindFamily(const nsCString& aName, bool aPrimaryNameOnly) {
|
|||
const nsCString& mTarget;
|
||||
};
|
||||
|
||||
const Header& header = GetHeader();
|
||||
Header& header = GetHeader();
|
||||
|
||||
Family* families = Families();
|
||||
if (!families) {
|
||||
|
@ -1268,7 +1260,7 @@ void FontList::SearchForLocalFace(const nsACString& aName, Family** aFamily,
|
|||
continue;
|
||||
}
|
||||
for (uint32_t j = 0; j < family->NumFaces(); j++) {
|
||||
auto* face = faces[j].ToPtr<Face>(this);
|
||||
Face* face = static_cast<Face*>(faces[j].ToPtr(this));
|
||||
if (!face) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -70,23 +70,11 @@ struct Pointer {
|
|||
* FontList, which will know where the shared memory block is mapped in
|
||||
* the current process's address space.
|
||||
*
|
||||
* aSize is the expected size of the pointed-to object, for bounds checking.
|
||||
*
|
||||
* NOTE!
|
||||
* In child processes this may fail and return nullptr, even if IsNull() is
|
||||
* false, in cases where the font list is in the process of being rebuilt.
|
||||
*/
|
||||
void* ToPtr(FontList* aFontList, size_t aSize) const;
|
||||
|
||||
template <typename T>
|
||||
T* ToPtr(FontList* aFontList) const {
|
||||
return static_cast<T*>(ToPtr(aFontList, sizeof(T)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* ToArray(FontList* aFontList, size_t aCount) const {
|
||||
return static_cast<T*>(ToPtr(aFontList, sizeof(T) * aCount));
|
||||
}
|
||||
void* ToPtr(FontList* aFontList) const;
|
||||
|
||||
Pointer& operator=(const Pointer& aOther) {
|
||||
mBlockAndOffset.store(aOther.mBlockAndOffset);
|
||||
|
@ -123,14 +111,14 @@ struct String {
|
|||
// allocate or copy. But that's unsafe because in the event of font-list
|
||||
// reinitalization, that shared memory will be unmapped; then any copy of
|
||||
// the nsCString that may still be around will crash if accessed.
|
||||
return nsCString(mPointer.ToArray<const char>(aList, mLength), mLength);
|
||||
return nsCString(static_cast<const char*>(mPointer.ToPtr(aList)), mLength);
|
||||
}
|
||||
|
||||
void Assign(const nsACString& aString, FontList* aList);
|
||||
|
||||
const char* BeginReading(FontList* aList) const {
|
||||
MOZ_ASSERT(!mPointer.IsNull());
|
||||
auto* str = mPointer.ToArray<const char>(aList, mLength);
|
||||
auto str = static_cast<const char*>(mPointer.ToPtr(aList));
|
||||
return str ? str : "";
|
||||
}
|
||||
|
||||
|
@ -296,7 +284,7 @@ struct Family {
|
|||
|
||||
Pointer* Faces(FontList* aList) const {
|
||||
MOZ_ASSERT(IsInitialized());
|
||||
return mFaces.ToArray<Pointer>(aList, mFaceCount);
|
||||
return static_cast<Pointer*>(mFaces.ToPtr(aList));
|
||||
}
|
||||
|
||||
FontVisibility Visibility() const { return mVisibility; }
|
||||
|
|
|
@ -1356,9 +1356,8 @@ void gfxDWriteFontList::GetFacesInitDataForFamily(
|
|||
}
|
||||
}
|
||||
|
||||
bool gfxDWriteFontList::ReadFaceNames(const fontlist::Family* aFamily,
|
||||
const fontlist::Face* aFace,
|
||||
nsCString& aPSName,
|
||||
bool gfxDWriteFontList::ReadFaceNames(fontlist::Family* aFamily,
|
||||
fontlist::Face* aFace, nsCString& aPSName,
|
||||
nsCString& aFullName) {
|
||||
IDWriteFontCollection* collection =
|
||||
#ifdef MOZ_BUNDLED_FONTS
|
||||
|
@ -1463,7 +1462,7 @@ void gfxDWriteFontList::ReadFaceNamesForFamily(
|
|||
// Read PS-names and fullnames of the faces, and any alternate family names
|
||||
// (either localizations or legacy subfamily names)
|
||||
for (unsigned i = 0; i < aFamily->NumFaces(); ++i) {
|
||||
auto* face = facePtrs[i].ToPtr<fontlist::Face>(list);
|
||||
auto face = static_cast<fontlist::Face*>(facePtrs[i].ToPtr(list));
|
||||
if (!face) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -392,8 +392,8 @@ class gfxDWriteFontList final : public gfxPlatformFontList {
|
|||
bool aNeedFullnamePostscriptNames)
|
||||
MOZ_REQUIRES(mLock) override;
|
||||
|
||||
bool ReadFaceNames(const mozilla::fontlist::Family* aFamily,
|
||||
const mozilla::fontlist::Face* aFace, nsCString& aPSName,
|
||||
bool ReadFaceNames(mozilla::fontlist::Family* aFamily,
|
||||
mozilla::fontlist::Face* aFace, nsCString& aPSName,
|
||||
nsCString& aFullName) override;
|
||||
|
||||
void GetFacesInitDataForFamily(
|
||||
|
|
|
@ -157,7 +157,8 @@ void gfxFontEntry::InitializeFrom(fontlist::Face* aFace,
|
|||
bool gfxFontEntry::TrySetShmemCharacterMap() {
|
||||
MOZ_ASSERT(mShmemFace);
|
||||
auto list = gfxPlatformFontList::PlatformFontList()->SharedFontList();
|
||||
auto* shmemCmap = mShmemFace->mCharacterMap.ToPtr<const SharedBitSet>(list);
|
||||
const auto* shmemCmap =
|
||||
static_cast<const SharedBitSet*>(mShmemFace->mCharacterMap.ToPtr(list));
|
||||
mShmemCharacterMap.exchange(shmemCmap);
|
||||
return shmemCmap != nullptr;
|
||||
}
|
||||
|
|
|
@ -1402,7 +1402,7 @@ void gfxMacPlatformFontList::InitAliasesForSingleFaceList() {
|
|||
if (facePtrs[i].IsNull()) {
|
||||
continue;
|
||||
}
|
||||
auto* face = facePtrs[i].ToPtr<const fontlist::Face>(list);
|
||||
auto face = static_cast<const fontlist::Face*>(facePtrs[i].ToPtr(list));
|
||||
if (face->mDescriptor.AsString(list).Equals(aliasName)) {
|
||||
// Found it! Create an entry in the Alias table.
|
||||
GenerateFontListKey(aliasName, key);
|
||||
|
@ -2187,9 +2187,9 @@ void gfxMacPlatformFontList::ReadFaceNamesForFamily(fontlist::Family* aFamily,
|
|||
const uint32_t kNAME = TRUETYPE_TAG('n', 'a', 'm', 'e');
|
||||
fontlist::FontList* list = SharedFontList();
|
||||
nsAutoCString canonicalName(aFamily->DisplayName().AsString(list));
|
||||
const auto* facePtrs = aFamily->Faces(list);
|
||||
const fontlist::Pointer* facePtrs = aFamily->Faces(list);
|
||||
for (uint32_t i = 0, n = aFamily->NumFaces(); i < n; i++) {
|
||||
auto* face = facePtrs[i].ToPtr<const fontlist::Face>(list);
|
||||
auto face = static_cast<fontlist::Face*>(facePtrs[i].ToPtr(list));
|
||||
if (!face) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -860,7 +860,8 @@ gfxFontEntry* gfxPlatformFontList::LookupInSharedFaceNameList(
|
|||
auto* families = list->Families();
|
||||
if (families) {
|
||||
family = &families[rec->mFamilyIndex];
|
||||
face = family->Faces(list)[rec->mFaceIndex].ToPtr<fontlist::Face>(list);
|
||||
face = static_cast<fontlist::Face*>(
|
||||
family->Faces(list)[rec->mFaceIndex].ToPtr(list));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1743,7 +1744,7 @@ bool gfxPlatformFontList::InitializeFamily(fontlist::Family* aFamily,
|
|||
auto* faces = aFamily->Faces(list);
|
||||
if (faces) {
|
||||
for (size_t i = 0; i < aFamily->NumFaces(); i++) {
|
||||
auto* face = faces[i].ToPtr<fontlist::Face>(list);
|
||||
auto* face = static_cast<fontlist::Face*>(faces[i].ToPtr(list));
|
||||
if (face && face->mCharacterMap.IsNull()) {
|
||||
// We don't want to cache this font entry, as the parent will most
|
||||
// likely never use it again; it's just to populate the charmap for
|
||||
|
@ -1887,7 +1888,7 @@ ShmemCharMapHashEntry::ShmemCharMapHashEntry(const gfxSparseBitSet* aCharMap)
|
|||
mHash(aCharMap->GetChecksum()) {
|
||||
size_t len = SharedBitSet::RequiredSize(*aCharMap);
|
||||
mCharMap = mList->Alloc(len);
|
||||
SharedBitSet::Create(mCharMap.ToPtr(mList, len), len, *aCharMap);
|
||||
SharedBitSet::Create(mCharMap.ToPtr(mList), len, *aCharMap);
|
||||
}
|
||||
|
||||
fontlist::Pointer gfxPlatformFontList::GetShmemCharMapLocked(
|
||||
|
@ -2981,7 +2982,7 @@ void gfxPlatformFontList::SetCharacterMap(uint32_t aGeneration,
|
|||
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
|
||||
return;
|
||||
}
|
||||
auto* face = aFacePtr.ToPtr<fontlist::Face>(list);
|
||||
fontlist::Face* face = static_cast<fontlist::Face*>(aFacePtr.ToPtr(list));
|
||||
if (face) {
|
||||
face->mCharacterMap = GetShmemCharMap(&aMap);
|
||||
}
|
||||
|
@ -3009,7 +3010,7 @@ void gfxPlatformFontList::SetupFamilyCharMap(
|
|||
// should have hit the MOZ_DIAGNOSTIC_ASSERT in FontList::ToSharedPointer
|
||||
// rather than passing a null or bad pointer to the parent.)
|
||||
|
||||
auto* family = aFamilyPtr.ToPtr<fontlist::Family>(list);
|
||||
auto* family = static_cast<fontlist::Family*>(aFamilyPtr.ToPtr(list));
|
||||
if (!family) {
|
||||
// Unable to resolve to a native pointer (or it was null).
|
||||
NS_WARNING("unexpected null Family pointer");
|
||||
|
|
|
@ -112,7 +112,8 @@ class ShmemCharMapHashEntry final : public PLDHashEntryHdr {
|
|||
return false;
|
||||
}
|
||||
|
||||
return mCharMap.ToPtr<const SharedBitSet>(mList)->Equals(aCharMap);
|
||||
return static_cast<const SharedBitSet*>(mCharMap.ToPtr(mList))
|
||||
->Equals(aCharMap);
|
||||
}
|
||||
|
||||
static KeyTypePointer KeyToPointer(KeyType aCharMap) { return aCharMap; }
|
||||
|
@ -411,9 +412,9 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
* Read PSName and FullName of the given face, for src:local lookup,
|
||||
* returning true if actually implemented and succeeded.
|
||||
*/
|
||||
virtual bool ReadFaceNames(const mozilla::fontlist::Family* aFamily,
|
||||
const mozilla::fontlist::Face* aFace,
|
||||
nsCString& aPSName, nsCString& aFullName) {
|
||||
virtual bool ReadFaceNames(mozilla::fontlist::Family* aFamily,
|
||||
mozilla::fontlist::Face* aFace, nsCString& aPSName,
|
||||
nsCString& aFullName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1042,7 +1043,7 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
|
|||
nsTHashMap<nsCStringHashKey, mozilla::fontlist::LocalFaceRec::InitData>
|
||||
mLocalNameTable;
|
||||
|
||||
nsRefPtrHashtable<nsPtrHashKey<const mozilla::fontlist::Face>, gfxFontEntry>
|
||||
nsRefPtrHashtable<nsPtrHashKey<mozilla::fontlist::Face>, gfxFontEntry>
|
||||
mFontEntries MOZ_GUARDED_BY(mLock);
|
||||
|
||||
mozilla::UniquePtr<FontPrefs> mFontPrefs;
|
||||
|
|
|
@ -1993,7 +1993,7 @@ void gfxFontGroup::AddFamilyToFontList(fontlist::Family* aFamily,
|
|||
}
|
||||
AutoTArray<fontlist::Face*, 4> faceList;
|
||||
aFamily->FindAllFacesForStyle(pfl->SharedFontList(), mStyle, faceList);
|
||||
for (auto* face : faceList) {
|
||||
for (auto face : faceList) {
|
||||
gfxFontEntry* fe = pfl->GetOrCreateFontEntry(face, aFamily);
|
||||
if (fe && !HasFont(fe)) {
|
||||
FamilyFace ff(aFamily, fe, aGeneric);
|
||||
|
|
Загрузка…
Ссылка в новой задаче