Truly independent web browser
LibWeb: Implement border-shape
Andreas Kling2727ee0a21f3
diff --git a/Libraries/LibWeb/CSS/Keywords.json b/Libraries/LibWeb/CSS/Keywords.jsonindex 5d9ce3df8c1..612941514c6 100644--- a/Libraries/LibWeb/CSS/Keywords.json+++ b/Libraries/LibWeb/CSS/Keywords.json@@ -273,6 +273,7 @@"gurmukhi","h","hadiyaa",+ "half-border-box","hanging","hangul-consonant","hangul",diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.jsonindex b227a1f95b5..1462ba2d899 100644--- a/Libraries/LibWeb/CSS/Properties.json+++ b/Libraries/LibWeb/CSS/Properties.json@@ -1254,6 +1254,16 @@],"needs-layout-node-for-resolved-value": true},+ "border-shape": {+ "style-group": "BorderValues",+ "affects-accumulated-visual-contexts": true,+ "affects-layout": false,+ "animation-type": "discrete",+ "__comment": "FIXME: The spec animates border-shape by computed value.",+ "inherited": false,+ "initial": "none",+ "requires-computation": "cascaded-value"+ },"border-spacing": {"style-group": "InheritedTableValues","_comment": "Follows the newer definition from: https://drafts.csswg.org/css-tables-3/#border-spacing-property",diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs b/Libraries/LibWeb/Rust/src/css/computed_value_types.rsindex 26da7d7ac64..7aff901699a 100644--- a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs+++ b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs@@ -255,6 +255,7 @@ pub struct BorderValues {pub corner_top_left_shape: f64,pub corner_top_right_shape: f64,pub border_image_source: ComputedStyleValueHandle,+ pub border_shape: ComputedStyleValueHandle,pub border_image_slice: ComputedStyleValueHandle,pub border_image_width: ComputedStyleValueHandle,pub border_image_outset: ComputedStyleValueHandle,diff --git a/Libraries/LibWeb/Rust/src/css/computed_values.rs b/Libraries/LibWeb/Rust/src/css/computed_values.rsindex 400117412ed..dac3544a77e 100644--- a/Libraries/LibWeb/Rust/src/css/computed_values.rs+++ b/Libraries/LibWeb/Rust/src/css/computed_values.rs@@ -724,6 +724,7 @@ impl_computed_payload_clone_and_eq!(BorderValues {corner_top_left_shape,corner_top_right_shape,border_image_source,+ border_shape,border_image_slice,border_image_width,border_image_outset,@@ -2240,6 +2241,7 @@ pub(crate) fn group_field_descriptors(group: usize) -> &'static [GroupFieldDescrCORNER_TOP_LEFT_SHAPE @ corner_top_left_shape => ResolvedF64,CORNER_TOP_RIGHT_SHAPE @ corner_top_right_shape => ResolvedF64,BORDER_IMAGE_SOURCE => RequireKeyword(k::NONE),+ BORDER_SHAPE => RequireKeyword(k::NONE),BORDER_IMAGE_OUTSET => RequireInitialValue,BORDER_IMAGE_REPEAT => RequireInitialValue,BORDER_IMAGE_SLICE => RequireInitialValue,@@ -3334,6 +3336,7 @@ impl BorderValues {corner_top_left_shape: 1.0,corner_top_right_shape: 1.0,border_image_source: initial(property_id::BORDER_IMAGE_SOURCE),+ border_shape: initial(property_id::BORDER_SHAPE),border_image_slice: initial(property_id::BORDER_IMAGE_SLICE),border_image_width: initial(property_id::BORDER_IMAGE_WIDTH),border_image_outset: initial(property_id::BORDER_IMAGE_OUTSET),diff --git a/Libraries/LibWeb/Rust/src/css/parser/positions_shapes_parser.rs b/Libraries/LibWeb/Rust/src/css/parser/positions_shapes_parser.rsindex e951e2412f8..f9153e0711b 100644--- a/Libraries/LibWeb/Rust/src/css/parser/positions_shapes_parser.rs+++ b/Libraries/LibWeb/Rust/src/css/parser/positions_shapes_parser.rs@@ -1336,6 +1336,63 @@ fn shape_box(value: &ComponentValue) -> Option<StyleValueData> {})}+// https://drafts.csswg.org/css-borders-4/#propdef-border-shape+// none | [ <basic-shape> <geometry-box>? ]{1,2}+fn parse_border_shape(context: &ParseContext, property: u16, values: &[ComponentValue]) -> Option<StyleValueData> {+ let significant = values.iter().filter(|value| !value.is_whitespace()).collect::<Vec<_>>();+ if let [only] = significant[..]+ && let Some(none) = keyword_value(only, &[keyword::NONE])+ {+ return Some(none);+ }+ // https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box+ let geometry_box = |value: &ComponentValue| {+ let ident = value.ident()?;+ [+ "content-box",+ "padding-box",+ "border-box",+ "margin-box",+ "fill-box",+ "stroke-box",+ "view-box",+ "half-border-box",+ ]+ .iter()+ .any(|accepted| equals_ascii_case_insensitive(ident, accepted.as_bytes()))+ .then(|| keyword_from_ascii_case_insensitive(ident))+ .flatten()+ .map(|keyword| StyleValueData::Keyword { keyword })+ };+ let mut items = Vec::new();+ let mut shape_count = 0;+ let mut index = 0;+ while index < significant.len() {+ items.push(parse_basic_shape(+ context,+ property,+ std::slice::from_ref(significant[index]),+ )?);+ shape_count += 1;+ index += 1;+ if let Some(box_value) = significant.get(index).and_then(|value| geometry_box(value)) {+ items.push(box_value);+ index += 1;+ }+ }+ if shape_count == 0 || shape_count > 2 {+ return None;+ }+ if items.len() == 1 {+ return items.pop();+ }+ Some(StyleValueData::ValueList {+ values: RetainedStyleValueDataList::from_retained_values(items.into_iter().map(retained).collect()),+ separator: 0,+ collapsible: false,+ })+}+fn parse_shape_outside(context: &ParseContext, property: u16, values: &[ComponentValue]) -> Option<StyleValueData> {if let Some(value) = values.iter()@@ -1834,6 +1891,8 @@ pub(crate) fn parse_geometry_property(return ParseOutcome::NotHandled;}parse_legacy_rect(context, property, values)+ } else if property == property_id::BORDER_SHAPE {+ parse_border_shape(context, property, values)} else if property == property_id::SHAPE_OUTSIDE {let is_shape_outside_value = values.iter().find(|value| !value.is_whitespace()).is_some_and(|value| {value.ident().is_some_and(|ident| {diff --git a/Libraries/LibWeb/Rust/src/css/style_compute.rs b/Libraries/LibWeb/Rust/src/css/style_compute.rsindex de487600cf6..c0f1247bca5 100644--- a/Libraries/LibWeb/Rust/src/css/style_compute.rs+++ b/Libraries/LibWeb/Rust/src/css/style_compute.rs@@ -2456,6 +2456,56 @@ fn border_spacing_pair(single: StyleValueData) -> Arc<StyleValueData> {})}+/// https://drafts.csswg.org/css-borders-4/#border-shape-geometry-box+/// The computed value of a border-shape leaves out the reference boxes that are the defaults, and keeps one of two+/// shapes that are the same against the same box. Returns `None` when the value is already canonical.+#[allow(clippy::arc_with_non_send_sync)]+fn canonicalize_border_shape(value: &StyleValueData) -> Option<Arc<StyleValueData>> {+ let StyleValueData::ValueList { values, .. } = value else {+ return None;+ };+ let mut entries: Vec<(&RetainedStyleValueData, Option<u16>)> = Vec::new();+ for item in values.as_slice() {+ match item.data() {+ StyleValueData::Keyword { keyword } => entries.last_mut()?.1 = Some(*keyword),+ _ => entries.push((item, None)),+ }+ }+ // A single shape defaults to the half-border-box. Of two, the outer one defaults to the border box, and the inner+ // one to the padding box.+ let default_box = |count: usize, index: usize| match (count, index) {+ (1, _) => keyword::HALF_BORDER_BOX,+ (_, 0) => keyword::BORDER_BOX,+ _ => keyword::PADDING_BOX,+ };+ if let [(outer, outer_box), (inner, inner_box)] = entries[..]+ && outer.data() == inner.data()+ && outer_box.unwrap_or(default_box(2, 0)) == inner_box.unwrap_or(default_box(2, 1))+ {+ // NB: An omitted box means something else for a single shape, so this keeps the box the outer shape used.+ entries = vec![(outer, Some(outer_box.unwrap_or(default_box(2, 0))))];+ }+ let count = entries.len();+ let mut canonical = Vec::with_capacity(count * 2);+ for (index, (shape, geometry_box)) in entries.into_iter().enumerate() {+ canonical.push(shape.clone_retained());+ if let Some(geometry_box) = geometry_box.filter(|&geometry_box| geometry_box != default_box(count, index)) {+ canonical.push(retained_new(StyleValueData::Keyword { keyword: geometry_box }));+ }+ }+ if canonical.len() == values.as_slice().len() {+ return None;+ }+ if let [only] = &canonical[..] {+ return Some(Arc::new(only.data().clone()));+ }+ Some(Arc::new(StyleValueData::ValueList {+ values: RetainedStyleValueDataList::from_retained_values(canonical),+ separator: 0,+ collapsible: false,+ }))+}+// https://drafts.csswg.org/css-contain-2/#contain-property#[allow(clippy::arc_with_non_send_sync)]fn collapse_containment_list(value: &StyleValueData) -> Option<Arc<StyleValueData>> {@@ -4172,6 +4222,21 @@ pub(crate) unsafe fn drive_property_computation(};NativeValue::StyleValue(border_spacing_pair(single))}+ (None, prop::BORDER_SHAPE) => {+ let resolution_context =+ length_resolution_context.expect("border-shape must compute with a resolution context");+ match absolutize_value(value_data, resolution_context, current_effective_color_scheme, results) {+ Some(crate::css::absolutize::Absolutized::Unchanged) => canonicalize_border_shape(value_data)+ .map_or(NativeValue::Unchanged, NativeValue::StyleValue),+ Some(crate::css::absolutize::Absolutized::Changed(new_value)) => {+ match canonicalize_border_shape(new_value.data()) {+ Some(canonical) => NativeValue::StyleValue(canonical),+ None => NativeValue::StyleValue(new_value.into_arc()),+ }+ }+ None => NativeValue::Unsupported,+ }+ }(_, prop::CONTAIN) => match collapse_containment_list(value_data) {Some(value) => NativeValue::StyleValue(value),None => NativeValue::Unchanged,diff --git a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs b/Libraries/LibWeb/Rust/src/css/table_group_builder.rsindex e0a2d2d1b4a..45f68fc6ed7 100644--- a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs+++ b/Libraries/LibWeb/Rust/src/css/table_group_builder.rs@@ -1822,6 +1822,7 @@ fn build_border_group(payload.border_top_right_radius = retained(property_id::BORDER_TOP_RIGHT_RADIUS);payload.has_noninitial_border_radii = has_noninitial_border_radii;payload.border_image_source = retained(property_id::BORDER_IMAGE_SOURCE);+ payload.border_shape = retained(property_id::BORDER_SHAPE);payload.border_image_slice = retained(property_id::BORDER_IMAGE_SLICE);payload.border_image_width = retained(property_id::BORDER_IMAGE_WIDTH);payload.border_image_outset = retained(property_id::BORDER_IMAGE_OUTSET);diff --git a/Libraries/LibWeb/Rust/src/painting/border_shape.rs b/Libraries/LibWeb/Rust/src/painting/border_shape.rsnew file mode 100644index 00000000000..e3ca41a7969--- /dev/null+++ b/Libraries/LibWeb/Rust/src/painting/border_shape.rs@@ -0,0 +1,270 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++//! https://drafts.csswg.org/css-borders-4/#border-shape++use crate::css::computed_value_views::ComputedValuesView;+use crate::css::css_enums::keyword;+use crate::css::css_pixels::{CssPixelRect, CssPixels};+use crate::css::property_metadata::property_id;+use crate::css::style_value::{BasicShapeData, StyleValueData};+use crate::layout::node_data::NodeSlotId;+use crate::painting::display_list::device_pixels::DevicePixelConverter;+use crate::painting::paint_read::PaintRead;+use crate::painting::paintable_data::BorderEdge;+use crate::painting::record::paint::border::{BordersDataDevicePixels, border_color};+use crate::painting::visual_context::basic_shapes::basic_shape_device_path;+use crate::painting::{paintable_geometry, style_queries};+use libgfx_rust::path::OwnedPath;+use libgfx_rust::{Color, WindingRule};++/// A border drawn along a shape, in device space.+pub(crate) enum BorderShape {+ /// A single shape: the border is a stroke along its path.+ Stroke {+ path: OwnedPath,+ fill_rule: WindingRule,+ /// The shape against its reference box shrunk by half the stroke width, along the inner edge of the stroke.+ inner_edge: OwnedPath,+ width: f32,+ color: Option<Color>,+ },+ /// Two shapes: the border is the area between them.+ Fill {+ outer: OwnedPath,+ inner: OwnedPath,+ inner_fill_rule: WindingRule,+ color: Option<Color>,+ },+}++/// Whether the computed value of 'border-shape' is not none.+pub(crate) fn has_border_shape(style: ComputedValuesView<'_>) -> bool {+ style_queries::handle_value(&style.border().border_shape)+ .is_some_and(|value| !matches!(value, StyleValueData::Keyword { .. }))+}++/// One path holding the subpaths of both `paths`.+fn combined_path(paths: [&OwnedPath; 2]) -> Option<OwnedPath> {+ let svg = paths.map(|path| path.to_svg_string()).join(" ");+ let parsed = crate::svg::parse_utf16_path(&svg.encode_utf16().collect::<Vec<_>>(), false)?;+ Some(crate::css::css_path::CssPath::new(parsed).to_gfx_path())+}++impl BorderShape {+ /// The area the border covers, filled with the even-odd rule, when it is not a stroke.+ pub(crate) fn fill_area(&self) -> Option<OwnedPath> {+ match self {+ Self::Stroke { .. } => None,+ Self::Fill { outer, inner, .. } => combined_path([outer, inner]),+ }+ }++ /// The inner border-shape clips the background. A single shape clips it along its path, under the stroke.+ pub(crate) fn background_clip_path(&self) -> (&OwnedPath, WindingRule) {+ match self {+ Self::Stroke { path, fill_rule, .. } => (path, *fill_rule),+ Self::Fill {+ inner, inner_fill_rule, ..+ } => (inner, *inner_fill_rule),+ }+ }++ /// https://drafts.csswg.org/css-borders-4/#border-shape-overflow-interaction+ /// The inner border-shape clips the overflow content of the element. A single shape clips it along the inner edge+ /// of its stroke.+ pub(crate) fn into_overflow_clip_path(self) -> (OwnedPath, WindingRule) {+ match self {+ Self::Stroke {+ inner_edge, fill_rule, ..+ } => (inner_edge, fill_rule),+ Self::Fill {+ inner, inner_fill_rule, ..+ } => (inner, inner_fill_rule),+ }+ }+}++/// The edge of the relevant side for border shape.+/// https://drafts.csswg.org/css-borders-4/#relevant-side-for-border-shape+fn relevant_side(style: ComputedValuesView<'_>) -> BorderEdge {+ let edge_of = |logical_style: u16| match crate::css::style_compute::map_logical_alias_to_physical(+ logical_style,+ style.writing_mode(),+ style.direction(),+ ) {+ property_id::BORDER_TOP_STYLE => BorderEdge::Top,+ property_id::BORDER_RIGHT_STYLE => BorderEdge::Right,+ property_id::BORDER_BOTTOM_STYLE => BorderEdge::Bottom,+ _ => BorderEdge::Left,+ };+ // An element's relevant side for border shape is the first side (in the order block-start, inline-start,+ // block-end, and inline-end) that has a non-none border style, or block-start if they're all none.+ let sides = [+ edge_of(property_id::BORDER_BLOCK_START_STYLE),+ edge_of(property_id::BORDER_INLINE_START_STYLE),+ edge_of(property_id::BORDER_BLOCK_END_STYLE),+ edge_of(property_id::BORDER_INLINE_END_STYLE),+ ];+ let computed_style = |edge| match edge {+ BorderEdge::Top => style.border_top_style(),+ BorderEdge::Right => style.border_right_style(),+ BorderEdge::Bottom => style.border_bottom_style(),+ BorderEdge::Left => style.border_left_style(),+ };+ sides+ .into_iter()+ .find(|&edge| computed_style(edge) != crate::css::css_enums::line_style::NONE)+ .unwrap_or(sides[0])+}++fn relevant_side_width(style: ComputedValuesView<'_>, edge: BorderEdge) -> CssPixels {+ match edge {+ BorderEdge::Top => style.border_top_width(),+ BorderEdge::Right => style.border_right_width(),+ BorderEdge::Bottom => style.border_bottom_width(),+ BorderEdge::Left => style.border_left_width(),+ }+}++/// The reference box a <geometry-box> keyword names, or `default` when there is none.+/// FIXME: Inline boxes paint once per fragment, but this resolves against the whole element's border box, so a box+/// broken across lines paints the whole shape in each fragment. The spec does not say how a border shape+/// fragments yet.+fn reference_box(+ layout_arena: &impl PaintRead,+ slot: NodeSlotId,+ style: ComputedValuesView<'_>,+ geometry_box: Option<u16>,+ default: u16,+) -> CssPixelRect {+ let border_box = paintable_geometry::absolute_border_box_rect(layout_arena, slot);+ let widths = [+ style.border_top_width(),+ style.border_right_width(),+ style.border_bottom_width(),+ style.border_left_width(),+ ];+ let inset = |rect: CssPixelRect, [top, right, bottom, left]: [CssPixels; 4]| {+ CssPixelRect::new(+ rect.x + left,+ rect.y + top,+ rect.width - left - right,+ rect.height - top - bottom,+ )+ };+ match geometry_box.unwrap_or(default) {+ keyword::PADDING_BOX => inset(border_box, widths),+ keyword::CONTENT_BOX => paintable_geometry::absolute_rect(layout_arena, slot),+ keyword::MARGIN_BOX => {+ let margin = paintable_geometry::committed_margin(layout_arena, slot);+ inset(border_box, [-margin.top, -margin.right, -margin.bottom, -margin.left])+ }+ // The box halfway between the border box and the padding box.+ keyword::HALF_BORDER_BOX => inset(border_box, widths.map(|width| width.scaled(0.5))),+ // FIXME: Map fill-box, stroke-box and view-box for SVG elements. They name the border box for CSS boxes.+ _ => border_box,+ }+}++impl BorderShape {+ pub(crate) fn of(+ layout_arena: &impl PaintRead,+ slot: NodeSlotId,+ borders_data: &BordersDataDevicePixels,+ pixel_ratio: f64,+ ) -> Option<Self> {+ let style = layout_arena.node_style_if_live(slot)?;+ let value = style_queries::handle_value(&style.border().border_shape)?;+ // [ <basic-shape> <geometry-box>? ]{1,2}, as a lone shape or a list of shapes and boxes.+ let mut shapes: Vec<(&BasicShapeData, Option<u16>)> = Vec::new();+ let items = match value {+ StyleValueData::ValueList { values, .. } => values.as_slice().iter().map(|value| value.data()).collect(),+ value => vec![value],+ };+ for item in items {+ match item {+ StyleValueData::BasicShape { shape } => shapes.push((shape.as_ref(), None)),+ StyleValueData::Keyword { keyword } => shapes.last_mut()?.1 = Some(*keyword),+ _ => return None,+ }+ }++ let edge = relevant_side(style);+ let side = borders_data.for_edge(edge);+ let color = (side.width > 0).then(|| border_color(edge, borders_data));+ // The fill color of the border is the relevant side's computed 'border-color', whatever its width.+ let fill_color = Color(match edge {+ BorderEdge::Top => style.border_top_color(),+ BorderEdge::Right => style.border_right_color(),+ BorderEdge::Bottom => style.border_bottom_color(),+ BorderEdge::Left => style.border_left_color(),+ });+ match shapes[..] {+ // A single shape defaults to the half-border-box, so that the stroke matches the default border.+ [(shape, geometry_box)] => {+ let reference = reference_box(layout_arena, slot, style, geometry_box, keyword::HALF_BORDER_BOX);+ let (path, fill_rule) = basic_shape_device_path(shape, reference, pixel_ratio);+ let half_width = relevant_side_width(style, edge).scaled(0.5);+ // FIXME: Moving the reference box by half the stroke width only offsets coordinates given as+ // percentages. Shapes with absolute lengths need the edges of the stroke's outline instead.+ let inner_edge_reference = CssPixelRect::new(+ reference.x + half_width,+ reference.y + half_width,+ reference.width - half_width - half_width,+ reference.height - half_width - half_width,+ );+ let (inner_edge, _) = basic_shape_device_path(shape, inner_edge_reference, pixel_ratio);+ Some(Self::Stroke {+ path,+ fill_rule,+ inner_edge,+ width: side.width as f32,+ color,+ })+ }+ // The outer shape defaults to the border box, and the inner one to the padding box.+ [(outer, outer_box), (inner, inner_box)] => {+ let outer_reference = reference_box(layout_arena, slot, style, outer_box, keyword::BORDER_BOX);+ let inner_reference = reference_box(layout_arena, slot, style, inner_box, keyword::PADDING_BOX);+ let (outer, _) = basic_shape_device_path(outer, outer_reference, pixel_ratio);+ let (inner, inner_fill_rule) = basic_shape_device_path(inner, inner_reference, pixel_ratio);+ Some(Self::Fill {+ outer,+ inner,+ inner_fill_rule,+ color: Some(fill_color),+ })+ }+ _ => None,+ }+ }++ /// The border shape of a box being painted, with the device pixel converter's scale.+ pub(crate) fn for_paintable(+ layout_arena: &impl PaintRead,+ slot: NodeSlotId,+ converter: &DevicePixelConverter,+ ) -> Option<Self> {+ let style = layout_arena.node_style_if_live(slot)?;+ if !has_border_shape(style) {+ return None;+ }+ let border = paintable_geometry::committed_border(layout_arena, slot);+ let borders_data = crate::painting::record::paint::border::style_borders_data(+ style,+ border,+ crate::painting::record::paint::border::ALL_PIECE_EDGES,+ converter,+ );+ Self::of(+ layout_arena,+ slot,+ &borders_data,+ converter.device_pixels_per_css_pixel(),+ )+ }+}diff --git a/Libraries/LibWeb/Rust/src/painting/mod.rs b/Libraries/LibWeb/Rust/src/painting/mod.rsindex 57841aa576d..c738e8263b9 100644--- a/Libraries/LibWeb/Rust/src/painting/mod.rs+++ b/Libraries/LibWeb/Rust/src/painting/mod.rs@@ -5,6 +5,7 @@*/pub mod border_radii;+pub(crate) mod border_shape;pub(crate) mod caret;pub(crate) mod chrome_geometry;pub(crate) mod client_rects;diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/background.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/background.rsindex 77844571312..a61bdb3db97 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/background.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/background.rs@@ -211,7 +211,19 @@ fn paint_background_layers<O: Observer>(.node_style_if_live(paintable).map(CornerShapes::of).filter(|shapes| !is_root_element && shapes.needs_contour(border_box_corner_radii));+ // https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction+ // The inner border shape clips the background, and the border radii are ignored.+ let border_shape_clip = (!is_root_element)+ .then(|| crate::painting::border_shape::BorderShape::for_paintable(recorder.source, paintable, &converter))+ .flatten()+ .map(|border_shape| {+ let (path, fill_rule) = border_shape.background_clip_path();+ PendingInlineClip::intersecting_path(path, fill_rule)+ });let contour_clip = |css_rect: CssPixelRect| {+ if let Some(clip) = &border_shape_clip {+ return Some(clip.clone());+ }corner_shapes.map(|shapes| {let rect = converter.rounded_device_rect(css_rect).to_float();let insets = Insets {diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/border.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/border.rsindex 4322c03887d..497600898f8 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/border.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/border.rs@@ -1477,6 +1477,15 @@ pub(crate) fn paint_box_borders<O: Observer>(return;}let converter = recorder.converter;+ if let Some(border_shape) = crate::painting::border_shape::BorderShape::of(+ recorder.source,+ paintable,+ borders_data,+ converter.device_pixels_per_css_pixel(),+ ) {+ paint_border_shape(&mut recorder.recorder, &border_shape, borders_data.force_dark_role);+ return;+ }let device_border_rect = converter.rounded_device_rect(border_box_rect);let corner_radii = border_radii.as_corners(&converter);if let Some(style) = recorder.source.node_style_if_live(paintable) {@@ -1495,6 +1504,54 @@ pub(crate) fn paint_box_borders<O: Observer>(paint_all_borders(&mut recorder.recorder, device_border_rect, corner_radii, borders_data);}+// https://drafts.csswg.org/css-borders-4/#border-shape-syntax+// FIXME: Draw the border's line style along the shape. Every style is drawn solid for now.+fn paint_border_shape(+ painter: &mut DisplayListRecorder,+ border_shape: &crate::painting::border_shape::BorderShape,+ force_dark_role: ForceDarkRole,+) {+ use crate::painting::border_shape::BorderShape;+ match border_shape {+ // Single shape: the border is rendered as a stroke along the shape's path, with the stroke width determined by+ // the relevant side's computed border width.+ BorderShape::Stroke {+ path,+ width,+ color: Some(color),+ ..+ } => painter.stroke_path(StrokePathParams {+ force_dark_role,+ cap_style: CapStyle::Butt,+ join_style: JoinStyle::Miter,+ // INTEROP: Corners of the shape stay sharp however acute they are, as in other engines.+ miter_limit: 1000.0,+ dash_array: Vec::new(),+ dash_offset: 0.0,+ path,+ opacity: 1.0,+ paint_style_or_color: PaintStyleOrColor::Color(*color),+ thickness: *width,+ should_anti_alias: ShouldAntiAlias::Yes,+ }),+ // Two shapes: the border is rendered as the area between the two paths.+ BorderShape::Fill { color: Some(color), .. } => {+ let Some(area) = border_shape.fill_area() else {+ return;+ };+ painter.fill_path(FillPathParams {+ force_dark_role,+ path: &area,+ opacity: 1.0,+ paint_style_or_color: PaintStyleOrColor::Color(*color),+ winding_rule: WindingRule::EvenOdd,+ should_anti_alias: ShouldAntiAlias::Yes,+ });+ }+ _ => {}+ }+}+// https://drafts.csswg.org/css-borders-4/#corner-shape-rendering// An element's border is rendered in the area between its outer contour and its inner contour.// FIXME: Draw the dashed, dotted, double, groove, ridge, inset and outset styles along the contour. Everydiff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/mod.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/mod.rsindex c8ec0adf444..0b9d459f1fc 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/mod.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/mod.rs@@ -62,7 +62,11 @@ pub(crate) fn paint_phase_mask<O: Observer>({phases |= PaintPhase::Background.bit();}- if facts.paints_border_image || style_queries::has_css_borders(style) {+ // A border shape fills the area between its two shapes even without border widths.+ if facts.paints_border_image+ || style_queries::has_css_borders(style)+ || crate::painting::border_shape::has_border_shape(style)+ {phases |= PaintPhase::Border.bit();}}diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rsindex fb398effcb2..a0b8622f6dd 100644--- a/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rs+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/basic_shapes.rs@@ -553,14 +553,12 @@ pub(crate) fn shape_to_path(path.build()}-pub(crate) fn compute_basic_shape_clip_path_data(- layout_arena: &impl PaintRead,- slot: NodeSlotId,+/// The device-space path of a computed basic shape whose reference box is `reference_box`, and its fill rule.+pub(crate) fn basic_shape_device_path(+ shape: &BasicShapeData,+ reference_box: CssPixelRect,pixel_ratio: f64,-) -> Option<(OwnedPath, libgfx_rust::IntRect, WindingRule)> {- let node = slot;- let style = layout_arena.node_style_if_live(node)?;- let clip_path = style_queries::handle_value(&style.mask().clip_path)?;+) -> (OwnedPath, WindingRule) {let BasicShapeData {kind,v0,@@ -572,24 +570,21 @@ pub(crate) fn compute_basic_shape_clip_path_data(points,path,commands,- } = clip_path.basic_shape()?;-- // FIXME: Support other geometry boxes. See: https://drafts.fxtf.org/css-masking/#typedef-geometry-box- let masking_area = paintable_geometry::absolute_border_box_rect(layout_arena, slot);- let reference_box = CssPixelRect::new(+ } = shape;+ let local_reference_box = CssPixelRect::new(CssPixels::from_raw(0),CssPixels::from_raw(0),- masking_area.width,- masking_area.height,+ reference_box.width,+ reference_box.height,);let shape_path = match *kind {- basic_shape_kind::INSET => inset_to_path(v0, v1, v2, v3, v4, reference_box),- basic_shape_kind::CIRCLE => circle_to_path(v0, v1, reference_box),- basic_shape_kind::ELLIPSE => ellipse_to_path(v0, v1, reference_box),- basic_shape_kind::POLYGON => polygon_to_path(points, reference_box),+ basic_shape_kind::INSET => inset_to_path(v0, v1, v2, v3, v4, local_reference_box),+ basic_shape_kind::CIRCLE => circle_to_path(v0, v1, local_reference_box),+ basic_shape_kind::ELLIPSE => ellipse_to_path(v0, v1, local_reference_box),+ basic_shape_kind::POLYGON => polygon_to_path(points, local_reference_box),basic_shape_kind::PATH => path.to_gfx_path(),- basic_shape_kind::SHAPE => shape_to_path(points.as_slice(), commands.as_slice(), reference_box),- _ => unreachable!("computed clip-path basic shape holds an unlowered kind"),+ basic_shape_kind::SHAPE => shape_to_path(points.as_slice(), commands.as_slice(), local_reference_box),+ _ => unreachable!("a computed basic shape holds a lowered kind"),};let resolved_fill_rule = match *kind {basic_shape_kind::POLYGON | basic_shape_kind::PATH | basic_shape_kind::SHAPE => {@@ -597,11 +592,33 @@ pub(crate) fn compute_basic_shape_clip_path_data(}_ => WindingRule::Nonzero,};-- let translated_path =- shape_path.copy_transformed([1.0, 0.0, 0.0, 1.0, masking_area.x.to_float(), masking_area.y.to_float()]);+ let translated_path = shape_path.copy_transformed([+ 1.0,+ 0.0,+ 0.0,+ 1.0,+ reference_box.x.to_float(),+ reference_box.y.to_float(),+ ]);let scale = pixel_ratio as f32;- let device_path = translated_path.copy_transformed([scale, 0.0, 0.0, scale, 0.0, 0.0]);+ (+ translated_path.copy_transformed([scale, 0.0, 0.0, scale, 0.0, 0.0]),+ resolved_fill_rule,+ )+}++pub(crate) fn compute_basic_shape_clip_path_data(+ layout_arena: &impl PaintRead,+ slot: NodeSlotId,+ pixel_ratio: f64,+) -> Option<(OwnedPath, libgfx_rust::IntRect, WindingRule)> {+ let node = slot;+ let style = layout_arena.node_style_if_live(node)?;+ let clip_path = style_queries::handle_value(&style.mask().clip_path)?;+ // FIXME: Support other geometry boxes. See: https://drafts.fxtf.org/css-masking/#typedef-geometry-box+ let masking_area = paintable_geometry::absolute_border_box_rect(layout_arena, slot);+ let (device_path, resolved_fill_rule) =+ basic_shape_device_path(clip_path.basic_shape()?, masking_area, pixel_ratio);let converter = DevicePixelConverter::new(pixel_ratio);let device_bounding_rect = converter.rounded_device_rect(masking_area);Some((device_path, device_bounding_rect, resolved_fill_rule))diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/build.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/build.rsindex e10b71e6c7d..75b1bbf38b4 100644--- a/Libraries/LibWeb/Rust/src/painting/visual_context/build.rs+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/build.rs@@ -209,8 +209,21 @@ impl BoxFacts {};// https://drafts.csswg.org/css-borders-4/#corner-shape-rendering// An element's overflow area is shaped by its inner contour.+ // NB: As with rounded corners, a clip in one axis only is not shaped.// FIXME: Shape an overflow clip edge that overflow-clip-margin moves off the padding box.if let Some(overflow_clip) = &mut facts.overflow_clip+ && super::node_values::overflow_clips_both_axes(layout_arena, slot)+ && let Some(border_shape) =+ crate::painting::border_shape::BorderShape::for_paintable(layout_arena, slot, &converter)+ {+ let (path, fill_rule) = border_shape.into_overflow_clip_path();+ facts.overflow_clip_contour = Some(ClipPathData {+ path: std::sync::Arc::new(path),+ bounding_rect: libgfx_rust::enclosing_int_rect(overflow_clip.rect),+ fill_rule,+ });+ overflow_clip.corner_radii = CornerRadii::default();+ } else if let Some(overflow_clip) = &mut facts.overflow_clip&& overflow_clip.corner_radii.has_any_radius()&& let Some(style) = layout_arena.node_style_if_live(slot){diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rsindex 7c19178654e..8f54e348207 100644--- a/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/node_values.rs@@ -356,6 +356,12 @@ pub(crate) fn border_radii_data(slot: NodeSlotId,) -> BorderRadii {let border = style.border();+ // https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction+ // When an element's computed value of 'border-shape' is not none, its 'border-radius' is ignored, as if it was set+ // to 0.+ if crate::painting::border_shape::has_border_shape(style) {+ return BorderRadii::default();+ }let has_noninitial_radii = !border_radius_is_initial(&border.border_bottom_left_radius)|| !border_radius_is_initial(&border.border_bottom_right_radius)|| !border_radius_is_initial(&border.border_top_left_radius)@@ -402,6 +408,12 @@ pub(crate) fn piece_border_radii_data(present_edges: u8,) -> BorderRadii {let border = style.border();+ // https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction+ // When an element's computed value of 'border-shape' is not none, its 'border-radius' is ignored, as if it was set+ // to 0.+ if crate::painting::border_shape::has_border_shape(style) {+ return BorderRadii::default();+ }let has_noninitial_radii = !border_radius_is_initial(&border.border_bottom_left_radius)|| !border_radius_is_initial(&border.border_bottom_right_radius)|| !border_radius_is_initial(&border.border_top_left_radius)@@ -833,10 +845,23 @@ pub(crate) fn may_have_clip(layout_arena: &impl PaintRead, node: NodeSlotId) ->|| style.content_visibility() == content_visibility::AUTO}-pub(crate) fn compute_clip_data(layout_arena: &impl PaintRead, slot: NodeSlotId, pixel_ratio: f64) -> Option<ClipData> {+/// Whether a box's overflow clips in both axes, which is when its clipping region follows its corners.+pub(crate) fn overflow_clips_both_axes(layout_arena: &impl PaintRead, slot: NodeSlotId) -> bool {+ use crate::css::css_enums::overflow;+ layout_arena.node_style_if_live(slot).is_some_and(|style| {+ let (overflow_x, overflow_y) = used_overflow(layout_arena, slot, style);+ overflow_x != overflow::VISIBLE && overflow_y != overflow::VISIBLE+ })+}++/// The overflow-x and overflow-y values a box clips its content with, after paint containment.+fn used_overflow(+ layout_arena: &impl PaintRead,+ slot: NodeSlotId,+ style: crate::css::computed_value_views::ComputedValuesView<'_>,+) -> (u8, u8) {use crate::css::css_enums::{content_visibility, overflow};let node = slot;- let style = layout_arena.node_style_if_live(node)?;let box_values = style.box_values();let mut overflow_x = box_values.overflow_x;let mut overflow_y = box_values.overflow_y;@@ -857,6 +882,14 @@ pub(crate) fn compute_clip_data(layout_arena: &impl PaintRead, slot: NodeSlotId,overflow_x = overflow::CLIP;overflow_y = overflow::CLIP;}+ (overflow_x, overflow_y)+}++pub(crate) fn compute_clip_data(layout_arena: &impl PaintRead, slot: NodeSlotId, pixel_ratio: f64) -> Option<ClipData> {+ use crate::css::css_enums::overflow;+ let node = slot;+ let style = layout_arena.node_style_if_live(node)?;+ let (overflow_x, overflow_y) = used_overflow(layout_arena, node, style);// https://drafts.csswg.org/css-overflow-3/#propdef-overflow// 'clip'diff --git a/Tests/LibWeb/Ref/expected/border-shape-one-axis-overflow-clip-is-not-shaped-ref.html b/Tests/LibWeb/Ref/expected/border-shape-one-axis-overflow-clip-is-not-shaped-ref.htmlnew file mode 100644index 00000000000..6a1d67e3685--- /dev/null+++ b/Tests/LibWeb/Ref/expected/border-shape-one-axis-overflow-clip-is-not-shaped-ref.html@@ -0,0 +1,15 @@+<!DOCTYPE html>+<style>+.box {+ width: 100px;+ height: 100px;+ margin: 50px;+ overflow-x: clip;+}+.content {+ width: 100px;+ height: 200px;+ background: green;+}+</style>+<div class="box"><div class="content"></div></div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-background-origin-border-box-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-background-origin-border-box-ref.htmlnew file mode 100644index 00000000000..e5040df425d--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-background-origin-border-box-ref.html@@ -0,0 +1,20 @@+<!DOCTYPE html>+<style>+ .test {+ display: inline-block;+ width: 130px;+ height: 130px;+ box-sizing: border-box;+ margin: 15px 5px;+ background: green;+ }++ .t4 {+ border-radius: 50%;+ }+</style>+<p>This should be a green background, no red.</p>+<div class="test"></div>+<div class="test"></div>+<div class="test"></div>+<div class="test t4"></div>\ No newline at end of filediff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-circle-extent-keywords-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-circle-extent-keywords-ref.htmlnew file mode 100644index 00000000000..845896202e3--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-circle-extent-keywords-ref.html@@ -0,0 +1,23 @@+<!doctype html>+<title>CSS Borders: border-shape circle() radial-extent keywords reference</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+ .box {+ width: 300px;+ height: 400px;+ margin: 50px;+ background: green;+ }+ /* closest side is the left edge: min(60, 300-60, 80, 400-80) = 60 */+ #closest-side { border-shape: circle(60px at 60px 80px); }+ /* farthest side is the bottom edge: max(60, 300-60, 80, 400-80) = 320 */+ #farthest-side { border-shape: circle(320px at 60px 80px); }+ /* closest corner is (0,0): hypot(60, 80) = 100 */+ #closest-corner { border-shape: circle(100px at 60px 80px); }+ /* farthest corner is (300,400): hypot(240, 320) = 400 */+ #farthest-corner { border-shape: circle(400px at 60px 80px); }+</style>+<div id="closest-side" class="box"></div>+<div id="farthest-side" class="box"></div>+<div id="closest-corner" class="box"></div>+<div id="farthest-corner" class="box"></div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-clips-background-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-clips-background-ref.htmlnew file mode 100644index 00000000000..7a19ae7ac3c--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-clips-background-ref.html@@ -0,0 +1,19 @@+<!DOCTYPE html>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+svg {+ width: 100px;+ height: 100px;+ overflow: visible;+ border: 10px solid transparent;+}++circle {+ stroke: purple;+ stroke-width: 10px;+ fill: green;+}+</style>+<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">+ <circle cx="50" cy="50" r="55" />+</svg>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-collapsed-shape-clips-background-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-collapsed-shape-clips-background-ref.htmlnew file mode 100644index 00000000000..db8e74d013a--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-collapsed-shape-clips-background-ref.html@@ -0,0 +1,15 @@+<!DOCTYPE html>+<meta charset="utf-8">+<style>+ .test {+ margin: 10px;+ display: inline-block;+ width: 200px;+ height: 200px;+ background: green;+ }+</style>++<div class="test"></div>+<div class="test"></div>+<div class="test"></div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-double-shape-default-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-double-shape-default-ref.htmlnew file mode 100644index 00000000000..36c2c059515--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-double-shape-default-ref.html@@ -0,0 +1,30 @@+<!DOCTYPE html>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+body {+ margin: 0;+}+.container {+ display: flex;+ gap: 40px;+ padding: 30px;+}+.box {+ width: 100px;+ height: 100px;+ background: lightblue;+ border: 20px solid rgba(255, 0, 0, 0.5);+ fill: rgba(0, 255, 0, 0.3);+}+/* Both should be identical with explicit border-box */+#double-implicit {+ border-shape: circle(50%) border-box circle(40%) padding-box;+}+#double-explicit {+ border-shape: circle(50%) border-box circle(40%) padding-box;+}+</style>+<div class="container">+ <div class="box" id="double-implicit"></div>+ <div class="box" id="double-explicit"></div>+</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-dynamic-color-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-dynamic-color-ref.htmlnew file mode 100644index 00000000000..01f1e10fdf4--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-dynamic-color-ref.html@@ -0,0 +1,13 @@+<!DOCTYPE html>+<title>CSS Borders Ref: dynamic border-color update</title>+<style>+ #target {+ width: 200px;+ height: 200px;+ box-sizing: border-box;+ background: green;+ border-shape: inset(0px) inset(0px round 100px);+ border-color: transparent;+ }+</style>+<div id="target"></div>\ No newline at end of filediff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-ellipse-extent-keywords-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-ellipse-extent-keywords-ref.htmlnew file mode 100644index 00000000000..3f6c3b3dec2--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-ellipse-extent-keywords-ref.html@@ -0,0 +1,23 @@+<!doctype html>+<title>CSS Borders: border-shape ellipse() radial-extent keywords reference</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+ .box {+ width: 300px;+ height: 400px;+ margin: 50px;+ background: green;+ }+ /* closest side: x = min(60, 240) = 60, y = min(80, 320) = 80 */+ #closest { border-shape: ellipse(60px 80px at 60px 80px); }+ /* farthest side: x = max(60, 240) = 240, y = max(80, 320) = 320 */+ #farthest { border-shape: ellipse(240px 320px at 60px 80px); }+ /* closest x, farthest y */+ #closest-farthest { border-shape: ellipse(60px 320px at 60px 80px); }+ /* farthest x, closest y */+ #farthest-closest { border-shape: ellipse(240px 80px at 60px 80px); }+</style>+<div id="closest" class="box"></div>+<div id="farthest" class="box"></div>+<div id="closest-farthest" class="box"></div>+<div id="farthest-closest" class="box"></div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-geometry-box-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-geometry-box-ref.htmlnew file mode 100644index 00000000000..6fdcbc59a08--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-geometry-box-ref.html@@ -0,0 +1,44 @@+<!DOCTYPE html>+<style>+body {+ margin: 0;+}+.container {+ display: inline-block;+}+svg {+ display: block;+}+</style>++<div class="container">+ <svg xmlns="http://www.w3.org/2000/svg" width="160" height="160">+ <rect width="160" height="160" fill="palegoldenrod" />+ <rect x="10" y="10" width="140" height="140" fill="thistle" />+ <rect x="30" y="30" width="100" height="100" fill="lightblue" />+ </svg>+</div>++<div class="container">+ <svg xmlns="http://www.w3.org/2000/svg" width="160" height="160">+ <rect width="160" height="160" fill="yellow" />+ <rect x="10" y="10" width="140" height="140" fill="palegoldenrod" />+ <rect x="20" y="20" width="120" height="120" fill="thistle" />+ <rect x="30" y="30" width="100" height="100" fill="lightblue" />+ </svg>+</div>++<div class="container">+ <svg xmlns="http://www.w3.org/2000/svg" width="160" height="160">+ <rect width="160" height="160" fill="yellow" />+ <rect x="20" y="20" width="120" height="120" fill="palegoldenrod" />+ <rect x="30" y="30" width="100" height="100" fill="lightblue" />+ </svg>+</div>++<div class="container">+ <svg xmlns="http://www.w3.org/2000/svg" width="160" height="160">+ <rect width="160" height="160" fill="palegoldenrod" />+ <rect x="30" y="30" width="100" height="100" fill="lightblue" />+ </svg>+</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-half-border-box-default-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-half-border-box-default-ref.htmlnew file mode 100644index 00000000000..b9d5f4c05eb--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-half-border-box-default-ref.html@@ -0,0 +1,39 @@+<!DOCTYPE html>+<style>+body {+ margin: 0;+}+.container {+ display: flex;+ gap: 32px;+ padding: 20px;+}+.target {+ width: 100px;+ height: 100px;+ background: lightblue;+}+/* Circle with explicit half-border-box */+#circle {+ border: 10px solid red;+ border-shape: circle(50%) half-border-box;+}+/* Ellipse with asymmetric borders and explicit half-border-box */+#ellipse {+ border-top: 8px solid green;+ border-right: 12px solid green;+ border-bottom: 8px solid green;+ border-left: 12px solid green;+ border-shape: ellipse(50% 50%) half-border-box;+}+/* Inset with uniform borders and explicit half-border-box */+#inset {+ border: 15px solid blue;+ border-shape: inset(10% round 20%) half-border-box;+}+</style>+<div class="container">+ <div class="target" id="circle"></div>+ <div class="target" id="ellipse"></div>+ <div class="target" id="inset"></div>+</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-ref.htmlnew file mode 100644index 00000000000..f5e1a93db17--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-ref.html@@ -0,0 +1,17 @@+<!DOCTYPE html>+<style>+.test {+ width: 200px;+ height: 200px;+ box-sizing: border-box;+ margin: 50px auto;+ outline: 1px solid black;+ border: 10px solid transparent;+ background: linear-gradient(green, green);+ /* Same border-shape as the test, but with border-radius: 0.+ If they match, then border-radius on the test was successfully ignored. */+ border-shape: inset(0px) inset(10px round 20px);+ border-radius: 0px;+}+</style>+<div class="test"></div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-inner-outer-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-inner-outer-ref.htmlnew file mode 100644index 00000000000..76b36749d86--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-inner-outer-ref.html@@ -0,0 +1,17 @@+<!DOCTYPE html>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+svg {+ width: 100px;+ height: 100px;+ overflow: visible;+}++polygon {+ fill: yellow;+}+</style>+<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">+ <polygon points="50,0 100,50, 50,100, 0,50" />+ <circle cx="50" cy="50" r="20" style="fill:green"></circle>+</svg>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-ref.htmlnew file mode 100644index 00000000000..1d746f899aa--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-ref.html@@ -0,0 +1,16 @@+<!DOCTYPE html>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+svg {+ width: 100px;+ height: 100px;+ overflow: visible;+}++polygon {+ fill: green;+}+</style>+<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">+ <polygon points="50,0 100,50, 50,100, 0,50" />+</svg>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-solid-background-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-solid-background-ref.htmlnew file mode 100644index 00000000000..cc482e344e2--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-solid-background-ref.html@@ -0,0 +1,19 @@+<!DOCTYPE html>+<style>+ .br-target {+ overflow-y: scroll;+ will-change: transform;+ width: 100px;+ height: 100px;+ border-radius: 50%;+ background: green;+ }+ .forcescroll {+ width: 25px;+ height: 400px;+ background: linear-gradient(pink, blue);+ }+</style>+<div class="br-target">+ <div class="forcescroll"></div>+</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-polygon-miter-limit-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-polygon-miter-limit-ref.htmlnew file mode 100644index 00000000000..fa85331a51d--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-polygon-miter-limit-ref.html@@ -0,0 +1,45 @@+<!DOCTYPE html>+<title>CSS Borders Reference: border-shape polygon stroke miter limit</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+ .test {+ width: 66px;+ height: 150px;+ margin: 50px 20px;+ display: inline-block;+ overflow: visible;+ }++ .t1 {+ border: 20px solid transparent;+ }++ .t2 {+ border: 19px solid transparent;+ }+</style>+<!-- For .test t1 -->+<svg class="test t1" viewBox="0 0 66 150">+ <polygon points="-20,-20 86,170 86,-20 -20,170" fill="none" stroke="green" stroke-width="20"+ stroke-miterlimit="1000" />+</svg>+<!-- For .test t2 -->+<svg class="test t2" viewBox="0 0 66 150">+ <polygon points="-19,-19 85,169 85,-19 -19,169" fill="none" stroke="green" stroke-width="19"+ stroke-miterlimit="1000" />+</svg>+<!-- For .test-path t1 -->+<svg class="test t1" viewBox="0 0 66 150">+ <polygon points="-20,-20 86,170 86,-20 -20,170" fill="none" stroke="green" stroke-width="20"+ stroke-miterlimit="1000" />+</svg>+<!-- For .test-shape t1 -->+<svg class="test t1" viewBox="0 0 66 150">+ <polygon points="-20,-20 86,170 86,-20 -20,170" fill="none" stroke="green" stroke-width="20"+ stroke-miterlimit="1000" />+</svg>+<!-- For .test-shape t2 -->+<svg class="test t2" viewBox="0 0 66 150">+ <polygon points="-19,-19 85,169 85,-19 -19,169" fill="none" stroke="green" stroke-width="19"+ stroke-miterlimit="1000" />+</svg>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-shape-arc-miter-limit-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-shape-arc-miter-limit-ref.htmlnew file mode 100644index 00000000000..0d3cc568305--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-shape-arc-miter-limit-ref.html@@ -0,0 +1,15 @@+<!DOCTYPE html>+<title>CSS Borders Reference: border-shape shape() with arc uses default stroke miter limit</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<style>+ .test {+ width: 100px;+ height: 100px;+ margin: 50px;+ display: inline-block;+ overflow: visible;+ }+</style>+<svg class="test" viewBox="0 0 100 100">+ <path d="M 50 10 A 80 80 0 0 0 90 80 A 80 80 0 0 0 10 80 A 80 80 0 0 0 50 10 Z" fill="none" stroke="green" stroke-width="10" stroke-miterlimit="4" />+</svg>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-stroke-invalidation-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-stroke-invalidation-ref.htmlnew file mode 100644index 00000000000..2a16aeebf7d--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-borders/border-shape/border-shape-stroke-invalidation-ref.html@@ -0,0 +1,15 @@+<!DOCTYPE html>+<style>+ body {+ margin: 0;+ }++ #changer {+ width: 200px;+ height: 200px;+ border-shape: circle(50% at 50% 50%);+ stroke: lightblue;+ stroke-width: 50px;+ }+</style>+<div id="changer"></div>diff --git a/Tests/LibWeb/Ref/input/border-shape-one-axis-overflow-clip-is-not-shaped.html b/Tests/LibWeb/Ref/input/border-shape-one-axis-overflow-clip-is-not-shaped.htmlnew file mode 100644index 00000000000..1f7030a33da--- /dev/null+++ b/Tests/LibWeb/Ref/input/border-shape-one-axis-overflow-clip-is-not-shaped.html@@ -0,0 +1,18 @@+<!DOCTYPE html>+<link rel="match" href="../expected/border-shape-one-axis-overflow-clip-is-not-shaped-ref.html">+<style>+.box {+ width: 100px;+ height: 100px;+ margin: 50px;+ overflow-x: clip;+ border-shape: circle();+}+.content {+ width: 100px;+ height: 200px;+ background: green;+}+</style>+<!-- An overflow clip in one axis only is not shaped by border-shape, as it is not rounded by border-radius. -->+<div class="box"><div class="content"></div></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-background-origin-border-box.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-background-origin-border-box.htmlnew file mode 100644index 00000000000..5baa5fc1d11--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-background-origin-border-box.html@@ -0,0 +1,43 @@+<!DOCTYPE html>+<title>CSS Borders Test: border-shape with background-origin</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-background-origin-border-box-ref.html">+<meta name="fuzzy" content="maxDifference=0-98;totalPixels=0-500">+<style>+ .test {+ display: inline-block;+ width: 100px;+ height: 100px;+ box-sizing: border-box;+ margin: 30px 20px;+ background: linear-gradient(green, green) red;+ background-origin: border-box;+ background-repeat: no-repeat;+ border: 30px solid;+ border-shape: inset(0px) border-box;+ }++ .t1 {+ border-color: rgba(0, 128, 0, 1);+ border-style: dotted;+ }++ .t2 {+ border-color: rgba(0, 128, 0, 1);+ }++ .t3 {+ border-color: rgba(0, 128, 0, 1);+ background-repeat: repeat;+ }++ .t4 {+ border-color: rgba(0, 128, 0, 1);+ border-shape: circle(50%) border-box;+ }+</style>+<p>This should be a green background, no red.</p>+<div class="test t1"></div>+<div class="test t2"></div>+<div class="test t3"></div>+<div class="test t4"></div>\ No newline at end of filediff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-circle-extent-keywords.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-circle-extent-keywords.htmlnew file mode 100644index 00000000000..948004a180d--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-circle-extent-keywords.html@@ -0,0 +1,22 @@+<!doctype html>+<title>CSS Borders: border-shape circle() radial-extent keywords</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="help" href="https://drafts.csswg.org/css-images-3/#typedef-radial-size">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-circle-extent-keywords-ref.html">+<meta name="assert" content="circle() radial-extent keywords resolve to the distance to the closest/farthest side or corner.">+<style>+ .box {+ width: 300px;+ height: 400px;+ margin: 50px;+ background: green;+ }+ #closest-side { border-shape: circle(closest-side at 60px 80px); }+ #farthest-side { border-shape: circle(farthest-side at 60px 80px); }+ #closest-corner { border-shape: circle(closest-corner at 60px 80px); }+ #farthest-corner { border-shape: circle(farthest-corner at 60px 80px); }+</style>+<div id="closest-side" class="box"></div>+<div id="farthest-side" class="box"></div>+<div id="closest-corner" class="box"></div>+<div id="farthest-corner" class="box"></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-clips-background.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-clips-background.htmlnew file mode 100644index 00000000000..01801179335--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-clips-background.html@@ -0,0 +1,14 @@+<!DOCTYPE html>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-clips-background-ref.html">+<style>+#target {+ width: 100px;+ height: 100px;+ border-shape: circle();+ border: 10px solid purple;+ background: green;+ border-radius: 10px;+}+</style>+<div id="target"></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-collapsed-shape-clips-background.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-collapsed-shape-clips-background.htmlnew file mode 100644index 00000000000..55eb6c87f63--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-collapsed-shape-clips-background.html@@ -0,0 +1,48 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>border-shape: collapsed shape clips background fully</title>+<link rel="author" title="Jason Leo" href="mailto:[email protected]">+<link rel="author" title="一丝" href="mailto:[email protected]">+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-collapsed-shape-clips-background-ref.html">+<style>+ .test {+ margin: 10px;+ display: inline-block;+ width: 200px;+ height: 200px;+ box-sizing: border-box;+ border: 1px solid green;+ background: green;+ }++ .inner {+ box-sizing: border-box;+ background: linear-gradient(red, red);+ border: 10px solid transparent;+ }++ .t1 .inner {+ height: 100%;+ border-shape: inset(100px);+ }+ .t2 .inner {+ height: 200px;+ border-shape: circle(0%);+ }+ .t3 .inner {+ height: 100%;+ background: red;+ border-shape: inset(0) circle(0%);+ }+</style>++<div class="test t1">+ <div class="inner"></div>+</div>+<div class="test t2">+ <div class="inner"></div>+</div>+<div class="test t3">+ <div class="inner"></div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-double-shape-default.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-double-shape-default.htmlnew file mode 100644index 00000000000..b3b40aa1f00--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-double-shape-default.html@@ -0,0 +1,34 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Borders Test: double-shape border-shape defaults to border-box</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-double-shape-default-ref.html">+<style>+body {+ margin: 0;+}+.container {+ display: flex;+ gap: 40px;+ padding: 30px;+}+.box {+ width: 100px;+ height: 100px;+ background: lightblue;+ border: 20px solid rgba(255, 0, 0, 0.5);+ fill: rgba(0, 255, 0, 0.3);+}+/* Double shape - should default to border-box + padding-box */+#double-implicit {+ border-shape: circle(50%) circle(40%);+}+/* Explicit border-box should match */+#double-explicit {+ border-shape: circle(50%) border-box circle(40%) padding-box;+}+</style>+<div class="container">+ <div class="box" id="double-implicit"></div>+ <div class="box" id="double-explicit"></div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-dynamic-color.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-dynamic-color.htmlnew file mode 100644index 00000000000..3d5a88cc274--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-dynamic-color.html@@ -0,0 +1,30 @@+<!DOCTYPE html>+<html class="reftest-wait">+<title>CSS Borders Test: dynamic border-color update</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-dynamic-color-ref.html">+<style>+ #target {+ width: 200px;+ height: 200px;+ box-sizing: border-box;+ background: green;+ color: red;+ border-shape: inset(0px) inset(0px round 100px);+ }++ .transparent-border {+ border-color: transparent;+ }+</style>+<div id="target"></div>+<script>+ requestAnimationFrame(() => {+ requestAnimationFrame(() => {+ document.getElementById('target').classList.add('transparent-border');+ document.documentElement.classList.remove('reftest-wait');+ });+ });+</script>++</html>\ No newline at end of filediff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-ellipse-extent-keywords.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-ellipse-extent-keywords.htmlnew file mode 100644index 00000000000..ef3a7ed9114--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-ellipse-extent-keywords.html@@ -0,0 +1,22 @@+<!doctype html>+<title>CSS Borders: border-shape ellipse() radial-extent keywords</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="help" href="https://drafts.csswg.org/css-images-3/#typedef-radial-size">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-ellipse-extent-keywords-ref.html">+<meta name="assert" content="ellipse() per-axis radial-extent keywords resolve to the distance to the closest/farthest side in each axis.">+<style>+ .box {+ width: 300px;+ height: 400px;+ margin: 50px;+ background: green;+ }+ #closest { border-shape: ellipse(closest-side closest-side at 60px 80px); }+ #farthest { border-shape: ellipse(farthest-side farthest-side at 60px 80px); }+ #closest-farthest { border-shape: ellipse(closest-side farthest-side at 60px 80px); }+ #farthest-closest { border-shape: ellipse(farthest-side closest-side at 60px 80px); }+</style>+<div id="closest" class="box"></div>+<div id="farthest" class="box"></div>+<div id="closest-farthest" class="box"></div>+<div id="farthest-closest" class="box"></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-geometry-box.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-geometry-box.htmlnew file mode 100644index 00000000000..31c36429e6b--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-geometry-box.html@@ -0,0 +1,63 @@+<!DOCTYPE html>+<title>CSS Borders Test: border-shape with geometry box</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-geometry-box-ref.html">+<style>+body {+ margin: 0;+}+.container {+ display: inline-block;+ background: yellow;+}+.test {+ width: 100px;+ height: 100px;+ background: thistle;+ padding: 10px;+ margin: 10px;+ border: 10px solid palegoldenrod;+}+.contents {+ width: 100%;+ height: 100%;+ background: lightblue;+}+#margin-border {+ border-shape: polygon(0 0, 100% 0, 100% 100%, 0 100%) margin-box polygon(0 0, 100% 0, 100% 100%, 0 100%) border-box;+}+#border-padding {+ border-shape: polygon(0 0, 100% 0, 100% 100%, 0 100%) border-box polygon(0 0, 100% 0, 100% 100%, 0 100%) padding-box;+}+#padding-content {+ border-shape: polygon(0 0, 100% 0, 100% 100%, 0 100%) padding-box polygon(0 0, 100% 0, 100% 100%, 0 100%) content-box;+}+#margin-content {+ border-shape: polygon(0 0, 100% 0, 100% 100%, 0 100%) margin-box polygon(0 0, 100% 0, 100% 100%, 0 100%) content-box;+}+</style>++<div class="container">+ <div class="test" id="margin-border">+ <div class="contents"></div>+ </div>+</div>++<div class="container">+ <div class="test" id="border-padding">+ <div class="contents"></div>+ </div>+</div>++<div class="container">+ <div class="test" id="padding-content">+ <div class="contents"></div>+ </div>+</div>++<div class="container">+ <div class="test" id="margin-content">+ <div class="contents"></div>+ </div>+</div>+diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-half-border-box-default.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-half-border-box-default.htmlnew file mode 100644index 00000000000..9d213942647--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-half-border-box-default.html@@ -0,0 +1,43 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Borders Test: border-shape defaults to half-border-box for single shape</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-half-border-box-default-ref.html">+<style>+body {+ margin: 0;+}+.container {+ display: flex;+ gap: 32px;+ padding: 20px;+}+.target {+ width: 100px;+ height: 100px;+ background: lightblue;+}+/* Circle with 10px border - shape should be centered in border */+#circle {+ border: 10px solid red;+ border-shape: circle(50%);+}+/* Ellipse with asymmetric borders */+#ellipse {+ border-top: 8px solid green;+ border-right: 12px solid green;+ border-bottom: 8px solid green;+ border-left: 12px solid green;+ border-shape: ellipse(50% 50%);+}+/* Inset with uniform borders */+#inset {+ border: 15px solid blue;+ border-shape: inset(10% round 20%);+}+</style>+<div class="container">+ <div class="target" id="circle"></div>+ <div class="target" id="ellipse"></div>+ <div class="target" id="inset"></div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius.htmlnew file mode 100644index 00000000000..8025611a06d--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius.html@@ -0,0 +1,20 @@+<!DOCTYPE html>+<title>CSS Border Shape: border-radius is ignored when border-shape is specified</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-ref.html">+<style>+.test {+ width: 200px;+ height: 200px;+ box-sizing: border-box;+ margin: 50px auto;+ outline: 1px solid black;+ border: 10px solid transparent;+ background: linear-gradient(green, green);+ /* Outer shape is sharp border-box (inset 0).+ Inner shape is rounded, inset by 10px (matching the border width). */+ border-shape: inset(0px) inset(10px round 20px);+ border-radius: 999px;+}+</style>+<div class="test"></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-inner-outer.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-inner-outer.htmlnew file mode 100644index 00000000000..34a8379a4e6--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-inner-outer.html@@ -0,0 +1,15 @@+<!DOCTYPE html>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-inner-outer-ref.html">+<meta name="fuzzy" content="maxDifference=0-170;totalPixels=0-150">+<style>+#target {+ width: 100px;+ height: 100px;+ border-shape: polygon(50% 0, 100% 50%, 50% 100%, 0 50%) circle(20%);+ border-color: yellow;+ background: green;+ border-radius: 10px;+}+</style>+<div id="target"></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-overflow-solid-background.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-overflow-solid-background.htmlnew file mode 100644index 00000000000..0bc38d3644b--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-overflow-solid-background.html@@ -0,0 +1,23 @@+<!DOCTYPE html>+<title>CSS Borders Shape: border-shape overscroll with solid background</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-solid-background-ref.html">+<meta name=fuzzy content="0-200;0-360">+<style>+ .bs-target {+ overflow-y: scroll;+ will-change: transform;+ width: 100px;+ height: 100px;+ border-shape: circle(50% at 50% 50%);+ background: green;+ }+ .forcescroll {+ width: 25px;+ height: 400px;+ background: linear-gradient(pink, blue);+ }+</style>+<div class="bs-target">+ <div class="forcescroll"></div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-overflow.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-overflow.htmlnew file mode 100644index 00000000000..6535861e144--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-overflow.html@@ -0,0 +1,22 @@+<!DOCTYPE html>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-overflow-ref.html">+<meta name="fuzzy" content="maxDifference=0-96;totalPixels=0-256">+<style>+#target {+ width: 100px;+ height: 100px;+ border-shape: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);+ border-radius: 10px;+ position: relative;+ overflow: hidden;+}+#inner {+ background: green;+ position: absolute;+ inset: 0;+}+</style>+<div id="target">+ <div id="inner"></div>+</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-polygon-miter-limit.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-polygon-miter-limit.htmlnew file mode 100644index 00000000000..9d2c9fe17ca--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-polygon-miter-limit.html@@ -0,0 +1,42 @@+<!DOCTYPE html>+<title>CSS Borders Test: border-shape polygon stroke keeps miter joins</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-polygon-miter-limit-ref.html">+<style>+ .test {+ border-shape: polygon(0% 0%, 100% 100%, 100% 0%, 0% 100%) border-box;+ width: 66px;+ height: 150px;+ margin: 50px 20px;+ display: inline-block;+ }++ .test-path {+ border-shape: path("M 0 0 L 106 190 L 106 0 L 0 190 Z") border-box;+ width: 66px;+ height: 150px;+ margin: 50px 20px;+ display: inline-block;+ }++ .test-shape {+ border-shape: shape(from 0% 0%, line to 100% 100%, line to 100% 0%, line to 0% 100%, close) border-box;+ width: 66px;+ height: 150px;+ margin: 50px 20px;+ display: inline-block;+ }++ .t1 {+ border: 20px solid green;+ }++ .t2 {+ border: 19px solid green;+ }+</style>+<div class="test t1"></div>+<div class="test t2"></div>+<div class="test-path t1"></div>+<div class="test-shape t1"></div>+<div class="test-shape t2"></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-shape-arc-miter-limit.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-shape-arc-miter-limit.htmlnew file mode 100644index 00000000000..4d26065011a--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-shape-arc-miter-limit.html@@ -0,0 +1,17 @@+<!DOCTYPE html>+<title>CSS Borders Test: border-shape shape() with arc uses default stroke miter limit</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-shape-arc-miter-limit-ref.html">+<meta name="fuzzy" content="maxDifference=0-10;totalPixels=0-50">+<style>+ .test {+ box-sizing: border-box;+ border-shape: shape(from 50% 10%, arc to 90% 80% of 80px ccw, arc to 10% 80% of 80px ccw, arc to 50% 10% of 80px ccw, close) border-box;+ width: 100px;+ height: 100px;+ margin: 50px;+ display: inline-block;+ border: 10px solid green;+ }+</style>+<div class="test"></div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-stroke-invalidation.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-stroke-invalidation.htmlnew file mode 100644index 00000000000..57deb963a2f--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-borders/border-shape/border-shape-stroke-invalidation.html@@ -0,0 +1,28 @@+<!DOCTYPE html>+<html class="reftest-wait">+<title>CSS Borders Shape: border-shape strokes update their entire visual area when the stroke color changes.</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<link rel="match" href="../../../../../expected/wpt-import/css/css-borders/border-shape/border-shape-stroke-invalidation-ref.html">+<style>+ body {+ margin: 0;+ }++ #changer {+ width: 200px;+ height: 200px;+ border-shape: circle(50% at 50% 50%);+ stroke: blue;+ stroke-width: 50px;+ }+</style>+<div id="changer"></div>+<script>+ const changer = document.getElementById('changer');+ requestAnimationFrame(() => {+ changer.style.setProperty('stroke', 'lightblue');+ requestAnimationFrame(() => {+ document.documentElement.classList.remove('reftest-wait');+ });+ });+</script>diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txtindex bcc8bb64342..050f7192c23 100644--- a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt+++ b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt@@ -141,6 +141,7 @@ All properties associated with getComputedStyle(document.body):"border-right-color","border-right-style","border-right-width",+ "border-shape","border-start-end-radius","border-start-start-radius","border-top-color",diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txtindex 91b7d3301a1..48d288f3668 100644--- a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt+++ b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt@@ -349,6 +349,8 @@ All supported properties and their default values exposed from CSSStylePropertie'border-right-style': 'none''borderRightWidth': '0px''border-right-width': '0px'+'borderShape': 'none'+'border-shape': 'none''borderSpacing': '0px''border-spacing': '0px''borderStartEndRadius': '0px'diff --git a/Tests/LibWeb/Text/expected/css/border-shape-computed-collapse-keeps-box.txt b/Tests/LibWeb/Text/expected/css/border-shape-computed-collapse-keeps-box.txtnew file mode 100644index 00000000000..fdd72090036--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/border-shape-computed-collapse-keeps-box.txt@@ -0,0 +1,3 @@+border-shape: circle() circle() border-box: circle() border-box+border-shape: circle() border-box circle() border-box: circle() border-box+border-shape: circle() circle(): circle() circle()diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txtindex dffabf575f4..3f8b78a1c16 100644--- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt+++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt@@ -139,6 +139,7 @@ border-left-width: 0pxborder-right-color: rgb(0, 0, 0)border-right-style: noneborder-right-width: 0px+border-shape: noneborder-start-end-radius: 0pxborder-start-start-radius: 0pxborder-top-color: rgb(0, 0, 0)@@ -209,7 +210,7 @@ grid-row-start: autogrid-template-areas: nonegrid-template-columns: nonegrid-template-rows: none-height: 2743px+height: 2756pxinline-size: 784pxinset-block-end: autoinset-block-start: auto@@ -335,7 +336,7 @@ top: autotouch-action: autotransform: nonetransform-box: view-box-transform-origin: 392px 2190.5px+transform-origin: 392px 2197pxtransform-style: flattransition-behavior: normaltransition-delay: 0sdiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-computed.txtnew file mode 100644index 00000000000..f8945a88bd5--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-computed.txt@@ -0,0 +1,6 @@+Harness status: OK++Found 1 tests++1 Fail+Fail border-radius and corner-shape are NOT reset in computed style when border-shape is specified\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-computed.txtnew file mode 100644index 00000000000..3fce80af71a--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-computed.txt@@ -0,0 +1,27 @@+Harness status: OK++Found 22 tests++22 Pass+Pass Property border-shape value 'none'+Pass Property border-shape value 'circle()'+Pass Property border-shape value 'circle(closest-corner at center)'+Pass Property border-shape value 'circle(closest-corner at 20px 50px)'+Pass Property border-shape value 'circle(farthest-corner at center)'+Pass Property border-shape value 'ellipse(closest-corner farthest-corner at 20px 50px)'+Pass Property border-shape value 'polygon(10px 10px, 100px 10px, 10px 100px)'+Pass Property border-shape value 'shape(from 0px 0px, hline to 100px, vline to 100px, close)'+Pass Property border-shape value 'circle() circle()'+Pass Property border-shape value 'circle() border-box circle() padding-box'+Pass Property border-shape value 'circle() polygon(10px 10px, 100px 10px, 10px 100px)'+Pass Property border-shape value 'circle(closest-corner) ellipse(farthest-corner closest-corner)'+Pass Property border-shape value 'circle() content-box'+Pass Property border-shape value 'circle() border-box'+Pass Property border-shape value 'circle() border-box polygon(10px 10px, 100px 10px, 10px 100px) border-box'+Pass Property border-shape value 'circle() padding-box polygon(10px 10px, 100px 10px, 10px 100px) border-box'+Pass Property border-shape value 'circle() padding-box polygon(10px 10px, 100px 10px, 10px 100px) padding-box'+Pass Property border-shape value 'circle() polygon(10px 10px, 100px 10px, 10px 100px) border-box'+Pass Property border-shape value 'circle() polygon(10px 10px, 100px 10px, 10px 100px) content-box'+Pass Property border-shape value 'circle() half-border-box'+Pass Property border-shape value 'circle() half-border-box circle() half-border-box'+Pass Property border-shape value 'circle() border-box circle() border-box'\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-invalid.txtnew file mode 100644index 00000000000..c806a9932f2--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-invalid.txt@@ -0,0 +1,17 @@+Harness status: OK++Found 12 tests++12 Pass+Pass e.style['border-shape'] = "circle() none" should not set the property value+Pass e.style['border-shape'] = "polygon(bla 10px 10px, 100px 10px, 10px 100px)" should not set the property value+Pass e.style['border-shape'] = "shape()" should not set the property value+Pass e.style['border-shape'] = "nonsense" should not set the property value+Pass e.style['border-shape'] = "1px" should not set the property value+Pass e.style['border-shape'] = "circle() padding-box margin-box" should not set the property value+Pass e.style['border-shape'] = "padding-box margin-box" should not set the property value+Pass e.style['border-shape'] = "padding-box" should not set the property value+Pass e.style['border-shape'] = "padding-box circle()" should not set the property value+Pass e.style['border-shape'] = "circle() padding-box margin-box circle()" should not set the property value+Pass e.style['border-shape'] = "circle() padding-box circle() margin-box circle()" should not set the property value+Pass e.style['border-shape'] = "circle() padding-box circle() margin-box padding-box" should not set the property value\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-valid.txtnew file mode 100644index 00000000000..6863e38b46d--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-borders/tentative/parsing/border-shape-valid.txt@@ -0,0 +1,17 @@+Harness status: OK++Found 12 tests++12 Pass+Pass e.style['border-shape'] = "none" should set the property value+Pass e.style['border-shape'] = "circle()" should set the property value+Pass e.style['border-shape'] = "circle(closest-corner at 20px 50px)" should set the property value+Pass e.style['border-shape'] = "circle(farthest-corner at center)" should set the property value+Pass e.style['border-shape'] = "ellipse(closest-corner farthest-corner at 20px 50px)" should set the property value+Pass e.style['border-shape'] = "polygon(10px 10px, 100px 10px, 10px 100px)" should set the property value+Pass e.style['border-shape'] = "shape(from 0px 0px, hline to 100px, vline to 100px, close)" should set the property value+Pass e.style['border-shape'] = "circle() circle()" should set the property value+Pass e.style['border-shape'] = "circle() polygon(10px 10px, 100px 10px, 10px 100px)" should set the property value+Pass e.style['border-shape'] = "circle(closest-corner) ellipse(farthest-corner closest-corner)" should set the property value+Pass e.style['border-shape'] = "circle() border-box circle() content-box" should set the property value+Pass e.style['border-shape'] = "circle() margin-box circle() view-box" should set the property value\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/css/border-shape-computed-collapse-keeps-box.html b/Tests/LibWeb/Text/input/css/border-shape-computed-collapse-keeps-box.htmlnew file mode 100644index 00000000000..5c51755251c--- /dev/null+++ b/Tests/LibWeb/Text/input/css/border-shape-computed-collapse-keeps-box.html@@ -0,0 +1,12 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<!-- Two equal shapes collapse into one, which keeps the box the outer shape used. -->+<div style="border-shape: circle() circle() border-box"></div>+<div style="border-shape: circle() border-box circle() border-box"></div>+<div style="border-shape: circle() circle()"></div>+<script>+ test(() => {+ for (const element of document.querySelectorAll("div"))+ println(`${element.getAttribute("style")}: ${getComputedStyle(element).borderShape}`);+ });+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-computed.html b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-computed.htmlnew file mode 100644index 00000000000..48024221e82--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/border-shape/border-shape-ignore-radius-computed.html@@ -0,0 +1,27 @@+<!DOCTYPE html>+<title>CSS Border Shape: border-radius is ignored in computed style when border-shape is specified</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape-radius-interaction">+<script src="../../../resources/testharness.js"></script>+<script src="../../../resources/testharnessreport.js"></script>+<style>+#test {+ border-shape: inset(0px) inset(0px round 20px);+ border-radius: 999px;+ corner-shape: bevel;+}+</style>+<div id="test"></div>+<script>+test(() => {+ const style = getComputedStyle(document.getElementById('test'));+ assert_not_equals(style.borderShape, 'none', 'borderShape should be parsed successfully');+ assert_equals(style.borderTopLeftRadius, '999px');+ assert_equals(style.borderTopRightRadius, '999px');+ assert_equals(style.borderBottomRightRadius, '999px');+ assert_equals(style.borderBottomLeftRadius, '999px');+ assert_equals(style.cornerTopLeftShape, 'superellipse(0)');+ assert_equals(style.cornerTopRightShape, 'superellipse(0)');+ assert_equals(style.cornerBottomRightShape, 'superellipse(0)');+ assert_equals(style.cornerBottomLeftShape, 'superellipse(0)');+}, "border-radius and corner-shape are NOT reset in computed style when border-shape is specified");+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-computed.html b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-computed.htmlnew file mode 100644index 00000000000..99989fe7a04--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-computed.html@@ -0,0 +1,34 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Borders and Box Decorations 4 Test: Parsing 'border-shape' with computed values</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="../../../../css/support/computed-testcommon.js"></script>++<div id="target"></div>++<script>+test_computed_value("border-shape", "none");+test_computed_value("border-shape", "circle()");+test_computed_value("border-shape", "circle(closest-corner at center)", "circle(closest-corner at 50% 50%)");+test_computed_value("border-shape", "circle(closest-corner at 20px 50px)");+test_computed_value("border-shape", "circle(farthest-corner at center)", "circle(farthest-corner at 50% 50%)");+test_computed_value("border-shape", "ellipse(closest-corner farthest-corner at 20px 50px)");+test_computed_value("border-shape", "polygon(10px 10px, 100px 10px, 10px 100px)");+test_computed_value("border-shape", "shape(from 0px 0px, hline to 100px, vline to 100px, close)");+test_computed_value("border-shape", "circle() circle()");+test_computed_value("border-shape", "circle() border-box circle() padding-box", "circle() circle()");+test_computed_value("border-shape", "circle() polygon(10px 10px, 100px 10px, 10px 100px)");+test_computed_value("border-shape", "circle(closest-corner) ellipse(farthest-corner closest-corner)");+test_computed_value("border-shape", "circle() content-box");+test_computed_value("border-shape", "circle() border-box");+test_computed_value("border-shape", "circle() border-box polygon(10px 10px, 100px 10px, 10px 100px) border-box", "circle() polygon(10px 10px, 100px 10px, 10px 100px) border-box");+test_computed_value("border-shape", "circle() padding-box polygon(10px 10px, 100px 10px, 10px 100px) border-box", "circle() padding-box polygon(10px 10px, 100px 10px, 10px 100px) border-box");+test_computed_value("border-shape", "circle() padding-box polygon(10px 10px, 100px 10px, 10px 100px) padding-box", "circle() padding-box polygon(10px 10px, 100px 10px, 10px 100px)");+test_computed_value("border-shape", "circle() polygon(10px 10px, 100px 10px, 10px 100px) border-box", "circle() polygon(10px 10px, 100px 10px, 10px 100px) border-box");+test_computed_value("border-shape", "circle() polygon(10px 10px, 100px 10px, 10px 100px) content-box", "circle() polygon(10px 10px, 100px 10px, 10px 100px) content-box");+test_computed_value("border-shape", "circle() half-border-box", "circle()");+test_computed_value("border-shape", "circle() half-border-box circle() half-border-box", "circle()");+test_computed_value("border-shape", "circle() border-box circle() border-box", "circle() border-box");+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-invalid.htmlnew file mode 100644index 00000000000..412f058aa93--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-invalid.html@@ -0,0 +1,21 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Borders and Box Decorations 4 Test: Parsing 'border-shape' with valid values</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="../../../../css/support/parsing-testcommon.js"></script>+<script>+test_invalid_value("border-shape", "circle() none");+test_invalid_value("border-shape", "polygon(bla 10px 10px, 100px 10px, 10px 100px)");+test_invalid_value("border-shape", "shape()");+test_invalid_value("border-shape", "nonsense");+test_invalid_value("border-shape", "1px");+test_invalid_value("border-shape", "circle() padding-box margin-box");+test_invalid_value("border-shape", "padding-box margin-box");+test_invalid_value("border-shape", "padding-box");+test_invalid_value("border-shape", "padding-box circle()");+test_invalid_value("border-shape", "circle() padding-box margin-box circle()");+test_invalid_value("border-shape", "circle() padding-box circle() margin-box circle()");+test_invalid_value("border-shape", "circle() padding-box circle() margin-box padding-box");+</script>\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-valid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-valid.htmlnew file mode 100644index 00000000000..d690d488931--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-borders/tentative/parsing/border-shape-valid.html@@ -0,0 +1,21 @@+<!DOCTYPE html>+<meta charset="utf-8">+<title>CSS Borders and Box Decorations 4 Test: Parsing 'border-shape' with valid values</title>+<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">+<script src="../../../../resources/testharness.js"></script>+<script src="../../../../resources/testharnessreport.js"></script>+<script src="../../../../css/support/parsing-testcommon.js"></script>+<script>+test_valid_value("border-shape", "none");+test_valid_value("border-shape", "circle()");+test_valid_value("border-shape", "circle(closest-corner at 20px 50px)");+test_valid_value("border-shape", "circle(farthest-corner at center)", "circle(farthest-corner at center center)");+test_valid_value("border-shape", "ellipse(closest-corner farthest-corner at 20px 50px)");+test_valid_value("border-shape", "polygon(10px 10px, 100px 10px, 10px 100px)");+test_valid_value("border-shape", "shape(from 0px 0px, hline to 100px, vline to 100px, close)");+test_valid_value("border-shape", "circle() circle()");+test_valid_value("border-shape", "circle() polygon(10px 10px, 100px 10px, 10px 100px)");+test_valid_value("border-shape", "circle(closest-corner) ellipse(farthest-corner closest-corner)");+test_valid_value("border-shape", "circle() border-box circle() content-box");+test_valid_value("border-shape", "circle() margin-box circle() view-box");+</script>