Skip to content

Truly independent web browser

LibWeb: Apply the offset transform of CSS Motion Path

Andreas Kling45196b507de1
diff --git a/Libraries/LibGfx/Path.cpp b/Libraries/LibGfx/Path.cpp
index 3a1811a15fb..b4547a11f9d 100644
--- a/Libraries/LibGfx/Path.cpp
+++ b/Libraries/LibGfx/Path.cpp
@@ -25,6 +25,7 @@ void ladybird_gfx_path_append_svg_string(void const*, void (*)(void*, char const
void ladybird_gfx_path_bounding_box(void const*, float*);
void ladybird_gfx_path_serialize(void const*, void (*)(void*, u8 const*, size_t), void*);
float ladybird_gfx_path_length(void const*);
+bool ladybird_gfx_path_point_at_length(void const*, float, float*);
void* ladybird_gfx_path_create_from_ops(u8 const* kinds, float const* values, size_t count);
void ladybird_gfx_path_append_ops(void*, u8 const* kinds, float const* values, size_t count);
void ladybird_gfx_path_append_path(void*, void const* other);
@@ -111,6 +112,18 @@ extern "C" float ladybird_gfx_path_length(void const* path)
return static_cast<Gfx::Path const*>(path)->length();
}
+extern "C" bool ladybird_gfx_path_point_at_length(void const* path, float distance, float* out)
+{
+ auto point = static_cast<Gfx::Path const*>(path)->point_at_length(distance);
+ if (!point.has_value())
+ return false;
+ out[0] = point->point.x();
+ out[1] = point->point.y();
+ out[2] = point->tangent.x();
+ out[3] = point->tangent.y();
+ return true;
+}
+
enum class PathBuilderOpKind : u8 {
MoveTo,
LineTo,
diff --git a/Libraries/LibGfx/Rust/src/path.rs b/Libraries/LibGfx/Rust/src/path.rs
index 0b938831a50..ddf4f10653f 100644
--- a/Libraries/LibGfx/Rust/src/path.rs
+++ b/Libraries/LibGfx/Rust/src/path.rs
@@ -39,6 +39,7 @@ unsafe extern "C" {
dash_offset: f32,
) -> *mut c_void;
fn ladybird_gfx_path_length(path: *const c_void) -> f32;
+ fn ladybird_gfx_path_point_at_length(path: *const c_void, distance: f32, out: *mut f32) -> bool;
fn ladybird_gfx_path_create_from_ops(kinds: *const u8, values: *const f32, count: usize) -> *mut c_void;
fn ladybird_gfx_path_append_ops(path: *mut c_void, kinds: *const u8, values: *const f32, count: usize);
fn ladybird_gfx_path_append_path(path: *mut c_void, other: *const c_void);
@@ -432,6 +433,13 @@ impl OwnedPath {
unsafe { ladybird_gfx_path_length(self.raw.as_ptr()) }
}
+ /// The point at the given distance along the path, followed by the path's tangent there.
+ pub fn point_at_length(&self, distance: f32) -> Option<[f32; 4]> {
+ let mut out = [0.0f32; 4];
+ // SAFETY: The path is live for the duration of the call; the out-array holds four floats.
+ unsafe { ladybird_gfx_path_point_at_length(self.raw.as_ptr(), distance, out.as_mut_ptr()) }.then_some(out)
+ }
+
pub fn copy_transformed(&self, affine_values: [f32; 6]) -> OwnedPath {
// SAFETY: The path is live for the call; the result is a fresh heap-allocated Gfx::Path.
unsafe {
diff --git a/Libraries/LibWeb/Rust/src/gfx_test_stubs.rs b/Libraries/LibWeb/Rust/src/gfx_test_stubs.rs
index 07f5e321ad0..a98eab840aa 100644
--- a/Libraries/LibWeb/Rust/src/gfx_test_stubs.rs
+++ b/Libraries/LibWeb/Rust/src/gfx_test_stubs.rs
@@ -126,6 +126,11 @@ extern "C" fn ladybird_gfx_path_length(_path: *const c_void) -> f32 {
unreachable!("no unit test builds a path");
}
+#[unsafe(no_mangle)]
+extern "C" fn ladybird_gfx_path_point_at_length(_path: *const c_void, _distance: f32, _out: *mut f32) -> bool {
+ unreachable!("no unit test builds a path");
+}
+
#[unsafe(no_mangle)]
extern "C" fn ladybird_gfx_path_place_glyph_runs_along(
_path: *const c_void,
diff --git a/Libraries/LibWeb/Rust/src/painting/style_queries.rs b/Libraries/LibWeb/Rust/src/painting/style_queries.rs
index 311bdf25461..c4b0617eae3 100644
--- a/Libraries/LibWeb/Rust/src/painting/style_queries.rs
+++ b/Libraries/LibWeb/Rust/src/painting/style_queries.rs
@@ -241,6 +241,11 @@ fn style_establishes_fixed_positioning_containing_block(
if (!transform.scale.pointer.is_null() || will_change(b"scale")) && transformable() {
return true;
}
+ // https://drafts.csswg.org/motion-1/#offset-path-property
+ // All the usual effects of having a transform apply (such as creating a stacking context, etc.)
+ if (transform.has_offset_path || will_change(b"offset-path")) && transformable() {
+ return true;
+ }
if (transform.has_perspective || will_change(b"perspective")) && transformable() {
return true;
@@ -348,7 +353,8 @@ pub(crate) fn has_css_transform(arena: &impl PaintRead, node: NodeSlotId, style:
let has_transform = !transform.transformations.pointer.is_null()
|| !transform.rotate.pointer.is_null()
|| !transform.translate.pointer.is_null()
- || !transform.scale.pointer.is_null();
+ || !transform.scale.pointer.is_null()
+ || transform.has_offset_path;
has_transform && is_transformable(arena, node)
}
@@ -725,6 +731,11 @@ pub(crate) fn establishes_stacking_context(arena: &impl PaintRead, node: NodeSlo
if !transform.scale.pointer.is_null() || will_change(b"scale") {
return true;
}
+ // https://drafts.csswg.org/motion-1/#offset-path-property
+ // All the usual effects of having a transform apply (such as creating a stacking context, etc.)
+ if transform.has_offset_path || will_change(b"offset-path") {
+ return true;
+ }
}
if has_z_index
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rs
index a0b8622f6dd..4a9ddd07dc3 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rs
@@ -16,7 +16,7 @@ use crate::painting::{paintable_geometry, style_queries};
use libgfx_rust::WindingRule;
use libgfx_rust::path::{OwnedPath, PathBuilder};
-mod basic_shape_kind {
+pub(super) mod basic_shape_kind {
pub const INSET: u8 = 0;
pub const CIRCLE: u8 = 3;
pub const ELLIPSE: u8 = 4;
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rs
index 3f78475412b..627930fcd2f 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/dirty.rs
@@ -22,6 +22,7 @@ pub enum VisualContextBoxDirtyKind {
ScrollableOverflowFlipped = 7,
ReattachedInLayoutTree = 8,
DefaultScrollShiftInputsChanged = 9,
+ OffsetPathContainingBlockChanged = 10,
}
impl VisualContextBoxDirtyKind {
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/incremental.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/incremental.rs
index 71904e582d1..701846b8395 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/incremental.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/incremental.rs
@@ -69,6 +69,7 @@ struct WorkPlan {
fn expand_dirty_entries(
layout_arena: &impl PaintableRowsRead,
dirty: &VisualContextDirtySet,
+ offset_path_boxes: &HashSet<NodeSlotId>,
) -> Result<WorkPlan, VisualContextUpdateScope> {
let mut work: HashMap<NodeSlotId, BoxDirtyBits> = HashMap::default();
for (slot, bits) in &dirty.boxes {
@@ -122,6 +123,24 @@ fn expand_dirty_entries(
ancestor = layout_arena.node_parent_if_live(parent);
}
}
+ // The offset transform of a box with an offset path depends on the geometry and style of its containing block,
+ // so the box is rebuilt whenever its containing block is.
+ let offset_path_boxes_to_rebuild: Vec<_> = offset_path_boxes
+ .iter()
+ .copied()
+ .filter(|slot| {
+ !work.contains_key(slot)
+ && layout_arena.paintable_row_is_populated(*slot)
+ && layout_arena
+ .node_containing_block_if_live(*slot)
+ .is_some_and(|containing_block| work.contains_key(&containing_block))
+ })
+ .collect();
+ for slot in offset_path_boxes_to_rebuild {
+ work.entry(slot)
+ .or_default()
+ .insert(VisualContextBoxDirtyKind::OffsetPathContainingBlockChanged);
+ }
let mut plan = WorkPlan {
work,
revalidate_children_of,
@@ -413,7 +432,7 @@ pub(crate) fn update_visual_context_tree<Arena: PaintableRowsRead>(
let plan = if scope.rebuilds_every_box() {
WorkPlan::default()
} else {
- match expand_dirty_entries(layout_arena, &state.dirty_boxes) {
+ match expand_dirty_entries(layout_arena, &state.dirty_boxes, &state.offset_path_boxes) {
Ok(plan) => plan,
Err(reason) => return IncrementalUpdateResult::NeedsFullBuild(reason),
}
@@ -427,6 +446,9 @@ pub(crate) fn update_visual_context_tree<Arena: PaintableRowsRead>(
"removed handles name nodes of the discarded tree"
);
tombstone_removed_blocks(std::sync::Arc::make_mut(tree), &state.dirty_boxes, &mut delta);
+ if scope.rebuilds_every_box() {
+ state.offset_path_boxes.clear();
+ }
let environment = BoxBuildEnvironment {
layout_arena,
@@ -540,6 +562,14 @@ pub(crate) fn update_visual_context_tree<Arena: PaintableRowsRead>(
},
);
let (handles, reconcile) = writer.finish();
+ if layout_arena
+ .node_style_if_live(slot)
+ .is_some_and(|style| style.transform().has_offset_path)
+ {
+ state.offset_path_boxes.insert(slot);
+ } else {
+ state.offset_path_boxes.remove(&slot);
+ }
let new_output = assignment.record.output_for_descendants;
assignment.node_handles = handles;
assignment.record.owns_geometry_dependent_nodes =
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/mod.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/mod.rs
index b51aa39219d..f059d671beb 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/mod.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/mod.rs
@@ -15,6 +15,7 @@ pub mod dirty;
pub mod dump;
pub mod incremental;
pub mod node_values;
+pub mod offset_transform;
pub mod reconcile;
pub mod records;
pub mod refresh;
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs
index 8f54e348207..fa22fdacd3d 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs
@@ -150,7 +150,7 @@ pub(crate) fn compute_transform(
};
let transform_values = style.transform();
- let style_has_transform = transform_values.resolved_transforms.length != 0;
+ let style_has_transform = transform_values.resolved_transforms.length != 0 || transform_values.has_offset_path;
let has_transform_node_input = style_has_transform
|| additional_element_transform.is_some()
|| style_queries::will_change_promotes_transform_node(style);
@@ -177,15 +177,36 @@ pub(crate) fn compute_transform(
// 3. Translate by the computed X, Y, and Z values of translate.
// 4. Rotate by the computed <angle> about the specified axis of rotate.
// 5. Scale by the computed X, Y, and Z values of scale.
- // FIXME: 6. Translate and rotate by the transform specified by offset.
+ // 6. Translate and rotate by the transform specified by offset.
// 7. Multiply by each of the transform functions in transform from left to right.
// NB: The resolved transform list carries translate, rotate, scale, and the
// transform functions pre-lowered in exactly that order.
- let mut matrix = multiply_transform_functions(
- translation_matrix(0.0, 0.0, origin_z),
- transform_values.resolved_transforms.as_slice(),
- reference_box,
- );
+ let resolved_transforms = transform_values.resolved_transforms.as_slice();
+ let mut matrix = translation_matrix(0.0, 0.0, origin_z);
+ if transform_values.has_offset_path {
+ let individual_transform_count = [
+ &transform_values.translate,
+ &transform_values.rotate,
+ &transform_values.scale,
+ ]
+ .into_iter()
+ .filter(|handle| !handle.pointer.is_null())
+ .count();
+ let (individual_transforms, transform_functions) = resolved_transforms.split_at(individual_transform_count);
+ matrix = multiply_transform_functions(matrix, individual_transforms, reference_box);
+ if let Some(offset_transform) = super::offset_transform::compute_offset_transform(
+ style,
+ layout_arena,
+ node,
+ reference_box,
+ (origin_x.to_double(), origin_y.to_double()),
+ ) {
+ matrix = matrix.multiplied(offset_transform);
+ }
+ matrix = multiply_transform_functions(matrix, transform_functions, reference_box);
+ } else {
+ matrix = multiply_transform_functions(matrix, resolved_transforms, reference_box);
+ }
// The x and y properties of <use> define an additional translation applied after any
// transformations specified with other properties.
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/offset_transform.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/offset_transform.rs
new file mode 100644
index 00000000000..27962a89715
--- /dev/null
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/offset_transform.rs
@@ -0,0 +1,402 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+//! https://drafts.csswg.org/motion-1/#transform
+//! The offset transform, which places and rotates a box along its offset path.
+
+use crate::css::computed_value_views::{ComputedValuesView, LengthPercentageRef};
+use crate::css::css_enums::keyword;
+use crate::css::css_pixels::{CssPixelRect, CssPixels};
+use crate::css::style_value::{BasicShapeData, OwnedBasicShapeData, RetainedStyleValueData, StyleValueData};
+use crate::layout::node_data::NodeSlotId;
+use crate::painting::paint_read::PaintRead;
+use crate::painting::{paintable_geometry, style_queries};
+use libgfx_rust::{FloatMatrix4x4, rotation_matrix, translation_matrix};
+
+use super::basic_shapes::{basic_shape_kind, position_resolved};
+
+/// A point along an offset path, and the direction of the path there in degrees, clockwise from the positive X axis.
+struct PathPosition {
+ point: (f64, f64),
+ direction: f64,
+}
+
+fn resolve_position(value: &StyleValueData, rect: CssPixelRect) -> Option<(f64, f64)> {
+ if !matches!(value, StyleValueData::Position { .. }) {
+ return None;
+ }
+ let point = position_resolved(Some(value), rect);
+ Some((point.x.to_double(), point.y.to_double()))
+}
+
+/// A computed position at the given point relative to the top left of `rect`.
+fn position_value_at(point: (f64, f64), rect: CssPixelRect) -> StyleValueData {
+ let edge = |offset: f64| {
+ RetainedStyleValueData::from_owned(StyleValueData::Edge {
+ has_edge: false,
+ edge: 0,
+ offset: RetainedStyleValueData::from_owned(StyleValueData::Length {
+ value: offset,
+ unit: crate::css::style_compute::px_length_unit(),
+ }),
+ })
+ };
+ StyleValueData::Position {
+ edge_x: edge(point.0 - rect.x.to_double()),
+ edge_y: edge(point.1 - rect.y.to_double()),
+ }
+}
+
+// https://drafts.csswg.org/motion-1/#offset-path-property
+// In CSS contexts, the boxes being referenced are from the element that establishes the containing block for this
+// element.
+// FIXME: In SVG contexts, all values behave as view-box.
+fn containing_block_reference_box(arena: &impl PaintRead, node: NodeSlotId, coord_box: u16) -> CssPixelRect {
+ let Some(containing_block) = arena.node_containing_block_if_live(node) else {
+ return CssPixelRect::default();
+ };
+ match coord_box {
+ keyword::CONTENT_BOX | keyword::FILL_BOX => paintable_geometry::absolute_rect(arena, containing_block),
+ keyword::PADDING_BOX => paintable_geometry::absolute_padding_box_rect(arena, containing_block),
+ _ => paintable_geometry::absolute_border_box_rect(arena, containing_block),
+ }
+}
+
+/// inset(0 round X), where X is the border-radius of the containing block of `node`.
+fn containing_block_inset_shape(arena: &impl PaintRead, node: NodeSlotId) -> OwnedBasicShapeData {
+ let zero = || {
+ RetainedStyleValueData::from_owned(StyleValueData::Length {
+ value: 0.0,
+ unit: crate::css::style_compute::px_length_unit(),
+ })
+ };
+ let containing_block_style = arena
+ .node_containing_block_if_live(node)
+ .and_then(|containing_block| arena.node_style_if_live(containing_block));
+ let radius = |select: fn(
+ &crate::css::computed_value_types::BorderValues,
+ ) -> &crate::css::computed_value_types::ComputedStyleValueHandle| {
+ let value = containing_block_style
+ .and_then(|style| style_queries::handle_value(select(style.border())))
+ .filter(|value| matches!(value, StyleValueData::BorderRadius { .. }));
+ match value {
+ // SAFETY: The containing block's style keeps the value alive while it gains one.
+ Some(value) => unsafe {
+ RetainedStyleValueData::from_retained_pointer(crate::css::style_value::retain_style_value(value))
+ },
+ None => RetainedStyleValueData::from_owned(StyleValueData::BorderRadius {
+ is_elliptical: false,
+ horizontal_radius: zero(),
+ vertical_radius: zero(),
+ }),
+ }
+ };
+ let radii = StyleValueData::BorderRadiusRect {
+ top_left: radius(|border| &border.border_top_left_radius),
+ top_right: radius(|border| &border.border_top_right_radius),
+ bottom_right: radius(|border| &border.border_bottom_right_radius),
+ bottom_left: radius(|border| &border.border_bottom_left_radius),
+ };
+ OwnedBasicShapeData::new(BasicShapeData {
+ kind: basic_shape_kind::INSET,
+ v0: zero(),
+ v1: zero(),
+ v2: zero(),
+ v3: zero(),
+ v4: RetainedStyleValueData::from_owned(radii),
+ fill_rule: 0,
+ points: crate::css::style_value::RetainedShapePointList::from_retained_points(Vec::new()),
+ path: crate::css::css_path::CssPath::none(),
+ commands: crate::css::style_value::ShapeCommands::default(),
+ })
+}
+
+// https://drafts.csswg.org/motion-1/#ray-function
+fn ray_length(size: u16, origin: (f64, f64), rect: CssPixelRect, angle_degrees: f64) -> f64 {
+ let (left, top) = (rect.x.to_double(), rect.y.to_double());
+ let (right, bottom) = (left + rect.width.to_double(), top + rect.height.to_double());
+ let (x, y) = origin;
+ let side_distances = [(x - left).abs(), (right - x).abs(), (y - top).abs(), (bottom - y).abs()];
+ let corner_distances = [(left, top), (right, top), (right, bottom), (left, bottom)]
+ .map(|(corner_x, corner_y)| (corner_x - x).hypot(corner_y - y));
+ match size {
+ // The distance from the ray's starting point to whichever side of the containing block is closest.
+ keyword::CLOSEST_SIDE => side_distances.into_iter().fold(f64::INFINITY, f64::min),
+ // The distance from the ray's starting point to whichever side of the containing block is farthest.
+ keyword::FARTHEST_SIDE => side_distances.into_iter().fold(0.0, f64::max),
+ // The distance from the ray's starting point to whichever corner of the containing block is closest.
+ keyword::CLOSEST_CORNER => corner_distances.into_iter().fold(f64::INFINITY, f64::min),
+ // The distance from the ray's starting point to whichever corner of the containing block is farthest.
+ keyword::FARTHEST_CORNER => corner_distances.into_iter().fold(0.0, f64::max),
+ // The distance from the ray's starting point to the point where the offset path intersects the containing
+ // block's boundary.
+ // If the ray's starting point is on the containing block's boundary, or outside its bounds entirely, the
+ // distance is zero.
+ _ => {
+ // INTEROP: Other engines measure a ray that starts on the boundary up to where it leaves the containing
+ // block, as long as it points into it.
+ if x < left || x > right || y < top || y > bottom {
+ return 0.0;
+ }
+ let radians = angle_degrees.to_radians();
+ let (dx, dy) = (radians.sin(), -radians.cos());
+ let along = |delta: f64, low: f64, high: f64, position: f64| {
+ if delta > 1e-9 {
+ (high - position) / delta
+ } else if delta < -1e-9 {
+ (low - position) / delta
+ } else {
+ f64::INFINITY
+ }
+ };
+ along(dx, left, right, x).min(along(dy, top, bottom, y))
+ }
+ }
+}
+
+fn angle_degrees(value: &StyleValueData) -> f64 {
+ crate::css::table_group_builder::angle_degrees(value).unwrap_or(0.0)
+}
+
+/// Computes the offset transform of a box with an offset path, in the coordinate space whose origin is the box's
+/// transform origin, as the CSS transform matrix uses it. `reference_box` is the box's transform reference box and
+/// `origin` its transform origin within that box.
+pub(crate) fn compute_offset_transform(
+ style: ComputedValuesView<'_>,
+ arena: &impl PaintRead,
+ node: NodeSlotId,
+ reference_box: CssPixelRect,
+ origin: (f64, f64),
+) -> Option<FloatMatrix4x4> {
+ let transform_values = style.transform();
+ let offset_path = style_queries::handle_value(&transform_values.offset_path)?;
+
+ // offset-path: <offset-path> || <coord-box>
+ // If <coord-box> is omitted, it defaults to border-box.
+ let (path, coord_box) = match offset_path {
+ StyleValueData::Keyword { keyword: keyword::NONE } => return None,
+ StyleValueData::Keyword { keyword } => (None, *keyword),
+ StyleValueData::ValueList { values, .. } => match values.as_slice() {
+ [path, coord_box] => match coord_box.data() {
+ StyleValueData::Keyword { keyword } => (Some(path.data()), *keyword),
+ _ => return None,
+ },
+ _ => return None,
+ },
+ path => (Some(path), keyword::BORDER_BOX),
+ };
+
+ let border_box = paintable_geometry::absolute_border_box_rect(arena, node);
+ let containing_box = containing_block_reference_box(arena, node, coord_box);
+
+ // https://drafts.csswg.org/motion-1/#offset-position-property
+ let offset_position = style_queries::handle_value(&transform_values.offset_position);
+ let starting_position = match offset_position {
+ // normal: The element does not have an offset starting position.
+ Some(StyleValueData::Keyword {
+ keyword: keyword::NORMAL,
+ })
+ | None => None,
+ // auto: The offset starting position is the top-left corner of the box.
+ Some(StyleValueData::Keyword { .. }) => Some((border_box.x.to_double(), border_box.y.to_double())),
+ // <position>: The offset starting position is the result of using the <position> to position a 0x0 object
+ // area within the box's containing block.
+ Some(position) => resolve_position(position, containing_box),
+ };
+
+ let mut is_unbounded_ray = false;
+ let mut is_closed_loop = false;
+ let mut ray_contain_reduction = None;
+ let (path_length, point_at): (f64, Box<dyn Fn(f64) -> PathPosition>) = match path {
+ Some(StyleValueData::Ray {
+ size,
+ contain,
+ angle,
+ position,
+ }) => {
+ // at <position>: Specifies the origin of the ray. If omitted, it uses the offset starting position of the
+ // element. If the element doesn't have an offset starting position either, it behaves as at center.
+ let origin = position
+ .optional_data()
+ .and_then(|position| resolve_position(position, containing_box))
+ .or(starting_position)
+ .unwrap_or((
+ containing_box.x.to_double() + containing_box.width.to_double() / 2.0,
+ containing_box.y.to_double() + containing_box.height.to_double() / 2.0,
+ ));
+ let angle = angle_degrees(angle.data());
+ let mut length = ray_length(*size, origin, containing_box, angle);
+ if *contain {
+ // The length of the offset path is reduced so that the element stays within the containing block
+ // even at offset-distance: 100%. Specifically, the path's length is reduced by half the width or
+ // half the height of the element's border box, whichever is larger, and floored at zero.
+ let reduction = (border_box.width.to_double() / 2.0).max(border_box.height.to_double() / 2.0);
+ length = (length - reduction).max(0.0);
+ ray_contain_reduction = Some(length);
+ } else {
+ is_unbounded_ray = true;
+ }
+ let radians = angle.to_radians();
+ (
+ length,
+ Box::new(move |distance| PathPosition {
+ point: (origin.0 + distance * radians.sin(), origin.1 - distance * radians.cos()),
+ // NB: Bearing angles point up at 0deg, while the path direction is measured from the positive
+ // X axis.
+ direction: angle - 90.0,
+ }),
+ )
+ }
+ _ => {
+ let (gfx_path, closed, offset) = match path {
+ // <basic-shape>: The offset path is the equivalent path of the <basic-shape> function.
+ // https://drafts.csswg.org/motion-1/#paths
+ Some(StyleValueData::BasicShape { shape }) => {
+ let shape = shape.as_ref();
+ if shape.kind == basic_shape_kind::PATH {
+ // NB: Like other engines, the coordinates of a path() start at the offset starting position, or
+ // at the top left of the box when it has none.
+ let start = starting_position.unwrap_or((border_box.x.to_double(), border_box.y.to_double()));
+ let closed = shape
+ .path
+ .parsed()
+ .is_some_and(crate::svg::ParsedPath::ends_with_close_path);
+ (shape.path.to_gfx_path(), closed, start)
+ } else {
+ // For all <basic-shape>s, if they accept an at <position> argument but that argument is omitted,
+ // and the element defines an offset starting position via offset-position, it uses the
+ // specified offset starting position for that argument.
+ let defaulted;
+ let shape = match starting_position {
+ Some(start)
+ if matches!(shape.kind, basic_shape_kind::CIRCLE | basic_shape_kind::ELLIPSE)
+ && shape.v1.optional_data().is_none() =>
+ {
+ let mut data: BasicShapeData = shape.clone();
+ data.v1 = RetainedStyleValueData::from_owned(position_value_at(start, containing_box));
+ defaulted = OwnedBasicShapeData::new(data);
+ defaulted.as_ref()
+ }
+ _ => shape,
+ };
+ // All basic CSS shapes are closed loops.
+ let (shape_path, _) = super::basic_shapes::basic_shape_device_path(shape, containing_box, 1.0);
+ (shape_path, true, (0.0, 0.0))
+ }
+ }
+ // <coord-box>: If <offset-path> is omitted, it defaults to inset(0 round X), where X is the value of
+ // border-radius on the element that establishes the containing block for this element.
+ // FIXME: Follow the corner-shape of the containing block.
+ None => {
+ let shape = containing_block_inset_shape(arena, node);
+ let (shape_path, _) =
+ super::basic_shapes::basic_shape_device_path(shape.as_ref(), containing_box, 1.0);
+ (shape_path, true, (0.0, 0.0))
+ }
+ // <url>: If the URL does not reference a shape element this behaves as path("m 0 0") instead.
+ // FIXME: Use the equivalent path of a referenced SVG shape element.
+ Some(_) => {
+ let mut builder = libgfx_rust::path::PathBuilder::new();
+ builder.move_to(0.0, 0.0);
+ let start = starting_position.unwrap_or((border_box.x.to_double(), border_box.y.to_double()));
+ (builder.build(), false, start)
+ }
+ };
+ is_closed_loop = closed;
+ let length = f64::from(gfx_path.length());
+ (
+ length,
+ Box::new(move |distance| {
+ let Some([x, y, tangent_x, tangent_y]) = gfx_path.point_at_length(distance as f32) else {
+ return PathPosition {
+ point: offset,
+ direction: 0.0,
+ };
+ };
+ let direction = if tangent_x == 0.0 && tangent_y == 0.0 {
+ 0.0
+ } else {
+ f64::from(tangent_y).atan2(f64::from(tangent_x)).to_degrees()
+ };
+ PathPosition {
+ point: (offset.0 + f64::from(x), offset.1 + f64::from(y)),
+ direction,
+ }
+ }),
+ )
+ }
+ };
+
+ // https://drafts.csswg.org/motion-1/#path-distance
+ // 1. Let the total length be the total length of offset path with all sub-paths.
+ // 2. Convert offset distance to pixels, with 100% being converted to total length.
+ let offset_distance = style_queries::handle_value(&transform_values.offset_distance).map_or(0.0, |distance| {
+ LengthPercentageRef::over(distance)
+ .to_px(CssPixels::nearest_value_for(path_length))
+ .to_double()
+ });
+ // 3. If offset path is an unbounded ray: Let used offset distance be equal to offset distance.
+ let used_distance = if is_unbounded_ray {
+ offset_distance
+ } else if let Some(length) = ray_contain_reduction {
+ // Otherwise if offset path is an <angle> path with contain: Let used offset distance be equal to offset
+ // distance, clamped so that the box lies entirely within the path.
+ offset_distance.clamp(0.0, length)
+ } else if !is_closed_loop {
+ // If offset path is any other unclosed interval: Let used offset distance be equal to offset distance clamped
+ // by 0 and the total length of the path.
+ offset_distance.clamp(0.0, path_length)
+ } else if path_length <= 0.0 {
+ // If the total length of the path is 0, used offset distance is also 0.
+ 0.0
+ } else {
+ // Otherwise offset path is a closed loop: Let used offset distance be equal to offset distance modulo the
+ // total length of the path.
+ offset_distance.rem_euclid(path_length)
+ };
+ let PathPosition { point, direction } = point_at(used_distance);
+
+ // https://drafts.csswg.org/motion-1/#offset-anchor-property
+ // auto: The anchor point is the same as the point indicated by transform-origin.
+ // <position>: The anchor point is the result of resolving the <position> against the element's reference box.
+ let anchor = style_queries::handle_value(&transform_values.offset_anchor)
+ .and_then(|anchor| resolve_position(anchor, reference_box))
+ .map_or(origin, |(x, y)| {
+ (x - reference_box.x.to_double(), y - reference_box.y.to_double())
+ });
+
+ // https://drafts.csswg.org/motion-1/#offset-rotate-property
+ let rotation = match style_queries::handle_value(&transform_values.offset_rotate) {
+ // auto <angle>?: The offset transform will have a rotation component equal to the difference between the
+ // offset path's direction at the offset position and the direction of the positive X axis (that is, a line
+ // going toward the right). If specified with an <angle>, the angle is added to the rotation component.
+ Some(StyleValueData::Keyword { keyword: keyword::AUTO }) | None => direction,
+ Some(StyleValueData::ValueList { values, .. }) => match values.as_slice() {
+ [_, angle] => direction + angle_degrees(angle.data()),
+ _ => direction,
+ },
+ // <angle>: When specified on its own, adds a rotation component to the offset transform of the specified
+ // angle.
+ Some(angle) => angle_degrees(angle),
+ };
+
+ // The offset transform is a 2d transform, a translation followed by a rotation:
+ // - Translate the element by the (X, Y) that aligns its anchor point with its offset position.
+ // - Rotate the element by the angle specified by offset-rotate.
+ // NB: The rotation is about the anchor point. In the coordinate space centered on the transform origin, this is
+ // a translation to the offset position, the rotation, and a translation from the anchor point.
+ let translate_x = point.0 - reference_box.x.to_double() - origin.0;
+ let translate_y = point.1 - reference_box.y.to_double() - origin.1;
+ Some(
+ translation_matrix(translate_x as f32, translate_y as f32, 0.0)
+ .multiplied(rotation_matrix([0.0, 0.0, 1.0], rotation.to_radians() as f32))
+ .multiplied(translation_matrix(
+ (origin.0 - anchor.0) as f32,
+ (origin.1 - anchor.1) as f32,
+ 0.0,
+ )),
+ )
+}
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/records.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/records.rs
index 23b2f54c20d..a562535c819 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/records.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/records.rs
@@ -24,6 +24,8 @@ pub struct VisualContextState {
pub quarantined_slots_are_releasable: bool,
// The list the tree was last given, which the next pass compares its own against.
pub published_compositor_animations: Vec<VisualAnimation>,
+ // The boxes whose transform node has an offset path, which depends on the geometry of their containing block.
+ pub offset_path_boxes: crate::fast_hash::FastSet<NodeSlotId>,
}
impl VisualContextState {
diff --git a/Libraries/LibWeb/Rust/src/svg/path_parser.rs b/Libraries/LibWeb/Rust/src/svg/path_parser.rs
index 6335f6b09b9..1723f44e9a3 100644
--- a/Libraries/LibWeb/Rust/src/svg/path_parser.rs
+++ b/Libraries/LibWeb/Rust/src/svg/path_parser.rs
@@ -897,6 +897,11 @@ impl ParsedPath {
Some((commands, points))
}
+ /// Whether the path ends with a closepath command, which makes it a closed loop.
+ pub(crate) fn ends_with_close_path(&self) -> bool {
+ matches!(self.instructions.last(), Some(PathInstruction::ClosePath))
+ }
+
pub(crate) fn serialize(&self) -> String {
let mut output = String::new();
self.serialize_into(&mut output);
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-ref.html
new file mode 100644
index 00000000000..9bc2409061d
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>offset-path path interpolation reference</title>
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: path("M 100 150 L 200 150");
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/animation/reftests/offset-path-with-transforms-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/animation/reftests/offset-path-with-transforms-ref.html
new file mode 100644
index 00000000000..413369e0eff
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/animation/reftests/offset-path-with-transforms-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: Combined transformation matrix interpolation reference</title>
+ <style>
+ #target {
+ width: 50px;
+ height: 100px;
+ background-color: lime;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-distance-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-distance-ref.html
new file mode 100644
index 00000000000..653dd8b1051
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-distance-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ transform: translateX(120px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-001-ref.html
new file mode 100644
index 00000000000..8b86ce26e16
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-001-ref.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;coord-box&gt; &lt;border-box&gt;</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ border-radius: 50%;
+ border: 10px solid black;
+ width: 400px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ transform: translate(260px, 50px);
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-002-ref.html
new file mode 100644
index 00000000000..41f65dc0164
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-002-ref.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;coord-box&gt; &lt;padding-box&gt;</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ border: 10px solid black;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ transform: translate(150px, -150px);
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-003-ref.html
new file mode 100644
index 00000000000..0fa94d4c31b
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-003-ref.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;coord-box&gt; &lt;content-box&gt;</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ border: 10px solid black;
+ padding: 10px;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ transform: translate(150px, -150px);
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-004-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-004-ref.html
new file mode 100644
index 00000000000..60870c815e1
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-coord-box-004-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: path(geometry-box) paths</title>
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: translate(-300px, 0px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-001-ref.html
new file mode 100644
index 00000000000..63c0a2ea883
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-001-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: rotate(45deg) translate(20px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-003-ref.html
new file mode 100644
index 00000000000..7261167cd7f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-003-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <style>
+ #container {
+ width: 400px;
+ height: 400px;
+ }
+ #target {
+ position: relative;
+ left: 100px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: rotate(45deg) translate(100px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-005-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-005-ref.html
new file mode 100644
index 00000000000..525d747053c
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-005-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <style>
+ #container {
+ width: 400px;
+ height: 400px;
+ }
+ #target {
+ position: relative;
+ left: 120px;
+ top: 160px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: rotate(45deg) translate(200px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-007-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-007-ref.html
new file mode 100644
index 00000000000..a48d9f0a2a0
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-007-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <style>
+ #container {
+ width: 400px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 200px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: rotate(90deg) translate(200px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-008-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-008-ref.html
new file mode 100644
index 00000000000..2c3720c44ce
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-008-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ }
+ #target {
+ position: relative;
+ left: 130%;
+ top: 60%;
+ width: 40px;
+ height: 40px;
+ background-color: lime;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-009-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-009-ref.html
new file mode 100644
index 00000000000..95b54368759
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-009-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ }
+ #target {
+ position: relative;
+ left: 130%;
+ top: 60%;
+ width: 40px;
+ height: 40px;
+ background-color: lime;
+ transform: translateY(60px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-011-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-011-ref.html
new file mode 100644
index 00000000000..9a477b26968
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-011-ref.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with offset-position: normal</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ transform: translate(300px, 200px) translateX(10px) rotate(-90deg) translate(50px, -50px);
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-012-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-012-ref.html
new file mode 100644
index 00000000000..dfb34bf784f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-012-ref.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with offset-position specified with position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ transform: translate(-40px, 320px);
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-013-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-013-ref.html
new file mode 100644
index 00000000000..d6bf4c037ba
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-013-ref.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with position and offset-position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ transform: translate(-50px, -130px);
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-014-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-014-ref.html
new file mode 100644
index 00000000000..cd0fab44c36
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-014-ref.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with default position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ transform: translate(150px, -150px);
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-015-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-015-ref.html
new file mode 100644
index 00000000000..13f25aa1a97
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-015-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with padding-box</title>
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ transform: translate(-50px, -50px);
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-016-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-016-ref.html
new file mode 100644
index 00000000000..dea09101505
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-016-ref.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with content-box</title>
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-017-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-017-ref.html
new file mode 100644
index 00000000000..03719c540dc
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-017-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with padding-box</title>
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ transform: translate(100px, -50px);
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-018-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-018-ref.html
new file mode 100644
index 00000000000..39dd8204de1
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-018-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: ray() path with content-box</title>
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ transform: translate(100px, 0px);
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-019-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-019-ref.html
new file mode 100644
index 00000000000..1bf242e3fc6
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-019-ref.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <style>
+ #container1 {
+ width: 100px;
+ height: 100px;
+ }
+ #container2 {
+ width: 200px;
+ height: 200px;
+ }
+ #target1 {
+ position: relative;
+ width: 50px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: translateX(100px);
+ }
+ #target2 {
+ position: relative;
+ width: 50px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: translateX(200px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container1">
+ <div id="target1"></div>
+ </div>
+ <div id="container2">
+ <div id="target2"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-022-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-022-ref.html
new file mode 100644
index 00000000000..63bbc2cfb32
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-022-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <style>
+ #container {
+ width: 400px;
+ height: 300px;
+ overflow: scroll;
+ }
+ #target {
+ position: relative;
+ left: 200px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: rotate(90deg) translate(200px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-001-ref.html
new file mode 100644
index 00000000000..05f54d9dc55
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-001-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 30px;
+ top: 40px;
+ width: 10px;
+ height: 10px;
+ background-color: lime;
+ /* ray length is sqrt(30^2 + 40^2); contain does -max(10, 10) / 2; */
+ /* the result length is 45px. angle is 180deg; */
+ /* 5 is origin shift. */
+ transform: translate(-5px, 40px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-002-ref.html
new file mode 100644
index 00000000000..a5bff446700
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-002-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 100px;
+ top: 100px;
+ width: 100px;
+ height: 100px;
+ background-color: lime;
+ /* ray length is sqrt(150^2 + 0^2); contain does -max(100, 100) / 2; */
+ /* the result length is 100. sin(90deg) * length = 100; */
+ transform: translateY(100px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-003-ref.html
new file mode 100644
index 00000000000..965960f2040
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-003-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 100px;
+ top: 100px;
+ width: 100px;
+ height: 100px;
+ background-color: lime;
+ /* ray length is sqrt(150^2 + 0^2); contain does -max(100, 100) / 2; */
+ /* the result length is 100. sin(45deg) * length = 70.71; */
+ transform: rotate(-45deg) translate(100px) rotate(45deg);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-004-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-004-ref.html
new file mode 100644
index 00000000000..188e2597c71
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-004-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 100px;
+ top: 100px;
+ width: 100px;
+ height: 100px;
+ background-color: lime;
+ /* ray length is sqrt(150^2 + 0^2); contain does -max(100, 100) / 2; */
+ /* the result length is 100. sin(45deg) * length = 70.71; */
+ transform: rotate(-45deg) translate(100px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-005-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-005-ref.html
new file mode 100644
index 00000000000..ead5dfb8cdd
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-ray-contain-005-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <style>
+ #container {
+ width: 250px;
+ height: 250px;
+ transform: translate(100px);
+ }
+ #target {
+ position: relative;
+ left: 50px;
+ top: 50px;
+ width: 150px;
+ height: 25px;
+ background-color: lime;
+ /*
+ * The original path length is 50px, contain applies
+ * decrease, so that the new length is -25px (-150px / 2).
+ * Note: offset-anchor is "200% -300%", and ray angle is -90deg
+ and offset-rotate is -90deg.
+ */
+ transform: translate(-75px, -12.5px) rotate(-90deg) translate(-225px, 87.5px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-001-ref.html
new file mode 100644
index 00000000000..6d6b64d32e3
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-001-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; circle() path with explicit arguments</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(250px, 350px) rotate(180deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-003-ref.html
new file mode 100644
index 00000000000..c005984f768
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-003-ref.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; circle() path with offset-distance</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ transform: translate(420.231px, 311.969px) rotate(154.813deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-004-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-004-ref.html
new file mode 100644
index 00000000000..925abdb8b4f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-004-ref.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; circle() path with offset-distance and offset-anchor</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ transform: translate(200px, 160px);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-005-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-005-ref.html
new file mode 100644
index 00000000000..77fc954ad95
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-circle-005-ref.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; circle() path with offset-position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ transform: translate(300px, 200px) translate(50px, -50px);
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-001-ref.html
new file mode 100644
index 00000000000..0e53fa2d355
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-001-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; ellipse() path with explicit arguments</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(250px, 350px) rotate(180deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-003-ref.html
new file mode 100644
index 00000000000..2239210e49b
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-003-ref.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; ellipse() path with offset-distance</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 200px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ transform: translate(8.6px, 91.4px) rotate(-135deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-004-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-004-ref.html
new file mode 100644
index 00000000000..fca4b190db5
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-004-ref.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; ellipse() path with offset-distance and offset-anchor</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ transform: translate(400px, 210px) translate(-50px, -50px);
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-005-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-005-ref.html
new file mode 100644
index 00000000000..98504d1a385
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-ellipse-005-ref.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; ellipse() path with offset-position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ transform: translate(300px, 200px) translate(50px, -50px);
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="inner">
+ <div id="box"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-inset-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-inset-001-ref.html
new file mode 100644
index 00000000000..52a9662841c
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-inset-001-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; inset() path with explicit arguments</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(348px, 340px) rotate(180deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-inset-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-inset-002-ref.html
new file mode 100644
index 00000000000..1bb649474aa
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-inset-002-ref.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; inset() path with explicit arguments and radius</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(306px, 94px) rotate(45deg);
+ transform-origin: 0 0;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-polygon-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-polygon-001-ref.html
new file mode 100644
index 00000000000..efaf54c79f2
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-polygon-001-ref.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; polygon() path</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(46px, 78px) rotate(-126.87deg);
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-001-ref.html
new file mode 100644
index 00000000000..2cb45198e95
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-001-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; rect() path with explicit arguments</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(520px, 142px) rotate(90deg) translate(40px, 40px);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-002-ref.html
new file mode 100644
index 00000000000..bc28974cb5c
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-002-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; rect() path with explicit arguments and radius</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(420.272px, 317.407px) rotate(161.625deg) translate(40px, 40px);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-003-ref.html
new file mode 100644
index 00000000000..1c742650915
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-rect-003-ref.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: offset-path:rect() path with explicit arguments and padding-box</title>
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 100px;
+ padding: 50px;
+ border: 50px solid black;
+}
+#box {
+ background-color: green;
+ transform: translate(200px, -78px) rotate(90deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-shape-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-shape-001-ref.html
new file mode 100644
index 00000000000..b1737a27df5
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-shape-001-ref.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; shape() path</title>
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(550px, 150px) rotate(90deg);
+ width: 100px;
+ height: 100px;
+ border-radius: 50% 50% 0 0;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-001-ref.html
new file mode 100644
index 00000000000..a7fd10c76e7
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-001-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; xywh() path with explicit arguments</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ transform: translate(260px, 60px) rotate(90deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-002-ref.html
new file mode 100644
index 00000000000..8b9ca37aa4a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-002-ref.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: &lt;basic-shape&gt; xywh() path with explicit arguments and radius</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 200px;
+}
+#box {
+ background-color: green;
+ transform: translate(375.35px, -15.35px) rotate(45deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-003-ref.html
new file mode 100644
index 00000000000..ef371f45c5c
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-shape-xywh-003-ref.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test reference: offset-path:xywh() path with explicit arguments and padding-box</title>
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 100px;
+ padding: 50px;
+ border: 50px solid black;
+}
+#box {
+ background-color: green;
+ transform: translate(200px, 10px) rotate(90deg);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-string-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-string-ref.html
new file mode 100644
index 00000000000..5c5ff5f6f2d
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-string-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: path(string) paths</title>
+ <link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: rotate(90deg) translate(120px);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-url-011-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-url-011-ref.html
new file mode 100644
index 00000000000..d0f97eda1dd
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-path-url-011-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path Referecne: url() to non SVG elements</title>
+ <style>
+ #target {
+ width: 50px;
+ height: 50px;
+ background-color: green;
+ transform: translate(25px, 25px);
+ border-radius: 50% 50% 0 0;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-rotate-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-rotate-ref.html
new file mode 100644
index 00000000000..4b2d36529af
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/motion/offset-rotate-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-rotate</title>
+ <link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ transform: rotate(30deg);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-distance-interpolation-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-distance-interpolation-001.html
new file mode 100644
index 00000000000..6c2ed2e820a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-distance-interpolation-001.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <title>offset-distance interpolation</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-distance-property">
+ <link rel="match" href="../../../../../../expected/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-ref.html">
+ <meta name="assert" content="offset-distance supports animation.">
+ <style>
+ @keyframes anim {
+ from { offset-distance: 0%; }
+ to { offset-distance: 100%; }
+ }
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: path("m 50 150 h 100");
+ animation: anim 10s -5s paused linear;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+ <script>
+ requestAnimationFrame(() => {
+ document.documentElement.classList.remove('reftest-wait');
+ });
+ </script>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-001.html
new file mode 100644
index 00000000000..b741aedeecb
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-001.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <title>offset-path path() interpolation</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../../../expected/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-ref.html">
+ <meta name="assert" content="offset-path path supports animation.">
+ <style>
+ @keyframes anim {
+ from { offset-path: path("m 100 100 l 100 100"); }
+ to { offset-path: path("m 100 200 l 100 -100"); }
+ }
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ animation: anim 10s -5s paused linear;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+ <script>
+ requestAnimationFrame(() => {
+ document.documentElement.classList.remove('reftest-wait');
+ });
+ </script>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-path-with-transforms-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-path-with-transforms-001.html
new file mode 100644
index 00000000000..0e9d390fadc
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-path-with-transforms-001.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <title>CSS Motion Path: Combined transformation matrix interpolation</title>
+ <link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
+ <link rel="match" href="../../../../../../expected/wpt-import/css/motion/animation/reftests/offset-path-with-transforms-ref.html">
+ <meta name="assert" content="This tests animating combined transformation matrix.">
+ <style>
+ @keyframes anim {
+ to {
+ translate: 0px 100px;
+ offset-distance: 100%;
+ transform: translateX(-100px);
+ }
+ }
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ offset-path: path("M25 0v100");
+ animation: anim 10s -5s paused linear;
+ }
+ </style>
+ </head>
+ <body onload="load()">
+ <div id="target"></div>
+ <div style='width: 50px; height: 100px; background-color: red;'></div>
+ </body>
+ <script>
+ requestAnimationFrame(() => {
+ document.documentElement.classList.remove('reftest-wait');
+ });
+ </script>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-rotate-interpolation-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-rotate-interpolation-001.html
new file mode 100644
index 00000000000..943290a6259
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/animation/reftests/offset-rotate-interpolation-001.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <title>offset-rotate interpolation</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-rotate-property">
+ <link rel="match" href="../../../../../../expected/wpt-import/css/motion/animation/reftests/offset-path-path-interpolation-ref.html">
+ <meta name="assert" content="offset-rotate supports animation.">
+ <style>
+ @keyframes anim {
+ from { offset-rotate: auto; }
+ to { offset-rotate: reverse; }
+ }
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: path("m 100 150 v -100");
+ animation: anim 10s -5s paused linear;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+ <script>
+ requestAnimationFrame(() => {
+ document.documentElement.classList.remove('reftest-wait');
+ });
+ </script>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/change-offset-path.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/change-offset-path.html
new file mode 100644
index 00000000000..4fe6098360a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/change-offset-path.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>Change offset-path property</title>
+<link rel="author" title="Philip Rogers" href="mailto:[email protected]">
+<link rel="help" href="https://crbug.com/1365255">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/../reference/ref-filled-green-100px-square-only.html">
+<style>
+#target {
+ will-change: transform;
+ transform: translate(50px, 50px);
+ offset-path: path('M 0 0 L 200 200 Z');
+ width: 100px;
+ height: 100px;
+ background: green;
+}
+#container {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+</style>
+<p>Test passes if there is a filled green square.</p>
+<div id="container">
+ <div id="target"></div>
+</div>
+<script>
+requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ target.style.offsetPath = 'path(\'M 0 0 Z\')';
+ document.documentElement.removeAttribute('class');
+ });
+});
+</script>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-001.html
new file mode 100644
index 00000000000..9ed62f68110
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-001.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when offset-path is a closed loop.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m 0 0 h 200 v 150 z');
+ offset-distance: 20%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-002.html
new file mode 100644
index 00000000000..a6a9616a020
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-002.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when offset-path is a closed loop.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m 0 0 h 200 v 150 z');
+ offset-distance: 120%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-003.html
new file mode 100644
index 00000000000..ec493420fff
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-003.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when offset-path is a closed loop.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m 0 0 h 200 v 150 z');
+ offset-distance: -280%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-004.html
new file mode 100644
index 00000000000..9c546149f47
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-004.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when total length of the path is 0.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m 120 0 h 0 v 0 z');
+ offset-distance: 20%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-005.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-005.html
new file mode 100644
index 00000000000..96ab73809bf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-005.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when total length of the path is 0.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m 120 0 h 0 v 0 z');
+ offset-distance: 120%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-006.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-006.html
new file mode 100644
index 00000000000..65d7c2d4a92
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-006.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when total length of the path is 0.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m 120 0 h 0 v 0 z');
+ offset-distance: -280%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-007.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-007.html
new file mode 100644
index 00000000000..2ac6531d41d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-007.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when offset-path is an unclosed interval.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m -80 0 h 1000');
+ offset-distance: 20%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-008.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-008.html
new file mode 100644
index 00000000000..58017618f50
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-008.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when offset-path is an unclosed interval.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m -80 0 h 200');
+ offset-distance: 120%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-009.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-009.html
new file mode 100644
index 00000000000..8bbe7142812
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-distance-009.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-distance</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#calculating-the-computed-distance-along-a-path">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-distance-ref.html">
+ <meta name="assert" content="This tests used offset-distance when offset-path is an unclosed interval.">
+ <style>
+ #target {
+ position: absolute;
+ width: 100px;
+ height: 40px;
+ background-color: lime;
+ transform-origin: 0% 0%;
+ offset-path: path('m 120 0 h 200 v 150');
+ offset-distance: -280%;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-001.html
new file mode 100644
index 00000000000..1b023650282
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-001.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;coord-box&gt; &lt;border-box&gt;</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-coord-box-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-coord-box">
+<meta name="fuzzy" content="maxDifference=0-100; totalPixels=0-450">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ border-radius: 50%;
+ border: 10px solid black;
+ width: 400px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ top: 100px;
+ left: 100px;
+ position: relative;
+ offset-path: border-box;
+ offset-distance: 25%;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-002.html
new file mode 100644
index 00000000000..9866af9e301
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-002.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;coord-box&gt; &lt;padding-box&gt;</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-coord-box-002-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-coord-box">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ border: 10px solid black;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ offset-path: padding-box;
+ offset-distance: 15%;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-003.html
new file mode 100644
index 00000000000..f11be61bc74
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-003.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;coord-box&gt; &lt;content-box&gt;</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-coord-box-003-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-coord-box">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ border: 10px solid black;
+ padding: 10px;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ top: 100px;
+ left: 100px;
+ position: relative;
+ offset-path: content-box;
+ offset-distance: 15%;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-004.html
new file mode 100644
index 00000000000..4b351611546
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-coord-box-004.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-path:stoke-box paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#valdef-offset-path-coord-box">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-coord-box-004-ref.html">
+ <meta name="assert" content="This tests that offset-path:stroke-box generates a rotation and translation.">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: stroke-box;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-001.html
new file mode 100644
index 00000000000..49bf17fc7fb
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-001-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-10">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(135deg closest-side);
+ offset-distance: 20px;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-002.html
new file mode 100644
index 00000000000..2ee5369eae7
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-002.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-001-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-10">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(135deg closest-side);
+ offset-distance: 20%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-003.html
new file mode 100644
index 00000000000..535db196d82
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-003.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-003-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <style>
+ #container {
+ width: 400px;
+ height: 400px;
+ }
+ #target {
+ position: relative;
+ left: 100px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(135deg closest-side);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-004.html
new file mode 100644
index 00000000000..2a12c4984ce
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-004.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-003-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <style>
+ #container {
+ width: 150px;
+ height: 150px;
+ }
+ #target {
+ position: relative;
+ left: 100px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(135deg farthest-side);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-005.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-005.html
new file mode 100644
index 00000000000..51ba7e99d52
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-005.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-005-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <style>
+ #container {
+ width: 400px;
+ height: 400px;
+ }
+ #target {
+ position: relative;
+ left: 120px;
+ top: 160px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(135deg closest-corner);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-006.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-006.html
new file mode 100644
index 00000000000..1ca4d203311
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-006.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-005-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ }
+ #target {
+ position: relative;
+ left: 120px;
+ top: 160px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(135deg farthest-corner);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-007.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-007.html
new file mode 100644
index 00000000000..6bd864a89fd
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-007.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-007-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <style>
+ #container {
+ width: 400px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 200px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(180deg sides);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-008.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-008.html
new file mode 100644
index 00000000000..bb95cd91a33
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-008.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-008-ref.html">
+ <meta name="assert" content="The initial position is outside the containing block.">
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ }
+ #target {
+ position: relative;
+ left: 140%;
+ top: 70%;
+ width: 40px;
+ height: 40px;
+ background-color: lime;
+ offset-path: ray(-90deg sides);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-009.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-009.html
new file mode 100644
index 00000000000..997ce8f87df
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-009.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-009-ref.html">
+ <meta name="assert" content="The initial position is outside the containing block.">
+ <style>
+ #container {
+ width: 200px;
+ height: 200px;
+ }
+ #target {
+ position: relative;
+ left: 140%;
+ top: 70%;
+ width: 40px;
+ height: 40px;
+ background-color: lime;
+ offset-path: ray(180deg closest-side);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-010.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-010.html
new file mode 100644
index 00000000000..923a7ce6929
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-010.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-001-ref.html">
+ <meta name="assert" content="This tests that ray() generates a rotation and translation.">
+ <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-10">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(135deg);
+ offset-distance: 20px;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-011.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-011.html
new file mode 100644
index 00000000000..85a0f42af27
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-011.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with offset-position: normal</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-011-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ offset-path: ray(90deg);
+ offset-distance: 10px;
+ offset-position: normal;
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-012.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-012.html
new file mode 100644
index 00000000000..cbba82dd212
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-012.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with offset-position specified with position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-012-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ offset-path: ray(180deg closest-side);
+ offset-distance: 100%;
+ offset-position: 10px 90%;
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-013.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-013.html
new file mode 100644
index 00000000000..be2d6c24aaf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-013.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with position and offset-position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-013-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ offset-path: ray(0deg closest-side at 100px 30%);
+ offset-distance: 100%;
+ offset-position: 10px 90%;
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-014.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-014.html
new file mode 100644
index 00000000000..47e4eacdc64
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-014.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with default position</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-014-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ }
+ #box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ left: 100px;
+ offset-path: ray(0deg closest-side);
+ offset-distance: 100%;
+ offset-position: normal;
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-015.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-015.html
new file mode 100644
index 00000000000..91e1098413a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-015.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with padding-box</title>
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-015-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ offset-path: ray(0deg sides at 0% 0%) padding-box;
+ offset-rotate: 0deg;
+ offset-anchor: 0% 0%;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-016.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-016.html
new file mode 100644
index 00000000000..fe59c406108
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-016.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with content-box</title>
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-016-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ offset-path: ray(0deg sides at 0% 0%) content-box;
+ offset-rotate: 0deg;
+ offset-anchor: 0% 0%;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ }
+</style>
+
+<div id="outer">
+ <div style="width: 100px; height: 100px; background-color: red;"></div>
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-017.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-017.html
new file mode 100644
index 00000000000..86280303293
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-017.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with padding-box</title>
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-017-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ offset-path: ray(0deg sides at 50% 50%) padding-box;
+ offset-distance: 100%;
+ offset-rotate: 0deg;
+ offset-anchor: 0% 0%;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-018.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-018.html
new file mode 100644
index 00000000000..1ba5e40ddff
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-018.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: ray() path with content-box</title>
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-018-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#ray-function">
+
+<style>
+ #outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 200px;
+ padding: 50px;
+ border: 50px solid black;
+ }
+ #box {
+ background-color: green;
+ offset-path: ray(0deg sides at 50% 50%) content-box;
+ offset-distance: 100%;
+ offset-rotate: 0deg;
+ offset-anchor: 0% 0%;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ }
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-019.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-019.html
new file mode 100644
index 00000000000..94e402bd0b9
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-019.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-019-ref.html">
+ <meta name="assert" content="Tests ray() when sharing style with different sized containing blocks.">
+ <style>
+ #container1 {
+ width: 100px;
+ height: 100px;
+ }
+ #container2 {
+ width: 200px;
+ height: 200px;
+ }
+ #target {
+ position: relative;
+ width: 50px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(90deg sides);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container1">
+ <div id="target"></div>
+ </div>
+ <div id="container2">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-020.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-020.html
new file mode 100644
index 00000000000..beba8bf9306
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-020.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-007-ref.html">
+ <meta name="assert" content="This tests ray() in a flex box.">
+ <style>
+ #container {
+ display: flex;
+ width: 400px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 200px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(180deg sides);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-021.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-021.html
new file mode 100644
index 00000000000..fb0a4fee48d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-021.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-007-ref.html">
+ <meta name="assert" content="This tests ray() in a flex box.">
+ <style>
+ #container {
+ display: grid;
+ width: 400px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 200px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(180deg sides);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-022.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-022.html
new file mode 100644
index 00000000000..8b737e7d256
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-022.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-022-ref.html">
+ <meta name="assert" content="This tests that ray() affects overflow .">
+ <style>
+ #container {
+ width: 400px;
+ height: 300px;
+ overflow: scroll;
+ }
+
+ #target {
+ position: relative;
+ left: 200px;
+ top: 100px;
+ width: 100px;
+ height: 50px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(180deg sides);
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-001.html
new file mode 100644
index 00000000000..c0397af6aa8
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-001.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-contain-001-ref.html">
+ <meta name="assert" content="This tests that the element should be contained in ray() path circle.">
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 30px;
+ top: 40px;
+ width: 10px;
+ height: 10px;
+ background-color: lime;
+ offset-path: ray(180deg closest-corner contain);
+ offset-rotate: 0deg;
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-002.html
new file mode 100644
index 00000000000..ea68876dffc
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-002.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-contain-002-ref.html">
+ <meta name="assert" content="This tests that the element should be contained in ray() path circle.">
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 150px;
+ top: 150px;
+ width: 100px;
+ height: 100px;
+ background-color: lime;
+ offset-path: ray(180deg closest-side contain);
+ offset-rotate: 0deg;
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-003.html
new file mode 100644
index 00000000000..fa5b379f0dd
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-003.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-contain-003-ref.html">
+ <meta name="assert" content="This tests that the element should be contained in ray() path circle.">
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 150px;
+ top: 150px;
+ width: 100px;
+ height: 100px;
+ background-color: lime;
+ offset-path: ray(45deg closest-side contain);
+ offset-rotate: 0deg;
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-004.html
new file mode 100644
index 00000000000..c847a1b616d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-004.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-contain-004-ref.html">
+ <meta name="assert" content="This tests that the element should be contained in ray() path circle.">
+ <meta name="fuzzy" content="maxDifference=0-20; totalPixels=0-10"/>
+ <style>
+ #container {
+ width: 300px;
+ height: 300px;
+ }
+ #target {
+ position: relative;
+ left: 150px;
+ top: 150px;
+ width: 100px;
+ height: 100px;
+ background-color: lime;
+ offset-path: ray(45deg closest-side contain);
+ offset-rotate: auto;
+ offset-distance: 100%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-005.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-005.html
new file mode 100644
index 00000000000..dca26c9b127
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-ray-contain-005.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: ray paths with contain</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-ray-contain-005-ref.html">
+ <meta name="assert" content="This tests that ray() with contain and the path length increases.">
+ <style>
+ #container {
+ width: 250px;
+ height: 250px;
+ /* move container to right 100px to make sure we render the element
+ properly */
+ transform: translate(100px);
+ }
+ #target {
+ position: relative;
+ left: 50px;
+ top: 50px;
+ width: 150px;
+ height: 25px;
+ background-color: lime;
+ offset-path: ray(-90deg closest-side contain);
+ offset-anchor: 200% -300%;
+ offset-rotate: -90deg;
+ offset-distance: 50%;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="container">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-001.html
new file mode 100644
index 00000000000..54bbad6c8a7
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-001.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; circle() path with explicit arguments</title>
+<meta name="fuzzy" content="maxDifference=0-150; totalPixels=0-300">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-circle-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: circle(closest-side at center);
+ offset-distance: 25%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-003.html
new file mode 100644
index 00000000000..b80259a2091
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-003.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; circle() path with offset-distance</title>
+<meta name="fuzzy" content="maxDifference=0-170; totalPixels=0-550">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-circle-003-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: circle(farthest-side at top);
+ offset-distance: 18%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-004.html
new file mode 100644
index 00000000000..39db83bb4f7
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-004.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; circle() path with offset-distance and offset-anchor</title>
+<meta name="fuzzy" content="maxDifference=0-300; totalPixels=0-500">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-circle-004-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: circle(10% at bottom 25% right 25%);
+ offset-anchor: 100% 100%;
+ offset-distance: 75%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-005.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-005.html
new file mode 100644
index 00000000000..ad5bcecdd8a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-005.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; circle() path with offset-position</title>
+<meta name="fuzzy" content="maxDifference=0-100; totalPixels=0-500">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-circle-005-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: circle(100px);
+ offset-position: normal;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-006.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-006.html
new file mode 100644
index 00000000000..4a9613c2066
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-006.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; circle() path with border radius on container</title>
+<meta name="fuzzy" content="maxDifference=0-100; totalPixels=0-500" />
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-circle-005-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ border-radius: 50%;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: circle(100px);
+ offset-position: normal;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-007.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-007.html
new file mode 100644
index 00000000000..1492e4893d5
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-007.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; circle() path with offset from container</title>
+<meta name="fuzzy" content="maxDifference=0-170; totalPixels=0-550">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-circle-003-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ top: 100px;
+ left: 100px;
+ background-color: green;
+ position: relative;
+ offset-path: circle(farthest-side at top);
+ offset-distance: 18%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-008.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-008.html
new file mode 100644
index 00000000000..b6cd7a318f9
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-circle-008.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; circle() path offset-position</title>
+<meta name="fuzzy" content="maxDifference=0-150; totalPixels=0-300">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-circle-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ top: 100px;
+ left: 200px;
+ background-color: green;
+ position: relative;
+ offset-path: circle();
+ offset-position: 300px 200px;
+ offset-distance: 25%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-001.html
new file mode 100644
index 00000000000..4df39875fa6
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-001.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; ellipse() path with explicit arguments</title>
+<meta name="fuzzy" content="maxDifference=0-100; totalPixels=0-400">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-ellipse-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: ellipse(closest-side closest-side at center);
+ offset-distance: 25%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-003.html
new file mode 100644
index 00000000000..04cd1d09ccf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-003.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; ellipse() path with offset-distance</title>
+<!-- Chrome currently passes with 13 max pixel difference and 473 total different pixels -->
+<!-- You can increase the numbers to handle anti-aliasing -->
+<meta name="fuzzy" content="maxDifference=0-150; totalPixels=0-530">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-ellipse-003-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 200px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: ellipse(farthest-side farthest-side at top);
+ offset-distance: 37.5%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-004.html
new file mode 100644
index 00000000000..9e472cccbc8
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-004.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; ellipse() path with offset-distance and offset-anchor</title>
+<meta name="fuzzy" content="maxDifference=0-250; totalPixels=0-500" />
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-ellipse-004-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: ellipse(10% 10% at bottom 25% right 25%);
+ offset-anchor: 100% 100%;
+ offset-distance: 75%;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-005.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-005.html
new file mode 100644
index 00000000000..3e36070ed4f
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-005.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; ellipse() path with offset-position</title>
+<meta name="fuzzy" content="maxDifference=0-100; totalPixels=0-500" />
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-ellipse-005-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: ellipse(100px 100px);
+ offset-position: normal;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-006.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-006.html
new file mode 100644
index 00000000000..0aeb31660e6
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-006.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; ellipse() path with offset from container</title>
+<!-- Chrome currently passes with 13 max pixel difference and 473 total different pixels -->
+<!-- You can increase the numbers to handle anti-aliasing -->
+<meta name="fuzzy" content="maxDifference=0-150; totalPixels=0-530">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-ellipse-003-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 200px;
+}
+#box {
+ top: 100px;
+ left: 100px;
+ background-color: green;
+ position: relative;
+ offset-path: ellipse(farthest-side farthest-side at top);
+ offset-distance: 37.5%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-007.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-007.html
new file mode 100644
index 00000000000..cc443bb203c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-ellipse-007.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; ellipse() path offset-position</title>
+<meta name="fuzzy" content="maxDifference=0-100; totalPixels=0-401">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-ellipse-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ top: 100px;
+ left: 200px;
+ background-color: green;
+ position: relative;
+ offset-path: ellipse();
+ offset-distance: 25%;
+ border-radius: 50% 50% 0 0;
+ offset-position: 300px 200px;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-inset-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-inset-001.html
new file mode 100644
index 00000000000..495f3807ce8
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-inset-001.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; inset() path with explicit arguments</title>
+<meta name="fuzzy" content="maxDifference=0-80; totalPixels=0-230">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-inset-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ top: 100px;
+ offset-path: inset(10px 10px 10px 10px);
+ offset-distance: 60%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-inset-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-inset-002.html
new file mode 100644
index 00000000000..8ba6f05d100
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-inset-002.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; inset() path with explicit arguments and radius</title>
+<meta name="fuzzy" content="maxDifference=0-170; totalPixels=0-500">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-inset-002-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: inset(50px round 50%);
+ offset-anchor: 0 0;
+ offset-distance: 12.5%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-polygon-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-polygon-001.html
new file mode 100644
index 00000000000..4caed57deaa
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-polygon-001.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; polygon() path</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-polygon-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+<meta name="fuzzy" content="maxDifference=0-20; totalPixels=0-100">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: polygon(0px 0px, 600px 0px, 300px 400px);
+ offset-distance: 90%;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-001.html
new file mode 100644
index 00000000000..dac0ff08675
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-001.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; rect() path with explicit arguments</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-rect-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: rect(5px 95% 95% 5px);
+ offset-distance: 40%;
+ offset-anchor: 10% 10%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-002.html
new file mode 100644
index 00000000000..054aca3feb6
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-002.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; rect() path with explicit arguments and radius</title>
+<meta name="fuzzy" content="maxDifference=0-160; totalPixels=0-520">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-rect-002-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: rect(5px 95% 95% 5px round 30%);
+ offset-distance: 45%;
+ offset-anchor: 10% 10%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-003.html
new file mode 100644
index 00000000000..c3cc14a1a39
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-rect-003.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: offset-path:rect() path with explicit arguments and padding-box</title>
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-rect-003-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-rect">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 100px;
+ padding: 50px;
+ border: 50px solid black;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: rect(auto auto 50% 10px) padding-box;
+ offset-distance: 40%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-001.html
new file mode 100644
index 00000000000..971d55bffa1
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-001.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; shape() function</title>
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+<link rel="help" href="https://drafts.csswg.org/css-shapes-2/#shape-function">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-shape-001-ref.html">
+<meta name="assert" content="This tests that shape() generates a rotation and translation.">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+
+#box {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ offset-path: shape(from 0px 0%,
+ hline by 100%,
+ vline to 400px,
+ hline by -100%,
+ close);
+ offset-distance: 40%;
+ border-radius: 50% 50% 0 0;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-002.html
new file mode 100644
index 00000000000..37d9f104b5b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-002.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; shape() function with padding-box</title>
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+<link rel="help" href="https://drafts.csswg.org/css-shapes-2/#shape-function">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-shape-001-ref.html">
+<meta name="assert" content="This tests that shape() generates a rotation and translation.">
+
+<style>
+#outer {
+ top: 50px;
+ left: 50px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+ padding: 50px;
+ box-sizing: content-box;
+}
+#box {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ offset-path: shape(from 50px 10%,
+ hline by calc(100% - 100px),
+ vline to calc(100% - 50px),
+ hline to 50px,
+ close)
+ padding-box;
+ offset-distance: 40%;
+ border-radius: 50% 50% 0 0;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-003.html
new file mode 100644
index 00000000000..cef802ac8ef
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-shape-003.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; shape() function with content-box</title>
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+<link rel="help" href="https://drafts.csswg.org/css-shapes-2/#shape-function">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-shape-001-ref.html">
+<meta name="assert" content="This tests that shape() generates a rotation and translation.">
+
+<style>
+#outer {
+ width: 600px;
+ height: 400px;
+ border: 50px solid transparent;
+}
+#box {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ offset-path: shape(from 50px calc(-10% + 90px),
+ hline by 100%,
+ vline to calc(100% + 50px))
+ content-box;
+ offset-distance: 80%;
+ border-radius: 50% 50% 0 0;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-001.html
new file mode 100644
index 00000000000..e12d4e745d0
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-001.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; xywh() path with explicit arguments</title>
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-xywh-001-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 600px;
+ height: 400px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: xywh(10px 10px 300px 200px);
+ offset-distance: 40%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-002.html
new file mode 100644
index 00000000000..17214d7e7e0
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-002.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: &lt;basic-shape&gt; xywh() path with explicit arguments and radius</title>
+<meta name="fuzzy" content="maxDifference=0-140; totalPixels=0-500">
+<link rel="author" title="Daniil Sakhapov" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-xywh-002-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 400px;
+ height: 200px;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: xywh(10% 10% 100% 100% round 50px / 50px);
+ /* Stop at the mid-point of the top-right corner */
+ offset-distance: calc(12.5% + 200px);
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-003.html
new file mode 100644
index 00000000000..b3bff7f5265
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-shape-xywh-003.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Motion Path test: offset-path:xywh() path with explicit arguments and padding-box</title>
+<link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-shape-xywh-003-ref.html">
+<link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-basic-shape">
+<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-xywh">
+
+<style>
+#outer {
+ top: 100px;
+ left: 100px;
+ position: relative;
+ width: 200px;
+ height: 100px;
+ padding: 50px;
+ border: 50px solid black;
+}
+#box {
+ background-color: green;
+ position: relative;
+ offset-path: xywh(10% 10% 90% 90%) padding-box;
+ offset-distance: 40%;
+ border-radius: 50% 50% 0 0;
+ width: 100px;
+ height: 100px;
+}
+</style>
+
+<div id="outer">
+ <div id="box"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-001.html
new file mode 100644
index 00000000000..48979d9ff97
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-001.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: path(string) paths</title>
+ <link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-string-ref.html">
+ <meta name="assert" content="This tests that path(<string>) generates a rotation and translation.">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: path('m 0 0 v 200');
+ offset-distance: 120px;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-002.html
new file mode 100644
index 00000000000..c3b20ad9160
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-002.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: path(string) paths</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-string-ref.html">
+ <meta name="assert" content="This tests that path(<string>) generates a rotation and translation.">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 0px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: path('m 0 120 v 200');
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-003.html
new file mode 100644
index 00000000000..6a35a83b1cc
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-string-003.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: path(string) with zero length path</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-string-ref.html">
+ <meta name="assert" content="This tests that path(<string>) generates a
+ proper rotation and translation when the path
+ is zero length.">
+ <style>
+ #target {
+ position: absolute;
+ left: 50px;
+ top: 80px;
+ width: 200px;
+ height: 300px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: path('M 50 40');
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-url-011.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-url-011.html
new file mode 100644
index 00000000000..bb89338a790
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-path-url-011.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-path:url() reference to non-SVG elements</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion/#valdef-offset-path-url">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-path-url-011-ref.html">
+ <meta name="assert" content='This tests that url() references to a non-SVG
+ element and behaves as path("m 0 0") instead.'>
+ <style>
+ #outer {
+ position: relative;
+ left: 50px;
+ top: 50px;
+ width: 300px;
+ height: 100px;
+ }
+ #target {
+ width: 50px;
+ height: 50px;
+ background-color: green;
+ /* This behaves as 'offset-path: path("m 0 0")' */
+ offset-path: url(#outer);
+ offset-anchor: 50% 50%;
+ offset-distance: 0%;
+ border-radius: 50% 50% 0 0;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="outer">
+ <div id="target"></div>
+ </div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-001.html
new file mode 100644
index 00000000000..5a2973e6ea5
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-001.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-rotate</title>
+ <link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-rotate-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-rotate-ref.html">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta name="assert" content="This tests offset-rotate auto">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(120deg closest-corner);
+ offset-rotate: auto;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-002.html
new file mode 100644
index 00000000000..4549df1ad84
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-002.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-rotate</title>
+ <link rel="author" title="Eric Willigers" href="mailto:[email protected]">
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-rotate-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-rotate-ref.html">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta name="assert" content="This tests offset-rotate reverse <angle>">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: ray(-120deg closest-corner);
+ offset-rotate: reverse 60deg;
+ offset-position: auto;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-003.html
new file mode 100644
index 00000000000..949841d1bfe
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-003.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Motion Path: offset-rotate</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-rotate-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-rotate-ref.html">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta name="assert" content="This tests offset-rotate <angle>">
+ <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-57" />
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-path: path('m 0 0 v -200 -200') ;
+ offset-rotate: 30deg;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-004.html b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-004.html
new file mode 100644
index 00000000000..16bdf25795b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/motion/offset-rotate-004.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <title>CSS Motion Path: offset-rotate</title>
+ <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-rotate-property">
+ <link rel="match" href="../../../../expected/wpt-import/css/motion/offset-rotate-ref.html">
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <meta name="assert" content="This tests offset-rotate auto with path()">
+ <style>
+ #target {
+ position: absolute;
+ left: 300px;
+ top: 100px;
+ width: 300px;
+ height: 200px;
+ background-color: lime;
+ transform-origin: 0px 0px;
+ offset-rotate: auto;
+ }
+ </style>
+ <script>
+ function test() {
+ let target = document.getElementById('target');
+ // Get a path which has the same direction as "ray(120deg ...)"
+ let verticalMove = 100 * Math.tan(30 * Math.PI / 180);
+ target.style.offsetPath = `path("m 0 0 l 100 ${verticalMove}")`;
+ window.getComputedStyle(target).offsetPath;
+
+ window.requestAnimationFrame(function() {
+ document.documentElement.removeAttribute('class');
+ });
+ }
+ </script>
+ </head>
+ <body onload='test()'>
+ <div id="target"></div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Text/expected/css/offset-path-containing-block-change.txt b/Tests/LibWeb/Text/expected/css/offset-path-containing-block-change.txt
new file mode 100644
index 00000000000..112e0747bdf
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/css/offset-path-containing-block-change.txt
@@ -0,0 +1,5 @@
+ray: 188.00,98.00 40x20
+coordBox: 88.00,-2.00 40x20
+After changing the containing block:
+ray: 388.00,98.00 40x20
+coordBox: 177.27,-2.00 40x20
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/motion/offset-path-bounding-client-rect.txt b/Tests/LibWeb/Text/expected/wpt-import/css/motion/offset-path-bounding-client-rect.txt
index 556cc81eabf..c811abf429f 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/motion/offset-path-bounding-client-rect.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/motion/offset-path-bounding-client-rect.txt
@@ -2,6 +2,6 @@ Harness status: OK
Found 2 tests
-2 Fail
-Fail Bounding client rect for #blue
-Fail Bounding client rect for #purple
\ No newline at end of file
+2 Pass
+Pass Bounding client rect for #blue
+Pass Bounding client rect for #purple
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/css/offset-path-containing-block-change.html b/Tests/LibWeb/Text/input/css/offset-path-containing-block-change.html
new file mode 100644
index 00000000000..a6fb13e1371
--- /dev/null
+++ b/Tests/LibWeb/Text/input/css/offset-path-containing-block-change.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<style>
+#container { position: relative; width: 200px; height: 200px; }
+.box { position: absolute; left: 0; top: 0; width: 40px; height: 20px; offset-rotate: 0deg; }
+#ray { offset-path: ray(90deg sides); offset-position: 0 100px; offset-distance: 100%; }
+#coordBox { offset-path: border-box; offset-distance: 12.5%; }
+</style>
+<div id="container">
+ <div class="box" id="ray"></div>
+ <div class="box" id="coordBox"></div>
+</div>
+<script src="../include.js"></script>
+<script>
+ function printRect(element) {
+ const rect = element.getBoundingClientRect();
+ println(`${element.id}: ${rect.x.toFixed(2)},${rect.y.toFixed(2)} ${rect.width}x${rect.height}`);
+ }
+
+ asyncTest(done => {
+ printRect(ray);
+ printRect(coordBox);
+ requestAnimationFrame(() => {
+ container.style.width = "400px";
+ container.style.borderRadius = "50px";
+ requestAnimationFrame(() => {
+ println("After changing the containing block:");
+ printRect(ray);
+ printRect(coordBox);
+ done();
+ });
+ });
+ });
+</script>