mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Converted serialization methods to implement the to_css trait, writing to string buffers to save string allocations for every result
This commit is contained in:
parent
0985d7563f
commit
51e642e875
4 changed files with 132 additions and 46 deletions
|
@ -5,7 +5,7 @@
|
|||
//! Element nodes.
|
||||
|
||||
use app_units::Au;
|
||||
use cssparser::Color;
|
||||
use cssparser::{Color, ToCss};
|
||||
use devtools_traits::AttrInfo;
|
||||
use dom::activation::Activatable;
|
||||
use dom::attr::AttrValue;
|
||||
|
@ -699,12 +699,10 @@ impl Element {
|
|||
}
|
||||
|
||||
fn sync_property_with_attrs_style(&self) {
|
||||
let style_str = if let &Some(ref declarations) = &*self.style_attribute().borrow() {
|
||||
declarations.serialize()
|
||||
let mut style_str = String::new();
|
||||
if let &Some(ref declarations) = &*self.style_attribute().borrow() {
|
||||
declarations.to_css(&mut style_str).unwrap();
|
||||
}
|
||||
else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
let new_style = AttrValue::String(style_str);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue