Truly independent web browser
LibWeb: Implement the remaining text drawing styles of canvas contexts
Andreas Klingfb5a523ab0c0
diff --git a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/canvas.rs b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/canvas.rsindex d03b10b99db..03b59040189 100644--- a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/canvas.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/canvas.rs@@ -19,9 +19,12 @@ use libgfx_rust::font::FontCascadeListHandle;use libgfx_rust::image_frame::ImageFrameHandle;use libjs_rust::api::{Gc, Object, Realm};-use super::drawing_state::CanvasColor;+use super::drawing_state::{CanvasColor, DrawingState};use super::host::CppTransport;use crate::bindings::conversions::CppInterface;+use crate::html::canvas_text_drawing_styles::{+ CanvasFontKerning, CanvasFontStretch, CanvasFontVariantCaps, CanvasTextRendering,+};use crate::html::predefined_color_space::PredefinedColorSpace;unsafe extern "C" {@@ -35,6 +38,7 @@ unsafe extern "C" {canvas: *mut c_void,canvas_is_offscreen: bool,font: usize,+ font_selection: FontSelection,out_font: *mut ResolvedFontAbi,) -> bool;fn web_canvas_2d_canvas_resolve_color(@@ -132,6 +136,28 @@ struct ResolvedFontAbi {serialized: usize,}+/// `CanvasFontSelection` of Canvas2DContextBase.cpp: the text drawing styles of a context that select the fonts of+/// its text beside its font, by the values of their enumerations.+#[repr(C)]+#[derive(Clone, Copy)]+pub(crate) struct FontSelection {+ font_kerning: CanvasFontKerning,+ font_stretch: CanvasFontStretch,+ font_variant_caps: CanvasFontVariantCaps,+ text_rendering: CanvasTextRendering,+}++impl FontSelection {+ pub(crate) fn of(state: &DrawingState) -> Self {+ Self {+ font_kerning: state.font_kerning,+ font_stretch: state.font_stretch,+ font_variant_caps: state.font_variant_caps,+ text_rendering: state.text_rendering,+ }+ }+}+/// The font of a context: the cascade of fonts that its text is drawn with, the font environment that chose them, and/// what the font attribute returns.#[derive(Clone)]@@ -271,7 +297,7 @@ impl Canvas {/// The font that a value of the font attribute describes, resolved against the canvas, unless the value is not a/// CSS font.- pub(crate) fn resolve_font(self, font: &Utf16String) -> Option<ResolvedFont> {+ pub(crate) fn resolve_font(self, font: &Utf16String, font_selection: FontSelection) -> Option<ResolvedFont> {let mut resolved = ResolvedFontAbi {cascade: core::ptr::null(),environment_generation: 0,@@ -283,6 +309,7 @@ impl Canvas {self.cell.as_ptr(),self.is_offscreen,font.raw_identity(),+ font_selection,&raw mut resolved,)};diff --git a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/context.rs b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/context.rsindex 649196f61aa..4433823206b 100644--- a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/context.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/context.rs@@ -20,7 +20,7 @@ use libgfx_rust::path::Path;use libgfx_rust::{AffineTransform, Color, CompositingAndBlendingOperator, FloatRect, IntRect, IntSize, WindingRule};use libjs_rust::api::{ForeignCellSlot, Gc, Realm, Trace, Visitor, Vm};-use super::canvas::{Canvas, FontMetricsSource, ResolvedFont, StyleValue, parse_color};+use super::canvas::{Canvas, FontMetricsSource, FontSelection, ResolvedFont, StyleValue, parse_color};use super::drawing_state::{CanvasColor, DrawingState, FillOrStrokeStyle};use super::host::{Bitmap, CppTransport, LentImageFrame};use crate::bindings::interface::Wrappable;@@ -626,11 +626,32 @@ impl ContextState {/// Sets the font of the current drawing state, unless the value is not a CSS font.pub(crate) fn assign_font(&self, font: &Utf16String) {- if let Some(font) = self.canvas.resolve_font(font) {+ let font_selection = FontSelection::of(&self.drawing_state());+ if let Some(font) = self.canvas.resolve_font(font, font_selection) {self.drawing_state_mut().font = Some(font);}}+ /// Resolves the font of the current drawing state again, after a change to the text drawing styles that select+ /// its fonts.+ pub(crate) fn font_selection_did_change(&self) {+ let font = self.drawing_state().font.as_ref().map(|font| font.serialized.clone());+ if let Some(font) = font {+ self.assign_font(&font);+ }+ }++ /// The word spacing of the current drawing state in CSS pixels.+ pub(crate) fn resolved_word_spacing(&self) -> f32 {+ let word_spacing = self.drawing_state().word_spacing.clone();+ match word_spacing {+ Some(word_spacing) => self+ .canvas+ .resolve_length(&word_spacing.length, self.font_metrics_source()),+ None => 0.0,+ }+ }+/// The font of the current drawing state, which is resolved the first time the context needs one, and again when/// the fonts that the canvas can use change.pub(crate) fn current_font(&self) -> ResolvedFont {diff --git a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/drawing_state.rs b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/drawing_state.rsindex f571e7df702..604d6b184d0 100644--- a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/drawing_state.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/drawing_state.rs@@ -19,6 +19,9 @@ use crate::html::canvas_pattern::CanvasPattern;use crate::html::canvas_rendering_context2d::{CanvasDirection, CanvasLineCap, CanvasLineJoin, CanvasTextAlign, CanvasTextBaseline, ImageSmoothingQuality,};+use crate::html::canvas_text_drawing_styles::{+ CanvasFontKerning, CanvasFontStretch, CanvasFontVariantCaps, CanvasTextRendering,+};/// A CSS color that a context was given: the color in sRGB, which the attribute that was set to it serializes, and the/// color converted to the color space of the context, which the context paints with.@@ -84,9 +87,9 @@ unsafe impl Trace for FillOrStrokeStyle {}}-/// The letter spacing of a context, a CSS <length> as the context was given it.+/// The letter spacing or the word spacing of a context, a CSS <length> as the context was given it.#[derive(Clone)]-pub(crate) struct LetterSpacing {+pub(crate) struct Spacing {pub(crate) length: StyleValue,pub(crate) serialized: Utf16String,}@@ -120,8 +123,16 @@ pub(crate) struct DrawingState {pub(crate) text_align: CanvasTextAlign,pub(crate) text_baseline: CanvasTextBaseline,pub(crate) direction: CanvasDirection,+ /// The language, https://html.spec.whatwg.org/multipage/canvas.html#concept-canvastextdrawingstyles-language+ pub(crate) language: Utf16String,/// The letter spacing, unless it is 0px.- pub(crate) letter_spacing: Option<LetterSpacing>,+ pub(crate) letter_spacing: Option<Spacing>,+ /// The word spacing, unless it is 0px.+ pub(crate) word_spacing: Option<Spacing>,+ pub(crate) font_kerning: CanvasFontKerning,+ pub(crate) font_stretch: CanvasFontStretch,+ pub(crate) font_variant_caps: CanvasFontVariantCaps,+ pub(crate) text_rendering: CanvasTextRendering,}impl Default for DrawingState {@@ -150,7 +161,13 @@ impl Default for DrawingState {text_align: CanvasTextAlign::Start,text_baseline: CanvasTextBaseline::Alphabetic,direction: CanvasDirection::Inherit,+ language: Utf16String::from_ascii(b"inherit"),letter_spacing: None,+ word_spacing: None,+ font_kerning: CanvasFontKerning::Auto,+ font_stretch: CanvasFontStretch::Normal,+ font_variant_caps: CanvasFontVariantCaps::Normal,+ text_rendering: CanvasTextRendering::Auto,}}}diff --git a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/text.rs b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/text.rsindex 0b2210a87bf..dadb0117a77 100644--- a/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/text.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/canvas_2d/text.rs@@ -44,6 +44,7 @@ pub(crate) fn shape_text(text: &[u16],baseline_start: FloatPoint,letter_spacing: f32,+ word_spacing: f32,) -> Vec<ShapedRun> {const TEXT_PRESENTATION: EmojiPresentation = EmojiPresentation {is_emoji: false,@@ -57,7 +58,7 @@ pub(crate) fn shape_text(let mut last_position = baseline_start;let mut add_run = |text: &[u16], font: &FontHandle| {- let shaped = shape_text_in_font(font, text, TextType::Common, 0.0, letter_spacing, 0.0);+ let shaped = shape_text_in_font(font, text, TextType::Common, 0.0, letter_spacing, word_spacing);let mut glyphs = shaped.glyphs().to_vec();if last_position.x != 0.0 || last_position.y != 0.0 {for glyph in &mut glyphs {diff --git a/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text.rs b/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text.rsindex 21786ff1bd7..7dcad48df42 100644--- a/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text.rs@@ -31,7 +31,8 @@ impl ContextState {let font = self.current_font();let letter_spacing = self.resolved_letter_spacing();- let runs = shape_text(&font.cascade, text, FloatPoint { x, y }, letter_spacing);+ let word_spacing = self.resolved_word_spacing();+ let runs = shape_text(&font.cascade, text, FloatPoint { x, y }, letter_spacing, word_spacing);let path = path_of_runs(&runs);let text_width: f32 = runs.iter().map(|run| run.width).sum();let transform = text_transform(&self.drawing_state(), &font.cascade.first(), x, text_width, max_width);@@ -75,7 +76,14 @@ impl<K: CanvasKind> RenderingContext2D<K> {let font = self.current_font();let letter_spacing = self.resolved_letter_spacing();- let runs = shape_text(&font.cascade, &text, FloatPoint { x: 0.0, y: 0.0 }, letter_spacing);+ let word_spacing = self.resolved_word_spacing();+ let runs = shape_text(+ &font.cascade,+ &text,+ FloatPoint { x: 0.0, y: 0.0 },+ letter_spacing,+ word_spacing,+ );let [run] = runs.as_slice() else {self.fill_internal(&self.text_path(&text, x, y, max_width), WindingRule::Nonzero);return Ok(());@@ -158,11 +166,13 @@ impl<K: CanvasKind> RenderingContext2D<K> {// 3. Let font be the current font of target, as given by that object's font attribute.let font = self.current_font();let letter_spacing = self.resolved_letter_spacing();+ let word_spacing = self.resolved_word_spacing();let runs = shape_text(&font.cascade,&replaced_text,FloatPoint { x: 0.0, y: 0.0 },letter_spacing,+ word_spacing,);// FIXME: 4. Let language be the target's language.diff --git a/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text_drawing_styles.rs b/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text_drawing_styles.rsindex 21e8fb0eac3..c5c1789324f 100644--- a/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text_drawing_styles.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/html/canvas_text_drawing_styles.rs@@ -12,7 +12,54 @@ use super::canvas_rendering_context2d::{CanvasDirection, CanvasTextAlign, Canvasuse crate::bindings::{CallContext, WebIdlResult};use crate::canvas_2d::canvas::parse_length;use crate::canvas_2d::context::{CanvasKind, RenderingContext2D};-use crate::canvas_2d::drawing_state::LetterSpacing;+use crate::canvas_2d::drawing_state::Spacing;++/// https://html.spec.whatwg.org/multipage/canvas.html#canvasfontkerning+#[repr(u8)]+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum CanvasFontKerning {+ Auto,+ Normal,+ None,+}++/// https://html.spec.whatwg.org/multipage/canvas.html#canvasfontstretch+#[repr(u8)]+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum CanvasFontStretch {+ UltraCondensed,+ ExtraCondensed,+ Condensed,+ SemiCondensed,+ Normal,+ SemiExpanded,+ Expanded,+ ExtraExpanded,+ UltraExpanded,+}++/// https://html.spec.whatwg.org/multipage/canvas.html#canvasfontvariantcaps+#[repr(u8)]+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum CanvasFontVariantCaps {+ Normal,+ SmallCaps,+ AllSmallCaps,+ PetiteCaps,+ AllPetiteCaps,+ Unicase,+ TitlingCaps,+}++/// https://html.spec.whatwg.org/multipage/canvas.html#canvastextrendering+#[repr(u8)]+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum CanvasTextRendering {+ Auto,+ OptimizeSpeed,+ OptimizeLegibility,+ GeometricPrecision,+}impl<K: CanvasKind> RenderingContext2D<K> {/// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-font@@ -87,7 +134,114 @@ impl<K: CanvasKind> RenderingContext2D<K> {};// 3. Set this's letter spacing to parsed.- self.drawing_state_mut().letter_spacing = Some(LetterSpacing { length, serialized });+ self.drawing_state_mut().letter_spacing = Some(Spacing { length, serialized });+ Ok(())+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-lang+ pub(crate) fn lang(&self, _: &mut CallContext) -> WebIdlResult<Utf16String> {+ // The lang getter steps are to return this's language.+ Ok(self.drawing_state().language.clone())+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-lang+ pub(crate) fn set_lang(&self, _: &mut CallContext, lang: Utf16String) -> WebIdlResult<()> {+ // The lang setter steps are to set this's language to the given value.+ self.drawing_state_mut().language = lang;+ Ok(())+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-wordspacing+ pub(crate) fn word_spacing(&self, _: &mut CallContext) -> WebIdlResult<Utf16String> {+ // The wordSpacing getter steps are to return the serialized form of this's word spacing.+ Ok(self.drawing_state().word_spacing.as_ref().map_or_else(+ || Utf16String::from_ascii(b"0px"),+ |word_spacing| word_spacing.serialized.clone(),+ ))+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-wordspacing+ pub(crate) fn set_word_spacing(&self, _: &mut CallContext, word_spacing: Utf16String) -> WebIdlResult<()> {+ // 1. Let parsed be the result of parsing the given value as a CSS <length>.+ // 2. If parsed is failure, then return.+ let Some((length, serialized)) = parse_length(&word_spacing) else {+ return Ok(());+ };++ // 3. Set this's word spacing to parsed.+ self.drawing_state_mut().word_spacing = Some(Spacing { length, serialized });+ Ok(())+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontkerning+ pub(crate) fn font_kerning(&self, _: &mut CallContext) -> WebIdlResult<CanvasFontKerning> {+ // The fontKerning IDL attribute, on getting, must return the current value.+ Ok(self.drawing_state().font_kerning)+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontkerning+ pub(crate) fn set_font_kerning(&self, _: &mut CallContext, font_kerning: CanvasFontKerning) -> WebIdlResult<()> {+ // On setting, the current value must be changed to the new value.+ if self.drawing_state().font_kerning != font_kerning {+ self.drawing_state_mut().font_kerning = font_kerning;+ self.font_selection_did_change();+ }+ Ok(())+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontstretch+ pub(crate) fn font_stretch(&self, _: &mut CallContext) -> WebIdlResult<CanvasFontStretch> {+ // The fontStretch IDL attribute, on getting, must return the current value.+ Ok(self.drawing_state().font_stretch)+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontstretch+ pub(crate) fn set_font_stretch(&self, _: &mut CallContext, font_stretch: CanvasFontStretch) -> WebIdlResult<()> {+ // On setting, the current value must be changed to the new value.+ if self.drawing_state().font_stretch != font_stretch {+ self.drawing_state_mut().font_stretch = font_stretch;+ self.font_selection_did_change();+ }+ Ok(())+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps+ pub(crate) fn font_variant_caps(&self, _: &mut CallContext) -> WebIdlResult<CanvasFontVariantCaps> {+ // The fontVariantCaps IDL attribute, on getting, must return the current value.+ Ok(self.drawing_state().font_variant_caps)+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps+ pub(crate) fn set_font_variant_caps(+ &self,+ _: &mut CallContext,+ font_variant_caps: CanvasFontVariantCaps,+ ) -> WebIdlResult<()> {+ // On setting, the current value must be changed to the new value.+ if self.drawing_state().font_variant_caps != font_variant_caps {+ self.drawing_state_mut().font_variant_caps = font_variant_caps;+ self.font_selection_did_change();+ }+ Ok(())+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-textrendering+ pub(crate) fn text_rendering(&self, _: &mut CallContext) -> WebIdlResult<CanvasTextRendering> {+ // The textRendering IDL attribute, on getting, must return the current value.+ Ok(self.drawing_state().text_rendering)+ }++ /// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-textrendering+ pub(crate) fn set_text_rendering(+ &self,+ _: &mut CallContext,+ text_rendering: CanvasTextRendering,+ ) -> WebIdlResult<()> {+ // On setting, the current value must be changed to the new value.+ if self.drawing_state().text_rendering != text_rendering {+ self.drawing_state_mut().text_rendering = text_rendering;+ self.font_selection_did_change();+ }Ok(())}}diff --git a/Libraries/LibWeb/HTML/Canvas/Canvas2DContextBase.cpp b/Libraries/LibWeb/HTML/Canvas/Canvas2DContextBase.cppindex 2eab424fdfd..06a26cff61a 100644--- a/Libraries/LibWeb/HTML/Canvas/Canvas2DContextBase.cpp+++ b/Libraries/LibWeb/HTML/Canvas/Canvas2DContextBase.cpp@@ -29,6 +29,7 @@#include <LibWeb/CSS/StyleComputer.h>#include <LibWeb/CSS/StyleValues/FilterStyleValue.h>#include <LibWeb/CSS/StyleValues/FontStyleStyleValue.h>+#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>@@ -94,6 +95,15 @@ struct ResolvedFont {FlatPtr serialized { 0 };};+// `FontSelection` of Bindings/Rust/src/canvas_2d/canvas.rs: the text drawing styles of a context that select the fonts+// of its text beside its font, by the indices of their values in their IDL enumerations.+struct CanvasFontSelection {+ u8 font_kerning { 0 };+ u8 font_stretch { 4 };+ u8 font_variant_caps { 0 };+ u8 text_rendering { 0 };+};+// `CanvasImageSourceKind` of Bindings/Rust/src/canvas_2d/canvas.rs: the sources of images that are implemented in C++.enum class CanvasImageSourceKind : u8 {HTMLImageElement,@@ -151,7 +161,7 @@ void* web_canvas_2d_canvas_create_transport(void* canvas_host);void* web_canvas_2d_canvas_wrapper(void* canvas, bool canvas_is_offscreen, void* realm);void* web_canvas_2d_canvas_relevant_realm(void* canvas_host);u64 web_canvas_2d_canvas_font_environment_generation(void* canvas_host);-bool web_canvas_2d_canvas_resolve_font(void* canvas, bool canvas_is_offscreen, FlatPtr font, ResolvedFont* out_font);+bool web_canvas_2d_canvas_resolve_font(void* canvas, bool canvas_is_offscreen, FlatPtr font, CanvasFontSelection, ResolvedFont* out_font);void web_canvas_2d_canvas_resolve_color(void* canvas_host, CSS::StyleValue const* color, FontMetricsSource, u8 color_space, Gfx::Color* out_color, Gfx::Color* out_color_in_color_space);float web_canvas_2d_canvas_resolve_length(void* canvas_host, CSS::StyleValue const* length, FontMetricsSource);bool web_canvas_2d_canvas_parse_filter(void* canvas_host, FlatPtr filter, FontMetricsSource, void* functions, void (*append_function)(void*, Compositing::RustFFI::FfiFilterFunction const*));@@ -361,7 +371,7 @@ u64 web_canvas_2d_canvas_font_environment_generation(void* canvas_host)// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fonttemplate<typename CanvasType>-static bool resolve_font(CanvasType& canvas_element, Utf16View font, ResolvedFont& out_font)+static bool resolve_font(CanvasType& canvas_element, Utf16View font, CanvasFontSelection font_selection, ResolvedFont& out_font){// The font IDL attribute, on setting, must be parsed as a CSS <'font'> value (but without supporting property-independent style sheet syntax like 'inherit'),// and the resulting font must be assigned to the context, with the 'line-height' component forced to 'normal', with the 'font-size' component converted to CSS pixels,@@ -462,6 +472,26 @@ static bool resolve_font(CanvasType& canvas_element, Utf16View font, ResolvedFonif (auto caps = computed_font_variant->as_shorthand().longhand(CSS::PropertyID::FontVariantCaps); caps->to_keyword() == CSS::Keyword::SmallCaps)feature_values[to_underlying(CSS::FontResolutionFeatureInput::FontVariantCaps)] = caps;+ // https://html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm+ // NB: The text preparation algorithm sets 'font-kerning', 'font-stretch', 'font-variant-caps' and SVG+ // 'text-rendering' from the fontKerning, fontStretch, fontVariantCaps and textRendering attributes of the+ // context. They select the fonts of the text, so they are applied when the font is resolved.+ // AD-HOC: fontStretch and fontVariantCaps only apply when they are not "normal", so that the font-stretch and+ // font-variant-caps components of the font still apply when they are.+ auto computed_font_width_percentage = computed_font_width->as_percentage().percentage();+ static constexpr Array<CSS::Keyword, 3> font_kerning_keywords { CSS::Keyword::Auto, CSS::Keyword::Normal, CSS::Keyword::None };+ if (font_selection.font_kerning != 0 && font_selection.font_kerning < font_kerning_keywords.size())+ feature_values[to_underlying(CSS::FontResolutionFeatureInput::FontKerning)] = CSS::KeywordStyleValue::create(font_kerning_keywords[font_selection.font_kerning]);+ static constexpr Array<double, 9> font_stretch_percentages { 50, 62.5, 75, 87.5, 100, 112.5, 125, 150, 200 };+ if (font_selection.font_stretch != 4 && font_selection.font_stretch < font_stretch_percentages.size())+ computed_font_width_percentage = CSS::Percentage { font_stretch_percentages[font_selection.font_stretch] };+ static constexpr Array<CSS::Keyword, 7> font_variant_caps_keywords { CSS::Keyword::Normal, CSS::Keyword::SmallCaps, CSS::Keyword::AllSmallCaps, CSS::Keyword::PetiteCaps, CSS::Keyword::AllPetiteCaps, CSS::Keyword::Unicase, CSS::Keyword::TitlingCaps };+ if (font_selection.font_variant_caps != 0 && font_selection.font_variant_caps < font_variant_caps_keywords.size())+ feature_values[to_underlying(CSS::FontResolutionFeatureInput::FontVariantCaps)] = CSS::KeywordStyleValue::create(font_variant_caps_keywords[font_selection.font_variant_caps]);+ static constexpr Array<CSS::Keyword, 4> text_rendering_keywords { CSS::Keyword::Auto, CSS::Keyword::Optimizespeed, CSS::Keyword::Optimizelegibility, CSS::Keyword::Geometricprecision };+ if (font_selection.text_rendering != 0 && font_selection.text_rendering < text_rendering_keywords.size())+ feature_values[to_underlying(CSS::FontResolutionFeatureInput::TextRendering)] = CSS::KeywordStyleValue::create(text_rendering_keywords[font_selection.text_rendering]);+// https://drafts.csswg.org/css-font-loading/#font-sourceauto& font_computer = canvas_element.canvas_font_computer();@@ -473,7 +503,7 @@ static bool resolve_font(CanvasType& canvas_element, Utf16View font, ResolvedFon.font_size = font_size,.font_slope = computed_font_style->as_font_style().to_font_slope(),.font_weight = computed_font_weight->as_number().number(),- .font_width = computed_font_width->as_percentage().percentage(),+ .font_width = computed_font_width_percentage,.feature_values = move(feature_values),.font_feature_values_scope = {},});@@ -488,13 +518,13 @@ static bool resolve_font(CanvasType& canvas_element, Utf16View font, ResolvedFonreturn true;}-bool web_canvas_2d_canvas_resolve_font(void* canvas, bool canvas_is_offscreen, FlatPtr font, ResolvedFont* out_font)+bool web_canvas_2d_canvas_resolve_font(void* canvas, bool canvas_is_offscreen, FlatPtr font, CanvasFontSelection font_selection, ResolvedFont* out_font){auto font_string = Utf16String::from_raw(font);auto* cell = static_cast<GC::Cell*>(canvas);if (canvas_is_offscreen)- return resolve_font(*static_cast<OffscreenCanvas*>(cell), font_string.utf16_view(), *out_font);- return resolve_font(*static_cast<HTMLCanvasElement*>(cell), font_string.utf16_view(), *out_font);+ return resolve_font(*static_cast<OffscreenCanvas*>(cell), font_string.utf16_view(), font_selection, *out_font);+ return resolve_font(*static_cast<HTMLCanvasElement*>(cell), font_string.utf16_view(), font_selection, *out_font);}// What the CSS values of a context are resolved with: the viewport of the canvas, and the font of the context.diff --git a/Libraries/LibWeb/HTML/Canvas/CanvasTextDrawingStyles.idl b/Libraries/LibWeb/HTML/Canvas/CanvasTextDrawingStyles.idlindex 49987a8385a..510b789a883 100644--- a/Libraries/LibWeb/HTML/Canvas/CanvasTextDrawingStyles.idl+++ b/Libraries/LibWeb/HTML/Canvas/CanvasTextDrawingStyles.idl@@ -10,15 +10,15 @@ enum CanvasTextRendering { "auto", "optimizeSpeed", "optimizeLegibility", "geome// https://html.spec.whatwg.org/multipage/canvas.html#canvastextdrawingstylesinterface mixin CanvasTextDrawingStyles {// text- [FIXME] attribute DOMString lang; // (default: "inherit")+ attribute DOMString lang; // (default: "inherit")attribute DOMString font; // (default 10px sans-serif)attribute CanvasTextAlign textAlign; // (default: "start")attribute CanvasTextBaseline textBaseline; // (default: "alphabetic")attribute CanvasDirection direction; // (default: "inherit")attribute DOMString letterSpacing; // (default: "0px")- [FIXME] attribute CanvasFontKerning fontKerning; // (default: "auto")- [FIXME] attribute CanvasFontStretch fontStretch; // (default: "normal")- [FIXME] attribute CanvasFontVariantCaps fontVariantCaps; // (default: "normal")- [FIXME] attribute CanvasTextRendering textRendering; // (default: "auto")- [FIXME] attribute DOMString wordSpacing; // (default: "0px")+ attribute CanvasFontKerning fontKerning; // (default: "auto")+ attribute CanvasFontStretch fontStretch; // (default: "normal")+ attribute CanvasFontVariantCaps fontVariantCaps; // (default: "normal")+ attribute CanvasTextRendering textRendering; // (default: "auto")+ attribute DOMString wordSpacing; // (default: "0px")};diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_kerning.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_kerning.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_kerning.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_kerning.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_variant_caps.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_variant_caps.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_variant_caps.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.font_variant_caps.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.text_rendering.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.text_rendering.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.text_rendering.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.text_rendering.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.word_spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.word_spacing.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.word_spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/reset/2d.reset.state.word_spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.absolute.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.absolute.spacing.txtindex fe3d4a6dd7d..48cda0d8eaf 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.absolute.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.absolute.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with absolute length\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with absolute length\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.font-relative.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.font-relative.spacing.txtindex 80e05fb5639..43bbbd6a559 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.font-relative.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.font-relative.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with font-relative length\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with font-relative length\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontKerning.with.uppercase.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontKerning.with.uppercase.txtindex d8fd0a53a33..00f7a8b0889 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontKerning.with.uppercase.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontKerning.with.uppercase.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of fontKerning for canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of fontKerning for canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontStretch.settings.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontStretch.settings.txtindex 367c58661d9..011171d06ea 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontStretch.settings.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontStretch.settings.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing value setting of fontStretch in Canvas\ No newline at end of file+1 Pass+Pass Testing value setting of fontStretch in Canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontVariant.settings.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontVariant.settings.txtindex 6e4b3069692..a452b350520 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontVariant.settings.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.fontVariant.settings.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of fontVariant for canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of fontVariant for canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.invalid.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.invalid.spacing.txtindex 979193b4ed1..949eb427cfa 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.invalid.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.invalid.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with invalid units\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with invalid units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.change.font.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.change.font.txtindex 2d4a19969f7..3170814aa6d 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.change.font.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.change.font.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Set letter spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of file+1 Pass+Pass Set letter spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.measure.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.measure.txtindex c92e9b31c9f..ee0bd5e5881 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.measure.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.letterSpacing.measure.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing with different length units\ No newline at end of file+1 Pass+Pass Testing letter spacing with different length units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.nonfinite.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.nonfinite.spacing.txtindex b09d2ace6a9..8a23b9a4dcf 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.nonfinite.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.nonfinite.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with nonfinite inputs\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with nonfinite inputs\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.textRendering.settings.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.textRendering.settings.txtindex c23368aaadf..f0209fd2d91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.textRendering.settings.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.textRendering.settings.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of textRendering in Canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of textRendering in Canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.change.font.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.change.font.txtindex 77cdc564e66..4461c7386c3 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.change.font.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.change.font.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Set word spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of file+1 Pass+Pass Set word spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.measure.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.measure.txtindex 1881cb40989..6205524ea24 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.measure.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.drawing.style.wordSpacing.measure.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing word spacing with different length units\ No newline at end of file+1 Pass+Pass Testing word spacing with different length units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.lang.default.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.lang.default.txtindex 781cf7ff191..5fde204b244 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.lang.default.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/text/2d.text.lang.default.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Canvas test: 2d.text.lang.default\ No newline at end of file+1 Pass+Pass Canvas test: 2d.text.lang.default\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.worker.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_kerning.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.worker.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.font_variant_caps.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.worker.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.text_rendering.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.worker.txtindex 24514dd912d..d3c713c0a91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/reset/2d.reset.state.word_spacing.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail check that the state is reset\ No newline at end of file+1 Pass+Pass check that the state is reset\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.txtindex fe3d4a6dd7d..48cda0d8eaf 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with absolute length\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with absolute length\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.worker.txtindex fe3d4a6dd7d..48cda0d8eaf 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.absolute.spacing.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with absolute length\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with absolute length\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.txtindex 80e05fb5639..43bbbd6a559 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with font-relative length\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with font-relative length\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.worker.txtindex 80e05fb5639..43bbbd6a559 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.font-relative.spacing.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with font-relative length\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with font-relative length\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.txtindex d8fd0a53a33..00f7a8b0889 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of fontKerning for canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of fontKerning for canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.worker.txtindex d8fd0a53a33..00f7a8b0889 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontKerning.with.uppercase.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of fontKerning for canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of fontKerning for canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.txtindex 367c58661d9..011171d06ea 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing value setting of fontStretch in Canvas\ No newline at end of file+1 Pass+Pass Testing value setting of fontStretch in Canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.worker.txtindex 367c58661d9..011171d06ea 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontStretch.settings.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing value setting of fontStretch in Canvas\ No newline at end of file+1 Pass+Pass Testing value setting of fontStretch in Canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.txtindex 6e4b3069692..a452b350520 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of fontVariant for canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of fontVariant for canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.worker.txtindex 6e4b3069692..a452b350520 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.fontVariant.settings.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of fontVariant for canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of fontVariant for canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.txtindex 979193b4ed1..949eb427cfa 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with invalid units\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with invalid units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.worker.txtindex 979193b4ed1..949eb427cfa 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.invalid.spacing.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with invalid units\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with invalid units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.txtindex 2d4a19969f7..3170814aa6d 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Set letter spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of file+1 Pass+Pass Set letter spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.worker.txtindex 2d4a19969f7..3170814aa6d 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.change.font.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Set letter spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of file+1 Pass+Pass Set letter spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.txtindex c92e9b31c9f..ee0bd5e5881 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing with different length units\ No newline at end of file+1 Pass+Pass Testing letter spacing with different length units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.worker.txtindex c92e9b31c9f..ee0bd5e5881 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.letterSpacing.measure.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing with different length units\ No newline at end of file+1 Pass+Pass Testing letter spacing with different length units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.txtindex b09d2ace6a9..8a23b9a4dcf 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with nonfinite inputs\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with nonfinite inputs\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.worker.txtindex b09d2ace6a9..8a23b9a4dcf 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.nonfinite.spacing.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing letter spacing and word spacing with nonfinite inputs\ No newline at end of file+1 Pass+Pass Testing letter spacing and word spacing with nonfinite inputs\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.txtindex c23368aaadf..f0209fd2d91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of textRendering in Canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of textRendering in Canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.worker.txtindex c23368aaadf..f0209fd2d91 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.textRendering.settings.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing basic functionalities of textRendering in Canvas\ No newline at end of file+1 Pass+Pass Testing basic functionalities of textRendering in Canvas\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.txtindex 77cdc564e66..4461c7386c3 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Set word spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of file+1 Pass+Pass Set word spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.worker.txtindex 77cdc564e66..4461c7386c3 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.change.font.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Set word spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of file+1 Pass+Pass Set word spacing and word spacing to font dependent value and verify it works after font change.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.txtindex 1881cb40989..6205524ea24 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing word spacing with different length units\ No newline at end of file+1 Pass+Pass Testing word spacing with different length units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.worker.txtindex 1881cb40989..6205524ea24 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.drawing.style.wordSpacing.measure.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Testing word spacing with different length units\ No newline at end of file+1 Pass+Pass Testing word spacing with different length units\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.txtindex 6b2f0477a80..e483249a4bb 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail OffscreenCanvas test: 2d.text.lang.default\ No newline at end of file+1 Pass+Pass OffscreenCanvas test: 2d.text.lang.default\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.worker.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.worker.txtindex cd924677233..cf5877d439e 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.worker.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/offscreen/text/2d.text.lang.default.worker.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail 2d\ No newline at end of file+1 Pass+Pass 2d\ No newline at end of file