@@ -35,34 +35,43 @@ pub struct TextDecorationColor(CssColor);
35
35
36
36
impl ToExpr for TextDecoration {
37
37
fn to_expr ( & self ) -> PropertyTuple {
38
- let mut props = vec ! [ ] ;
38
+ let mut props: Vec < ( CSSPropertyType , Expr ) > = vec ! [ ] ;
39
39
40
40
if let Some ( line) = & self . line {
41
- props. push ( PropOrSpread :: Prop ( Box :: new ( Prop :: KeyValue ( KeyValueProp {
42
- key : generate_prop_name ! ( "type" ) ,
43
- value : match line {
41
+ props. push ( (
42
+ CSSPropertyType :: TextDecorationLine ,
43
+ match line {
44
44
TextDecorationLine :: Underline => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_UNDERLINE ) ,
45
45
TextDecorationLine :: LineThrough => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH ) ,
46
46
TextDecorationLine :: Overline => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_OVERLINE ) ,
47
47
_ => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_NONE ) ,
48
- } . into ( )
49
- } ) ) ) ) ;
48
+ }
49
+ ) ) ;
50
50
}
51
51
52
52
if let Some ( color) = & self . color {
53
- props. push ( PropOrSpread :: Prop ( Box :: new ( Prop :: KeyValue ( KeyValueProp {
54
- key : generate_prop_name ! ( "color" ) ,
55
- value : generate_expr_lit_color ! ( color. 0 . clone( ) ) . into ( )
56
- } ) ) ) ) ;
53
+ props. push ( (
54
+ CSSPropertyType :: TextDecorationColor ,
55
+ generate_expr_lit_color ! ( color. 0 . clone( ) )
56
+ ) ) ;
57
+
58
+ }
59
+
60
+ if let Some ( style) = & self . style {
61
+ props. push ( (
62
+ CSSPropertyType :: TextDecorationStyle ,
63
+ match style {
64
+ TextDecorationStyle :: Solid => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationStyle :: ARKUI_TEXT_DECORATION_STYLE_SOLID ) ,
65
+ TextDecorationStyle :: Double => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationStyle :: ARKUI_TEXT_DECORATION_STYLE_DOUBLE ) ,
66
+ TextDecorationStyle :: Dotted => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationStyle :: ARKUI_TEXT_DECORATION_STYLE_DOTTED ) ,
67
+ TextDecorationStyle :: Dashed => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationStyle :: ARKUI_TEXT_DECORATION_STYLE_DASHED ) ,
68
+ TextDecorationStyle :: Wavy => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationStyle :: ARKUI_TEXT_DECORATION_STYLE_WAVY ) ,
69
+ }
70
+ ) ) ;
71
+
57
72
}
58
73
59
- PropertyTuple :: One (
60
- CSSPropertyType :: TextDecoration ,
61
- Expr :: Object ( ObjectLit {
62
- span : DUMMY_SP ,
63
- props : props
64
- } )
65
- )
74
+ PropertyTuple :: Array ( props)
66
75
}
67
76
}
68
77
0 commit comments