Screenshot tools pin the generic font families through
Page.setFontFamilies so that captures are reproducible. The
first full-page capture then makes the browser re-push
WebPreferences to the renderer -- unchanged, but
WebView::ApplyWebPreferences() re-applies the embedder's font
family maps unconditionally, which overwrites the override. Every capture
after the first one renders with a different monospace font, which is what
the report describes as text metrics depending on the previous element.
The fix skips the font family maps when a WebPreferences
update does not change them, so a re-push is the no-op it is meant to be.
A real change to the maps still wins. Behind the default-on
PreserveDevToolsFontFamilyOverrides kill switch.
fixed to Liberation
Serif, takes a captureBeyondViewport screenshot and measures
the run again -- 138px without the fix, 195.84px with it.WebViewTest.FontFamilyOverrideSurvivesWebPreferencesRepush
covers the Blink side, including that a real change to the font family
preferences still applies, and a second test pins the old behavior with the
kill switch off.WebViewTest cases pass.