Truly independent web browser
LibWeb: Support -webkit-text-stroke
sideshowbarkerfdce9b71214f
diff --git a/Libraries/LibCompositing/Rust/src/display_list/builder.rs b/Libraries/LibCompositing/Rust/src/display_list/builder.rsindex 01da6922e9f..6f6245139e4 100644--- a/Libraries/LibCompositing/Rust/src/display_list/builder.rs+++ b/Libraries/LibCompositing/Rust/src/display_list/builder.rs@@ -78,6 +78,13 @@ impl PendingInlineClip {}}+ pub fn subtracting_path(path: &Path, path_winding_rule: WindingRule) -> Self {+ Self {+ mode: ClipMode::Difference,+ ..Self::intersecting_path(path, path_winding_rule)+ }+ }+/// Whether this clip alone keeps what it clips within `rect`, in the space of the command it is recorded on.pub fn lies_within(&self, rect: FloatRect) -> bool {self.space.is_none()diff --git a/Libraries/LibCompositing/Rust/src/display_list/commands.rs b/Libraries/LibCompositing/Rust/src/display_list/commands.rsindex baccb0a2bd3..4bc9d7fda0e 100644--- a/Libraries/LibCompositing/Rust/src/display_list/commands.rs+++ b/Libraries/LibCompositing/Rust/src/display_list/commands.rs@@ -693,6 +693,8 @@ pub trait DisplayListCommand: Copy + FfiBytes {#[derive(Clone, Copy, Debug, PartialEq)]#[repr(C)]pub struct DrawGlyphRun {+ /// Zero fills the glyphs; a positive device-pixel width strokes their outlines.+ pub stroke_width: f32,pub font_id: FontResourceId,pub glyphs: DisplayListDataSpan,pub rect: IntRect,@@ -704,6 +706,7 @@ pub struct DrawGlyphRun {pub font_smoothing: u8,}ffi_bytes_fields!(DrawGlyphRun {+ stroke_width,font_id,glyphs,rect,diff --git a/Libraries/LibCompositing/Rust/src/display_list/damage.rs b/Libraries/LibCompositing/Rust/src/display_list/damage.rsindex ca522f46de1..aa41ed1dc0f 100644--- a/Libraries/LibCompositing/Rust/src/display_list/damage.rs+++ b/Libraries/LibCompositing/Rust/src/display_list/damage.rs@@ -300,7 +300,8 @@ fn display_list_commands_are_equal(a: &CommandReference<'_>, b: &CommandReferenc}if a.header.command_type == DisplayListCommandType::DrawGlyphRun {- return same_field(offset_of!(DrawGlyphRun, font_smoothing), 1)+ return same_field(offset_of!(DrawGlyphRun, stroke_width), 4)+ && same_field(offset_of!(DrawGlyphRun, font_smoothing), 1)&& first.u64_at(offset_of!(DrawGlyphRun, font_id)) == second.u64_at(offset_of!(DrawGlyphRun, font_id))&& first.span_bytes_at(offset_of!(DrawGlyphRun, glyphs))== second.span_bytes_at(offset_of!(DrawGlyphRun, glyphs))@@ -1922,12 +1923,13 @@ mod tests {)}- fn glyph_run_command_bytes(inline_padding: usize, font_smoothing: u8) -> TestDisplayList {+ fn glyph_run_command_bytes(inline_padding: usize, font_smoothing: u8, stroke_width: f32) -> TestDisplayList {let glyph = DisplayListGlyph {position: FloatPoint { x: 1.0, y: 2.0 },glyph_id: 3,};let command = DrawGlyphRun {+ stroke_width,font_smoothing,font_id: FontResourceId(1),glyphs: DisplayListDataSpan {@@ -2876,8 +2878,8 @@ mod tests {#[test]fn inline_payload_alignment_does_not_damage_glyph_runs() {let tree = identity_tree();- let old_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_AUTO);- let new_display_list = glyph_run_command_bytes(4, FONT_SMOOTHING_AUTO);+ let old_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_AUTO, 0.0);+ let new_display_list = glyph_run_command_bytes(4, FONT_SMOOTHING_AUTO, 0.0);assert_eq!(damage(&old_display_list, &tree, &new_display_list, &tree),Some(IntRect::default())@@ -2887,8 +2889,19 @@ mod tests {#[test]fn changing_font_smoothing_damages_glyph_runs() {let tree = identity_tree();- let old_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_AUTO);- let new_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_ANTIALIASED);+ let old_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_AUTO, 0.0);+ let new_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_ANTIALIASED, 0.0);+ assert_eq!(+ damage(&old_display_list, &tree, &new_display_list, &tree),+ Some(IntRect::new(9, 9, 22, 22))+ );+ }++ #[test]+ fn changing_text_stroke_width_damages_glyph_runs() {+ let tree = identity_tree();+ let old_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_AUTO, 1.0);+ let new_display_list = glyph_run_command_bytes(0, FONT_SMOOTHING_AUTO, 2.0);assert_eq!(damage(&old_display_list, &tree, &new_display_list, &tree),Some(IntRect::new(9, 9, 22, 22))@@ -2961,6 +2974,7 @@ mod tests {append_record(&mut bytes,&DrawGlyphRun {+ stroke_width: 0.0,font_smoothing: FONT_SMOOTHING_AUTO,font_id: FontResourceId(1),glyphs: DisplayListDataSpan::default(),diff --git a/Libraries/LibCompositing/Rust/src/display_list/replay.rs b/Libraries/LibCompositing/Rust/src/display_list/replay.rsindex 7fa864a3098..bebc20ab4ae 100644--- a/Libraries/LibCompositing/Rust/src/display_list/replay.rs+++ b/Libraries/LibCompositing/Rust/src/display_list/replay.rs@@ -43,7 +43,7 @@ pub trait ReplayPainter {fn pop(&mut self);fn push_device_space_plane_clip(&mut self, vertices: &[FloatVector3]);fn push_transform(&mut self, transform: &AffineTransform);- fn push_clip_path_bytes(&mut self, path_bytes: &[u8], winding_rule: WindingRule);+ fn push_clip_path_bytes(&mut self, path_bytes: &[u8], winding_rule: WindingRule, mode: ClipMode);// Plays one command. `command` holds the command struct, which can differ from the one at the start of// `payload`; the command's spans point into `payload`.fn play_command(&mut self, command_type: DisplayListCommandType, command: &[u8], payload: &[u8]);@@ -144,7 +144,11 @@ pub fn replay_records<Painter: ReplayPainter + ?Sized>(}match clip.kind {InlineClipKind::Path => {- painter.push_clip_path_bytes(span_bytes(payload, clip.path_data), clip.path_winding_rule);+ painter.push_clip_path_bytes(+ span_bytes(payload, clip.path_data),+ clip.path_winding_rule,+ clip.mode,+ );}InlineClipKind::Rect | InlineClipKind::RoundedRect => painter.push_clip(&ReplayClip {rect: clip.clip_rect_or_path_device_bounds,@@ -1042,7 +1046,7 @@ mod tests {}fn push_transform(&mut self, _transform: &AffineTransform) {}- fn push_clip_path_bytes(&mut self, _path_bytes: &[u8], _winding_rule: WindingRule) {}+ fn push_clip_path_bytes(&mut self, _path_bytes: &[u8], _winding_rule: WindingRule, _mode: ClipMode) {}fn play_command(&mut self, _command_type: DisplayListCommandType, _command: &[u8], _payload: &[u8]) {}diff --git a/Libraries/LibCompositing/Rust/src/display_list/validate.rs b/Libraries/LibCompositing/Rust/src/display_list/validate.rsindex 767792d86bc..8f2290351eb 100644--- a/Libraries/LibCompositing/Rust/src/display_list/validate.rs+++ b/Libraries/LibCompositing/Rust/src/display_list/validate.rs@@ -382,6 +382,10 @@ fn validate_command_fields(let p = payload;match command_type {T::DrawGlyphRun => {+ let stroke_width = p.f32_at(offset_of!(DrawGlyphRun, stroke_width));+ if !stroke_width.is_finite() || stroke_width < 0.0 {+ return Err("Glyph run stroke width must be finite and nonnegative");+ }p.array_span_at::<DisplayListGlyph>(offset_of!(DrawGlyphRun, glyphs))?;p.enum_at::<Orientation>(offset_of!(DrawGlyphRun, orientation))?;}diff --git a/Libraries/LibCompositing/Rust/src/host/replay.rs b/Libraries/LibCompositing/Rust/src/host/replay.rsindex 849ba243b98..841842c225b 100644--- a/Libraries/LibCompositing/Rust/src/host/replay.rs+++ b/Libraries/LibCompositing/Rust/src/host/replay.rs@@ -4,7 +4,9 @@* SPDX-License-Identifier: BSD-2-Clause*/-use crate::display_list::commands::{DisplayListCommandType, EffectNodeIndex, ReplayClip, ReplayLayer, ReplayMask};+use crate::display_list::commands::{+ ClipMode, DisplayListCommandType, EffectNodeIndex, ReplayClip, ReplayLayer, ReplayMask,+};use crate::display_list::replay::{ReplayPainter, ReplaySelection};use libgfx_rust::path::Path;use libgfx_rust::path::ffi::PathGeometryData;@@ -60,7 +62,7 @@ pub struct FfiDisplayListReplayCallbacks {pub pop: unsafe extern "C" fn(*mut c_void),pub push_device_space_plane_clip: unsafe extern "C" fn(*mut c_void, *const FloatVector3, usize),pub push_transform: unsafe extern "C" fn(*mut c_void, *const AffineTransform),- pub push_clip_path_bytes: unsafe extern "C" fn(*mut c_void, *const u8, usize, WindingRule),+ pub push_clip_path_bytes: unsafe extern "C" fn(*mut c_void, *const u8, usize, WindingRule, ClipMode),// Arguments: the command type, the command struct, and the payload its spans point into, with its size.pub play_command: unsafe extern "C" fn(*mut c_void, DisplayListCommandType, *const u8, *const u8, usize),}@@ -124,9 +126,9 @@ impl ReplayPainter for FfiDisplayListReplayCallbacks {unsafe { (self.push_transform)(self.context, transform) };}- fn push_clip_path_bytes(&mut self, path_bytes: &[u8], winding_rule: WindingRule) {+ fn push_clip_path_bytes(&mut self, path_bytes: &[u8], winding_rule: WindingRule, mode: ClipMode) {// SAFETY: The C++ painter reads the serialized path synchronously.- unsafe { (self.push_clip_path_bytes)(self.context, path_bytes.as_ptr(), path_bytes.len(), winding_rule) };+ unsafe { (self.push_clip_path_bytes)(self.context, path_bytes.as_ptr(), path_bytes.len(), winding_rule, mode) };}fn play_command(&mut self, command_type: DisplayListCommandType, command: &[u8], payload: &[u8]) {diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.jsonindex a762db08577..b1d6a3af4e1 100644--- a/Libraries/LibWeb/CSS/Properties.json+++ b/Libraries/LibWeb/CSS/Properties.json@@ -195,6 +195,38 @@"color"]},+ "-webkit-text-stroke": {+ "affects-layout": false,+ "initial": "0 currentColor",+ "longhands": [+ "-webkit-text-stroke-width",+ "-webkit-text-stroke-color"+ ]+ },+ "-webkit-text-stroke-color": {+ "style-group": "InheritedTextValues",+ "affects-layout": false,+ "animation-type": "by-computed-value",+ "inherited": true,+ "initial": "currentColor",+ "needs-layout-node-for-resolved-value": true,+ "requires-computation": "cascaded-value",+ "valid-types": [+ "color"+ ]+ },+ "-webkit-text-stroke-width": {+ "style-group": "InheritedTextValues",+ "affects-layout": false,+ "animation-type": "discrete",+ "inherited": true,+ "initial": "0",+ "requires-computation": "non-inherited-value",+ "valid-types": [+ "length [0,∞]",+ "line-width"+ ]+ },"-webkit-transform": {"legacy-alias-for": "transform"},diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs b/Libraries/LibWeb/Rust/src/css/computed_value_types.rsindex d25e545a5be..b0cf2871309 100644--- a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs+++ b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs@@ -574,6 +574,8 @@ pub struct InheritedTextValues {pub color_style_value: ComputedStyleValueHandle,pub webkit_text_fill_color: u32,pub webkit_text_fill_color_is_current_color: bool,+ pub webkit_text_stroke_color: StyleColor,+ pub webkit_text_stroke_width: f64,pub font_smoothing: u8,pub text_shadow: RetainedComputedShadowList,pub text_transform: u8,diff --git a/Libraries/LibWeb/Rust/src/css/computed_values.rs b/Libraries/LibWeb/Rust/src/css/computed_values.rsindex 09f573c366c..5bec6ae4839 100644--- a/Libraries/LibWeb/Rust/src/css/computed_values.rs+++ b/Libraries/LibWeb/Rust/src/css/computed_values.rs@@ -247,6 +247,8 @@ impl_computed_payload_clone_and_eq!(InheritedTextValues {font_smoothing,webkit_text_fill_color => paint_only,webkit_text_fill_color_is_current_color => paint_only,+ webkit_text_stroke_color => paint_only,+ webkit_text_stroke_width => paint_only,text_shadow,text_transform,text_wrap_style,@@ -2560,6 +2562,8 @@ pub(crate) enum GroupFieldKind {EnumKeyword(fn(u16) -> Option<u8>),/// A number stored as f64.F64,+ /// A nonnegative pixel length stored without fixed-point rounding.+ PixelLengthF64,/// A pixel length stored as raw CSSPixels (i32).CssPixels,/// A pixel length stored as raw CSSPixels, clamped at zero.@@ -2698,6 +2702,8 @@ pub(crate) fn group_field_descriptors(group: usize) -> &'static [GroupFieldDescrCOLOR @ color_style_value => RetainedData,_WEBKIT_TEXT_FILL_COLOR @ webkit_text_fill_color => Color,_WEBKIT_TEXT_FILL_COLOR @ webkit_text_fill_color_is_current_color => KeywordEqualsBool(k::CURRENTCOLOR),+ _WEBKIT_TEXT_STROKE_COLOR @ webkit_text_stroke_color => HeldColor,+ _WEBKIT_TEXT_STROKE_WIDTH @ webkit_text_stroke_width => PixelLengthF64,TEXT_SHADOW => RequireKeyword(k::NONE),TEXT_JUSTIFY @ text_justify => EnumKeyword(enums::keyword_to_text_justify),TEXT_TRANSFORM @ text_transform => EnumKeyword(enums::keyword_to_text_transform),@@ -5348,6 +5354,16 @@ fn decode_group_field_pokes<'a>(};pokes.push(Poke::F64(offset, *value));}+ Kind::PixelLengthF64 => {+ let length = match data {+ StyleValueData::Length { value, unit } if *unit == px_length_unit() => *value,+ StyleValueData::Calculated { .. } => {+ crate::css::calc::resolve_calculated_length_without_context(data, 0.0)?+ }+ _ => return None,+ };+ pokes.push(Poke::F64(offset, length.max(0.0)));+ }Kind::CssPixels => match data {StyleValueData::Length { value, unit } if *unit == px_length_unit() => pokes.push(Poke::I32(offset,@@ -6174,6 +6190,8 @@ impl InheritedTextValues {font_smoothing: css_enums::font_smoothing::AUTO,webkit_text_fill_color: 0xff00_0000,webkit_text_fill_color_is_current_color: true,+ webkit_text_stroke_color: crate::css::computed_value_types::StyleColor::CURRENT_COLOR,+ webkit_text_stroke_width: 0.0,text_shadow: RetainedComputedShadowList::from_vec(Vec::new()),text_transform: enum_value(css_enums::keyword_to_text_transform(css_enums::keyword::NONE)),text_wrap_style: enum_value(css_enums::keyword_to_text_wrap_style(css_enums::keyword::AUTO)),diff --git a/Libraries/LibWeb/Rust/src/css/parser/value_parser.rs b/Libraries/LibWeb/Rust/src/css/parser/value_parser.rsindex cc53c5c2f2e..455f90bcac3 100644--- a/Libraries/LibWeb/Rust/src/css/parser/value_parser.rs+++ b/Libraries/LibWeb/Rust/src/css/parser/value_parser.rs@@ -4167,6 +4167,7 @@ fn parse_unordered_shorthand(context: &ParseContext, property: u16, values: &[Co| property_id::FLEX_FLOW| property_id::OUTLINE| property_id::TEXT_WRAP+ | property_id::_WEBKIT_TEXT_STROKE) {return ParseOutcome::NotHandled;}@@ -4212,7 +4213,7 @@ fn parse_unordered_shorthand(context: &ParseContext, property: u16, values: &[Coelse {return ParseOutcome::Invalid;};- let order = if property == property_id::FLEX_FLOW {+ let order = if matches!(property, property_id::FLEX_FLOW | property_id::_WEBKIT_TEXT_STROKE) {(0..longhands.len()).collect()} else {for index in 0..longhands.len() {diff --git a/Libraries/LibWeb/Rust/src/css/resolved_value.rs b/Libraries/LibWeb/Rust/src/css/resolved_value.rsindex e04582ffaaf..09daf6eb027 100644--- a/Libraries/LibWeb/Rust/src/css/resolved_value.rs+++ b/Libraries/LibWeb/Rust/src/css/resolved_value.rs@@ -965,6 +965,13 @@ impl ResolvedValueBox<'_> {property_id::_WEBKIT_TEXT_FILL_COLOR => {self.resolved_color(property, style.inherited_text().webkit_text_fill_color)}+ property_id::_WEBKIT_TEXT_STROKE_COLOR => self.resolved_color(+ property,+ style+ .inherited_text()+ .webkit_text_stroke_color+ .resolve(style.current_color()),+ ),property_id::LETTER_SPACING => {// https://drafts.csswg.org/css-text-4/#letter-spacing-property// For legacy reasons, a computed letter-spacing of zero yields a resolved value (getComputedStyle()@@ -1103,6 +1110,7 @@ pub unsafe extern "C" fn rust_resolved_value_of_style(property_id::OUTLINE_COLOR => used_color(misc_layout.outline_color.resolve(current_color)),property_id::TEXT_DECORATION_COLOR => used_color(text_reset.text_decoration_color.resolve(current_color)),property_id::_WEBKIT_TEXT_FILL_COLOR => used_color(text.webkit_text_fill_color),+ property_id::_WEBKIT_TEXT_STROKE_COLOR => used_color(text.webkit_text_stroke_color.resolve(current_color)),property_id::BOX_SHADOW => {// SAFETY: The list holds `length` shadows while the style lives.let shadows = unsafe {diff --git a/Libraries/LibWeb/Rust/src/css/style/layout_style.rs b/Libraries/LibWeb/Rust/src/css/style/layout_style.rsindex 4429f9be585..54cc24b2411 100644--- a/Libraries/LibWeb/Rust/src/css/style/layout_style.rs+++ b/Libraries/LibWeb/Rust/src/css/style/layout_style.rs@@ -270,6 +270,7 @@ impl LayoutStyle {self.payloads.write_group::<InheritedTextValues>(index, |values| {values.color = fade(values.color);values.webkit_text_fill_color = fade(values.webkit_text_fill_color);+ values.webkit_text_stroke_color.rgba = fade(values.webkit_text_stroke_color.rgba);});};self.changed = true;diff --git a/Libraries/LibWeb/Rust/src/css/style_compute.rs b/Libraries/LibWeb/Rust/src/css/style_compute.rsindex d5f953f644a..781fa0a15d2 100644--- a/Libraries/LibWeb/Rust/src/css/style_compute.rs+++ b/Libraries/LibWeb/Rust/src/css/style_compute.rs@@ -1647,6 +1647,8 @@ pub(crate) fn value_depends_on_inherited_info_for_property(value: &StyleValueDat|| matches!(value, StyleValueData::Keyword { keyword }if matches!(*keyword, keyword::LARGER | keyword::SMALLER | keyword::MATH))}+ prop::_WEBKIT_TEXT_STROKE_WIDTH => matches!(value, StyleValueData::Keyword { keyword }+ if matches!(*keyword, keyword::THIN | keyword::MEDIUM | keyword::THICK)),prop::LINE_HEIGHT => value_contains_percentage(value),prop::TEXT_ALIGN => matches!(value, StyleValueData::Keyword { keyword }if matches!(*keyword, keyword::MATCH_PARENT | keyword::_LIBWEB_INHERIT_OR_CENTER)),@@ -2439,7 +2441,8 @@ fn property_has_dedicated_compute_rule(property_id: u16) -> bool {use crate::css::property_metadata::property_id as prop;matches!(property_id,- prop::ANIMATION_NAME+ prop::_WEBKIT_TEXT_STROKE_WIDTH+ | prop::ANIMATION_NAME| prop::BACKGROUND_ATTACHMENT| prop::BACKGROUND_CLIP| prop::BACKGROUND_ORIGIN@@ -3615,6 +3618,28 @@ pub(crate) unsafe fn drive_property_computation(})};let native = match (absolutized, inherited_property_id) {+ (_, prop::_WEBKIT_TEXT_STROKE_WIDTH) if matches!(value_data, StyleValueData::Keyword { .. }) => {+ let StyleValueData::Keyword { keyword } = value_data else {+ unreachable!()+ };+ let multiplier = match *keyword {+ keyword::THIN => 1.0,+ keyword::MEDIUM => 3.0,+ keyword::THICK => 5.0,+ _ => unreachable!("a text stroke width keyword is thin, medium or thick"),+ };+ let context = length_resolution_context.expect("text stroke widths require font metrics");+ results.depends_on_viewport_metrics |= context.font_metrics_depend_on_viewport_metrics;+ NativeValue::Px(context.font_metrics.font_size * context.zoom * multiplier / 48.0)+ }+ (Some(absolutized), prop::_WEBKIT_TEXT_STROKE_WIDTH) => {+ absolutized.map_or(NativeValue::Unchanged, NativeValue::Px)+ }+ (None, prop::_WEBKIT_TEXT_STROKE_WIDTH) => NativeValue::Px(+ crate::css::calc::resolve_calculated_length_without_context(value_data, 0.0)+ .expect("a calculated text stroke width resolves to a length"),+ ),+(Some(absolutized),prop::BORDER_BOTTOM_WIDTHdiff --git a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rsindex bad60332b23..0878e284598 100644--- a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs+++ b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs@@ -529,6 +529,9 @@ fn dump_command(output: &mut String, command_type: DisplayListCommandType, paylomatch command_type {DisplayListCommandType::DrawGlyphRun => {let command = read_command::<DrawGlyphRun>(payload);+ if command.stroke_width > 0.0 {+ write_field(output, "stroke_width", command.stroke_width);+ }write_field(output, "rect", command.rect);write_field(output, "translation", command.translation);write_field(output, "color", command.color);diff --git a/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rs b/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rsindex b09b2a9c91b..3a29697a1f9 100644--- a/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rs+++ b/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rs@@ -1073,6 +1073,7 @@ impl DisplayListRecorder {baseline_start: FloatPoint,run: GlyphRunForRecording<impl IntoIterator<Item = DisplayListGlyph>>,color: Color,+ stroke_width: f32,rect: IntRect,scale: f64,orientation: Orientation,@@ -1085,7 +1086,12 @@ impl DisplayListRecorder {let color = self.resolve_color(color, force_dark_role);let mut payload = CommandPayloadBuilder::new::<DrawGlyphRun>(&self.builder);let glyphs = payload.append_objects(run.glyphs);+ let stroke_width = stroke_width.min(crate::css::css_pixels::max_dimension_value().to_float());+ // A miter limit of 4 lets sharp glyph corners extend four half-widths beyond the fill bounds.+ let margin = (stroke_width * 2.0).ceil() as i32;+ let glyph_bounding_rect = glyph_bounding_rect.inflated_edges(margin, margin, margin, margin);let command = DrawGlyphRun {+ stroke_width,font_smoothing: run.font_smoothing,font_id: run.font_id,glyphs,diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/background.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/background.rsindex b914c6399a1..0e826c6b6c0 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/background.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/background.rs@@ -1127,29 +1127,42 @@ fn append_text_clip_paths<O: Observer>(recorder: &mut PaintRecorder<'_, O>, fragfragment_absolute_device_rect,scale,);- recorder.recorder.draw_glyph_run(- emission.baseline_start,- crate::painting::display_list::recorder::GlyphRunForRecording {- font_smoothing: recorder- .source- .node_style_if_live(fragment.style_source)- .unwrap()- .inherited_text()- .font_smoothing,- font_id: crate::painting::display_list::commands::FontResourceId(font_id),- glyphs: run- .glyphs- .placed()- .filter(|placed| placed.glyph.should_paint())- .map(crate::painting::display_list::commands::DisplayListGlyph::from),- },- libgfx_rust::Color::from_rgb(0, 0, 0),- fragment_absolute_device_rect,- scale,- emission.orientation,- emission.glyph_bounding_rect,- ForceDarkRole::None,- );+ let stroke_width = recorder+ .source+ .node_style_if_live(fragment.style_source)+ .unwrap()+ .inherited_text()+ .webkit_text_stroke_width+ * scale;+ for width in [0.0, stroke_width as f32]+ .into_iter()+ .take(if stroke_width > 0.0 { 2 } else { 1 })+ {+ recorder.recorder.draw_glyph_run(+ emission.baseline_start,+ crate::painting::display_list::recorder::GlyphRunForRecording {+ font_smoothing: recorder+ .source+ .node_style_if_live(fragment.style_source)+ .unwrap()+ .inherited_text()+ .font_smoothing,+ font_id: crate::painting::display_list::commands::FontResourceId(font_id),+ glyphs: run+ .glyphs+ .placed()+ .filter(|placed| placed.glyph.should_paint())+ .map(crate::painting::display_list::commands::DisplayListGlyph::from),+ },+ libgfx_rust::Color::from_rgb(0, 0, 0),+ width,+ fragment_absolute_device_rect,+ scale,+ emission.orientation,+ emission.glyph_bounding_rect,+ ForceDarkRole::None,+ );+ }}}diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/inspector_overlay.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/inspector_overlay.rsindex 2703229a0f7..24bf5829f5f 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/inspector_overlay.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/inspector_overlay.rs@@ -533,6 +533,7 @@ fn draw_label<O: Observer>(recorder: &mut PaintRecorder<'_, O>, label: &OverlayLglyphs: label.glyphs.placed().map(DisplayListGlyph::from),},color,+ 0.0,rect,1.0,Orientation::Horizontal,diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/math.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/math.rsindex a797ef1b5b4..e8783500db2 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/math.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/math.rs@@ -42,6 +42,18 @@ pub(crate) fn paint_foreground<O: Observer>(color};let font_smoothing = style.inherited_text().font_smoothing;+ let stroke_width = if data.replaces_text {+ (style.inherited_text().webkit_text_stroke_width * recorder.inputs.device_pixels_per_css_pixel) as f32+ } else {+ 0.0+ };+ let stroke_color = Color(+ style+ .inherited_text()+ .webkit_text_stroke_color+ .resolve(style.current_color()),+ );+ let paint_order = style.inherited_svg().paint_order;let content_box = paintable_geometry::absolute_rect(recorder.source, paintable);let converter = recorder.converter;for rule in &data.rules {@@ -60,25 +72,33 @@ pub(crate) fn paint_foreground<O: Observer>(// NB: Display list glyphs are positioned by the top of the font's ascent rather than by their baseline.let ascent = run.font.facts().ascent;let ink_rect = converter.enclosing_device_rect(run.ink_bounds.translated_by(content_box.location()));- recorder.recorder.draw_glyph_run(- origin,- GlyphRunForRecording {- font_smoothing,- font_id: FontResourceId(font_id),- glyphs: run.glyphs.iter().map(|glyph| DisplayListGlyph {- position: FloatPoint {- x: glyph.x,- y: glyph.y - ascent,- },- glyph_id: glyph.glyph_id,- }),- },- glyph_color,- ink_rect,- scale,- Orientation::Horizontal,- ink_rect,- ForceDarkRole::Foreground,- );+ for operation in paint_order {+ let (color, width) = match operation {+ crate::css::css_enums::paint_order::FILL => (glyph_color, 0.0),+ crate::css::css_enums::paint_order::STROKE if stroke_width > 0.0 => (stroke_color, stroke_width),+ _ => continue,+ };+ recorder.recorder.draw_glyph_run(+ origin,+ GlyphRunForRecording {+ font_smoothing,+ font_id: FontResourceId(font_id),+ glyphs: run.glyphs.iter().map(|glyph| DisplayListGlyph {+ position: FloatPoint {+ x: glyph.x,+ y: glyph.y - ascent,+ },+ glyph_id: glyph.glyph_id,+ }),+ },+ color,+ width,+ ink_rect,+ scale,+ Orientation::Horizontal,+ ink_rect,+ ForceDarkRole::Foreground,+ );+ }}}diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/text.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/text.rsindex 716e1425e1f..079890a6e72 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/text.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/text.rs@@ -9,6 +9,7 @@ use crate::painting::record::trace::Observer;use crate::css::css_pixels::{CssPixelRect, CssPixels};use crate::layout::node_data::{NodeFlag, NodeSlotId};+use crate::painting::display_list::builder::PendingInlineClip;use crate::painting::display_list::commands::{DisplayListGlyph, FontResourceId, TextShadowLayer};use crate::painting::display_list::recorder::GlyphRunForRecording;use crate::painting::force_dark::ForceDarkRole;@@ -17,7 +18,9 @@ use crate::painting::record::PaintRecorder;use crate::painting::record::inputs::CaretTarget;use crate::painting::selection::{HighlightPseudoElement, SelectionRange};use crate::painting::text_fragment::{self, SelectionOffsets};-use libgfx_rust::{Color, FloatPoint, IntPoint, IntRect, Orientation};+use libgfx_rust::path::Path;+use libgfx_rust::{Color, FloatPoint, IntPoint, IntRect, Orientation, WindingRule};+use std::collections::HashSet;use std::sync::Arc;#[derive(Clone, Copy)]@@ -535,9 +538,67 @@ pub(crate) fn paint_fragments<O: Observer>(recorder: &mut PaintRecorder<'_, O>,for span in &spans {paint_text_shadow(recorder, block, span, &span.shadow_layers);}+ // Glyph strokes can extend beyond a highlight rectangle. Keep the normal glyphs outside the highlights, then+ // let each overlay redraw the text inside its rectangle without a stroke.+ let mut stroked_highlights = HashSet::new();+ for fragment_spans in spans.chunk_by(|a, b| a.fragment_index == b.fragment_index) {+ let Some(span) = fragment_spans.iter().find(|span| !span.highlights.is_empty()) else {+ continue;+ };+ let side = recorder.source.committed_side_data(block);+ let fragment = &side.fragments()[span.fragment_index as usize];+ let style = recorder.source.node_style_if_live(fragment.style_source).unwrap();+ let text = style.inherited_text();+ if text.webkit_text_stroke_width <= 0.0 {+ continue;+ }+ let normal_span = RenderSpan {+ fragment_index: span.fragment_index,+ start_code_unit: 0,+ end_code_unit: fragment.length_in_code_units,+ text_color: text.webkit_text_fill_color,+ shadow_layers: Vec::new(),+ highlights: Vec::new(),+ decoration_color: None,+ };+ let mut highlight_path = Path::new();+ for rect in fragment_spans+ .iter()+ .filter(|other| !other.highlights.is_empty())+ .flat_map(|other| highlight_rects(recorder, block, other))+ {+ let rect = recorder.converter.rounded_device_rect(rect).to_float();+ highlight_path.move_to(FloatPoint { x: rect.x, y: rect.y });+ highlight_path.line_to(FloatPoint {+ x: rect.x + rect.width,+ y: rect.y,+ });+ highlight_path.line_to(FloatPoint {+ x: rect.x + rect.width,+ y: rect.y + rect.height,+ });+ highlight_path.line_to(FloatPoint {+ x: rect.x,+ y: rect.y + rect.height,+ });+ highlight_path.close();+ }+ let clip = PendingInlineClip::subtracting_path(&highlight_path, WindingRule::Nonzero);+ let clip_depth = recorder.recorder.ambient_inline_clip_depth();+ recorder.recorder.push_ambient_inline_clips(&[clip]);+ paint_text_fragment(recorder, block, &normal_span, &[], true);+ recorder.recorder.truncate_ambient_inline_clips(clip_depth);+ stroked_highlights.insert(span.fragment_index);+ }for span in spans.iter().filter(|span| span.highlights.is_empty()) {let sets = crate::painting::record::paint::text_decoration::decoration_sets_for_span(recorder, block, span);- paint_text_fragment(recorder, block, span, &sets);+ paint_text_fragment(+ recorder,+ block,+ span,+ &sets,+ !stroked_highlights.contains(&span.fragment_index),+ );}let highlight_backdrop = recorder@@ -586,7 +647,7 @@ pub(crate) fn paint_fragments<O: Observer>(recorder: &mut PaintRecorder<'_, O>,for span in spans.iter().filter(|span| !span.highlights.is_empty()) {let sets = crate::painting::record::paint::text_decoration::decoration_sets_for_span(recorder, block, span);- paint_text_fragment(recorder, block, span, &sets);+ paint_text_fragment(recorder, block, span, &sets, true);}}@@ -721,6 +782,7 @@ fn paint_text_fragment<O: Observer>(block: NodeSlotId,span: &RenderSpan,decoration_sets: &[crate::painting::record::paint::text_decoration::TextDecorationSet],+ draw_glyphs: bool,) {if span.start_code_unit == span.end_code_unit {return;@@ -770,12 +832,16 @@ fn paint_text_fragment<O: Observer>(orientation,glyph_bounding_rect,} = glyph_run_emission(fragment, run, fragment_absolute_rect, fragment_device_rect, scale);- let font_smoothing = recorder- .source- .node_style_if_live(fragment.style_source)- .unwrap()- .inherited_text()- .font_smoothing;+ let style = recorder.source.node_style_if_live(fragment.style_source).unwrap();+ let text = style.inherited_text();+ let font_smoothing = text.font_smoothing;+ let stroke_width = if span.highlights.is_empty() {+ (text.webkit_text_stroke_width * scale) as f32+ } else {+ 0.0+ };+ let stroke_color = Color(text.webkit_text_stroke_color.resolve(style.current_color()));+ let paint_order = style.inherited_svg().paint_order;let run_for_recording = || GlyphRunForRecording {font_smoothing,font_id: FontResourceId(font_id),@@ -786,20 +852,33 @@ fn paint_text_fragment<O: Observer>(.map(DisplayListGlyph::from),};+ let paint_glyphs = |recorder: &mut crate::painting::display_list::recorder::DisplayListRecorder| {+ for operation in paint_order {+ let (color, width) = match operation {+ crate::css::css_enums::paint_order::FILL => (Color(span.text_color), 0.0),+ crate::css::css_enums::paint_order::STROKE if stroke_width > 0.0 => (stroke_color, stroke_width),+ _ => continue,+ };+ recorder.draw_glyph_run(+ baseline_start,+ run_for_recording(),+ color,+ width,+ fragment_device_rect,+ scale,+ orientation,+ glyph_bounding_rect,+ ForceDarkRole::Foreground,+ );+ }+ };// Paint text, clipped to span range if not full fragment.let is_full_fragment = span.start_code_unit == 0 && span.end_code_unit == fragment.length_in_code_units;let mut decoration_box = fragment_absolute_rect;if is_full_fragment {- recorder.recorder.draw_glyph_run(- baseline_start,- run_for_recording(),- Color(span.text_color),- fragment_device_rect,- scale,- orientation,- glyph_bounding_rect,- ForceDarkRole::Foreground,- );+ if draw_glyphs {+ paint_glyphs(&mut recorder.recorder);+ }} else {let offsets = SelectionOffsets {start: span.start_code_unit,@@ -808,18 +887,9 @@ fn paint_text_fragment<O: Observer>(let range_rects = text_fragment::rects_for_selection_offsets(recorder.source, fragment, offsets);for range_rect in &range_rects {let span_rect = converter.rounded_device_rect(*range_rect);- recorder.recorder.record_clipped_to(span_rect, |recorder| {- recorder.draw_glyph_run(- baseline_start,- run_for_recording(),- Color(span.text_color),- fragment_device_rect,- scale,- orientation,- glyph_bounding_rect,- ForceDarkRole::Foreground,- );- });+ if draw_glyphs {+ recorder.recorder.record_clipped_to(span_rect, paint_glyphs);+ }}let range_rect = text_fragment::rect_for_selection_offsets(recorder.source, fragment, offsets);decoration_box.x = range_rect.x;diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/text_decoration.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/text_decoration.rsindex 7e8eff50846..29d202c3931 100644--- a/Libraries/LibWeb/Rust/src/painting/record/paint/text_decoration.rs+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/text_decoration.rs@@ -19,6 +19,20 @@ use crate::painting::record::PaintRecorder;use libgfx_rust::path::Path;use libgfx_rust::{CapStyle, Color, FloatPoint, IntPoint, JoinStyle, LineStyle, ShouldAntiAlias};+fn decoration_color(style: crate::css::computed_value_views::ComputedValuesView<'_>) -> u32 {+ let text = style.inherited_text();+ // https://drafts.csswg.org/css-text-decor-3/#text-decoration-color-property+ // AD-HOC: currentColor normally resolves to color. For compatibility with stroked text, use a visible explicit+ // stroke color, falling back to the text fill color.+ if style.text_reset().text_decoration_color.is_current_color && text.webkit_text_stroke_width > 0.0 {+ if !text.webkit_text_stroke_color.is_current_color && Color(text.webkit_text_stroke_color.rgba).alpha() > 0 {+ return text.webkit_text_stroke_color.rgba;+ }+ return text.webkit_text_fill_color;+ }+ style.text_decoration_color()+}+#[derive(Clone, Copy, Default)]pub(crate) struct TextDecorationSet {pub lines: [u8; 8],@@ -206,7 +220,7 @@ pub(crate) fn decoration_sets_for_span<O: Observer>(current,lines,text_reset.text_decoration_style,- span.decoration_color.unwrap_or(style.text_decoration_color()),+ span.decoration_color.unwrap_or_else(|| decoration_color(style)),thickness,None,);@@ -243,7 +257,7 @@ pub(crate) fn decoration_sets_for_span<O: Observer>(block_node,lines,text_reset.text_decoration_style,- span.decoration_color.unwrap_or(style.text_decoration_color()),+ span.decoration_color.unwrap_or_else(|| decoration_color(style)),thickness,None,);diff --git a/Meta/RustLints/rustc-ice-2026-11-12T04_49_58-26991.txt b/Meta/RustLints/rustc-ice-2026-11-12T04_49_58-26991.txtnew file mode 100644index 00000000000..298e1826dc8--- /dev/null+++ b/Meta/RustLints/rustc-ice-2026-11-12T04_49_58-26991.txt@@ -0,0 +1,36 @@+delayed bug: no resolution for an import+disabled backtrace+delayed bug: no resolution for an import+disabled backtrace+delayed bug: no resolution for an import+disabled backtrace+delayed bug: no resolution for an import+disabled backtrace+delayed bug: no resolution for an import+disabled backtrace+delayed bug: no resolution for an import+disabled backtrace+delayed bug: could not resolve trait item being implemented+disabled backtrace+delayed bug: could not resolve trait item being implemented+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+delayed bug: path with `Res::Err` but no error emitted+disabled backtrace+++rustc version: 1.98.0-nightly (91fe22da8 2026-06-21)+platform: aarch64-apple-darwin\ No newline at end of filediff --git a/Services/Compositor/DisplayListPlayer.cpp b/Services/Compositor/DisplayListPlayer.cppindex 5d70e88f19e..d8ea7b836bb 100644--- a/Services/Compositor/DisplayListPlayer.cpp+++ b/Services/Compositor/DisplayListPlayer.cpp@@ -79,7 +79,7 @@ struct DisplayListPlayer::ReplayCallbacks {.pop = [](void* context) { static_cast<DisplayListPlayer*>(context)->pop(); },.push_device_space_plane_clip = [](void* context, Gfx::FloatVector3 const* vertices, size_t vertex_count) { static_cast<DisplayListPlayer*>(context)->push_device_space_plane_clip({ vertices, vertex_count }); },.push_transform = [](void* context, Gfx::AffineTransform const* transform) { static_cast<DisplayListPlayer*>(context)->push_transform(*transform); },- .push_clip_path_bytes = [](void* context, u8 const* path_bytes, size_t path_bytes_size, Gfx::WindingRule winding_rule) { static_cast<DisplayListPlayer*>(context)->push_clip_path_bytes({ path_bytes, path_bytes_size }, winding_rule); },+ .push_clip_path_bytes = [](void* context, u8 const* path_bytes, size_t path_bytes_size, Gfx::WindingRule winding_rule, Compositing::ClipMode mode) { static_cast<DisplayListPlayer*>(context)->push_clip_path_bytes({ path_bytes, path_bytes_size }, winding_rule, mode); },.play_command = [](void* context, DisplayListCommandType command_type, u8 const* command, u8 const* payload, size_t payload_size) { static_cast<DisplayListPlayer*>(context)->play_command_bytes(command_type, command, { payload, payload_size }); },};}diff --git a/Services/Compositor/DisplayListPlayer.h b/Services/Compositor/DisplayListPlayer.hindex 74a501ce39f..822ef9715ca 100644--- a/Services/Compositor/DisplayListPlayer.h+++ b/Services/Compositor/DisplayListPlayer.h@@ -73,7 +73,7 @@ private:virtual void push_clip(Compositing::ReplayClip const&) = 0;// A path stays the same for as long as it has its identity.virtual void push_clip_path(Gfx::PathData const&, u64 path_identity, Gfx::WindingRule) = 0;- virtual void push_clip_path_bytes(ReadonlyBytes, Gfx::WindingRule) = 0;+ virtual void push_clip_path_bytes(ReadonlyBytes, Gfx::WindingRule, Compositing::ClipMode) = 0;virtual void push_transform(Gfx::AffineTransform const&) = 0;virtual void push_layer(Compositing::ReplayLayer const&) = 0;virtual void push_mask(Compositing::ReplayMask const&, Compositing::ReplayLayer const* backdrop) = 0;diff --git a/Services/Compositor/DisplayListPlayerSkia.cpp b/Services/Compositor/DisplayListPlayerSkia.cppindex e40e6e7a26c..7f68f8703d1 100644--- a/Services/Compositor/DisplayListPlayerSkia.cpp+++ b/Services/Compositor/DisplayListPlayerSkia.cpp@@ -252,6 +252,12 @@ void DisplayListPlayerSkia::play_command(DrawGlyphRun const& command)SkPaint paint;paint.setColor(to_skia_color(command.color));+ if (command.stroke_width > 0) {+ paint.setStyle(SkPaint::kStroke_Style);+ paint.setStrokeWidth(command.stroke_width);+ paint.setStrokeMiter(4);+ paint.setAntiAlias(true);+ }draw_glyph_run(surface().canvas(), *blob, command.rect, command.translation, command.orientation, paint);}@@ -1495,10 +1501,12 @@ void DisplayListPlayerSkia::push_clip_path(Gfx::PathData const& path, u64 path_iclip_path(raster_cache().clip_path(path_identity, path), winding_rule, true);}-void DisplayListPlayerSkia::push_clip_path_bytes(ReadonlyBytes path_bytes, Gfx::WindingRule winding_rule)+void DisplayListPlayerSkia::push_clip_path_bytes(ReadonlyBytes path_bytes, Gfx::WindingRule winding_rule, Compositing::ClipMode mode){surface().canvas().save();- clip_path(Gfx::skia_path_from_serialized_bytes(path_bytes), winding_rule, true);+ auto path = Gfx::skia_path_from_serialized_bytes(path_bytes);+ path.setFillType(to_skia_path_fill_type(winding_rule));+ surface().canvas().clipPath(path, mode == ClipMode::Difference ? SkClipOp::kDifference : SkClipOp::kIntersect, true);}void DisplayListPlayerSkia::push_transform(Gfx::AffineTransform const& transform)diff --git a/Services/Compositor/DisplayListPlayerSkia.h b/Services/Compositor/DisplayListPlayerSkia.hindex aa6d79efdb7..3e9c4c23b2a 100644--- a/Services/Compositor/DisplayListPlayerSkia.h+++ b/Services/Compositor/DisplayListPlayerSkia.h@@ -69,7 +69,7 @@ private:void push_clip(Compositing::ReplayClip const&) override;void push_clip_path(Gfx::PathData const&, u64 path_identity, Gfx::WindingRule) override;- void push_clip_path_bytes(ReadonlyBytes, Gfx::WindingRule) override;+ void push_clip_path_bytes(ReadonlyBytes, Gfx::WindingRule, Compositing::ClipMode) override;void push_transform(Gfx::AffineTransform const&) override;void push_layer(Compositing::ReplayLayer const&) override;void push_mask(Compositing::ReplayMask const&, Compositing::ReplayLayer const* backdrop) override;diff --git a/Tests/LibWeb/Crash/webkit-text-stroke-many-highlights.html b/Tests/LibWeb/Crash/webkit-text-stroke-many-highlights.htmlnew file mode 100644index 00000000000..d277e5c7f2d--- /dev/null+++ b/Tests/LibWeb/Crash/webkit-text-stroke-many-highlights.html@@ -0,0 +1,19 @@+<!doctype html>+<style>+#target { font-size: 1px; white-space: nowrap; -webkit-text-stroke: 1px red; }+::highlight(many) { color: blue; }+</style>+<div id="target"></div>+<script>+const target = document.getElementById("target");+target.textContent = "XX".repeat(260);+const ranges = [];+for (let i = 0; i < 260; ++i) {+ const range = new Range();+ range.setStart(target.firstChild, i * 2);+ range.setEnd(target.firstChild, i * 2 + 1);+ ranges.push(range);+}+CSS.highlights.set("many", new Highlight(...ranges));+internals.dumpDisplayList();+</script>diff --git a/Tests/LibWeb/Ref/expected/webkit-text-stroke-decorations.html b/Tests/LibWeb/Ref/expected/webkit-text-stroke-decorations.htmlnew file mode 100644index 00000000000..51979b96f0a--- /dev/null+++ b/Tests/LibWeb/Ref/expected/webkit-text-stroke-decorations.html@@ -0,0 +1,23 @@+<!doctype html>+<style>+p { color: black; -webkit-text-fill-color: blue; -webkit-text-stroke: 1px red; text-decoration: underline; text-decoration-skip-ink: none; }+.current { -webkit-text-stroke-color: currentColor; }+.transparent { -webkit-text-stroke-color: transparent; }+.explicit { text-decoration-color: green; }+.fill-transparent { -webkit-text-fill-color: transparent; }+</style>+<style>+p { text-decoration-color: red; }+.current, .transparent { text-decoration-color: blue; }+.explicit { text-decoration-color: green; }+.fill-transparent.current, .fill-transparent.transparent { text-decoration-color: transparent; }+.fill-transparent.explicit { text-decoration-color: green; }+</style>+<p>Explicit stroke color</p>+<p class="current">Current stroke color</p>+<p class="transparent">Transparent stroke color</p>+<p class="explicit">Explicit decoration color</p>+<p class="fill-transparent current">Transparent fill, current stroke color</p>+<p class="fill-transparent transparent">Transparent fill and stroke color</p>+<p class="fill-transparent">Transparent fill, explicit stroke color</p>+<p class="fill-transparent current explicit">Transparent fill, explicit decoration color</p>diff --git a/Tests/LibWeb/Ref/expected/webkit-text-stroke-keyword-zoom.html b/Tests/LibWeb/Ref/expected/webkit-text-stroke-keyword-zoom.htmlnew file mode 100644index 00000000000..260e0e6db54--- /dev/null+++ b/Tests/LibWeb/Ref/expected/webkit-text-stroke-keyword-zoom.html@@ -0,0 +1,6 @@+<!doctype html>+<style>+body { margin: 32px; }+div { font: 48px/1.5 sans-serif; zoom: 2; color: black; -webkit-text-fill-color: transparent; -webkit-text-stroke: 10px; }+</style>+<div>Stroked text</div>diff --git a/Tests/LibWeb/Ref/expected/webkit-text-stroke-miter-bounds.html b/Tests/LibWeb/Ref/expected/webkit-text-stroke-miter-bounds.htmlnew file mode 100644index 00000000000..ae226a4ac62--- /dev/null+++ b/Tests/LibWeb/Ref/expected/webkit-text-stroke-miter-bounds.html@@ -0,0 +1,14 @@+<!doctype html>+<style>body { margin: 0; height: 300px; }</style>+<canvas width="300" height="300"></canvas>+<script>+const context = document.querySelector("canvas").getContext("2d");+context.strokeStyle = "blue";+context.lineWidth = 20;+context.miterLimit = 4;+context.moveTo(110, 200);+context.lineTo(150, 100);+context.lineTo(190, 200);+context.closePath();+context.stroke();+</script>diff --git a/Tests/LibWeb/Ref/expected/webkit-text-stroke.html b/Tests/LibWeb/Ref/expected/webkit-text-stroke.htmlnew file mode 100644index 00000000000..884ff6fc4c8--- /dev/null+++ b/Tests/LibWeb/Ref/expected/webkit-text-stroke.html@@ -0,0 +1,49 @@+<!doctype html>+<html class="reftest-wait">+<style>+@font-face { font-family: Ahem; src: url("../data/fonts/Ahem.ttf"); }+body { margin: 0; }+</style>+<canvas width="200" height="460"></canvas>+<script>+document.fonts.load("40px Ahem").then(() => {+ const context = document.querySelector("canvas").getContext("2d");+ context.font = "40px Ahem";+ context.fillStyle = "blue";+ context.strokeStyle = "red";+ context.lineWidth = 6;+ context.fillText("X", 20, 52);+ context.strokeText("X", 20, 52);+ context.strokeText("X", 20, 112);+ context.fillText("X", 20, 112);+ context.strokeText("X", 20, 172);+ context.lineWidth = 0.5;+ context.fillText("X", 20, 232);+ context.strokeText("X", 20, 232);+ context.lineWidth = 6;+ context.strokeText("X", 20, 292);+ context.fillStyle = "green";+ context.fillText("X", 80, 292);+ context.fillStyle = "blue";+ context.save();+ context.beginPath();+ context.rect(0, 310, 200, 60);+ context.rect(60, 320, 40, 40);+ context.clip("evenodd");+ context.strokeText("XXX", 20, 352);+ context.restore();+ context.save();+ context.beginPath();+ context.rect(60, 320, 40, 40);+ context.clip();+ context.fillStyle = "yellow";+ context.fillRect(60, 320, 40, 40);+ context.fillStyle = "blue";+ context.fillText("X", 60, 352);+ context.restore();+ context.fillStyle = context.strokeStyle = "purple";+ context.fillText("X", 30, 422);+ context.strokeText("X", 30, 422);+ document.documentElement.classList.remove("reftest-wait");+});+</script>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-pseudo/highlight-styling-003-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-pseudo/highlight-styling-003-ref.htmlnew file mode 100644index 00000000000..ec877aafab0--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-pseudo/highlight-styling-003-ref.html@@ -0,0 +1,13 @@+<!doctype html>+<meta charset="utf-8">+<link rel="author" title="Delan Azabani" href="mailto:[email protected]">+<link rel="stylesheet" href="support/highlights.css">+<style>+ main {+ font-size: 7em;+ margin: 0.5em;+ color: white;+ }+</style>+<p>Test passes if the text below is white (invisible).+<main class="highlight_reftest">quick</main>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-text/text-stroke-width-subpixel-notref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-text/text-stroke-width-subpixel-notref.htmlnew file mode 100644index 00000000000..ba5e8d90f3e--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-text/text-stroke-width-subpixel-notref.html@@ -0,0 +1,2 @@+<!doctype html>+<div style="font: 20px monospace; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: lime; color: white">A</div>diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/fill-stroke/reference/paint-order-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/fill-stroke/reference/paint-order-001-ref.htmlnew file mode 100644index 00000000000..af56147f522--- /dev/null+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/fill-stroke/reference/paint-order-001-ref.html@@ -0,0 +1,42 @@+<!DOCTYPE html>+<html>+<meta charset="utf-8">+<title>webkit-text-stroke and paint-order: reference</title>+<link rel="author" title="Jonathan Kew" href="[email protected]">+<link rel="author" title="Mozilla" href="https://www.mozilla.org">+<style>+body>div { position: relative; clear: left; float: left; }+span.f { -webkit-text-stroke: 5px orange; }+span.s,+span.sf { display: inline-block; position: relative; }+span.s::before,+span.sf::before { -webkit-text-stroke: 5px orange; position: absolute; z-index: -1; }+span.s::before { content: "stroke"; }+span.sf::before { content: "s-f"; }+</style>+<body>+<div style="font: bold 32px serif;">+ <span class="f">initial</span>+ <span class="f">fill</span>+ <span class="s">stroke</span>+ <span class="f">f-s</span>+ <span class="sf">s-f</span>+</div>++<div style="font: bold 64px serif;">+ <span class="f">initial</span>+ <span class="f">fill</span>+ <span class="s">stroke</span>+ <span class="f">f-s</span>+ <span class="sf">s-f</span>+</div>++<div style="font: bold 96px serif;">+ <span class="f">initial</span><br>+ <span class="f">fill</span>+ <span class="s">stroke</span><br>+ <span class="f">f-s</span>+ <span class="sf">s-f</span>+</div>+<body>+<html>diff --git a/Tests/LibWeb/Ref/input/webkit-text-stroke-decorations.html b/Tests/LibWeb/Ref/input/webkit-text-stroke-decorations.htmlnew file mode 100644index 00000000000..52e9ffe46a9--- /dev/null+++ b/Tests/LibWeb/Ref/input/webkit-text-stroke-decorations.html@@ -0,0 +1,17 @@+<!doctype html>+<link rel="match" href="../expected/webkit-text-stroke-decorations.html">+<style>+p { color: black; -webkit-text-fill-color: blue; -webkit-text-stroke: 1px red; text-decoration: underline; text-decoration-skip-ink: none; }+.current { -webkit-text-stroke-color: currentColor; }+.transparent { -webkit-text-stroke-color: transparent; }+.explicit { text-decoration-color: green; }+.fill-transparent { -webkit-text-fill-color: transparent; }+</style>+<p>Explicit stroke color</p>+<p class="current">Current stroke color</p>+<p class="transparent">Transparent stroke color</p>+<p class="explicit">Explicit decoration color</p>+<p class="fill-transparent current">Transparent fill, current stroke color</p>+<p class="fill-transparent transparent">Transparent fill and stroke color</p>+<p class="fill-transparent">Transparent fill, explicit stroke color</p>+<p class="fill-transparent current explicit">Transparent fill, explicit decoration color</p>diff --git a/Tests/LibWeb/Ref/input/webkit-text-stroke-keyword-zoom.html b/Tests/LibWeb/Ref/input/webkit-text-stroke-keyword-zoom.htmlnew file mode 100644index 00000000000..fda711e7b84--- /dev/null+++ b/Tests/LibWeb/Ref/input/webkit-text-stroke-keyword-zoom.html@@ -0,0 +1,7 @@+<!doctype html>+<link rel="match" href="../expected/webkit-text-stroke-keyword-zoom.html">+<style>+body { margin: 32px; }+div { font: 48px/1.5 sans-serif; zoom: 2; color: black; -webkit-text-fill-color: transparent; -webkit-text-stroke: thick; }+</style>+<div>Stroked text</div>diff --git a/Tests/LibWeb/Ref/input/webkit-text-stroke-miter-bounds.html b/Tests/LibWeb/Ref/input/webkit-text-stroke-miter-bounds.htmlnew file mode 100644index 00000000000..6acf4f71828--- /dev/null+++ b/Tests/LibWeb/Ref/input/webkit-text-stroke-miter-bounds.html@@ -0,0 +1,14 @@+<!doctype html>+<html class="reftest-wait">+<meta name="fuzzy" content="maxDifference=0-46;totalPixels=0-480">+<link rel="match" href="../expected/webkit-text-stroke-miter-bounds.html">+<!-- The triangle font has an apex whose miter extends beyond half the stroke width. -->+<style>+@font-face { font-family: triangle; src: url(data:font/ttf;base64,AAEAAAAKAIAAAwAgT1MvMkU3R2wAAAEoAAAAYGNtYXAADACrAAABkAAAADRnbHlmAvU8YwAAAcwAAAAaaGVhZDE0FvwAAACsAAAANmhoZWEH0QROAAAA5AAAACRobXR4BEwAAAAAAYgAAAAGbG9jYQANAAAAAAHEAAAABm1heHAABAAFAAABCAAAACBuYW1lU0qlHAAAAegAAAC9cG9zdNrbzuIAAAKoAAAALwABAAAAAQAAPhZ0hV8PPPUAAwPoAAAAAOca6RoAAAAA5xrpGgBkAAADhAPoAAAAAwACAAAAAAAAAAEAAAPoAAAAAAPoAGQAZAOEAAEAAAAAAAAAAAAAAAAAAAABAAEAAAACAAMAAQAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAwPoAZAABQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAPz8/PwAAAFgAWAPoAAAAAAPoAAAAAAAAAAAAAAAAAAAAAAAgAAAD6AAAAGQAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQAIAAAAAQABAABAAAAWP//AAAAWP///6kAAQAAAAAAAAAAAA0AAAABAGQAAAOEA+gAAgAAMwEBZAGQAZAD6PwYAAAAAAAKAH4AAQAAAAAAAQAOAAAAAQAAAAAAAgAHAA4AAQAAAAAAAwAOAAAAAQAAAAAABAAOAAAAAQAAAAAABgAOAAAAAwABBAkAAQAcABUAAwABBAkAAgAOADEAAwABBAkAAwAcABUAAwABBAkABAAcABUAAwABBAkABgAcABVTdHJva2VUcmlhbmdsZVJlZ3VsYXIAUwB0AHIAbwBrAGUAVAByAGkAYQBuAGcAbABlAFIAZQBnAHUAbABhAHIAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAABAgh0cmlhbmdsZQA=); }+body { margin: 0; height: 300px; }+#target { position: absolute; left: 100px; top: 100px; font: 100px/100px triangle; -webkit-text-fill-color: transparent; -webkit-text-stroke: 20px blue; }+</style>+<div id="target">X</div>+<script>+document.fonts.load("100px triangle").then(() => document.documentElement.classList.remove("reftest-wait"));+</script>diff --git a/Tests/LibWeb/Ref/input/webkit-text-stroke.html b/Tests/LibWeb/Ref/input/webkit-text-stroke.htmlnew file mode 100644index 00000000000..4b20f4675ac--- /dev/null+++ b/Tests/LibWeb/Ref/input/webkit-text-stroke.html@@ -0,0 +1,25 @@+<!doctype html>+<html class="reftest-wait">+<meta name="fuzzy" content="maxDifference=0-28;totalPixels=0-320">+<link rel="match" href="../expected/webkit-text-stroke.html">+<style>@font-face { font-family: Ahem; src: url("../data/fonts/Ahem.ttf"); }+body { margin: 0; }+.case { position: absolute; left: 20px; font: 40px/40px Ahem; -webkit-text-stroke: 6px red; color: blue; }+</style>+<div class="case" style="top:20px">X</div>+<div class="case" style="top:80px;paint-order:stroke fill">X</div>+<div class="case" style="top:140px;-webkit-text-fill-color:transparent">X</div>+<div class="case" style="top:200px;-webkit-text-stroke-width:0.5px">X</div>+<div class="case" style="top:260px;-webkit-text-fill-color:transparent;text-shadow:60px 0 green">X</div>+<div id="selected" class="case" style="top:320px;-webkit-text-fill-color:transparent">XXX</div>+<style>#selected::selection { color: blue; background: yellow; }</style>+<script>+document.fonts.ready.then(() => {+ const range = document.createRange();+ range.setStart(document.getElementById("selected").firstChild, 1);+ range.setEnd(document.getElementById("selected").firstChild, 2);+ getSelection().addRange(range);+ document.documentElement.classList.remove("reftest-wait");+});+</script>+<div class="case" style="top:380px;padding:10px;background:purple;background-clip:text;-webkit-text-fill-color:transparent;-webkit-text-stroke-color:transparent">X</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-pseudo/highlight-styling-003.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-pseudo/highlight-styling-003.htmlnew file mode 100644index 00000000000..8116de842a8--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-pseudo/highlight-styling-003.html@@ -0,0 +1,24 @@+<!doctype html>+<meta charset="utf-8">+<title>CSS Pseudo-Elements Test: highlight styling: compat stroke/fill properties</title>+<link rel="author" title="Delan Azabani" href="mailto:[email protected]">+<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-styling">+<link rel="match" href="../../../../expected/wpt-import/css/css-pseudo/highlight-styling-003-ref.html">+<meta name="assert" value="This test verifies that prefixed properties are ignored in ::selection.">+<script src="support/selections.js"></script>+<link rel="stylesheet" href="support/highlights.css">+<style>+ main {+ font-size: 7em;+ margin: 0.5em;+ }+ main::selection {+ color: white;+ -webkit-text-fill-color: yellow;+ -webkit-text-stroke-color: green;+ -webkit-text-stroke-width: 4px;+ }+</style>+<p>Test passes if the text below is white (invisible).+<main class="highlight_reftest">quick</main>+<script>selectNodeContents(document.querySelector("main"));</script>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-text/text-stroke-width-subpixel.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-text/text-stroke-width-subpixel.htmlnew file mode 100644index 00000000000..ce4c534dac8--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-text/text-stroke-width-subpixel.html@@ -0,0 +1,5 @@+<!doctype html>+<title>-webkit-text-stroke-width is not snapped to device pixels</title>+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1837692">+<link rel="mismatch" href="../../../../expected/wpt-import/css/css-text/text-stroke-width-subpixel-notref.html">+<div style="font: 20px monospace; -webkit-text-stroke-width: 0.1px; -webkit-text-stroke-color: lime; color: white">A</div>diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/fill-stroke/paint-order-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/fill-stroke/paint-order-001.htmlnew file mode 100644index 00000000000..10809963eb2--- /dev/null+++ b/Tests/LibWeb/Ref/input/wpt-import/css/fill-stroke/paint-order-001.html@@ -0,0 +1,44 @@+<!DOCTYPE html>+<html>+<meta charset="utf-8">+<title>webkit-text-stroke and paint-order</title>+<link rel="author" title="Jonathan Kew" href="[email protected]">+<link rel="author" title="Mozilla" href="https://www.mozilla.org">+<link rel="match" href="../../../../expected/wpt-import/css/fill-stroke/reference/paint-order-001-ref.html">+<link rel="help" href="https://www.w3.org/TR/fill-stroke-3/#strokes">+<link rel="help" href="https://compat.spec.whatwg.org/#the-webkit-text-stroke">+<meta name="fuzzy" content="maxDifference=0-3;totalPixels=0-5">+<style>+span { -webkit-text-stroke: 5px orange; }+span.i { paint-order: initial; }+span.f { paint-order: fill; }+span.fs { paint-order: fill stroke; }+span.s { paint-order: stroke; }+span.sf { paint-order: stroke fill; }+</style>+<body>+<div style="font: bold 32px serif;">+ <span class="i">initial</span>+ <span class="f">fill</span>+ <span class="s">stroke</span>+ <span class="fs">f-s</span>+ <span class="sf">s-f</span>+</div>++<div style="font: bold 64px serif;">+ <span class="i">initial</span>+ <span class="f">fill</span>+ <span class="s">stroke</span>+ <span class="fs">f-s</span>+ <span class="sf">s-f</span>+</div>++<div style="font: bold 96px serif;">+ <span class="i">initial</span><br>+ <span class="f">fill</span>+ <span class="s">stroke</span><br>+ <span class="fs">f-s</span>+ <span class="sf">s-f</span>+</div>+<body>+<html>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 af2cfd5e386..495758821f3 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@@ -2,6 +2,8 @@ All properties associated with getComputedStyle(document.body):["-webkit-font-smoothing","-webkit-text-fill-color",+ "-webkit-text-stroke-color",+ "-webkit-text-stroke-width","accent-color","block-ellipsis","border-collapse",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 ca3f0d0d128..cd2d0081fd3 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@@ -164,6 +164,15 @@ All supported properties and their default values exposed from CSSStylePropertie'WebkitTextFillColor': 'rgb(0, 0, 0)''webkitTextFillColor': 'rgb(0, 0, 0)''-webkit-text-fill-color': 'rgb(0, 0, 0)'+'WebkitTextStroke': '0px rgb(0, 0, 0)'+'webkitTextStroke': '0px rgb(0, 0, 0)'+'-webkit-text-stroke': '0px rgb(0, 0, 0)'+'WebkitTextStrokeColor': 'rgb(0, 0, 0)'+'webkitTextStrokeColor': 'rgb(0, 0, 0)'+'-webkit-text-stroke-color': 'rgb(0, 0, 0)'+'WebkitTextStrokeWidth': '0px'+'webkitTextStrokeWidth': '0px'+'-webkit-text-stroke-width': '0px''WebkitTransform': 'none''webkitTransform': 'none''-webkit-transform': 'none'diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txtindex 9e659bd15dd..86c9dbe5d9c 100644--- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt+++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt@@ -1,5 +1,7 @@-webkit-font-smoothing: auto-webkit-text-fill-color: rgb(0, 0, 0)+-webkit-text-stroke-color: rgb(0, 0, 0)+-webkit-text-stroke-width: 0pxaccent-color: autoblock-ellipsis: no-ellipsisborder-collapse: separatediff --git a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-with-hints.txt b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-with-hints.txtindex c36f7807f74..3caee33eb82 100644--- a/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-with-hints.txt+++ b/Tests/LibWeb/Text/expected/css/style-memory/bytes-per-element-with-hints.txt@@ -14,5 +14,5 @@ unique:elementDeclarations: within 40styleValues: within 92records: within 160- payloads: within 320+ payloads: within 352cppHintProperties: within 16diff --git a/Tests/LibWeb/Text/expected/display_list/webkit-text-stroke.txt b/Tests/LibWeb/Text/expected/display_list/webkit-text-stroke.txtnew file mode 100644index 00000000000..d145573b703--- /dev/null+++ b/Tests/LibWeb/Text/expected/display_list/webkit-text-stroke.txt@@ -0,0 +1,6 @@+transparent fill: 2+changed width: 5+fill then stroke: fill, 5+stroke then fill: 5, fill+transparent stroke: fill+large math operator: 3diff --git a/Tests/LibWeb/Text/expected/webkit-text-stroke.txt b/Tests/LibWeb/Text/expected/webkit-text-stroke.txtnew file mode 100644index 00000000000..227d2474390--- /dev/null+++ b/Tests/LibWeb/Text/expected/webkit-text-stroke.txt@@ -0,0 +1,37 @@+valid 1px red: true+valid red 1px: true+valid blue: true+valid 0.1px: true+valid thin: true+valid calc(1px + 2px) green: true+invalid -1px red: true+invalid 10%: true+invalid 1px 2px: true+invalid red blue: true+invalid none: true+invalid 1: true+serialized: 1px red+16px thin: 0.3333+16px medium: 1+16px thick: 1.6667+16px 0.1px: 0.1+16px 0.5em: 8+16px calc(1px + 2px): 3+48px thin: 1+48px medium: 3+48px thick: 5+48px 0.1px: 0.1+48px 0.5em: 24+48px calc(1px + 2px): 3+parent: 10px rgb(255, 0, 0)+child: 10px rgb(0, 0, 255)+inherited color: rgb(0, 128, 0)+reset width: 0px rgb(255, 0, 0)+font-relative child: 3px+changed parent font: 6px+zoom keyword: 6+zoom 2 thin: 2+zoom 2 medium: 6+zoom 2 thick: 10+zoom 2 calc(5em / 48): 5+zoom 2 5px: 5diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/computed-initial.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/computed-initial.txtindex 83fbe0e3350..0dcc2647b96 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/computed-initial.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/computed-initial.txt@@ -1,8 +1,9 @@Harness status: OK-Found 195 tests+Found 198 tests-195 Pass+198 Pass+Pass -webkit-text-stroke-widthPass border-spacingPass font-sizePass stroke-dashoffset@@ -68,6 +69,7 @@ Pass scroll-margin-topPass shape-marginPass xPass y+Pass -webkit-text-stroke-width: initial;Pass border-spacing: initial;Pass font-size: initial;Pass stroke-dashoffset: initial;@@ -133,6 +135,7 @@ Pass scroll-margin-top: initial;Pass shape-margin: initial;Pass x: initial;Pass y: initial;+Pass -webkit-text-stroke-width (all: initial)Pass border-spacing (all: initial)Pass font-size (all: initial)Pass stroke-dashoffset (all: initial)diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/all-length-properties.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/all-length-properties.txtindex 4e1a0580ade..90eb0cdb06c 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/all-length-properties.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/all-length-properties.txt@@ -1,8 +1,9 @@Harness status: OK-Found 147 tests+Found 148 tests-147 Pass+148 Pass+Pass -webkit-text-stroke-width: 10px; parent=10px; child=10pxPass border-spacing: 10px; parent=10px; child=10pxPass font-size: 10px; parent=10px; child=10pxPass letter-spacing: 10px; parent=10px; child=10pxdiff --git a/Tests/LibWeb/Text/expected/wpt-import/css/fill-stroke/webkit-text-stroke-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/fill-stroke/webkit-text-stroke-computed.txtnew file mode 100644index 00000000000..4c340821ff0--- /dev/null+++ b/Tests/LibWeb/Text/expected/wpt-import/css/fill-stroke/webkit-text-stroke-computed.txt@@ -0,0 +1,8 @@+Harness status: OK++Found 3 tests++3 Pass+Pass Property -webkit-text-stroke value 'green'+Pass Property -webkit-text-stroke value '3px'+Pass Property -webkit-text-stroke value '1px red'\ No newline at end of filediff --git a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-with-hints.html b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-with-hints.htmlindex dc469ef63b1..d788ec6a1f3 100644--- a/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-with-hints.html+++ b/Tests/LibWeb/Text/input/css/style-memory/bytes-per-element-with-hints.html@@ -51,7 +51,7 @@elementDeclarations: 40,styleValues: 92,records: 160,- payloads: 320,+ payloads: 352,cppHintProperties: 16,};diff --git a/Tests/LibWeb/Text/input/display_list/webkit-text-stroke.html b/Tests/LibWeb/Text/input/display_list/webkit-text-stroke.htmlnew file mode 100644index 00000000000..b1dfbc5633f--- /dev/null+++ b/Tests/LibWeb/Text/input/display_list/webkit-text-stroke.html@@ -0,0 +1,33 @@+<!doctype html>+<script src="../include.js"></script>+<style>+ #target { font: 40px serif; -webkit-text-fill-color: transparent; -webkit-text-stroke: 2px red; }+</style>+<div id="target">Outlined text</div>+<script>+test(() => {+ __outputElement.style.display = "none";+ const target = document.getElementById("target");+ const output = [];+ function record(label) {+ const commands = internals.dumpDisplayList().split("\n")+ .filter(line => line.includes("DrawGlyphRun"));+ output.push(`${label}: ${commands.map(line => line.match(/stroke_width=([^ ]+)/)?.[1] ?? "fill").join(", ")}`);+ }+ record("transparent fill");+ target.style.webkitTextStrokeWidth = "5px";+ record("changed width");+ target.style.webkitTextFillColor = "blue";+ record("fill then stroke");+ target.style.paintOrder = "stroke fill";+ record("stroke then fill");+ target.style.webkitTextStrokeColor = "transparent";+ record("transparent stroke");+ target.style.webkitTextStroke = "3px green";+ target.style.webkitTextFillColor = "transparent";+ target.innerHTML = '<math display="block"><mo>∑</mo></math>';+ record("large math operator");+ __outputElement.style.display = "";+ output.forEach(println);+});+</script>diff --git a/Tests/LibWeb/Text/input/webkit-text-stroke.html b/Tests/LibWeb/Text/input/webkit-text-stroke.htmlnew file mode 100644index 00000000000..a8eeeb29105--- /dev/null+++ b/Tests/LibWeb/Text/input/webkit-text-stroke.html@@ -0,0 +1,42 @@+<!doctype html>+<script src="include.js"></script>+<div id="parent"><span id="child">text</span></div>+<script>+test(() => {+ const parent = document.getElementById("parent");+ const child = document.getElementById("child");+ const style = parent.style;+ for (const value of ["1px red", "red 1px", "blue", "0.1px", "thin", "calc(1px + 2px) green"])+ println(`valid ${value}: ${CSS.supports("-webkit-text-stroke", value)}`);+ for (const value of ["-1px red", "10%", "1px 2px", "red blue", "none", "1"])+ println(`invalid ${value}: ${!CSS.supports("-webkit-text-stroke", value)}`);+ style.webkitTextStroke = "red 1px";+ println(`serialized: ${style.webkitTextStroke}`);+ for (const fontSize of ["16px", "48px"]) {+ style.fontSize = fontSize;+ for (const width of ["thin", "medium", "thick", "0.1px", "0.5em", "calc(1px + 2px)"]) {+ style.webkitTextStrokeWidth = width;+ println(`${fontSize} ${width}: ${Number(parseFloat(getComputedStyle(parent).webkitTextStrokeWidth).toFixed(4))}`);+ }+ }+ style.cssText = "color: red; font-size: 20px; -webkit-text-stroke: .5em";+ child.style.cssText = "color: blue; font-size: 40px";+ println(`parent: ${getComputedStyle(parent).webkitTextStroke}`);+ println(`child: ${getComputedStyle(child).webkitTextStroke}`);+ style.webkitTextStrokeColor = "green";+ println(`inherited color: ${getComputedStyle(child).webkitTextStrokeColor}`);+ style.webkitTextStroke = "red";+ println(`reset width: ${getComputedStyle(child).webkitTextStroke}`);+ style.cssText = "font-size: 48px";+ child.style.cssText = "-webkit-text-stroke-width: medium";+ println(`font-relative child: ${getComputedStyle(child).webkitTextStrokeWidth}`);+ style.fontSize = "96px";+ println(`changed parent font: ${getComputedStyle(child).webkitTextStrokeWidth}`);+ style.cssText = "font-size: 48px; zoom: 2; -webkit-text-stroke: medium red";+ println(`zoom keyword: ${Number(parseFloat(getComputedStyle(parent).webkitTextStrokeWidth).toFixed(4))}`);+ for (const width of ["thin", "medium", "thick", "calc(5em / 48)", "5px"]) {+ style.webkitTextStrokeWidth = width;+ println(`zoom 2 ${width}: ${Number(parseFloat(getComputedStyle(parent).webkitTextStrokeWidth).toFixed(4))}`);+ }+});+</script>diff --git a/Tests/LibWeb/Text/input/wpt-import/css/fill-stroke/webkit-text-stroke-computed.html b/Tests/LibWeb/Text/input/wpt-import/css/fill-stroke/webkit-text-stroke-computed.htmlnew file mode 100644index 00000000000..656909247b0--- /dev/null+++ b/Tests/LibWeb/Text/input/wpt-import/css/fill-stroke/webkit-text-stroke-computed.html@@ -0,0 +1,25 @@+<!DOCTYPE html>+<html>+<head>+<meta charset="utf-8">+<title>CSS webkit-text-stroke Test: Computed webkit-text-stroke</title>+<link rel="author" title="Takuya Kurimoto" href="mailto:[email protected]">+<link rel="help" href="https://compat.spec.whatwg.org/#propdef--webkit-text-stroke">+<script src="../../resources/testharness.js"></script>+<script src="../../resources/testharnessreport.js"></script>+<script src="../../css/support/computed-testcommon.js"></script>+<style>+ #target {+ color: lime;+ }+</style>+</head>+<body>+<div id="target"></div>+<script>+test_computed_value("-webkit-text-stroke", "green", "0px rgb(0, 128, 0)");+test_computed_value("-webkit-text-stroke", "3px", "3px rgb(0, 255, 0)");+test_computed_value("-webkit-text-stroke", "1px red", "1px rgb(255, 0, 0)");+</script>+</body>+</html>