style: Reuse declaration block with SVG presentation attributes

Ideally we'd only update the attributes that actually changed. That's a
bit more work I can try to look into, but this and bug 1823686 should
improve things here.

Differential Revision: https://phabricator.services.mozilla.com/D173162
This commit is contained in:
Emilio Cobos Álvarez 2023-03-22 18:12:20 +00:00 committed by Martin Robinson
parent 7d12331626
commit 4d62fec376

View file

@ -754,6 +754,14 @@ impl PropertyDeclarationBlock {
self.declarations.remove(i); self.declarations.remove(i);
} }
/// Clears all the declarations from this block.
#[inline]
pub fn clear(&mut self) {
self.declarations_importance.clear();
self.declarations.clear();
self.longhands.clear();
}
/// <https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty> /// <https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty>
/// ///
/// `first_declaration` needs to be the result of /// `first_declaration` needs to be the result of