@@ -4,13 +4,12 @@ use oxvg_ast::{
4
4
element:: Element ,
5
5
visitor:: { Context , PrepareOutcome , Visitor } ,
6
6
} ;
7
- use oxvg_derive:: OptionalDefault ;
8
7
use regex:: Regex ;
9
8
use serde:: Deserialize ;
10
9
11
10
use super :: ContextFlags ;
12
11
13
- #[ derive( Deserialize , Default , Clone , OptionalDefault ) ]
12
+ #[ derive( Deserialize , Default , Clone ) ]
14
13
#[ serde( rename_all = "camelCase" ) ]
15
14
pub struct CleanupEnableBackground {
16
15
#[ serde( skip_deserializing) ]
@@ -25,7 +24,7 @@ struct EnableBackgroundDimensions<'a> {
25
24
impl < E : Element > Visitor < E > for CleanupEnableBackground {
26
25
type Error = String ;
27
26
28
- fn prepare ( & mut self , document : & E , _context_flags : & mut ContextFlags ) -> PrepareOutcome {
27
+ fn prepare ( & mut self , document : & E , _context_flags : & mut ContextFlags ) -> PrepareOutcome {
29
28
let Some ( root) = document. find_element ( ) else {
30
29
return PrepareOutcome :: none;
31
30
} ;
@@ -42,7 +41,7 @@ impl<E: Element> Visitor<E> for CleanupEnableBackground {
42
41
/// - Drop `enable-background` on `<svg>` node, if it matches the node's width and height
43
42
/// - Set `enable-background` to `"new"` on `<mask>` or `<pattern>` nodes, if it matches the
44
43
/// node's width and height
45
- fn element ( & mut self , element : & mut E , _context : & mut Context < E > ) -> Result < ( ) , String > {
44
+ fn element ( & mut self , element : & mut E , _context : & mut Context < E > ) -> Result < ( ) , String > {
46
45
let style_name = & "style" . into ( ) ;
47
46
if let Some ( mut style) = element. get_attribute_node_local ( style_name) {
48
47
let new_value = Regex :: new ( r"(^|;)\s*enable-background\s*:\s*new[\d\s]*" )
0 commit comments