Truly independent web browser
LibWeb: Do not add stroke-dasharray values when compositing
Andreas Kling7c07fd035025
diff --git a/Libraries/LibWeb/Rust/src/css/animation.rs b/Libraries/LibWeb/Rust/src/css/animation.rsindex c654517489a..60e84b34720 100644--- a/Libraries/LibWeb/Rust/src/css/animation.rs+++ b/Libraries/LibWeb/Rust/src/css/animation.rs@@ -99,6 +99,27 @@ const NONNEGATIVE_LENGTH_RANGE: &[NumericRangeOverride] = &[NumericRangeOverridemax: f32::MAX as f64,}];+// https://svgwg.org/svg2-draft/painting.html#StrokeDashing+// If any value in the list is negative, the <dasharray> value is invalid.+// NB: So the values that interpolating dash lists produces are clamped to be non-negative.+const STROKE_DASHARRAY_RANGES: &[NumericRangeOverride] = &[+ NumericRangeOverride {+ value_type: VALUE_TYPE_LENGTH,+ min: 0.0,+ max: f32::MAX as f64,+ },+ NumericRangeOverride {+ value_type: VALUE_TYPE_PERCENTAGE,+ min: 0.0,+ max: f32::MAX as f64,+ },+ NumericRangeOverride {+ value_type: VALUE_TYPE_NUMBER,+ min: 0.0,+ max: f32::MAX as f64,+ },+];+#[repr(C)]pub struct FfiAnimationValueResult {pub value: *const StyleValueData,@@ -1395,18 +1416,37 @@ fn retained_calculation(fn retained_length_percentage_calculation(calculation: Arc<crate::css::calc::CalcNode>,resolved_type: crate::css::calc::FfiNumericType,+ range_overrides: &[NumericRangeOverride],) -> RetainedStyleValueData {+ let range = |value_type: u8| {+ range_overrides+ .iter()+ .find(|range| range.value_type == value_type)+ .map(|range| (range.min, range.max))+ };let value = match &*calculation {crate::css::calc::CalcNode::Numeric(crate::css::calc::CalcNumericValue::Length { value, unit }) => {StyleValueData::Length {- value: *value,+ value: clamp_to_range(*value, range(VALUE_TYPE_LENGTH)),unit: *unit,}}crate::css::calc::CalcNode::Numeric(crate::css::calc::CalcNumericValue::Percentage(value)) => {- StyleValueData::Percentage { value: *value }+ StyleValueData::Percentage {+ value: clamp_to_range(*value, range(VALUE_TYPE_PERCENTAGE)),+ }+ }+ _ => {+ let mut value = crate::css::calc::length_percentage_calculated_style_value(calculation, resolved_type);+ if let StyleValueData::Calculated { accepted_ranges, .. } = &mut value {+ *accepted_ranges = crate::css::style_value::RetainedNumericRangeList::from_numeric_ranges(+ [VALUE_TYPE_LENGTH, VALUE_TYPE_PERCENTAGE]+ .into_iter()+ .filter_map(|value_type| range(value_type).map(|(min, max)| (value_type, min, max))),+ );+ }+ value}- _ => crate::css::calc::length_percentage_calculated_style_value(calculation, resolved_type),};RetainedStyleValueData::from_arc(Arc::new(value))}@@ -1445,7 +1485,7 @@ fn interpolate_translate_component(let from = length_percentage_calculation_node(from)?;let to = length_percentage_calculation_node(to)?;let (calculation, resolved_type) = crate::css::calc::interpolate_length_percentage_calculations(from, to, delta)?;- Some(retained_length_percentage_calculation(calculation, resolved_type))+ Some(retained_length_percentage_calculation(calculation, resolved_type, &[]))}fn decode_translate_components(value: &StyleValueData) -> Option<Vec<RetainedStyleValueData>> {@@ -1889,7 +1929,7 @@ fn composite_grid_component({// https://drafts.csswg.org/css-values-4/#combine-mixed// Addition of <percentage> is defined the same as interpolation except by adding each component rather than interpolating it.- return retained_length_percentage_calculation(calculation, resolved_type);+ return retained_length_percentage_calculation(calculation, resolved_type, &[]);}animated.clone_retained()@@ -3509,7 +3549,7 @@ fn composite_scalar_value({// https://drafts.csswg.org/css-values-4/#combine-mixed// Addition of <percentage> is defined the same as interpolation except by adding each component rather than interpolating it.- return handled_retained_value(retained_length_percentage_calculation(calculation, resolved_type));+ return handled_retained_value(retained_length_percentage_calculation(calculation, resolved_type, &[]));}match (underlying, animated) {@@ -4178,7 +4218,11 @@ fn interpolate_scalar_value(&& let Some((calculation, resolved_type)) =crate::css::calc::interpolate_length_percentage_calculations(from, to, delta){- return handled_retained_value(retained_length_percentage_calculation(calculation, resolved_type));+ return handled_retained_value(retained_length_percentage_calculation(+ calculation,+ resolved_type,+ range_overrides,+ ));}match (from, to) {@@ -7614,7 +7658,12 @@ pub(crate) fn interpolate_value(for index in 0..list_size {let from_value = from_list.map_or(from, |(values, _, _)| values[index % from_length].data());let to_value = to_list.map_or(to, |(values, _, _)| values[index % to_length].data());- let result = interpolate_scalar_value(property_id, from_value, to_value, delta, &[]);+ let ranges = if is_stroke_dasharray {+ STROKE_DASHARRAY_RANGES+ } else {+ &[]+ };+ let result = interpolate_scalar_value(property_id, from_value, to_value, delta, ranges);let Some(result_value) = result.into_value() else {return discrete_value(context, from, to, delta);};@@ -7867,6 +7916,10 @@ fn composite_batch_value<'a>(composite_scalar_value(underlying, animated, operation)}).unwrap_or_else(handled_without_value)+ } else if property_id == crate::css::property_metadata::property_id::STROKE_DASHARRAY {+ // https://svgwg.org/svg2-draft/painting.html#StrokeDashing+ // stroke-dasharray values are not additive.+ handled_without_value()} else if property_id == crate::css::property_metadata::property_id::OFFSET_PATH {composite_offset_path(underlying, animated, operation).map_or_else(handled_without_value, owned)} else if property_id == crate::css::property_metadata::property_id::OFFSET_ROTATE {diff --git a/Libraries/LibWeb/Rust/src/css/style_value.rs b/Libraries/LibWeb/Rust/src/css/style_value.rsindex ace5217deab..2f85d6e8059 100644--- a/Libraries/LibWeb/Rust/src/css/style_value.rs+++ b/Libraries/LibWeb/Rust/src/css/style_value.rs@@ -1483,6 +1483,20 @@ impl RetainedNumericRangeList {Self { pointer, length }}+ pub(crate) fn from_numeric_ranges(ranges: impl IntoIterator<Item = (u8, f64, f64)>) -> Self {+ let ranges = ranges+ .into_iter()+ .map(|(value_type, min, max)| RetainedNumericRangeByType { value_type, min, max })+ .collect::<Vec<_>>();+ if ranges.is_empty() {+ return Self::empty();+ }+ let ranges = ranges.into_boxed_slice();+ let length = ranges.len();+ let pointer = Box::into_raw(ranges) as *mut RetainedNumericRangeByType;+ Self { pointer, length }+ }+pub(crate) fn as_slice(&self) -> &[RetainedNumericRangeByType] {if self.pointer.is_null() {return &[];diff --git a/Tests/LibWeb/Text/expected/SVG/stroke-dasharray-interpolation-calc-clamped.txt b/Tests/LibWeb/Text/expected/SVG/stroke-dasharray-interpolation-calc-clamped.txtnew file mode 100644index 00000000000..07dc47528d4--- /dev/null+++ b/Tests/LibWeb/Text/expected/SVG/stroke-dasharray-interpolation-calc-clamped.txt@@ -0,0 +1,3 @@+stroke-dasharray: calc(-20.000005% + 12px), 10px+isPointInStroke(5, 50): false+isPointInStroke(50, 50): falsediff --git a/Tests/LibWeb/Text/expected/wpt-import/svg/painting/animations/stroke-dasharray-composition.txt b/Tests/LibWeb/Text/expected/wpt-import/svg/painting/animations/stroke-dasharray-composition.txtindex 578fed7a1e7..c0a03b08dc6 100644--- a/Tests/LibWeb/Text/expected/wpt-import/svg/painting/animations/stroke-dasharray-composition.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/svg/painting/animations/stroke-dasharray-composition.txt@@ -2,64 +2,63 @@ Harness status: OKFound 136 tests-84 Pass-52 Fail-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.6) should be [ 0 0]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.4) should be [ 0 1]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.2) should be [ 0 3]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0) should be [ 0 5]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.2) should be [ 2 7]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.4) should be [ 4 9]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.6) should be [ 6 11]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.8) should be [ 8 13]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1) should be [10 15]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1.2) should be [12 17]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.6) should be [ 0 0]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.4) should be [ 0 1]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.2) should be [ 0 3]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0) should be [ 0 5]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.2) should be [ 2 7]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.4) should be [ 4 9]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.6) should be [ 6 11]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.8) should be [ 8 13]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1) should be [10 15]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1.2) should be [12 17]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.6) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.4) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.2) should be [5 10]+136 Pass+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.6) should be [ 0 0]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.4) should be [ 0 1]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.2) should be [ 0 3]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0) should be [ 0 5]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.2) should be [ 2 7]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.4) should be [ 4 9]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.6) should be [ 6 11]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.8) should be [ 8 13]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1) should be [10 15]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1.2) should be [12 17]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.6) should be [ 0 0]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.4) should be [ 0 1]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (-0.2) should be [ 0 3]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0) should be [ 0 5]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.2) should be [ 2 7]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.4) should be [ 4 9]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.6) should be [ 6 11]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (0.8) should be [ 8 13]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1) should be [10 15]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5 5] from add [0 5] to add [10 15] at (1.2) should be [12 17]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.6) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.4) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.2) should be [5 10]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.2) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.4) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.6) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.8) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1) should be [5 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1.2) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.6) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.4) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.2) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.2) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.4) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.6) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.8) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1) should be [5 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1.2) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.6) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.4) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (-0.2) should be [5 10]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.2) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.4) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.6) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.8) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1) should be [5 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1.2) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.2) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.4) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.6) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (0.8) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1) should be [5 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 10] from replace [5 10] to add [5 10] at (1.2) should be [5 10]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (-1.5) should be [none]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (-0.5) should be [none]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0) should be [none]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.4) should be [none]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.5) should be [10 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.6) should be [10 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1) should be [10 10]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1.5) should be [10 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.5) should be [10 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.6) should be [10 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1) should be [10 10]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1.5) should be [10 10]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (-1.5) should be [none]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (-0.5) should be [none]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0) should be [none]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.4) should be [none]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.5) should be [10 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.6) should be [10 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1) should be [10 10]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1.5) should be [10 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.5) should be [10 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (0.6) should be [10 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1) should be [10 10]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from add [none] to add [10 10] at (1.5) should be [10 10]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [0 5] from add [5] to replace [15 20 25] at (-0.2) should be [3 2 1]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [0 5] from add [5] to replace [15 20 25] at (0) should be [5 5 5]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [0 5] from add [5] to replace [15 20 25] at (0.2) should be [7 8 9]@@ -76,22 +75,22 @@ Pass Compositing Web Animations: property <stroke-dasharray> underlying [0 5] frPass Compositing Web Animations: property <stroke-dasharray> underlying [0 5] from add [5] to replace [15 20 25] at (0.8) should be [13 17 21]Pass Compositing Web Animations: property <stroke-dasharray> underlying [0 5] from add [5] to replace [15 20 25] at (1) should be [15 20 25]Pass Compositing Web Animations: property <stroke-dasharray> underlying [0 5] from add [5] to replace [15 20 25] at (1.2) should be [17 23 29]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (-0.2) should be [ 3 12 13 22 0 8 15 24 1 10 11 20]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (-0.2) should be [ 3 12 13 22 0 8 15 24 1 10 11 20]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0) should be [ 5 10 15 20 5 10 15 20 5 10 15 20]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.2) should be [ 7 8 17 18 11 12 15 16 9 10 19 20]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.4) should be [ 9 6 19 16 17 14 15 12 13 10 23 20]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.6) should be [11 4 21 14 23 16 15 8 17 10 27 20]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.8) should be [13 2 23 12 29 18 15 4 21 10 31 20]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (1) should be [15 0 25 10 35 20 15 0 25 10 35 20]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (1.2) should be [17 0 27 8 41 22 15 0 29 10 39 20]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (-0.2) should be [ 3 12 13 22 0 8 15 24 1 10 11 20]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (1.2) should be [17 0 27 8 41 22 15 0 29 10 39 20]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (-0.2) should be [ 3 12 13 22 0 8 15 24 1 10 11 20]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0) should be [ 5 10 15 20 5 10 15 20 5 10 15 20]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.2) should be [ 7 8 17 18 11 12 15 16 9 10 19 20]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.4) should be [ 9 6 19 16 17 14 15 12 13 10 23 20]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.6) should be [11 4 21 14 23 16 15 8 17 10 27 20]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (0.8) should be [13 2 23 12 29 18 15 4 21 10 31 20]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (1) should be [15 0 25 10 35 20 15 0 25 10 35 20]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (1.2) should be [17 0 27 8 41 22 15 0 29 10 39 20]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 30] from replace [5 10 15 20] to add [15 0 25 10 35 20] at (1.2) should be [17 0 27 8 41 22 15 0 29 10 39 20]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 20] from replace [5 10 15] to add [10 5 20 15] at (-0.2) should be [ 4 11 14 3 10 17 2 9 16 5 8 15]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 20] from replace [5 10 15] to add [10 5 20 15] at (0) should be [ 5 10 15 5 10 15 5 10 15 5 10 15]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [10 20] from replace [5 10 15] to add [10 5 20 15] at (0.2) should be [ 6 9 16 7 10 13 8 11 14 5 12 15]@@ -108,7 +107,7 @@ Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 20]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 20] from replace [5 10 15] to add [10 5 20 15] at (0.8) should be [ 9 6 19 13 10 7 17 14 11 5 18 15]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 20] from replace [5 10 15] to add [10 5 20 15] at (1) should be [10 5 20 15 10 5 20 15 10 5 20 15]Pass Compositing Web Animations: property <stroke-dasharray> underlying [10 20] from replace [5 10 15] to add [10 5 20 15] at (1.2) should be [11 4 21 17 10 3 23 16 9 5 22 15]-Fail Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (-0.2) should be [ 0 2 7 0 0 9 0 1 6 0 3 8 0 0 5]+Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (-0.2) should be [ 0 2 7 0 0 9 0 1 6 0 3 8 0 0 5]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (0) should be [ 0 5 10 0 5 10 0 5 10 0 5 10 0 5 10]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (0.2) should be [ 3 8 13 6 11 11 4 9 14 7 7 12 5 10 15]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (0.4) should be [ 6 11 16 12 17 12 8 13 18 14 9 14 10 15 20]@@ -116,7 +115,7 @@ Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5] fromPass Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (0.8) should be [12 17 22 24 29 14 16 21 26 28 13 18 20 25 30]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (1) should be [15 20 25 30 35 15 20 25 30 35 15 20 25 30 35]Pass Compositing CSS Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (1.2) should be [18 23 28 36 41 16 24 29 34 42 17 22 30 35 40]-Fail Compositing Web Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (-0.2) should be [ 0 2 7 0 0 9 0 1 6 0 3 8 0 0 5]+Pass Compositing Web Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (-0.2) should be [ 0 2 7 0 0 9 0 1 6 0 3 8 0 0 5]Pass Compositing Web Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (0) should be [ 0 5 10 0 5 10 0 5 10 0 5 10 0 5 10]Pass Compositing Web Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (0.2) should be [ 3 8 13 6 11 11 4 9 14 7 7 12 5 10 15]Pass Compositing Web Animations: property <stroke-dasharray> underlying [5] from add [0 5 10] to add [15 20 25 30 35] at (0.4) should be [ 6 11 16 12 17 12 8 13 18 14 9 14 10 15 20]diff --git a/Tests/LibWeb/Text/input/SVG/stroke-dasharray-interpolation-calc-clamped.html b/Tests/LibWeb/Text/input/SVG/stroke-dasharray-interpolation-calc-clamped.htmlnew file mode 100644index 00000000000..c12711c2ca9--- /dev/null+++ b/Tests/LibWeb/Text/input/SVG/stroke-dasharray-interpolation-calc-clamped.html@@ -0,0 +1,22 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<svg width="100" height="100">+ <line id="line" x1="0" y1="50" x2="100" y2="50" stroke="black" stroke-width="4" style="stroke-dasharray: 100% 10"></line>+</svg>+<script>+ test(() => {+ const line = document.getElementById("line");+ // NB: The easing makes the interpolation progress 1.2 halfway through, so the first dash is+ // calc(-20% + 12px), which resolves to -8px before clamping.+ const animation = line.animate([{ strokeDasharray: "100% 10" }, { strokeDasharray: "10px 10" }], {+ duration: 1000,+ easing: "linear(0, 1.2 50%, 1)",+ });+ animation.pause();+ animation.currentTime = 500;+ println(`stroke-dasharray: ${getComputedStyle(line).strokeDasharray}`);+ // A zero-length dash followed by a gap paints nothing, so no point is in the stroke.+ println(`isPointInStroke(5, 50): ${line.isPointInStroke({ x: 5, y: 50 })}`);+ println(`isPointInStroke(50, 50): ${line.isPointInStroke({ x: 50, y: 50 })}`);+ });+</script>