style: Rework -x-text-zoom to allow disabling text zoom and min-font-size separately

And use it instead of explicit document checks. This centralizes where
we check for it.

IsChromeDoc is relatively cheap, but this bug wants to also check for
PDF.js which is a bit more expensive.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D176940
This commit is contained in:
Emilio Cobos Álvarez 2023-05-03 15:02:40 +00:00 committed by Martin Robinson
parent a6b97563c3
commit a27f477c7d
10 changed files with 46 additions and 65 deletions

View file

@ -71,7 +71,7 @@ pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumer
pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis};
pub use self::font::{FontVariantAlternates, FontWeight};
pub use self::font::{FontVariantEastAsian, FontVariationSettings};
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
pub use self::font::{MathDepth, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextScale};
pub use self::image::{Gradient, Image, ImageRendering, LineDirection, MozImageRect};
pub use self::length::{CSSPixelLength, NonNegativeLength};
pub use self::length::{Length, LengthOrNumber, LengthPercentage, NonNegativeLengthOrNumber};
@ -390,10 +390,7 @@ impl<'a> Context<'a> {
/// Apply text-zoom if enabled.
#[cfg(feature = "gecko")]
pub fn maybe_zoom_text(&self, size: CSSPixelLength) -> CSSPixelLength {
// We disable zoom for <svg:text> by unsetting the
// -x-text-zoom property, which leads to a false value
// in mAllowZoomAndMinSize
if self.style().get_font().gecko.mAllowZoomAndMinSize {
if self.style().get_font().clone__x_text_scale().text_zoom_enabled() {
self.device().zoom_text(size)
} else {
size