mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Optimize serialization of identifiers of length <= 16 🐉🐲
Much like we optimize to_ascii_lowercase. This also fixes a bug in Servo where attr() rules with an unknown namespace prefix are parsed, which is wrong.
This commit is contained in:
parent
e57319a734
commit
f4c9c598a3
13 changed files with 96 additions and 65 deletions
|
@ -461,6 +461,7 @@ impl SingleFontFamily {
|
|||
/// Get the corresponding font-family with family name
|
||||
fn from_font_family_name(family: &structs::FontFamilyName) -> SingleFontFamily {
|
||||
use gecko_bindings::structs::FontFamilyType;
|
||||
use values::serialize_atom_identifier;
|
||||
|
||||
match family.mType {
|
||||
FontFamilyType::eFamily_sans_serif => SingleFontFamily::Generic(atom!("sans-serif")),
|
||||
|
@ -472,7 +473,7 @@ impl SingleFontFamily {
|
|||
FontFamilyType::eFamily_named => {
|
||||
let name = Atom::from(&*family.mName);
|
||||
let mut serialization = String::new();
|
||||
serialize_identifier(&name.to_string(), &mut serialization).unwrap();
|
||||
serialize_atom_identifier(&name, &mut serialization).unwrap();
|
||||
SingleFontFamily::FamilyName(FamilyName {
|
||||
name: name.clone(),
|
||||
syntax: FamilyNameSyntax::Identifiers(serialization),
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
//! Computed values.
|
||||
|
||||
use {Atom, Namespace};
|
||||
use Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
use Prefix;
|
||||
use context::QuirksMode;
|
||||
use euclid::Size2D;
|
||||
use font_metrics::{FontMetricsProvider, get_metrics_provider_for_product};
|
||||
|
@ -414,7 +416,8 @@ trivial_to_computed_value!(u32);
|
|||
trivial_to_computed_value!(Atom);
|
||||
trivial_to_computed_value!(BorderStyle);
|
||||
trivial_to_computed_value!(CursorKind);
|
||||
trivial_to_computed_value!(Namespace);
|
||||
#[cfg(feature = "servo")]
|
||||
trivial_to_computed_value!(Prefix);
|
||||
trivial_to_computed_value!(String);
|
||||
trivial_to_computed_value!(Box<str>);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue