From 4d62fec376deaca98de182a11bc4ad8c948d7e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 22 Mar 2023 18:12:20 +0000 Subject: [PATCH] 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 --- components/style/properties/declaration_block.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 204c874fc1c..d5cdb425022 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -754,6 +754,14 @@ impl PropertyDeclarationBlock { 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(); + } + /// /// /// `first_declaration` needs to be the result of