From 7d1d9950cee24e04e77bdbc5d6d2fe071f8a205a Mon Sep 17 00:00:00 2001 From: zhuminghui2 Date: Tue, 14 May 2024 20:08:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9display=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81block=E7=9A=84=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/style_propetries/display.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/style_propetries/display.rs b/src/style_propetries/display.rs index 0dadce3..0eae90b 100644 --- a/src/style_propetries/display.rs +++ b/src/style_propetries/display.rs @@ -1,6 +1,6 @@ -use lightningcss::properties::{Property, display::{Display::{Keyword, Pair}, DisplayKeyword, DisplayInside}}; +use lightningcss::properties::{display::{Display::{Keyword, Pair}, DisplayInside, DisplayKeyword, DisplayOutside}, Property}; use crate::{generate_expr_lit_str, generate_invalid_expr}; @@ -16,6 +16,7 @@ pub struct Display { pub enum EnumValue { None, Flex, + Block, Invalid, } @@ -34,7 +35,11 @@ impl From<(String, &Property<'_>)> for Display { if let DisplayInside::Flex(_) = value.inside { EnumValue::Flex } else { - EnumValue::Invalid + if let DisplayOutside::Block = value.outside { + EnumValue::Block + } else { + EnumValue::Invalid + } } } } @@ -54,6 +59,7 @@ impl ToExpr for Display { match &self.value { EnumValue::None => generate_expr_lit_str!("none"), EnumValue::Flex => generate_expr_lit_str!("flex"), + EnumValue::Block => generate_expr_lit_str!("block"), EnumValue::Invalid => generate_invalid_expr!(), } ) @@ -65,6 +71,7 @@ impl ToExpr for Display { match &self.value { EnumValue::None => generate_expr_lit_str!("none"), EnumValue::Flex => generate_expr_lit_str!("flex"), + EnumValue::Block => generate_expr_lit_str!("block"), EnumValue::Invalid => generate_invalid_expr!(), } )