зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1685756 - Part 3: Take default scale into account when disabling font inflation. r=hiro
Font inflation isn't required for pages whose viewport is narrow enough that we don't have to zoom *out* when doing zoom-to-fit. As the viewport scale is given as a CSSToScreenScale, this means that what we're actually doing at the moment, though, is comparing the width of the viewport in CSS pixels to the width of the screen in physical pixels, *without* taking the default scale on a high-DPI device into account. This issue affects neither pages using a "width=device-width" viewport (the IsAutoSizeEnabled() check handles those), nor pages without an explicitly specified viewport at all (the viewport info returns the minimum zoom level in that case, i.e. 25 %, which would therefore require a device scale of > 4 in order for us to erroneously turn off font inflation - even modern phones don't seem to quite reach *that* sort of pixel density, e.g. a Pixel 5 only reports a default scale of ~2.73. For pages with an explicitly sized viewport this can however mean that we turn off font inflation too early: Slashdot e.g. uses "width=1000", which means that on a phone with a 720 px screen font inflation is correctly enabled, but on a different phone squeezing 1080 px into the same physical screen width (i.e. higher DPI, but *not* a physically larger screen), font inflation is suddenly and incorrectly turned off. Differential Revision: https://phabricator.services.mozilla.com/D122059
This commit is contained in:
Родитель
51801cf11b
Коммит
6a54fe3b58
|
@ -11472,8 +11472,10 @@ bool PresShell::DetermineFontSizeInflationState() {
|
|||
PixelCastJustification::LayoutDeviceIsScreenForBounds);
|
||||
nsViewportInfo vInf = GetDocument()->GetViewportInfo(screenSize);
|
||||
|
||||
if (vInf.GetDefaultZoom() >= CSSToScreenScale(1.0f) ||
|
||||
vInf.IsAutoSizeEnabled()) {
|
||||
CSSToScreenScale defaultScale =
|
||||
mPresContext->CSSToDevPixelScale() * LayoutDeviceToScreenScale(1.0);
|
||||
|
||||
if (vInf.GetDefaultZoom() >= defaultScale || vInf.IsAutoSizeEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceE
|
|||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == form-button-fixed-width.html form-button-fixed-width-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == form-button.html form-button-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == fixed-width-viewport-no-inflation.html fixed-width-viewport-no-inflation.html
|
||||
fails asserts(0-2) pref(layout.css.devPixelsPerPx,"0.5") test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == fixed-width-viewport-no-inflation.html fixed-width-viewport-no-inflation.html
|
||||
asserts(0-2) pref(layout.css.devPixelsPerPx,"0.5") test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == fixed-width-viewport-no-inflation.html fixed-width-viewport-no-inflation.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == fixed-width-viewport-inflation.html fixed-width-viewport-inflation-ref.html
|
||||
fails skip-if(Android&&webrender||cocoaWidget) asserts(0-2) pref(layout.css.devPixelsPerPx,"2.0") test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == fixed-width-viewport-inflation.html fixed-width-viewport-inflation-ref.html
|
||||
skip-if(Android&&webrender||cocoaWidget) asserts(0-2) pref(layout.css.devPixelsPerPx,"2.0") test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == fixed-width-viewport-inflation.html fixed-width-viewport-inflation-ref.html
|
||||
|
||||
# Ordinarily, reftests use a browser.viewport.desktopWidth of 800px, same as the
|
||||
# size of the reftest document. The failure condition of the test below however
|
||||
|
|
Загрузка…
Ссылка в новой задаче