@@ -35,34 +35,43 @@ pub struct TextDecorationColor(CssColor);
3535
3636impl ToExpr for TextDecoration {
3737 fn to_expr ( & self ) -> PropertyTuple {
38- let mut props = vec ! [ ] ;
38+ let mut props: Vec < ( CSSPropertyType , Expr ) > = vec ! [ ] ;
3939
4040 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 {
4444 TextDecorationLine :: Underline => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_UNDERLINE ) ,
4545 TextDecorationLine :: LineThrough => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH ) ,
4646 TextDecorationLine :: Overline => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_OVERLINE ) ,
4747 _ => generate_expr_enum ! ( style_property_enum:: ArkUI_TextDecorationType :: ARKUI_TEXT_DECORATION_TYPE_NONE ) ,
48- } . into ( )
49- } ) ) ) ) ;
48+ }
49+ ) ) ;
5050 }
5151
5252 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+
5772 }
5873
59- PropertyTuple :: One (
60- CSSPropertyType :: TextDecoration ,
61- Expr :: Object ( ObjectLit {
62- span : DUMMY_SP ,
63- props : props
64- } )
65- )
74+ PropertyTuple :: Array ( props)
6675 }
6776}
6877
0 commit comments