Skip to content

Commit c3ac11e

Browse files
committed
Parse and prefix box-decoration-break property
Closes parcel-bundler#250
1 parent cb69f33 commit c3ac11e

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

src/lib.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11352,6 +11352,44 @@ mod tests {
1135211352
);
1135311353
}
1135411354

11355+
#[test]
11356+
fn test_break() {
11357+
prefix_test(
11358+
r#"
11359+
.foo {
11360+
box-decoration-break: clone;
11361+
}
11362+
"#,
11363+
indoc! {r#"
11364+
.foo {
11365+
-webkit-box-decoration-break: clone;
11366+
box-decoration-break: clone;
11367+
}
11368+
"#},
11369+
Browsers {
11370+
safari: Some(15 << 16),
11371+
..Browsers::default()
11372+
},
11373+
);
11374+
11375+
prefix_test(
11376+
r#"
11377+
.foo {
11378+
box-decoration-break: clone;
11379+
}
11380+
"#,
11381+
indoc! {r#"
11382+
.foo {
11383+
box-decoration-break: clone;
11384+
}
11385+
"#},
11386+
Browsers {
11387+
firefox: Some(95 << 16),
11388+
..Browsers::default()
11389+
},
11390+
);
11391+
}
11392+
1135511393
#[test]
1135611394
fn test_position() {
1135711395
test(

src/properties/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,9 @@ define_properties! {
10711071
"text-emphasis-position": TextEmphasisPosition(TextEmphasisPosition, VendorPrefix) / WebKit,
10721072
"text-shadow": TextShadow(SmallVec<[TextShadow; 1]>),
10731073

1074+
// https://www.w3.org/TR/css-break-3/
1075+
"box-decoration-break": BoxDecorationBreak(BoxDecorationBreak, VendorPrefix) / WebKit,
1076+
10741077
// https://www.w3.org/TR/2021/WD-css-ui-4-20210316
10751078
"resize": Resize(Resize),
10761079
"cursor": Cursor(Cursor<'i>),

src/properties/prefix_handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ define_prefixes! {
9696
UserSelect,
9797
Appearance,
9898
ClipPath,
99+
BoxDecorationBreak,
99100
}
100101

101102
macro_rules! define_fallbacks {

src/properties/text.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,22 @@ impl<'i> Parse<'i> for TextEmphasisPosition {
909909
}
910910
}
911911

912+
enum_property! {
913+
/// A value for the [box-decoration-break](https://www.w3.org/TR/css-break-3/#break-decoration) property.
914+
pub enum BoxDecorationBreak {
915+
/// The element is rendered with no breaks present, and then sliced by the breaks afterward.
916+
Slice,
917+
/// Each box fragment is independently wrapped with the border, padding, and margin.
918+
Clone,
919+
}
920+
}
921+
922+
impl Default for BoxDecorationBreak {
923+
fn default() -> Self {
924+
BoxDecorationBreak::Slice
925+
}
926+
}
927+
912928
impl ToCss for TextEmphasisPosition {
913929
fn to_css<W>(&self, dest: &mut Printer<W>) -> Result<(), PrinterError>
914930
where

0 commit comments

Comments
 (0)