зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1899187 - Use a real percentage for -moz-min-font-size-ratio. r=firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D211780
This commit is contained in:
Родитель
4b8f8f4639
Коммит
297dfea1e6
|
@ -1223,8 +1223,7 @@ Length Gecko_nsStyleFont_ComputeMinSize(const nsStyleFont* aFont,
|
|||
return {0};
|
||||
}
|
||||
|
||||
minFontSize.ScaleBy(aFont->mMinFontSizeRatio);
|
||||
minFontSize.ScaleBy(1.0f / 100.0f);
|
||||
minFontSize.ScaleBy(aFont->mMinFontSizeRatio._0);
|
||||
return minFontSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,9 +212,9 @@ nsStyleFont::nsStyleFont(const nsStyleFont& aSrc)
|
|||
mFontPalette(aSrc.mFontPalette),
|
||||
mMathDepth(aSrc.mMathDepth),
|
||||
mLineHeight(aSrc.mLineHeight),
|
||||
mMinFontSizeRatio(aSrc.mMinFontSizeRatio),
|
||||
mMathVariant(aSrc.mMathVariant),
|
||||
mMathStyle(aSrc.mMathStyle),
|
||||
mMinFontSizeRatio(aSrc.mMinFontSizeRatio),
|
||||
mExplicitLanguage(aSrc.mExplicitLanguage),
|
||||
mXTextScale(aSrc.mXTextScale),
|
||||
mScriptUnconstrainedSize(aSrc.mScriptUnconstrainedSize),
|
||||
|
|
|
@ -141,17 +141,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
|
|||
mozilla::Length mFontSizeOffset;
|
||||
mozilla::StyleFontSizeKeyword mFontSizeKeyword;
|
||||
mozilla::StyleFontPalette mFontPalette;
|
||||
|
||||
// math-depth support (used for MathML scriptlevel)
|
||||
int8_t mMathDepth;
|
||||
mozilla::StyleLineHeight mLineHeight;
|
||||
// allow different min font-size for certain cases
|
||||
mozilla::StylePercentage mMinFontSizeRatio{1.0f};
|
||||
// MathML mathvariant support
|
||||
mozilla::StyleMathVariant mMathVariant;
|
||||
// math-style support (used for MathML displaystyle)
|
||||
mozilla::StyleMathStyle mMathStyle;
|
||||
|
||||
// allow different min font-size for certain cases
|
||||
uint8_t mMinFontSizeRatio = 100; // percent * 100
|
||||
|
||||
// Was mLanguage set based on a lang attribute in the document?
|
||||
bool mExplicitLanguage = false;
|
||||
|
|
|
@ -35,7 +35,7 @@ use servo_arc::{Arc, UniqueArc};
|
|||
use std::mem::{forget, MaybeUninit, ManuallyDrop};
|
||||
use std::{cmp, ops, ptr};
|
||||
use crate::values;
|
||||
use crate::values::computed::{BorderStyle, Percentage, Time, Zoom};
|
||||
use crate::values::computed::{BorderStyle, Time, Zoom};
|
||||
use crate::values::computed::font::FontSize;
|
||||
use crate::values::generics::column::ColumnCount;
|
||||
|
||||
|
@ -942,33 +942,11 @@ fn static_assert() {
|
|||
}
|
||||
|
||||
|
||||
${impl_simple("_moz_min_font_size_ratio", "mMinFontSizeRatio")}
|
||||
${impl_simple("font_language_override", "mFont.languageOverride")}
|
||||
${impl_simple("font_variant_ligatures", "mFont.variantLigatures")}
|
||||
${impl_simple("font_variant_east_asian", "mFont.variantEastAsian")}
|
||||
${impl_simple("font_variant_numeric", "mFont.variantNumeric")}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn clone__moz_min_font_size_ratio(
|
||||
&self,
|
||||
) -> longhands::_moz_min_font_size_ratio::computed_value::T {
|
||||
Percentage(self.mMinFontSizeRatio as f32 / 100.)
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn set__moz_min_font_size_ratio(&mut self, v: longhands::_moz_min_font_size_ratio::computed_value::T) {
|
||||
let scaled = v.0 * 100.;
|
||||
let percentage = if scaled > 255. {
|
||||
255.
|
||||
} else if scaled < 0. {
|
||||
0.
|
||||
} else {
|
||||
scaled
|
||||
};
|
||||
|
||||
self.mMinFontSizeRatio = percentage as u8;
|
||||
}
|
||||
|
||||
${impl_simple_copy('_moz_min_font_size_ratio', 'mMinFontSizeRatio')}
|
||||
</%self:impl_trait>
|
||||
|
||||
<%def name="impl_coordinated_property_copy(type, ident, gecko_ffi_name)">
|
||||
|
|
Загрузка…
Ссылка в новой задаче