Skip to content

Commit cecfd33

Browse files
committed
feat: 增加display: inline和inline-block
1 parent 91e1cf5 commit cecfd33

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/style_propetries/display.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pub enum EnumValue {
2323
Block,
2424
Invalid,
2525
Box,
26+
InlineBlock,
27+
Inline,
2628
}
2729

2830
impl From<(String, &Property<'_>)> for Display {
@@ -41,6 +43,14 @@ impl From<(String, &Property<'_>)> for Display {
4143
EnumValue::Flex
4244
} else if let DisplayInside::Box(_) = value.inside {
4345
EnumValue::Box
46+
} else if let DisplayInside::FlowRoot = value.inside {
47+
if let DisplayOutside::Inline = value.outside {
48+
EnumValue::InlineBlock
49+
} else {
50+
EnumValue::Block
51+
}
52+
} else if let DisplayOutside::Inline = value.outside {
53+
EnumValue::Inline
4454
} else {
4555
if let DisplayOutside::Block = value.outside {
4656
EnumValue::Block
@@ -67,6 +77,8 @@ impl ToExpr for Display {
6777
EnumValue::Flex => generate_expr_enum!(style_property_enum::Display::Flex),
6878
EnumValue::Block => generate_expr_enum!(style_property_enum::Display::Block),
6979
EnumValue::Box => generate_expr_enum!(style_property_enum::Display::Box),
80+
EnumValue::InlineBlock => generate_expr_enum!(style_property_enum::Display::InlineBlock),
81+
EnumValue::Inline => generate_expr_enum!(style_property_enum::Display::Inline),
7082
EnumValue::Invalid => generate_invalid_expr!(),
7183
},
7284
)

src/style_propetries/style_property_enum.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,8 @@ pub enum Display {
388388
Block,
389389
Flex,
390390
Box,
391+
InlineBlock,
392+
Inline,
391393
}
392394

393395
#[repr(u32)]

0 commit comments

Comments
 (0)