style: Plumb android text scale via nsLookAndFeel

That's how we do it for all other platforms. Do this rather than via a
custom mostly-untested pref, which allows us to simplify text zoom
handling.

Differential Revision: https://phabricator.services.mozilla.com/D177062
This commit is contained in:
Emilio Cobos Álvarez 2023-05-11 19:01:19 +00:00 committed by Martin Robinson
parent c2a2113136
commit 3f03650c88

View file

@ -511,24 +511,24 @@ impl Device {
/// Returns the current effective text zoom. /// Returns the current effective text zoom.
#[inline] #[inline]
fn effective_text_zoom(&self) -> f32 { fn text_zoom(&self) -> f32 {
let pc = match self.pres_context() { let pc = match self.pres_context() {
Some(pc) => pc, Some(pc) => pc,
None => return 1., None => return 1.,
}; };
pc.mEffectiveTextZoom pc.mTextZoom
} }
/// Applies text zoom to a font-size or line-height value (see nsStyleFont::ZoomText). /// Applies text zoom to a font-size or line-height value (see nsStyleFont::ZoomText).
#[inline] #[inline]
pub fn zoom_text(&self, size: Length) -> Length { pub fn zoom_text(&self, size: Length) -> Length {
size.scale_by(self.effective_text_zoom()) size.scale_by(self.text_zoom())
} }
/// Un-apply text zoom. /// Un-apply text zoom.
#[inline] #[inline]
pub fn unzoom_text(&self, size: Length) -> Length { pub fn unzoom_text(&self, size: Length) -> Length {
size.scale_by(1. / self.effective_text_zoom()) size.scale_by(1. / self.text_zoom())
} }
/// Returns safe area insets /// Returns safe area insets