mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
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:
parent
c2a2113136
commit
3f03650c88
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue