From 26aeb18c0cbb3299951be7b7a9398705d33374cd Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:46:36 +0300 Subject: [PATCH] fix(css/parser): Improve handling of math functions in at-rules (#6140) --- .../src/compressor/calc_sum.rs | 85 +- .../src/compressor/container.rs | 62 + .../src/compressor/math/mod.rs | 78 + .../swc_css_minifier/src/compressor/media.rs | 61 +- crates/swc_css_minifier/src/compressor/mod.rs | 23 +- .../compress-at-rule/media/output.min.css | 2 +- .../container-condition/input.css | 4 + .../container-condition/output.min.css | 1 + .../fixture/compress-calc/container/input.css | 31 + .../compress-calc/container/output.min.css | 1 + .../compress-calc/media-query/input.css | 12 + .../compress-calc/media-query/output.min.css | 2 +- .../compress-calc/simple-calc/input.css | 4 + .../compress-calc/simple-calc/output.min.css | 2 +- .../supports-condition/input.css | 11 + .../supports-condition/output.min.css | 1 + crates/swc_css_parser/src/parser/at_rule.rs | 18 +- .../tests/fixture/at-rule/container/input.css | 2 + .../fixture/at-rule/container/output.json | 365 +++- .../fixture/at-rule/container/span.rust-debug | 358 +++- .../tests/fixture/at-rule/media/input.css | 2 + .../tests/fixture/at-rule/media/output.json | 1588 +++++++++++------ .../fixture/at-rule/media/span.rust-debug | 1262 +++++++++++-- 23 files changed, 3193 insertions(+), 782 deletions(-) create mode 100644 crates/swc_css_minifier/src/compressor/container.rs create mode 100644 crates/swc_css_minifier/src/compressor/math/mod.rs create mode 100644 crates/swc_css_minifier/tests/fixture/compress-calc/container-condition/input.css create mode 100644 crates/swc_css_minifier/tests/fixture/compress-calc/container-condition/output.min.css create mode 100644 crates/swc_css_minifier/tests/fixture/compress-calc/container/input.css create mode 100644 crates/swc_css_minifier/tests/fixture/compress-calc/container/output.min.css create mode 100644 crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/input.css create mode 100644 crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/output.min.css diff --git a/crates/swc_css_minifier/src/compressor/calc_sum.rs b/crates/swc_css_minifier/src/compressor/calc_sum.rs index 69cbfca9ea4..9ae0c3db8cb 100644 --- a/crates/swc_css_minifier/src/compressor/calc_sum.rs +++ b/crates/swc_css_minifier/src/compressor/calc_sum.rs @@ -1,15 +1,10 @@ use std::collections::HashMap; -use swc_atoms::{js_word, JsWord}; +use swc_atoms::JsWord; use swc_css_ast::*; use super::{unit::*, Compressor}; - -fn is_calc_function_name(ident: &Ident) -> bool { - ident.value.to_ascii_lowercase() == js_word!("calc") - || ident.value.to_ascii_lowercase() == js_word!("-webkit-calc") - || ident.value.to_ascii_lowercase() == js_word!("-moz-calc") -} +use crate::compressor::math::{is_calc_function_name, transform_calc_value_into_component_value}; // transform "(simple calc-value)" into "simple calc-value" fn remove_unnecessary_nesting_from_calc_sum(calc_sum: &mut CalcSum) { @@ -50,76 +45,6 @@ fn try_to_extract_into_calc_value(calc_sum: &CalcSum) -> Option { None } -fn transform_calc_value_into_component_value(calc_value: &CalcValue) -> ComponentValue { - match &calc_value { - CalcValue::Number(n) => ComponentValue::Number(n.clone()), - CalcValue::Dimension(Dimension::Length(l)) => { - ComponentValue::Dimension(Dimension::Length(Length { - span: l.span, - value: l.value.clone(), - unit: l.unit.clone(), - })) - } - CalcValue::Dimension(Dimension::Angle(a)) => { - ComponentValue::Dimension(Dimension::Angle(Angle { - span: a.span, - value: a.value.clone(), - unit: a.unit.clone(), - })) - } - CalcValue::Dimension(Dimension::Time(t)) => { - ComponentValue::Dimension(Dimension::Time(Time { - span: t.span, - value: t.value.clone(), - unit: t.unit.clone(), - })) - } - CalcValue::Dimension(Dimension::Frequency(f)) => { - ComponentValue::Dimension(Dimension::Frequency(Frequency { - span: f.span, - value: f.value.clone(), - unit: f.unit.clone(), - })) - } - CalcValue::Dimension(Dimension::Resolution(r)) => { - ComponentValue::Dimension(Dimension::Resolution(Resolution { - span: r.span, - value: r.value.clone(), - unit: r.unit.clone(), - })) - } - CalcValue::Dimension(Dimension::Flex(f)) => { - ComponentValue::Dimension(Dimension::Flex(Flex { - span: f.span, - value: f.value.clone(), - unit: f.unit.clone(), - })) - } - CalcValue::Dimension(Dimension::UnknownDimension(u)) => { - ComponentValue::Dimension(Dimension::UnknownDimension(UnknownDimension { - span: u.span, - value: u.value.clone(), - unit: u.unit.clone(), - })) - } - CalcValue::Percentage(p) => ComponentValue::Percentage(Percentage { - span: p.span, - value: p.value.clone(), - }), - CalcValue::Function(f) => ComponentValue::Function(Function { - span: f.span, - name: f.name.clone(), - value: f.value.to_vec(), - }), - CalcValue::Constant(_) => { - unreachable!("CalcValue::Constant cannot be transformed into a ComponentValue per spec") - } - CalcValue::Sum(_) => { - unreachable!("CalcValue::Sum cannot be transformed into a ComponentValue") - } - } -} - // We want to track the position of data (dimension, percentage, operator...) in // a Vec #[derive(Debug, Clone)] @@ -1064,7 +989,11 @@ impl Compressor { // they’re treated like any other // keyword" } - CalcValueOrOperator::Value(calc_value) => { + // `calc` and other math functions can be used in `@supports` to + // check availability, we should leave them as is + CalcValueOrOperator::Value(calc_value) + if !self.in_supports_conidition => + { *component_value = transform_calc_value_into_component_value(calc_value); } diff --git a/crates/swc_css_minifier/src/compressor/container.rs b/crates/swc_css_minifier/src/compressor/container.rs new file mode 100644 index 00000000000..d0bc464fa66 --- /dev/null +++ b/crates/swc_css_minifier/src/compressor/container.rs @@ -0,0 +1,62 @@ +use swc_css_ast::*; + +use super::Compressor; +use crate::compressor::math::{is_calc_function_name, transform_calc_value_into_component_value}; + +impl Compressor { + pub(super) fn compress_calc_sum_in_size_feature_value(&mut self, n: &mut SizeFeatureValue) { + match n { + SizeFeatureValue::Function(Function { name, value, .. }) + if is_calc_function_name(name) && value.len() == 1 => + { + match &value[0] { + ComponentValue::CalcSum(CalcSum { + expressions: calc_sum_expressions, + .. + }) if calc_sum_expressions.len() == 1 => { + match &calc_sum_expressions[0] { + CalcProductOrOperator::Product(CalcProduct { + expressions: calc_product_expressions, + .. + }) if calc_product_expressions.len() == 1 => { + match &calc_product_expressions[0] { + CalcValueOrOperator::Value(CalcValue::Sum(_)) => { + // Do nothing, we cannot transform a + // CalcSum into a ComponentValue + } + CalcValueOrOperator::Value(CalcValue::Constant(_)) => { + // https://www.w3.org/TR/css-values-4/#calc-constants + // "These keywords are only usable + // within a calculation" + // "If used outside of a calculation, + // they’re treated like any other + // keyword" + } + CalcValueOrOperator::Value(calc_value) => { + match transform_calc_value_into_component_value(calc_value) + { + ComponentValue::Function(function) => { + *n = SizeFeatureValue::Function(function); + } + ComponentValue::Dimension(dimension) => { + *n = SizeFeatureValue::Dimension(dimension); + } + ComponentValue::Number(number) => { + *n = SizeFeatureValue::Number(number); + } + _ => {} + } + } + _ => {} + } + } + _ => {} + } + } + _ => {} + } + } + _ => {} + } + } +} diff --git a/crates/swc_css_minifier/src/compressor/math/mod.rs b/crates/swc_css_minifier/src/compressor/math/mod.rs new file mode 100644 index 00000000000..b13ae4bb61e --- /dev/null +++ b/crates/swc_css_minifier/src/compressor/math/mod.rs @@ -0,0 +1,78 @@ +use swc_atoms::js_word; +use swc_css_ast::*; + +pub fn is_calc_function_name(ident: &Ident) -> bool { + ident.value.to_ascii_lowercase() == js_word!("calc") + || ident.value.to_ascii_lowercase() == js_word!("-webkit-calc") + || ident.value.to_ascii_lowercase() == js_word!("-moz-calc") +} + +pub fn transform_calc_value_into_component_value(calc_value: &CalcValue) -> ComponentValue { + match &calc_value { + CalcValue::Number(n) => ComponentValue::Number(n.clone()), + CalcValue::Dimension(Dimension::Length(l)) => { + ComponentValue::Dimension(Dimension::Length(Length { + span: l.span, + value: l.value.clone(), + unit: l.unit.clone(), + })) + } + CalcValue::Dimension(Dimension::Angle(a)) => { + ComponentValue::Dimension(Dimension::Angle(Angle { + span: a.span, + value: a.value.clone(), + unit: a.unit.clone(), + })) + } + CalcValue::Dimension(Dimension::Time(t)) => { + ComponentValue::Dimension(Dimension::Time(Time { + span: t.span, + value: t.value.clone(), + unit: t.unit.clone(), + })) + } + CalcValue::Dimension(Dimension::Frequency(f)) => { + ComponentValue::Dimension(Dimension::Frequency(Frequency { + span: f.span, + value: f.value.clone(), + unit: f.unit.clone(), + })) + } + CalcValue::Dimension(Dimension::Resolution(r)) => { + ComponentValue::Dimension(Dimension::Resolution(Resolution { + span: r.span, + value: r.value.clone(), + unit: r.unit.clone(), + })) + } + CalcValue::Dimension(Dimension::Flex(f)) => { + ComponentValue::Dimension(Dimension::Flex(Flex { + span: f.span, + value: f.value.clone(), + unit: f.unit.clone(), + })) + } + CalcValue::Dimension(Dimension::UnknownDimension(u)) => { + ComponentValue::Dimension(Dimension::UnknownDimension(UnknownDimension { + span: u.span, + value: u.value.clone(), + unit: u.unit.clone(), + })) + } + CalcValue::Percentage(p) => ComponentValue::Percentage(Percentage { + span: p.span, + value: p.value.clone(), + }), + CalcValue::Function(f) => ComponentValue::Function(Function { + span: f.span, + name: f.name.clone(), + value: f.value.to_vec(), + }), + CalcValue::Constant(_) => { + unreachable!("CalcValue::Constant cannot be transformed into a ComponentValue per spec") + } + CalcValue::Sum(_) => { + unreachable!("CalcValue::Sum cannot be transformed into a ComponentValue") + } + } +} diff --git a/crates/swc_css_minifier/src/compressor/media.rs b/crates/swc_css_minifier/src/compressor/media.rs index eb1979cdbd4..bc730df5f5b 100644 --- a/crates/swc_css_minifier/src/compressor/media.rs +++ b/crates/swc_css_minifier/src/compressor/media.rs @@ -4,7 +4,10 @@ use swc_common::DUMMY_SP; use swc_css_ast::*; use super::Compressor; -use crate::util::dedup; +use crate::{ + compressor::math::{is_calc_function_name, transform_calc_value_into_component_value}, + util::dedup, +}; impl Compressor { fn is_first_media_in_parens(&self, media_condition: &MediaCondition) -> bool { @@ -326,4 +329,60 @@ impl Compressor { _ => {} } } + + pub(super) fn compress_calc_sum_in_media_feature_value(&mut self, n: &mut MediaFeatureValue) { + match n { + MediaFeatureValue::Function(Function { name, value, .. }) + if is_calc_function_name(name) && value.len() == 1 => + { + match &value[0] { + ComponentValue::CalcSum(CalcSum { + expressions: calc_sum_expressions, + .. + }) if calc_sum_expressions.len() == 1 => { + match &calc_sum_expressions[0] { + CalcProductOrOperator::Product(CalcProduct { + expressions: calc_product_expressions, + .. + }) if calc_product_expressions.len() == 1 => { + match &calc_product_expressions[0] { + CalcValueOrOperator::Value(CalcValue::Sum(_)) => { + // Do nothing, we cannot transform a + // CalcSum into a ComponentValue + } + CalcValueOrOperator::Value(CalcValue::Constant(_)) => { + // https://www.w3.org/TR/css-values-4/#calc-constants + // "These keywords are only usable + // within a calculation" + // "If used outside of a calculation, + // they’re treated like any other + // keyword" + } + CalcValueOrOperator::Value(calc_value) => { + match transform_calc_value_into_component_value(calc_value) + { + ComponentValue::Function(function) => { + *n = MediaFeatureValue::Function(function); + } + ComponentValue::Dimension(dimension) => { + *n = MediaFeatureValue::Dimension(dimension); + } + ComponentValue::Number(number) => { + *n = MediaFeatureValue::Number(number); + } + _ => {} + } + } + _ => {} + } + } + _ => {} + } + } + _ => {} + } + } + _ => {} + } + } } diff --git a/crates/swc_css_minifier/src/compressor/mod.rs b/crates/swc_css_minifier/src/compressor/mod.rs index ebc6bb2a1dd..b7171eb2211 100644 --- a/crates/swc_css_minifier/src/compressor/mod.rs +++ b/crates/swc_css_minifier/src/compressor/mod.rs @@ -9,6 +9,7 @@ mod alpha_value; mod angle; mod calc_sum; mod color; +mod container; mod ctx; mod declaration; mod easing_function; @@ -17,6 +18,7 @@ mod frequency; mod import; mod keyframes; mod length; +mod math; mod media; mod selector; mod supports; @@ -34,6 +36,7 @@ pub fn compressor() -> impl VisitMut { struct Compressor { ctx: Ctx, need_utf8_at_rule: bool, + in_supports_conidition: bool, } impl Compressor { @@ -166,9 +169,21 @@ impl VisitMut for Compressor { self.compress_media_in_parens(n); } - fn visit_mut_supports_condition(&mut self, n: &mut SupportsCondition) { + fn visit_mut_media_feature_value(&mut self, n: &mut MediaFeatureValue) { n.visit_mut_children_with(self); + self.compress_calc_sum_in_media_feature_value(n); + } + + fn visit_mut_supports_condition(&mut self, n: &mut SupportsCondition) { + let old_in_support_condition = self.in_supports_conidition; + + self.in_supports_conidition = true; + + n.visit_mut_children_with(self); + + self.in_supports_conidition = old_in_support_condition; + self.compress_supports_condition(n); } @@ -178,6 +193,12 @@ impl VisitMut for Compressor { self.compress_supports_in_parens(n); } + fn visit_mut_size_feature_value(&mut self, n: &mut SizeFeatureValue) { + n.visit_mut_children_with(self); + + self.compress_calc_sum_in_size_feature_value(n); + } + fn visit_mut_keyframe_selector(&mut self, n: &mut KeyframeSelector) { n.visit_mut_children_with(self); diff --git a/crates/swc_css_minifier/tests/fixture/compress-at-rule/media/output.min.css b/crates/swc_css_minifier/tests/fixture/compress-at-rule/media/output.min.css index 2ea914f8161..2090964c368 100644 --- a/crates/swc_css_minifier/tests/fixture/compress-at-rule/media/output.min.css +++ b/crates/swc_css_minifier/tests/fixture/compress-at-rule/media/output.min.css @@ -1 +1 @@ -@media print{body{font-size:10pt}}@media print{body{font-size:10pt}}@media(min-width:900px){a{color:red}}@media only screen and (min-width:320px){body{line-height:1.4}}@media(400px<=width<=700px){body{line-height:1.4}}@media screen and (min-width:900px){article{padding:1rem 3rem}}@media(height>600px){body{line-height:1.4}}@media(400px<=width<=700px){body{line-height:1.4}}@media(foo:bar){body{line-height:1.4}}@media(min-width:30em)and (orientation:landscape){.test{color:red}}@media screen and (min-width:30em)and (orientation:landscape){.test{color:red}}@media screen and (min-width:30em)and (max-width:300px)and (orientation:landscape){.test{color:red}}@media(min-height:680px),screen and (orientation:portrait){.test{color:red}}@media(not (color))or (hover){.test{color:red}}@media only screen and ((min-width:320px)and (max-width:1480px)){body{background:red}}@media((min-width:320px)and (max-width:1480px)){body{background:red}}@media((min-width:320px)or (max-width:1480px)){body{background:red}}@media(min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media(min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media(min-width:320px)or (max-width:1480px)or (orientation:landscape){body{background:red}}@media(min-width:320px)or (max-width:1480px)or (orientation:landscape){body{background:red}}@media screen and (min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media screen and (min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media not (resolution:-300dpi){body{background:green}}@media(grid)and (max-width:15em){body{background:green}}@media(max-width:calc(5px + 1rem)){body{color:red}}@media(-webkit-calc(10px + 100px)600px){body{line-height:1.4}}@media(400px<=width<=700px){body{line-height:1.4}}@media(foo:bar){body{line-height:1.4}}@media(min-width:30em)and (orientation:landscape){.test{color:red}}@media screen and (min-width:30em)and (orientation:landscape){.test{color:red}}@media screen and (min-width:30em)and (max-width:300px)and (orientation:landscape){.test{color:red}}@media(min-height:680px),screen and (orientation:portrait){.test{color:red}}@media(not (color))or (hover){.test{color:red}}@media only screen and ((min-width:320px)and (max-width:1480px)){body{background:red}}@media((min-width:320px)and (max-width:1480px)){body{background:red}}@media((min-width:320px)or (max-width:1480px)){body{background:red}}@media(min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media(min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media(min-width:320px)or (max-width:1480px)or (orientation:landscape){body{background:red}}@media(min-width:320px)or (max-width:1480px)or (orientation:landscape){body{background:red}}@media screen and (min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media screen and (min-width:320px)and (max-width:1480px)and (orientation:landscape){body{background:red}}@media not (resolution:-300dpi){body{background:green}}@media(grid)and (max-width:15em){body{background:green}}@media(max-width:calc(5px + 1rem)){body{color:red}}@media(110px= calc(100px + 100px)) { + /* only applies when an inline-size container is available */ + h2 { font-size: calc(1.2em + 1cqi); } +} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/container-condition/output.min.css b/crates/swc_css_minifier/tests/fixture/compress-calc/container-condition/output.min.css new file mode 100644 index 00000000000..4fd480e392b --- /dev/null +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/container-condition/output.min.css @@ -0,0 +1 @@ +@container(inline-size>=200px){h2{font-size:calc(1.2em + 1cqi)}} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/container/input.css b/crates/swc_css_minifier/tests/fixture/compress-calc/container/input.css new file mode 100644 index 00000000000..966d756e23c --- /dev/null +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/container/input.css @@ -0,0 +1,31 @@ +@container (inline-size >= 0px) { + h2 { font-size: calc(1cqw + 1cqw); } +} + +@container (inline-size >= 0px) { + h2 { font-size: calc(1cqh + 1cqh); } +} + +@container (inline-size >= 0px) { + h2 { font-size: calc(1cqi + 1cqi); } +} + +@container (inline-size >= 0px) { + h2 { font-size: calc(1cqb + 1cqb); } +} + +@container (inline-size >= 0px) { + h2 { font-size: calc(1cqmin + 1cqmin); } +} + +@container (inline-size >= 0px) { + h2 { font-size: calc(1cqmax + 1cqmax); } +} + +@container (inline-size >= calc(100px + 100px)) { + h2 { font-size: calc(1cqw + 1cqw); } +} + +@container (inline-size >= calc(calc(100px + 100px))) { + h2 { font-size: calc(1cqw + 1cqw); } +} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/container/output.min.css b/crates/swc_css_minifier/tests/fixture/compress-calc/container/output.min.css new file mode 100644 index 00000000000..f189d960d0d --- /dev/null +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/container/output.min.css @@ -0,0 +1 @@ +@container(inline-size>=0px){h2{font-size:2cqw}}@container(inline-size>=0px){h2{font-size:2cqh}}@container(inline-size>=0px){h2{font-size:2cqi}}@container(inline-size>=0px){h2{font-size:2cqb}}@container(inline-size>=0px){h2{font-size:2cqmin}}@container(inline-size>=0px){h2{font-size:2cqmax}}@container(inline-size>=200px){h2{font-size:2cqw}}@container(inline-size>=calc(200px)){h2{font-size:2cqw}} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/input.css b/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/input.css index c8dd9d7973f..0227679f0ad 100644 --- a/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/input.css +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/input.css @@ -3,3 +3,15 @@ color: red; } } + +@media (min-width: calc(calc(10px + 10px))) { + .class1 { + color: red; + } +} + +@media (color: calc(0 + 1)) { + .class1 { + color: red; + } +} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/output.min.css b/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/output.min.css index 4b718c1cf78..4d8cdca0c89 100644 --- a/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/output.min.css +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/media-query/output.min.css @@ -1 +1 @@ -@media(min-width:calc(10px + 10px)){.class1{color:red}} +@media(min-width:20px){.class1{color:red}}@media(min-width:calc(20px)){.class1{color:red}}@media(color:1){.class1{color:red}} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/input.css b/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/input.css index 7bc17088912..606f408d14e 100644 --- a/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/input.css +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/input.css @@ -148,3 +148,7 @@ .class36 { width: calc(1.1E+1px + 1.1E+1px); } + +.class37 { + width: calc(calc(calc(100px + 100px))); +} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/output.min.css b/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/output.min.css index 768b15b2dcd..b7ead97c203 100644 --- a/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/output.min.css +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/simple-calc/output.min.css @@ -1 +1 @@ -.class1{width:2px}.class2{width:2px;height:5px}.class3{width:1.5rem}.class4{width:2em}.class5{width:calc(2ex/2)}.class6{width:60px}.class7{width:calc(-0px + 100%)}.class8{width:calc(200px - 100%)}.class9{width:2px}.class10{width:2px}.class11{width:3rem}.class12{width:calc(100% + 1px)}.class13{width:calc(2rem - .14285em)}@supports(width:calc(100% - constant(safe-area-inset-left))){.class14{width:calc(100% - constant(safe-area-inset-left))}}.class15{width:calc(100% + 1163.5px - 75.37%)}.class16{width:calc(((100% + 123.5px)/.7537 - 100vw + 60px)/2 + 30px)}.class17{width:calc(75.37% - 763.5px)}.class18{width:calc(1163.5px - 10%)}.class19{width:calc((1em - calc(10px + 1em))/2)}.class20{width:200px}.class21{width:0}.class22{width:200px}.class23{width:calc(200px/1)}.class24{width:-200px}.class25{width:0}.class26{width:-200px}.class27{width:calc(200px/-1)}.class28{width:200px}.class29{width:200px}.class30{width:200px}.class31{width:22px}.class32{width:200px}.class33{width:22e9px}.class34{width:90px}.class35{width:100%}.class36{width:22px} +.class1{width:2px}.class2{width:2px;height:5px}.class3{width:1.5rem}.class4{width:2em}.class5{width:calc(2ex/2)}.class6{width:60px}.class7{width:calc(-0px + 100%)}.class8{width:calc(200px - 100%)}.class9{width:2px}.class10{width:2px}.class11{width:3rem}.class12{width:calc(100% + 1px)}.class13{width:calc(2rem - .14285em)}@supports(width:calc(100% - constant(safe-area-inset-left))){.class14{width:calc(100% - constant(safe-area-inset-left))}}.class15{width:calc(100% + 1163.5px - 75.37%)}.class16{width:calc(((100% + 123.5px)/.7537 - 100vw + 60px)/2 + 30px)}.class17{width:calc(75.37% - 763.5px)}.class18{width:calc(1163.5px - 10%)}.class19{width:calc((1em - calc(10px + 1em))/2)}.class20{width:200px}.class21{width:0}.class22{width:200px}.class23{width:calc(200px/1)}.class24{width:-200px}.class25{width:0}.class26{width:-200px}.class27{width:calc(200px/-1)}.class28{width:200px}.class29{width:200px}.class30{width:200px}.class31{width:22px}.class32{width:200px}.class33{width:22e9px}.class34{width:90px}.class35{width:100%}.class36{width:22px}.class37{width:calc(calc(200px))} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/input.css b/crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/input.css new file mode 100644 index 00000000000..f55b590878c --- /dev/null +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/input.css @@ -0,0 +1,11 @@ +@supports (width: calc(100px + 100px)) { + div { + background: red; + } +} + +@supports (width: calc(calc(100px + 100px))) { + div { + background: red; + } +} diff --git a/crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/output.min.css b/crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/output.min.css new file mode 100644 index 00000000000..14549a5a521 --- /dev/null +++ b/crates/swc_css_minifier/tests/fixture/compress-calc/supports-condition/output.min.css @@ -0,0 +1 @@ +@supports(width:calc(200px)){div{background:red}}@supports(width:calc(calc(200px))){div{background:red}} diff --git a/crates/swc_css_parser/src/parser/at_rule.rs b/crates/swc_css_parser/src/parser/at_rule.rs index 0c86652f514..20903b0aafb 100644 --- a/crates/swc_css_parser/src/parser/at_rule.rs +++ b/crates/swc_css_parser/src/parser/at_rule.rs @@ -1879,7 +1879,14 @@ where tok!("ident") => Ok(MediaFeatureValue::Ident(self.parse()?)), tok!("dimension") => Ok(MediaFeatureValue::Dimension(self.parse()?)), Token::Function { value, .. } if is_math_function(value) => { - Ok(MediaFeatureValue::Function(self.parse()?)) + let ctx = Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }; + + Ok(MediaFeatureValue::Function( + self.with_ctx(ctx).parse_as::()?, + )) } _ => Err(Error::new( span, @@ -2492,7 +2499,14 @@ where tok!("ident") => Ok(SizeFeatureValue::Ident(self.parse()?)), tok!("dimension") => Ok(SizeFeatureValue::Dimension(self.parse()?)), Token::Function { value, .. } if is_math_function(value) => { - Ok(SizeFeatureValue::Function(self.parse()?)) + let ctx = Ctx { + block_contents_grammar: BlockContentsGrammar::DeclarationValue, + ..self.ctx + }; + + Ok(SizeFeatureValue::Function( + self.with_ctx(ctx).parse_as::()?, + )) } _ => Err(Error::new( span, diff --git a/crates/swc_css_parser/tests/fixture/at-rule/container/input.css b/crates/swc_css_parser/tests/fixture/at-rule/container/input.css index e01addec060..5e117a752d8 100644 --- a/crates/swc_css_parser/tests/fixture/at-rule/container/input.css +++ b/crates/swc_css_parser/tests/fixture/at-rule/container/input.css @@ -129,3 +129,5 @@ main, aside { } } } + +@container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} diff --git a/crates/swc_css_parser/tests/fixture/at-rule/container/output.json b/crates/swc_css_parser/tests/fixture/at-rule/container/output.json index 98dc2bf234d..7f318eef3ee 100644 --- a/crates/swc_css_parser/tests/fixture/at-rule/container/output.json +++ b/crates/swc_css_parser/tests/fixture/at-rule/container/output.json @@ -2,7 +2,7 @@ "type": "Stylesheet", "span": { "start": 1, - "end": 2395, + "end": 2467, "ctxt": 0 }, "rules": [ @@ -6787,6 +6787,369 @@ } ] } + }, + { + "type": "AtRule", + "span": { + "start": 2396, + "end": 2466, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 2397, + "end": 2406, + "ctxt": 0 + }, + "value": "container", + "raw": "container" + }, + "prelude": { + "type": "ContainerCondition", + "span": { + "start": 2406, + "end": 2432, + "ctxt": 0 + }, + "name": null, + "query": { + "type": "ContainerQuery", + "span": { + "start": 2406, + "end": 2432, + "ctxt": 0 + }, + "queries": [ + { + "type": "SizeFeatureRange", + "span": { + "start": 2406, + "end": 2432, + "ctxt": 0 + }, + "left": { + "type": "Ident", + "span": { + "start": 2407, + "end": 2418, + "ctxt": 0 + }, + "value": "inline-size", + "raw": "inline-size" + }, + "comparison": ">=", + "right": { + "type": "Function", + "span": { + "start": 2420, + "end": 2431, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 2420, + "end": 2424, + "ctxt": 0 + }, + "value": "calc", + "raw": "calc" + }, + "value": [ + { + "type": "CalcSum", + "span": { + "start": 2425, + "end": 2430, + "ctxt": 0 + }, + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 2425, + "end": 2430, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 2425, + "end": 2430, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 2425, + "end": 2428, + "ctxt": 0 + }, + "value": 200.0, + "raw": "200" + }, + "unit": { + "type": "Ident", + "span": { + "start": 2428, + "end": 2430, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + } + ] + } + ] + } + } + ] + } + }, + "block": { + "type": "SimpleBlock", + "span": { + "start": 2432, + "end": 2466, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 2432, + "end": 2433, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [ + { + "type": "QualifiedRule", + "span": { + "start": 2433, + "end": 2465, + "ctxt": 0 + }, + "prelude": { + "type": "SelectorList", + "span": { + "start": 2433, + "end": 2435, + "ctxt": 0 + }, + "children": [ + { + "type": "ComplexSelector", + "span": { + "start": 2433, + "end": 2435, + "ctxt": 0 + }, + "children": [ + { + "type": "CompoundSelector", + "span": { + "start": 2433, + "end": 2435, + "ctxt": 0 + }, + "nestingSelector": null, + "typeSelector": { + "type": "TagNameSelector", + "span": { + "start": 2433, + "end": 2435, + "ctxt": 0 + }, + "name": { + "type": "WqName", + "span": { + "start": 2433, + "end": 2435, + "ctxt": 0 + }, + "prefix": null, + "value": { + "type": "Ident", + "span": { + "start": 2433, + "end": 2435, + "ctxt": 0 + }, + "value": "h2", + "raw": "h2" + } + } + }, + "subclassSelectors": [] + } + ] + } + ] + }, + "block": { + "type": "SimpleBlock", + "span": { + "start": 2435, + "end": 2465, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 2435, + "end": 2436, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [ + { + "type": "Declaration", + "span": { + "start": 2436, + "end": 2464, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 2436, + "end": 2445, + "ctxt": 0 + }, + "value": "font-size", + "raw": "font-size" + }, + "value": [ + { + "type": "Function", + "span": { + "start": 2446, + "end": 2464, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 2446, + "end": 2450, + "ctxt": 0 + }, + "value": "calc", + "raw": "calc" + }, + "value": [ + { + "type": "CalcSum", + "span": { + "start": 2451, + "end": 2463, + "ctxt": 0 + }, + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 2451, + "end": 2456, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 2451, + "end": 2456, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 2451, + "end": 2454, + "ctxt": 0 + }, + "value": 1.2, + "raw": "1.2" + }, + "unit": { + "type": "Ident", + "span": { + "start": 2454, + "end": 2456, + "ctxt": 0 + }, + "value": "em", + "raw": "em" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 2457, + "end": 2458, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 2459, + "end": 2463, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 2459, + "end": 2463, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 2459, + "end": 2460, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + }, + "unit": { + "type": "Ident", + "span": { + "start": 2460, + "end": 2463, + "ctxt": 0 + }, + "value": "cqi", + "raw": "cqi" + } + } + ] + } + ] + } + ] + } + ], + "important": null + } + ] + } + } + ] + } } ] } diff --git a/crates/swc_css_parser/tests/fixture/at-rule/container/span.rust-debug b/crates/swc_css_parser/tests/fixture/at-rule/container/span.rust-debug index bdc681724a2..4008c029079 100644 --- a/crates/swc_css_parser/tests/fixture/at-rule/container/span.rust-debug +++ b/crates/swc_css_parser/tests/fixture/at-rule/container/span.rust-debug @@ -131,7 +131,9 @@ 128 | | background-color: skyblue; 129 | | } 130 | | } - 131 | `-> } + 131 | | } + 132 | | + 133 | `-> @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} `---- x Rule @@ -6392,3 +6394,357 @@ 128 | background-color: skyblue; : ^^^^^^^ `---- + + x Rule + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x AtRule + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x AtRuleName + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^ + `---- + + x Function + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x ComponentValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcSum + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x LBrace + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^ + `---- + + x ComponentValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x Rule + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x QualifiedRule + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x SelectorList + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x ComplexSelector + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x CompoundSelector + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x TypeSelector + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x TagNameSelector + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x WqName + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x LBrace + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^ + `---- + + x ComponentValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x StyleBlock + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x Declaration + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x DeclarationName + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^ + `---- + + x ComponentValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^ + `---- + + x Function + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x ComponentValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^ + `---- + + x CalcSum + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^^^^^^^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^ + `---- + + x CalcOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/container/input.css:133:1] + 133 | @container(inline-size>=calc(200px)){h2{font-size:calc(1.2em + 1cqi)}} + : ^^^ + `---- diff --git a/crates/swc_css_parser/tests/fixture/at-rule/media/input.css b/crates/swc_css_parser/tests/fixture/at-rule/media/input.css index 2041c03647e..12cadeddcf0 100644 --- a/crates/swc_css_parser/tests/fixture/at-rule/media/input.css +++ b/crates/swc_css_parser/tests/fixture/at-rule/media/input.css @@ -147,3 +147,5 @@ @media (aspect-ratio: 12/) {} @media func(100px) {} @media screen and func(100px) {} +@media(min-width:calc(10px + 10px)) {} +@media (width > calc(220px + 100px)) {} diff --git a/crates/swc_css_parser/tests/fixture/at-rule/media/output.json b/crates/swc_css_parser/tests/fixture/at-rule/media/output.json index 18803efe31e..b8e8bbc881a 100644 --- a/crates/swc_css_parser/tests/fixture/at-rule/media/output.json +++ b/crates/swc_css_parser/tests/fixture/at-rule/media/output.json @@ -2,7 +2,7 @@ "type": "Stylesheet", "span": { "start": 1, - "end": 4690, + "end": 4769, "ctxt": 0 }, "rules": [ @@ -13778,77 +13778,99 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4168, - "end": 4171, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 5.0, - "raw_value": "5", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4171, - "end": 4172, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4172, - "end": 4173, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4173, - "end": 4174, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4174, "end": 4178, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 1.0, - "raw_value": "1", - "unit": "rem", - "raw_unit": "rem", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4168, + "end": 4171, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4168, + "end": 4171, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4168, + "end": 4169, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4169, + "end": 4171, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4172, + "end": 4173, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4174, + "end": 4178, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4174, + "end": 4178, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4174, + "end": 4175, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4175, + "end": 4178, + "ctxt": 0 + }, + "value": "rem", + "raw": "rem" + } + } + ] } - } + ] } ] } @@ -13957,74 +13979,71 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4205, - "end": 4213, - "ctxt": 0 - }, - "token": { - "Ident": { - "value": "Infinity", - "raw": "Infinity" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4213, - "end": 4214, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4214, - "end": 4215, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "*" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4215, - "end": 4216, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4216, "end": 4219, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 1.0, - "raw_value": "1", - "unit": "px", - "raw_unit": "px", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4205, + "end": 4219, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Ident", + "span": { + "start": 4205, + "end": 4213, + "ctxt": 0 + }, + "value": "Infinity", + "raw": "Infinity" + }, + { + "type": "CalcOperator", + "span": { + "start": 4214, + "end": 4215, + "ctxt": 0 + }, + "value": "*" + }, + { + "type": "Length", + "span": { + "start": 4216, + "end": 4219, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4216, + "end": 4217, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4217, + "end": 4219, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] } - } + ] } ] } @@ -14132,77 +14151,99 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4249, - "end": 4252, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 5.0, - "raw_value": "5", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4252, - "end": 4253, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4253, - "end": 4254, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4254, - "end": 4255, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4255, "end": 4259, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 1.0, - "raw_value": "1", - "unit": "rem", - "raw_unit": "rem", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4249, + "end": 4252, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4249, + "end": 4252, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4249, + "end": 4250, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4250, + "end": 4252, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4253, + "end": 4254, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4255, + "end": 4259, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4255, + "end": 4259, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4255, + "end": 4256, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4256, + "end": 4259, + "ctxt": 0 + }, + "value": "rem", + "raw": "rem" + } + } + ] } - } + ] } ] } @@ -14310,77 +14351,99 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4285, - "end": 4288, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 5.0, - "raw_value": "5", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4288, - "end": 4289, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4289, - "end": 4290, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4290, - "end": 4291, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4291, "end": 4295, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 1.0, - "raw_value": "1", - "unit": "rem", - "raw_unit": "rem", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4285, + "end": 4288, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4285, + "end": 4288, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4285, + "end": 4286, + "ctxt": 0 + }, + "value": 5.0, + "raw": "5" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4286, + "end": 4288, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4289, + "end": 4290, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4291, + "end": 4295, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4291, + "end": 4295, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4291, + "end": 4292, + "ctxt": 0 + }, + "value": 1.0, + "raw": "1" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4292, + "end": 4295, + "ctxt": 0 + }, + "value": "rem", + "raw": "rem" + } + } + ] } - } + ] } ] } @@ -14478,77 +14541,99 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4314, - "end": 4319, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 100.0, - "raw_value": "100", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4319, - "end": 4320, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4320, - "end": 4321, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4321, - "end": 4322, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4322, "end": 4326, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 10.0, - "raw_value": "10", - "unit": "px", - "raw_unit": "px", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4314, + "end": 4319, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4314, + "end": 4319, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4314, + "end": 4317, + "ctxt": 0 + }, + "value": 100.0, + "raw": "100" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4317, + "end": 4319, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4320, + "end": 4321, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4322, + "end": 4326, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4322, + "end": 4326, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4322, + "end": 4324, + "ctxt": 0 + }, + "value": 10.0, + "raw": "10" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4324, + "end": 4326, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] } - } + ] } ] }, @@ -14583,77 +14668,99 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4344, - "end": 4350, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 1000.0, - "raw_value": "1000", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4350, - "end": 4351, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4351, - "end": 4352, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4352, - "end": 4353, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4353, "end": 4357, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 10.0, - "raw_value": "10", - "unit": "px", - "raw_unit": "px", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4344, + "end": 4350, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4344, + "end": 4350, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4344, + "end": 4348, + "ctxt": 0 + }, + "value": 1000.0, + "raw": "1000" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4348, + "end": 4350, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4351, + "end": 4352, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4353, + "end": 4357, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4353, + "end": 4357, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4353, + "end": 4355, + "ctxt": 0 + }, + "value": 10.0, + "raw": "10" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4355, + "end": 4357, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] } - } + ] } ] } @@ -14751,77 +14858,99 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4384, - "end": 4388, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 10.0, - "raw_value": "10", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4388, - "end": 4389, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4389, - "end": 4390, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4390, - "end": 4391, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4391, "end": 4396, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 100.0, - "raw_value": "100", - "unit": "px", - "raw_unit": "px", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4384, + "end": 4388, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4384, + "end": 4388, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4384, + "end": 4386, + "ctxt": 0 + }, + "value": 10.0, + "raw": "10" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4386, + "end": 4388, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4389, + "end": 4390, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4391, + "end": 4396, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4391, + "end": 4396, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4391, + "end": 4394, + "ctxt": 0 + }, + "value": 100.0, + "raw": "100" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4394, + "end": 4396, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] } - } + ] } ] }, @@ -14856,77 +14985,99 @@ }, "value": [ { - "type": "PreservedToken", + "type": "CalcSum", "span": { "start": 4414, - "end": 4420, - "ctxt": 0 - }, - "token": { - "Dimension": { - "value": 1000.0, - "raw_value": "1000", - "unit": "px", - "raw_unit": "px", - "type": "integer" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4420, - "end": 4421, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4421, - "end": 4422, - "ctxt": 0 - }, - "token": { - "Delim": { - "value": "+" - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4422, - "end": 4423, - "ctxt": 0 - }, - "token": { - "WhiteSpace": { - "value": " " - } - } - }, - { - "type": "PreservedToken", - "span": { - "start": 4423, "end": 4427, "ctxt": 0 }, - "token": { - "Dimension": { - "value": 10.0, - "raw_value": "10", - "unit": "px", - "raw_unit": "px", - "type": "integer" + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4414, + "end": 4420, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4414, + "end": 4420, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4414, + "end": 4418, + "ctxt": 0 + }, + "value": 1000.0, + "raw": "1000" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4418, + "end": 4420, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4421, + "end": 4422, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4423, + "end": 4427, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4423, + "end": 4427, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4423, + "end": 4425, + "ctxt": 0 + }, + "value": 10.0, + "raw": "10" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4425, + "end": 4427, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] } - } + ] } ] } @@ -16096,6 +16247,407 @@ }, "value": [] } + }, + { + "type": "AtRule", + "span": { + "start": 4690, + "end": 4728, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 4691, + "end": 4696, + "ctxt": 0 + }, + "value": "media", + "raw": "media" + }, + "prelude": { + "type": "MediaQueryList", + "span": { + "start": 4696, + "end": 4725, + "ctxt": 0 + }, + "queries": [ + { + "type": "MediaQuery", + "span": { + "start": 4696, + "end": 4725, + "ctxt": 0 + }, + "modifier": null, + "mediaType": null, + "keyword": null, + "condition": { + "type": "MediaCondition", + "span": { + "start": 4696, + "end": 4725, + "ctxt": 0 + }, + "conditions": [ + { + "type": "MediaFeaturePlain", + "span": { + "start": 4696, + "end": 4725, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 4697, + "end": 4706, + "ctxt": 0 + }, + "value": "min-width", + "raw": "min-width" + }, + "value": { + "type": "Function", + "span": { + "start": 4707, + "end": 4724, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 4707, + "end": 4711, + "ctxt": 0 + }, + "value": "calc", + "raw": "calc" + }, + "value": [ + { + "type": "CalcSum", + "span": { + "start": 4712, + "end": 4723, + "ctxt": 0 + }, + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4712, + "end": 4716, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4712, + "end": 4716, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4712, + "end": 4714, + "ctxt": 0 + }, + "value": 10.0, + "raw": "10" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4714, + "end": 4716, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4717, + "end": 4718, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4719, + "end": 4723, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4719, + "end": 4723, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4719, + "end": 4721, + "ctxt": 0 + }, + "value": 10.0, + "raw": "10" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4721, + "end": 4723, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + } + ] + } + ] + } + } + ] + } + } + ] + }, + "block": { + "type": "SimpleBlock", + "span": { + "start": 4726, + "end": 4728, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 4726, + "end": 4727, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [] + } + }, + { + "type": "AtRule", + "span": { + "start": 4729, + "end": 4768, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 4730, + "end": 4735, + "ctxt": 0 + }, + "value": "media", + "raw": "media" + }, + "prelude": { + "type": "MediaQueryList", + "span": { + "start": 4736, + "end": 4765, + "ctxt": 0 + }, + "queries": [ + { + "type": "MediaQuery", + "span": { + "start": 4736, + "end": 4765, + "ctxt": 0 + }, + "modifier": null, + "mediaType": null, + "keyword": null, + "condition": { + "type": "MediaCondition", + "span": { + "start": 4736, + "end": 4765, + "ctxt": 0 + }, + "conditions": [ + { + "type": "MediaFeatureRange", + "span": { + "start": 4736, + "end": 4765, + "ctxt": 0 + }, + "left": { + "type": "Ident", + "span": { + "start": 4737, + "end": 4742, + "ctxt": 0 + }, + "value": "width", + "raw": "width" + }, + "comparison": ">", + "right": { + "type": "Function", + "span": { + "start": 4745, + "end": 4764, + "ctxt": 0 + }, + "name": { + "type": "Ident", + "span": { + "start": 4745, + "end": 4749, + "ctxt": 0 + }, + "value": "calc", + "raw": "calc" + }, + "value": [ + { + "type": "CalcSum", + "span": { + "start": 4750, + "end": 4763, + "ctxt": 0 + }, + "expressions": [ + { + "type": "CalcProduct", + "span": { + "start": 4750, + "end": 4755, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4750, + "end": 4755, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4750, + "end": 4753, + "ctxt": 0 + }, + "value": 220.0, + "raw": "220" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4753, + "end": 4755, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + }, + { + "type": "CalcOperator", + "span": { + "start": 4756, + "end": 4757, + "ctxt": 0 + }, + "value": "+" + }, + { + "type": "CalcProduct", + "span": { + "start": 4758, + "end": 4763, + "ctxt": 0 + }, + "expressions": [ + { + "type": "Length", + "span": { + "start": 4758, + "end": 4763, + "ctxt": 0 + }, + "value": { + "type": "Number", + "span": { + "start": 4758, + "end": 4761, + "ctxt": 0 + }, + "value": 100.0, + "raw": "100" + }, + "unit": { + "type": "Ident", + "span": { + "start": 4761, + "end": 4763, + "ctxt": 0 + }, + "value": "px", + "raw": "px" + } + } + ] + } + ] + } + ] + } + } + ] + } + } + ] + }, + "block": { + "type": "SimpleBlock", + "span": { + "start": 4766, + "end": 4768, + "ctxt": 0 + }, + "name": { + "type": "PreservedToken", + "span": { + "start": 4766, + "end": 4767, + "ctxt": 0 + }, + "token": "LBrace" + }, + "value": [] + } } ] } diff --git a/crates/swc_css_parser/tests/fixture/at-rule/media/span.rust-debug b/crates/swc_css_parser/tests/fixture/at-rule/media/span.rust-debug index 77d31bf78a1..a00c884a11b 100644 --- a/crates/swc_css_parser/tests/fixture/at-rule/media/span.rust-debug +++ b/crates/swc_css_parser/tests/fixture/at-rule/media/span.rust-debug @@ -149,7 +149,9 @@ 146 | | @media screen and (min-width: ) {} 147 | | @media (aspect-ratio: 12/) {} 148 | | @media func(100px) {} - 149 | `-> @media screen and func(100px) {} + 149 | | @media screen and func(100px) {} + 150 | | @media(min-width:calc(10px + 10px)) {} + 151 | `-> @media (width > calc(220px + 100px)) {} `---- x Rule @@ -14869,63 +14871,123 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} - : ^^^ + : ^^^^^^^^^^ `---- - x Dimension { value: 5.0, raw_value: Atom('5' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^^^^^^^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} : ^^^ `---- - x ComponentValue + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} - : ^ + : ^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} - : ^ + : ^^^ `---- - x ComponentValue + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} : ^ `---- - x Delim { value: '+' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] - 133 | @media (width > calc(5px + 1rem)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] - 133 | @media (width > calc(5px + 1rem)) {} - : ^ - `---- - - x ComponentValue + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} : ^^^^ `---- - x Dimension { value: 1.0, raw_value: Atom('1' type=inline), unit: Atom('rem' type=static), raw_unit: Atom('rem' type=static), type_flag: Integer } + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} : ^^^^ `---- + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] + 133 | @media (width > calc(5px + 1rem)) {} + : ^^^ + `---- + x SimpleBlock ,-[$DIR/tests/fixture/at-rule/media/input.css:133:1] 133 | @media (width > calc(5px + 1rem)) {} @@ -15037,63 +15099,93 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} - : ^^^^^^^^ + : ^^^^^^^^^^^^^^ `---- - x Ident { value: Atom('Infinity' type=static), raw: Atom('Infinity' type=static) } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] + 134 | @media (width < calc(Infinity * 1px)) {} + : ^^^^^^^^^^^^^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] + 134 | @media (width < calc(Infinity * 1px)) {} + : ^^^^^^^^^^^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] + 134 | @media (width < calc(Infinity * 1px)) {} + : ^^^^^^^^^^^^^^ + `---- + + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} : ^^^^^^^^ `---- - x ComponentValue + x CalcValue ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} - : ^ + : ^^^^^^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x Ident ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} - : ^ + : ^^^^^^^^ `---- - x ComponentValue + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} : ^ `---- - x Delim { value: '*' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] - 134 | @media (width < calc(Infinity * 1px)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] - 134 | @media (width < calc(Infinity * 1px)) {} - : ^ - `---- - - x ComponentValue + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} : ^^^ `---- - x Dimension { value: 1.0, raw_value: Atom('1' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcValue ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} : ^^^ `---- + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] + 134 | @media (width < calc(Infinity * 1px)) {} + : ^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] + 134 | @media (width < calc(Infinity * 1px)) {} + : ^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] + 134 | @media (width < calc(Infinity * 1px)) {} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] + 134 | @media (width < calc(Infinity * 1px)) {} + : ^^ + `---- + x SimpleBlock ,-[$DIR/tests/fixture/at-rule/media/input.css:134:1] 134 | @media (width < calc(Infinity * 1px)) {} @@ -15205,63 +15297,123 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} - : ^^^ + : ^^^^^^^^^^ `---- - x Dimension { value: 5.0, raw_value: Atom('5' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^^^^^^^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} : ^^^ `---- - x ComponentValue + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} - : ^ + : ^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} - : ^ + : ^^^ `---- - x ComponentValue + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} : ^ `---- - x Delim { value: '+' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] - 135 | @media (max-width: calc(5px + 1rem)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] - 135 | @media (max-width: calc(5px + 1rem)) {} - : ^ - `---- - - x ComponentValue + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} : ^^^^ `---- - x Dimension { value: 1.0, raw_value: Atom('1' type=inline), unit: Atom('rem' type=static), raw_unit: Atom('rem' type=static), type_flag: Integer } + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} : ^^^^ `---- + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] + 135 | @media (max-width: calc(5px + 1rem)) {} + : ^^^ + `---- + x SimpleBlock ,-[$DIR/tests/fixture/at-rule/media/input.css:135:1] 135 | @media (max-width: calc(5px + 1rem)) {} @@ -15373,63 +15525,123 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} - : ^^^ + : ^^^^^^^^^^ `---- - x Dimension { value: 5.0, raw_value: Atom('5' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^^^^^^^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} : ^^^ `---- - x ComponentValue + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} - : ^ + : ^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} - : ^ + : ^^^ `---- - x ComponentValue + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} : ^ `---- - x Delim { value: '+' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] - 136 | @media (width: calc(5px + 1rem)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] - 136 | @media (width: calc(5px + 1rem)) {} - : ^ - `---- - - x ComponentValue + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} : ^^^^ `---- - x Dimension { value: 1.0, raw_value: Atom('1' type=inline), unit: Atom('rem' type=static), raw_unit: Atom('rem' type=static), type_flag: Integer } + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} : ^^^^ `---- + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] + 136 | @media (width: calc(5px + 1rem)) {} + : ^^^ + `---- + x SimpleBlock ,-[$DIR/tests/fixture/at-rule/media/input.css:136:1] 136 | @media (width: calc(5px + 1rem)) {} @@ -15529,63 +15741,123 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^^^^^ + : ^^^^^^^^^^^^ `---- - x Dimension { value: 100.0, raw_value: Atom('100' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^^^^^^^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^^^^^ `---- - x ComponentValue + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^^ `---- - x ComponentValue + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^ `---- - x Delim { value: '+' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] - 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] - 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x ComponentValue + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^^^^ `---- - x Dimension { value: 10.0, raw_value: Atom('10' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^^^^ `---- + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + x MediaFeatureName ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} @@ -15619,63 +15891,123 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^^^^^^ + : ^^^^^^^^^^^^^ `---- - x Dimension { value: 1000.0, raw_value: Atom('1000' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^^^^^^^^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^^^^^^ `---- - x ComponentValue + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^^^ `---- - x ComponentValue + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^ `---- - x Delim { value: '+' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] - 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] - 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x ComponentValue + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^^^^ `---- - x Dimension { value: 10.0, raw_value: Atom('10' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} : ^^^^ `---- + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] + 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + x SimpleBlock ,-[$DIR/tests/fixture/at-rule/media/input.css:137:1] 137 | @media (calc(100px + 10px) < width <= calc(1000px + 10px)) {} @@ -15775,63 +16107,123 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^^^^ + : ^^^^^^^^^^^^ `---- - x Dimension { value: 10.0, raw_value: Atom('10' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^^^^^^^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^^^^ `---- - x ComponentValue + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^ `---- - x ComponentValue + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^ `---- - x Delim { value: '+' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] - 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] - 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x ComponentValue + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^^^^^ `---- - x Dimension { value: 100.0, raw_value: Atom('100' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^^^^^ `---- + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + x MediaFeatureName ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} @@ -15865,63 +16257,123 @@ x ComponentValue ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^^^^^^ + : ^^^^^^^^^^^^^ `---- - x Dimension { value: 1000.0, raw_value: Atom('1000' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^^^^^^^^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^^^^^^ `---- - x ComponentValue + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^^^ `---- - x WhiteSpace { value: Atom(' ' type=inline) } + x CalcValueOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ + : ^^^^^^ `---- - x ComponentValue + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^ `---- - x Delim { value: '+' } + x CalcOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^ `---- - x ComponentValue - ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] - 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x WhiteSpace { value: Atom(' ' type=inline) } - ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] - 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} - : ^ - `---- - - x ComponentValue + x CalcProductOrOperator ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^^^^ `---- - x Dimension { value: 10.0, raw_value: Atom('10' type=inline), unit: Atom('px' type=static), raw_unit: Atom('px' type=static), type_flag: Integer } + x CalcProduct ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} : ^^^^ `---- + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] + 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} + : ^^ + `---- + x SimpleBlock ,-[$DIR/tests/fixture/at-rule/media/input.css:138:1] 138 | @media (-webkit-calc(10px + 100px) < width <= calc(1000px + 10px)) {} @@ -16959,3 +17411,459 @@ 149 | @media screen and func(100px) {} : ^ `---- + + x Rule + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x AtRule + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x AtRuleName + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^ + `---- + + x MediaQueryList + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaQuery + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaCondition + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaConditionAllType + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaInParens + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaFeature + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaFeaturePlain + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaFeatureName + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^ + `---- + + x MediaFeatureValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^ + `---- + + x Function + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x ComponentValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^ + `---- + + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^^^^^^^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^ + `---- + + x CalcOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^^ + `---- + + x LBrace + ,-[$DIR/tests/fixture/at-rule/media/input.css:150:1] + 150 | @media(min-width:calc(10px + 10px)) {} + : ^ + `---- + + x Rule + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x AtRule + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x AtRuleName + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x MediaQueryList + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaQuery + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaCondition + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaConditionAllType + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaInParens + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaFeature + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaFeatureRange + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + `---- + + x MediaFeatureValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x MediaFeatureValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^ + `---- + + x Function + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^^^^^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^ + `---- + + x ComponentValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^ + `---- + + x CalcSum + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^^^^^^^^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^ + `---- + + x CalcOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^ + `---- + + x CalcProductOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x CalcProduct + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x CalcValueOrOperator + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x CalcValue + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Dimension + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Length + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^^^ + `---- + + x Number + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^^ + `---- + + x Ident + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^ + `---- + + x SimpleBlock + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^^ + `---- + + x LBrace + ,-[$DIR/tests/fixture/at-rule/media/input.css:151:1] + 151 | @media (width > calc(220px + 100px)) {} + : ^ + `----