mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #18355 - servo:no-fmt, r=emilio
Reduce usage of fmt in serialization and error reporting `format!` and `write!` create a somewhat-heavyweight `Formatting` struct and use dynamic dispatch to call into impls of `Dispaly` and related traits. The former also allocates an intermediate string that is sometimes unnecessary. I started looking into this from https://bugzilla.mozilla.org/show_bug.cgi?id=1355599, but I expect the impact there will be small to insignificant. It might be a slightly less so on parsing (error reporting). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18355) <!-- Reviewable:end -->
This commit is contained in:
commit
c60dd53210
27 changed files with 328 additions and 365 deletions
|
@ -424,7 +424,11 @@ impl ToCss for NoCalcLength {
|
|||
NoCalcLength::FontRelative(length) => length.to_css(dest),
|
||||
NoCalcLength::ViewportPercentage(length) => length.to_css(dest),
|
||||
/* This should only be reached from style dumping code */
|
||||
NoCalcLength::ServoCharacterWidth(CharacterWidth(i)) => write!(dest, "CharWidth({})", i),
|
||||
NoCalcLength::ServoCharacterWidth(CharacterWidth(i)) => {
|
||||
dest.write_str("CharWidth(")?;
|
||||
i.to_css(dest)?;
|
||||
dest.write_char(')')
|
||||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
NoCalcLength::Physical(length) => length.to_css(dest),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue