Skip to content

Commit bd03210

Browse files
authored
Proper print-color-adjust support (parcel-bundler#1102)
1 parent 9e04c01 commit bd03210

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

src/lib.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30120,6 +30120,35 @@ mod tests {
3012030120
);
3012130121
}
3012230122

30123+
#[test]
30124+
fn test_print_color_adjust() {
30125+
prefix_test(
30126+
".foo { print-color-adjust: exact; }",
30127+
indoc! { r#"
30128+
.foo {
30129+
-webkit-print-color-adjust: exact;
30130+
print-color-adjust: exact;
30131+
}
30132+
"#},
30133+
Browsers {
30134+
chrome: Some(135 << 16),
30135+
..Browsers::default()
30136+
},
30137+
);
30138+
prefix_test(
30139+
".foo { print-color-adjust: exact; }",
30140+
indoc! { r#"
30141+
.foo {
30142+
print-color-adjust: exact;
30143+
}
30144+
"#},
30145+
Browsers {
30146+
chrome: Some(137 << 16),
30147+
..Browsers::default()
30148+
},
30149+
);
30150+
}
30151+
3012330152
#[test]
3012430153
fn test_all() {
3012530154
minify_test(".foo { all: initial; all: initial }", ".foo{all:initial}");

src/properties/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,6 +1616,7 @@ define_properties! {
16161616

16171617
// https://drafts.csswg.org/css-color-adjust/
16181618
"color-scheme": ColorScheme(ColorScheme),
1619+
"print-color-adjust": PrintColorAdjust(PrintColorAdjust, VendorPrefix) / WebKit,
16191620
}
16201621

16211622
impl<'i, T: smallvec::Array<Item = V>, V: Parse<'i>> Parse<'i> for SmallVec<T> {

src/properties/prefix_handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ define_prefixes! {
7373
ClipPath,
7474
BoxDecorationBreak,
7575
TextSizeAdjust,
76+
PrintColorAdjust,
7677
}
7778

7879
macro_rules! define_fallbacks {

src/properties/ui.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,16 @@ impl<'i> PropertyHandler<'i> for ColorSchemeHandler {
571571
fn finalize(&mut self, _: &mut DeclarationList<'i>, _: &mut PropertyHandlerContext<'i, '_>) {}
572572
}
573573

574+
enum_property! {
575+
/// A value for the [print-color-adjust](https://drafts.csswg.org/css-color-adjust/#propdef-print-color-adjust) property.
576+
pub enum PrintColorAdjust {
577+
/// The user agent is allowed to make adjustments to the element as it deems appropriate.
578+
Economy,
579+
/// The user agent is not allowed to make adjustments to the element.
580+
Exact,
581+
}
582+
}
583+
574584
#[inline]
575585
fn define_var<'i>(name: &'static str, value: Token<'static>) -> Property<'i> {
576586
Property::Custom(CustomProperty {

0 commit comments

Comments
 (0)