зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #19074 - style: Avoid double-applying text-zoom for keywords (from emilio:font-size-woes); r=Manishearth
Bug: 1412743 Reviewed-by: Manishearth Source-Repo: https://github.com/servo/servo Source-Revision: c882266c8915b9f424cc4efbc860a9e417bf1326 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : f37fd9c1a8191f4ac687f71b5c70b607ff817abb
This commit is contained in:
Родитель
315f41e7b7
Коммит
200b619205
|
@ -852,8 +852,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
context.builder.get_font().gecko().mGenericID !=
|
||||
context.builder.get_parent_font().gecko().mGenericID {
|
||||
if let Some(info) = computed.keyword_info {
|
||||
computed.size = context.maybe_zoom_text(info.kw.to_computed_value(context)
|
||||
.scale_by(info.factor) + info.offset)
|
||||
computed.size = info.to_computed_value(context);
|
||||
}
|
||||
}
|
||||
% endif
|
||||
|
@ -885,8 +884,7 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
let kw_inherited_size = context.builder.get_parent_font()
|
||||
.clone_font_size()
|
||||
.keyword_info.map(|info| {
|
||||
context.maybe_zoom_text(SpecifiedValue::Keyword(info)
|
||||
.to_computed_value(context).size)
|
||||
SpecifiedValue::Keyword(info).to_computed_value(context).size
|
||||
});
|
||||
let mut font = context.builder.take_font();
|
||||
font.inherit_font_size_from(context.builder.get_parent_font(),
|
||||
|
@ -904,9 +902,9 @@ ${helpers.single_keyword_system("font-variant-caps",
|
|||
pub fn cascade_initial_font_size(context: &mut Context) {
|
||||
// font-size's default ("medium") does not always
|
||||
// compute to the same value and depends on the font
|
||||
let mut computed = longhands::font_size::get_initial_specified_value()
|
||||
.to_computed_value(context);
|
||||
computed.size = context.maybe_zoom_text(computed.size);
|
||||
let computed =
|
||||
longhands::font_size::get_initial_specified_value()
|
||||
.to_computed_value(context);
|
||||
context.builder.mutate_font().set_font_size(computed);
|
||||
% if product == "gecko":
|
||||
let device = context.builder.device;
|
||||
|
|
|
@ -38,6 +38,13 @@ pub struct KeywordInfo {
|
|||
}
|
||||
|
||||
impl KeywordInfo {
|
||||
/// Computes the final size for this font-size keyword, accounting for
|
||||
/// text-zoom.
|
||||
pub fn to_computed_value(&self, context: &Context) -> NonNegativeLength {
|
||||
let base = context.maybe_zoom_text(self.kw.to_computed_value(context));
|
||||
base.scale_by(self.factor) + context.maybe_zoom_text(self.offset)
|
||||
}
|
||||
|
||||
/// Given a parent keyword info (self), apply an additional factor/offset to it
|
||||
pub fn compose(self, factor: f32, offset: NonNegativeLength) -> Self {
|
||||
KeywordInfo {
|
||||
|
|
|
@ -316,7 +316,7 @@ impl FontSize {
|
|||
FontSize::Keyword(i) => {
|
||||
// As a specified keyword, this is keyword derived
|
||||
info = Some(i);
|
||||
context.maybe_zoom_text(i.kw.to_computed_value(context).scale_by(i.factor) + i.offset)
|
||||
i.to_computed_value(context)
|
||||
}
|
||||
FontSize::Smaller => {
|
||||
info = compose_keyword(1. / LARGER_FONT_SIZE_RATIO);
|
||||
|
|
Загрузка…
Ссылка в новой задаче