stylo: Handle text-zoom for font-size

This commit is contained in:
Manish Goregaokar 2017-07-28 17:32:30 -07:00 committed by Manish Goregaokar
parent de5f6f19bd
commit 16d46eaf7a
5 changed files with 52 additions and 15 deletions

View file

@ -132,6 +132,26 @@ impl<'a> Context<'a> {
pub fn style(&self) -> &StyleBuilder {
&self.builder
}
/// Apply text-zoom if enabled
#[cfg(feature = "gecko")]
pub fn maybe_zoom_text(&self, size: Au) -> Au {
// We disable zoom for <svg:text> by unsetting the
// -x-text-zoom property, which leads to a false value
// in mAllowZoom
if self.style().get_font().gecko.mAllowZoom {
self.device().zoom_text(size)
} else {
size
}
}
/// (Servo doesn't do text-zoom)
#[cfg(feature = "servo")]
pub fn maybe_zoom_text(&self, size: Au) -> Au {
size
}
}
/// An iterator over a slice of computed values