From 541ab0f35c696b5b0d7a74cd033e1d93cdeb7444 Mon Sep 17 00:00:00 2001 From: Nirupam Bhowmick <48842933+heydryft@users.noreply.github.com> Date: Sun, 21 Dec 2025 23:48:32 +0000 Subject: [PATCH] fix: rewrite gfxTextRun constructor for Firefox 146 FontVisibilityProvider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update constructor signature from nsPresContext to FontVisibilityProvider - Remove mLastPrefFirstFont and mSkipDrawing from initializer (not in FF146) - Update line numbers: 1861→1873, 1876→1875 - Replace mPresContext with mFontVisibilityProvider for user context extraction --- .../roverfox/font-fingerprinting.context.patch | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/patches/roverfox/font-fingerprinting.context.patch b/patches/roverfox/font-fingerprinting.context.patch index a2c283b4..9009e72d 100644 --- a/patches/roverfox/font-fingerprinting.context.patch +++ b/patches/roverfox/font-fingerprinting.context.patch @@ -869,25 +869,25 @@ index a8fac45e67..d59815f2d5 100644 EmphasisMarkDrawParams params(aContext, aPaletteCache); params.mark = aMark; -@@ -1861,7 +1865,8 @@ gfxFontGroup::gfxFontGroup(nsPresContext* aPresContext, - mPageLang(gfxPlatformFontList::GetFontPrefLangFor(aLanguage)), - mLastPrefFirstFont(false), - mSkipDrawing(false), -- mExplicitLanguage(aExplicitLanguage) { -+ mExplicitLanguage(aExplicitLanguage), +@@ -1873,2 +1877,3 @@ gfxFontGroup::gfxFontGroup(FontVisibilityProvider* aFontVisibilityProvider, + mPageLang(gfxPlatformFontList::GetFontPrefLangFor(aLanguage)), + mExplicitLanguage(aExplicitLanguage), +- mFontVariantEmoji(aVariantEmoji) { ++ mFontVariantEmoji(aVariantEmoji), ++ mUserContextId(0) { + mUserContextId(0) { switch (aVariantEmoji) { case StyleFontVariantEmoji::Normal: case StyleFontVariantEmoji::Unicode: -@@ -1876,6 +1881,19 @@ gfxFontGroup::gfxFontGroup(nsPresContext* aPresContext, +@@ -1875,4 +1880,17 @@ gfxFontGroup::gfxFontGroup(FontVisibilityProvider* aFontVisibilityProvider, // We don't use SetUserFontSet() here, as we want to unconditionally call // EnsureFontList() rather than only do UpdateUserFonts() if it changed. mCurrGeneration = 0; + + // Initialize cached user context ID from the document principal. + mUserContextId = 0; -+ if (mPresContext) { -+ if (auto* doc = mPresContext->Document()) { ++ if (mFontVisibilityProvider) { + if (auto* doc = mFontVisibilityProvider ? mFontVisibilityProvider->GetDocument() : nullptr) { + if (auto* principal = doc->NodePrincipal()) { + auto* bp = mozilla::BasePrincipal::Cast(principal); + if (bp) {