mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Avoid redundantly serializing the initial value of font-weight (400) as part of the font shorthand in computed style
Differential Revision: https://phabricator.services.mozilla.com/D168250
This commit is contained in:
parent
8a2cfc0b24
commit
3de6f5a887
1 changed files with 11 additions and 2 deletions
|
@ -39,7 +39,7 @@
|
|||
use crate::properties::longhands::font_size;
|
||||
use crate::properties::longhands::font_variant_caps;
|
||||
use crate::values::specified::text::LineHeight;
|
||||
use crate::values::specified::FontSize;
|
||||
use crate::values::specified::{FontSize, FontWeight};
|
||||
use crate::values::specified::font::{FontStretch, FontStretchKeyword};
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::specified::font::SystemFont;
|
||||
|
@ -224,13 +224,22 @@
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
% for name in "style variant_caps weight".split():
|
||||
% for name in "style variant_caps".split():
|
||||
if self.font_${name} != &font_${name}::get_initial_specified_value() {
|
||||
self.font_${name}.to_css(dest)?;
|
||||
dest.write_char(' ')?;
|
||||
}
|
||||
% endfor
|
||||
|
||||
// The initial specified font-weight value of 'normal' computes as a number (400),
|
||||
// not to the keyword, so we need to check for that as well in order to properly
|
||||
// serialize the computed style.
|
||||
if self.font_weight != &FontWeight::normal() &&
|
||||
self.font_weight != &FontWeight::from_gecko_keyword(400) {
|
||||
self.font_weight.to_css(dest)?;
|
||||
dest.write_char(' ')?;
|
||||
}
|
||||
|
||||
if font_stretch != FontStretchKeyword::Normal {
|
||||
font_stretch.to_css(dest)?;
|
||||
dest.write_char(' ')?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue