Skip to content

Truly independent web browser

LibWeb: Tailor loose line breaking to CJK languages

Andreas Klinge5d355499444
diff --git a/Libraries/LibUnicode/Segmenter.cpp b/Libraries/LibUnicode/Segmenter.cpp
index 3d9ea021979..a799f68d349 100644
--- a/Libraries/LibUnicode/Segmenter.cpp
+++ b/Libraries/LibUnicode/Segmenter.cpp
@@ -758,6 +758,8 @@ enum class UnicodeLayoutLineBreakMode : u8 {
Strict,
Normal,
Loose,
+ LooseJapanese,
+ LooseChinese,
};
extern "C" {
@@ -771,7 +773,7 @@ void unicode_layout_segmenter_destroy(void*);
static Unicode::Segmenter& unicode_layout_segmenter_prototype(Unicode::SegmenterGranularity granularity, UnicodeLayoutLineBreakMode line_break_mode = UnicodeLayoutLineBreakMode::Strict)
{
static thread_local Unicode::Segmenter* grapheme_prototype = nullptr;
- static thread_local Unicode::Segmenter* line_prototypes[3] {};
+ static thread_local Unicode::Segmenter* line_prototypes[5] {};
static thread_local Unicode::Segmenter* word_prototype = nullptr;
auto& prototype = granularity == Unicode::SegmenterGranularity::Grapheme ? grapheme_prototype
: granularity == Unicode::SegmenterGranularity::Word ? word_prototype
@@ -783,11 +785,27 @@ static Unicode::Segmenter& unicode_layout_segmenter_prototype(Unicode::Segmenter
// Unicode line breaking class CJ.
// INTEROP: Chrome and Firefox allow breaks before CJ characters for normal as well as loose, despite the
// current specification forbidding them for normal. ICU's normal tailoring resolves CJ to ID.
- prototype = line_break_mode == UnicodeLayoutLineBreakMode::Loose
- ? Unicode::Segmenter::create("en-u-lb-loose"_utf16, granularity).leak_ptr()
- : line_break_mode == UnicodeLayoutLineBreakMode::Normal
- ? Unicode::Segmenter::create("en-u-lb-normal"_utf16, granularity).leak_ptr()
- : Unicode::Segmenter::create(granularity).leak_ptr();
+ // The following breaks are allowed for loose if the writing system is Chinese or Japanese and are otherwise forbidden:
+ // - breaks before certain centered punctuation marks:
+ // U+30FB, U+FF1A, U+FF1B, U+FF65, U+203C, U+2047, U+2048, U+2049, U+FF01, U+FF1F
+ // NB: ICU's Japanese and Chinese loose tailorings implement these language-specific breaks.
+ switch (line_break_mode) {
+ case UnicodeLayoutLineBreakMode::Strict:
+ prototype = Unicode::Segmenter::create(granularity).leak_ptr();
+ break;
+ case UnicodeLayoutLineBreakMode::Normal:
+ prototype = Unicode::Segmenter::create("en-u-lb-normal"_utf16, granularity).leak_ptr();
+ break;
+ case UnicodeLayoutLineBreakMode::Loose:
+ prototype = Unicode::Segmenter::create("en-u-lb-loose"_utf16, granularity).leak_ptr();
+ break;
+ case UnicodeLayoutLineBreakMode::LooseJapanese:
+ prototype = Unicode::Segmenter::create("ja-u-lb-loose"_utf16, granularity).leak_ptr();
+ break;
+ case UnicodeLayoutLineBreakMode::LooseChinese:
+ prototype = Unicode::Segmenter::create("zh-u-lb-loose"_utf16, granularity).leak_ptr();
+ break;
+ }
}
return *prototype;
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/inputs.rs b/Libraries/LibWeb/Rust/src/css/style/inputs.rs
index e323dc6779b..910a2b67a7c 100644
--- a/Libraries/LibWeb/Rust/src/css/style/inputs.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/inputs.rs
@@ -921,13 +921,22 @@ impl RetainedState {
/// The language tag a text node's transform reads: the one its DOM parent element resolves to.
/// A text node under a shadow root or the document has no element above it and reads none.
- fn text_language_tag(&self, node: StyleNodeID) -> &[u16] {
+ pub(crate) fn text_language_tag(&self, node: StyleNodeID) -> &[u16] {
self.tree
.text_parent(node)
.filter(|&parent| self.tree.host_of(parent).is_none() && !self.tree.is_relation_only(parent))
.map_or(&[], |parent| self.facts.language_tag_of(parent))
}
+ /// Text directly under a shadow root uses its host's language for line breaking.
+ pub(crate) fn text_line_break_language_tag(&self, node: StyleNodeID) -> &[u16] {
+ self.tree
+ .text_parent(node)
+ .map(|parent| self.tree.host_of(parent).unwrap_or(parent))
+ .filter(|&parent| !self.tree.is_relation_only(parent))
+ .map_or(&[], |parent| self.facts.language_tag_of(parent))
+ }
+
/// Record the text node's whitespace-only state, as its data now spells it.
pub fn set_text_is_ascii_whitespace(&mut self, node: StyleNodeID, value: bool) {
self.tree.set_text_is_ascii_whitespace(node, value);
diff --git a/Libraries/LibWeb/Rust/src/css/style/tests.rs b/Libraries/LibWeb/Rust/src/css/style/tests.rs
index cb58778ea69..f125473d2b3 100644
--- a/Libraries/LibWeb/Rust/src/css/style/tests.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/tests.rs
@@ -12219,3 +12219,71 @@ fn a_document_with_other_routes_routes_user_agent_rules_itself() {
);
assert!(first.routing.has_routes_of(&routing_built_from(&first, &[first_sheet])));
}
+
+#[test]
+fn shadow_text_line_break_language_follows_host_mutation() {
+ use crate::layout::text_chunker::LineBreakLanguage;
+
+ let mut engine = StyleEngine::new();
+ let mut raw = [0_u32; 4];
+ engine.allocate_style_nodes(&mut raw);
+ let [document, host, shadow_root, wrapper] = raw.map(|raw| StyleNodeID::from_raw(raw).unwrap());
+ engine.record_tree_delta(document, None, Some(relations(None, None, None)));
+ engine.record_tree_delta(host, None, Some(relations(Some(document.raw()), None, None)));
+ engine.record_tree_delta(shadow_root, None, Some(TreeRelations::detached(TreeScopeID(1))));
+ engine.record_tree_delta(wrapper, None, Some(relations(Some(shadow_root.raw()), None, None)));
+ engine.set_shadow_root(host, shadow_root);
+ engine.apply_staged_tree_deltas();
+ let mut raw_text = [0_u32; 5];
+ engine.allocate_text_style_nodes(&mut raw_text);
+ let [direct, wrapped, light, under_document, detached] = raw_text.map(|raw| StyleNodeID::from_raw(raw).unwrap());
+ engine.link_style_nodes_in_dom_order(&[
+ direct.raw(),
+ shadow_root.raw(),
+ 0,
+ wrapped.raw(),
+ wrapper.raw(),
+ 0,
+ light.raw(),
+ host.raw(),
+ 0,
+ under_document.raw(),
+ document.raw(),
+ 0,
+ ]);
+ let german = engine.intern_atom(0x13393);
+ engine.set_element_language_text(german, &"de".encode_utf16().collect::<Vec<_>>());
+ engine.set_element_language(wrapper, german);
+
+ for (index, (tag, language)) in [
+ ("ja", LineBreakLanguage::Japanese),
+ ("de", LineBreakLanguage::Other),
+ ("zh-Hant", LineBreakLanguage::Chinese),
+ ("JA-jp", LineBreakLanguage::Japanese),
+ ("ko-Hani", LineBreakLanguage::Chinese),
+ ("ja-Latn", LineBreakLanguage::Other),
+ ("zh-Hira", LineBreakLanguage::Japanese),
+ ("", LineBreakLanguage::Other),
+ ]
+ .into_iter()
+ .enumerate()
+ {
+ let atom = engine.intern_atom(0x14000 + index);
+ let units = tag.encode_utf16().collect::<Vec<_>>();
+ engine.set_element_language_text(atom, &units);
+ engine.set_element_language(host, atom);
+ discard_transaction(&mut engine);
+ let retained = &engine.retained;
+ assert_eq!(retained.text_line_break_language_tag(direct), units, "{tag}");
+ assert_eq!(retained.text_line_break_language_tag(light), units, "{tag}");
+ assert!(LineBreakLanguage::from_tag(retained.text_line_break_language_tag(direct)) == language);
+ assert_eq!(
+ retained.text_line_break_language_tag(wrapped),
+ "de".encode_utf16().collect::<Vec<_>>()
+ );
+ assert!(retained.text_line_break_language_tag(under_document).is_empty());
+ assert!(retained.text_line_break_language_tag(detached).is_empty());
+ // The existing casing resolver keeps its separate DOM-parent contract.
+ assert!(retained.text_language_tag(direct).is_empty());
+ }
+}
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
index f55e2bfbc3e..afeea2dae19 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
@@ -5340,6 +5340,20 @@ impl LayoutNodeArena {
})
}
+ pub(crate) fn text_line_break_language(&self, id: NodeSlotId) -> super::text_chunker::LineBreakLanguage {
+ use super::text_chunker::LineBreakLanguage;
+ if self.data(id).kind.get() == NodeKind::GeneratedTextNode {
+ return self
+ .generated_text_language_tag(id)
+ .as_deref()
+ .map_or(LineBreakLanguage::Other, LineBreakLanguage::from_tag);
+ }
+ let Some(node) = self.node_style_node(id).filter(|node| node.text_index().is_some()) else {
+ return LineBreakLanguage::Other;
+ };
+ self.with_style_store(|engine| LineBreakLanguage::from_tag(engine.text_line_break_language_tag(node)))
+ }
+
pub(crate) fn set_text_content(&mut self, id: NodeSlotId, content: TextContent) {
let mut state = self.text_node_state_mut(id);
if let Some(previous) = state.content.as_mut()
diff --git a/Libraries/LibWeb/Rust/src/layout/rendered_text.rs b/Libraries/LibWeb/Rust/src/layout/rendered_text.rs
index c88a047c779..c38bfe9939b 100644
--- a/Libraries/LibWeb/Rust/src/layout/rendered_text.rs
+++ b/Libraries/LibWeb/Rust/src/layout/rendered_text.rs
@@ -113,7 +113,7 @@ fn transform_uses_locale(transform: u8) -> bool {
)
}
-/// Enrolls the text under `root` whose casing depends on the language it renders with, and answers whether there was
+/// Enrolls the text under `root` whose casing or loose line breaking depends on its language, and answers whether there was
/// any. This only enrolls text; source views are requested after DOM language invalidation completes.
pub(crate) fn enroll_text_after_language_change(arena: &LayoutNodeArena, root: NodeSlotId) -> bool {
let mut changed = false;
@@ -124,7 +124,9 @@ pub(crate) fn enroll_text_after_language_change(arena: &LayoutNodeArena, root: N
let parent = arena.data(node).parent.get();
if !parent.is_invalid()
&& arena.style_payloads(parent).is_some_and(|style| {
- transform_uses_locale(ComputedValuesView::new(&style.groups).inherited_text().text_transform)
+ let values = ComputedValuesView::new(&style.groups);
+ transform_uses_locale(values.inherited_text().text_transform)
+ || values.line_break() == crate::css::css_enums::line_break::LOOSE
})
{
arena.enroll_text_node_for_content_sync(node);
@@ -149,6 +151,7 @@ pub(crate) struct TextChunkCacheKey {
pub(crate) white_space_collapse: u8,
pub(crate) word_break: u8,
pub(crate) line_break: u8,
+ pub(crate) line_break_language: super::text_chunker::LineBreakLanguage,
pub(crate) font_variant_emoji: u8,
pub(crate) frozen_font_list: std::sync::Arc<libgfx_rust::font::FrozenFontList>,
pub(crate) splits_at_orientation_changes: bool,
@@ -162,6 +165,7 @@ impl PartialEq for TextChunkCacheKey {
&& self.white_space_collapse == other.white_space_collapse
&& self.word_break == other.word_break
&& self.line_break == other.line_break
+ && self.line_break_language == other.line_break_language
&& self.font_variant_emoji == other.font_variant_emoji
&& self.splits_at_orientation_changes == other.splits_at_orientation_changes
// A frozen cascade is immutable, so naming the same one is the whole of equality.
@@ -432,6 +436,37 @@ mod tests {
}
}
+ #[test]
+ fn text_chunk_cache_tracks_line_break_language_changes() {
+ use crate::layout::text_chunker::LineBreakLanguage;
+ let content = content("文・", 0, 2, Vec::new());
+ let mut key = TextChunkCacheKey {
+ should_wrap_lines: true,
+ should_respect_linebreaks: false,
+ unidirectional_ltr: true,
+ white_space_collapse: 0,
+ word_break: 0,
+ line_break: crate::css::css_enums::line_break::LOOSE,
+ line_break_language: LineBreakLanguage::Japanese,
+ font_variant_emoji: 0,
+ frozen_font_list: std::sync::Arc::new(libgfx_rust::font::FrozenFontList::empty()),
+ splits_at_orientation_changes: false,
+ };
+ let mut previous = content.text_chunks(&key, Vec::new);
+ for language in [
+ LineBreakLanguage::Other,
+ LineBreakLanguage::Chinese,
+ LineBreakLanguage::Japanese,
+ ] {
+ key.line_break_language = language;
+ let chunks = content.text_chunks(&key, Vec::new);
+ assert!(!std::sync::Arc::ptr_eq(&previous, &chunks));
+ let hit = content.text_chunks(&key, || panic!("unchanged language should reuse chunks"));
+ assert!(std::sync::Arc::ptr_eq(&chunks, &hit));
+ previous = chunks;
+ }
+ }
+
#[test]
fn text_chunk_users_survive_cache_and_snapshot_replacement() {
use super::TextChunkCacheKey;
@@ -448,6 +483,7 @@ mod tests {
white_space_collapse: 0,
word_break: 0,
line_break: crate::css::css_enums::line_break::AUTO,
+ line_break_language: crate::layout::text_chunker::LineBreakLanguage::Other,
font_variant_emoji: 0,
frozen_font_list: std::sync::Arc::new(libgfx_rust::font::FrozenFontList::empty()),
splits_at_orientation_changes: false,
diff --git a/Libraries/LibWeb/Rust/src/layout/text_chunker.rs b/Libraries/LibWeb/Rust/src/layout/text_chunker.rs
index f3157c177ab..67df79c7ed0 100644
--- a/Libraries/LibWeb/Rust/src/layout/text_chunker.rs
+++ b/Libraries/LibWeb/Rust/src/layout/text_chunker.rs
@@ -13,6 +13,133 @@ enum LineBreakMode {
Strict,
Normal,
Loose,
+ LooseJapanese,
+ LooseChinese,
+}
+
+#[derive(Clone, Copy, PartialEq, Eq)]
+pub(crate) enum LineBreakLanguage {
+ Other,
+ Japanese,
+ Chinese,
+}
+
+impl LineBreakLanguage {
+ pub(crate) fn from_tag(tag: &[u16]) -> Self {
+ let is_alpha = |subtag: &[u16]| {
+ subtag
+ .iter()
+ .all(|&unit| u8::try_from(unit).is_ok_and(|unit| unit.is_ascii_alphabetic()))
+ };
+ let matches = |subtag: &[u16], expected: &[u8]| {
+ subtag.len() == expected.len()
+ && subtag
+ .iter()
+ .zip(expected)
+ .all(|(&unit, &expected)| (unit | 0x20) == u16::from(expected))
+ };
+ let mut subtags = tag.split(|&unit| unit == u16::from(b'-'));
+ let primary = subtags.next().unwrap_or_default();
+ if !(2..=8).contains(&primary.len()) || !is_alpha(primary) {
+ return Self::Other;
+ }
+ let mut candidate = subtags.next();
+ // BCP47 permits up to three extlang subtags, only after a two- or three-letter primary language.
+ if primary.len() <= 3 {
+ for _ in 0..3 {
+ if !candidate.is_some_and(|subtag| subtag.len() == 3 && is_alpha(subtag)) {
+ break;
+ }
+ candidate = subtags.next();
+ }
+ }
+ // https://drafts.csswg.org/css-text-4/#script-tagging
+ // Only this position can name a script. Region, variant, extension and private-use subtags cannot override it.
+ if let Some(script) = candidate.filter(|subtag| subtag.len() == 4 && is_alpha(subtag)) {
+ if [b"hant", b"hans", b"hani", b"hanb", b"bopo"]
+ .iter()
+ .any(|name| matches(script, *name))
+ {
+ return Self::Chinese;
+ }
+ if [b"jpan", b"hrkt", b"hira", b"kana"]
+ .iter()
+ .any(|name| matches(script, *name))
+ {
+ return Self::Japanese;
+ }
+ return Self::Other;
+ }
+ if matches(primary, b"ja") {
+ Self::Japanese
+ } else if matches(primary, b"zh") {
+ Self::Chinese
+ } else {
+ Self::Other
+ }
+ }
+}
+
+#[cfg(test)]
+mod language_tests {
+ use super::LineBreakLanguage::{self, Chinese, Japanese, Other};
+
+ #[test]
+ fn explicit_script_overrides_line_break_language() {
+ for (tag, expected) in [
+ ("ko-Hani", Chinese),
+ ("ja-Latn", Other),
+ ("zh-Latn", Other),
+ ("ja-Hans", Chinese),
+ ("zh-Hira", Japanese),
+ ("en-Jpan", Japanese),
+ ("en-Hant", Chinese),
+ ("en-Hans", Chinese),
+ ("en-Hani", Chinese),
+ ("en-Hanb", Chinese),
+ ("en-Bopo", Chinese),
+ ("en-Hrkt", Japanese),
+ ("en-Hira", Japanese),
+ ("en-Kana", Japanese),
+ ("ja-Hang", Other),
+ ("ja-Kore", Other),
+ ("zh-Jamo", Other),
+ ("zh-Zzzz", Other),
+ ("JA-hAnS", Chinese),
+ ("zh-cmn-Jpan", Japanese),
+ ("ja-abc-def-ghi-Hans", Chinese),
+ ("yue-Hant", Chinese),
+ ] {
+ let units: Vec<_> = tag.encode_utf16().collect();
+ assert!(LineBreakLanguage::from_tag(&units) == expected, "{tag}");
+ }
+ }
+
+ #[test]
+ fn only_the_script_position_changes_line_break_language() {
+ for (tag, expected) in [
+ ("ja", Japanese),
+ ("ja-JP", Japanese),
+ ("JA-jp", Japanese),
+ ("zh", Chinese),
+ ("zh-Hant-TW", Chinese),
+ ("ja-x-Latn", Japanese),
+ ("ja-u-ca-hans", Japanese),
+ ("ja-JP-Latn", Japanese),
+ ("ja-1996-Latn", Japanese),
+ ("ja-fonipa-Latn", Japanese),
+ ("en-x-Jpan", Other),
+ ("en-u-ca-jpan", Other),
+ ("abcd-xyz-Jpan", Other),
+ ("x-Jpan", Other),
+ ("jあ-Jpan", Other),
+ ("japanesee-Jpan", Other),
+ ("", Other),
+ ] {
+ let units: Vec<_> = tag.encode_utf16().collect();
+ assert!(LineBreakLanguage::from_tag(&units) == expected, "{tag}");
+ }
+ }
}
unsafe extern "C" {
@@ -175,6 +302,7 @@ pub(crate) struct TextChunkInputs<'text> {
pub white_space_collapse: u8,
pub word_break: u8,
pub line_break: u8,
+ pub line_break_language: LineBreakLanguage,
pub font_variant_emoji: u8,
pub should_wrap_lines: bool,
pub should_respect_linebreaks: bool,
@@ -345,10 +473,12 @@ struct LineSegmenter<'text> {
}
impl<'text> LineSegmenter<'text> {
- fn new(text: &'text [u16], line_break: u8) -> Self {
- let mode = match line_break {
- line_break::LOOSE => LineBreakMode::Loose,
- line_break::NORMAL => LineBreakMode::Normal,
+ fn new(text: &'text [u16], line_break: u8, language: LineBreakLanguage) -> Self {
+ let mode = match (line_break, language) {
+ (line_break::LOOSE, LineBreakLanguage::Japanese) => LineBreakMode::LooseJapanese,
+ (line_break::LOOSE, LineBreakLanguage::Chinese) => LineBreakMode::LooseChinese,
+ (line_break::LOOSE, LineBreakLanguage::Other) => LineBreakMode::Loose,
+ (line_break::NORMAL, _) => LineBreakMode::Normal,
_ => LineBreakMode::Strict,
};
// SAFETY: See GraphemeSegmenter::new; the same lifetime contract holds,
@@ -537,7 +667,7 @@ impl<'text> TextChunker<'text> {
text: inputs.text,
frozen_font_list: inputs.frozen_font_list,
grapheme_segmenter: GraphemeSegmenter::new(inputs.text),
- line_segmenter: LineSegmenter::new(inputs.text, inputs.line_break),
+ line_segmenter: LineSegmenter::new(inputs.text, inputs.line_break, inputs.line_break_language),
word_break: inputs.word_break,
allow_conditional_japanese_starters,
font_variant_emoji: inputs.font_variant_emoji,
@@ -967,6 +1097,11 @@ pub(crate) fn text_chunks(
white_space_collapse: parent_style.white_space_collapse(),
word_break: parent_style.word_break(),
line_break: parent_style.line_break(),
+ line_break_language: if parent_style.line_break() == line_break::LOOSE {
+ callbacks.arena().text_line_break_language(node)
+ } else {
+ LineBreakLanguage::Other
+ },
font_variant_emoji: parent_style.font_variant_emoji(),
frozen_font_list: parent_style.frozen_font_list_ref(),
splits_at_orientation_changes: matches!(
@@ -982,6 +1117,7 @@ pub(crate) fn text_chunks(
white_space_collapse: key.white_space_collapse,
word_break: key.word_break,
line_break: key.line_break,
+ line_break_language: key.line_break_language,
font_variant_emoji: key.font_variant_emoji,
should_wrap_lines,
should_respect_linebreaks,
diff --git a/Tests/LibWeb/Text/expected/css/cjk-loose-language-change.txt b/Tests/LibWeb/Text/expected/css/cjk-loose-language-change.txt
index cdd9fa33877..cf26bae3476 100644
--- a/Tests/LibWeb/Text/expected/css/cjk-loose-language-change.txt
+++ b/Tests/LibWeb/Text/expected/css/cjk-loose-language-change.txt
@@ -1,6 +1,6 @@
-ja: text false, generated intrinsic size false
+ja: text true, generated intrinsic size true
de: text true, generated intrinsic size true
-zh: text false, generated intrinsic size false
-ja-JP: text false, generated intrinsic size false
+zh: text true, generated intrinsic size true
+ja-JP: text true, generated intrinsic size true
en: text true, generated intrinsic size true
-zh-Hant: text false, generated intrinsic size false
+zh-Hant: text true, generated intrinsic size true
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-cpm-loose.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-cpm-loose.txt
index 7197b64539f..c0fb2bc27e9 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-cpm-loose.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-cpm-loose.txt
@@ -2,14 +2,14 @@ Harness status: OK
Found 10 tests
-10 Fail
-Fail 30FB KATAKANA MIDDLE DOT may appear at line start if ja and loose
-Fail FF1A FULLWIDTH COLON may appear at line start if ja and loose
-Fail FF1B FULLWIDTH SEMICOLON may appear at line start if ja and loose
-Fail FF65 HALFWIDTH KATAKANA MIDDLE DOT may appear at line start if ja and loose
-Fail 203C DOUBLE EXCLAMATION MARK may appear at line start if ja and loose
-Fail 2047 DOUBLE QUESTION MARK may appear at line start if ja and loose
-Fail 2048 QUESTION EXCLAMATION MARK may appear at line start if ja and loose
-Fail 2049 EXCLAMATION QUESTION MARK may appear at line start if ja and loose
-Fail FF01 FULLWIDTH EXCLAMATION MARK may appear at line start if ja and loose
-Fail FF1F FULLWIDTH QUESTION MARK may appear at line start if ja and loose
\ No newline at end of file
+10 Pass
+Pass 30FB KATAKANA MIDDLE DOT may appear at line start if ja and loose
+Pass FF1A FULLWIDTH COLON may appear at line start if ja and loose
+Pass FF1B FULLWIDTH SEMICOLON may appear at line start if ja and loose
+Pass FF65 HALFWIDTH KATAKANA MIDDLE DOT may appear at line start if ja and loose
+Pass 203C DOUBLE EXCLAMATION MARK may appear at line start if ja and loose
+Pass 2047 DOUBLE QUESTION MARK may appear at line start if ja and loose
+Pass 2048 QUESTION EXCLAMATION MARK may appear at line start if ja and loose
+Pass 2049 EXCLAMATION QUESTION MARK may appear at line start if ja and loose
+Pass FF01 FULLWIDTH EXCLAMATION MARK may appear at line start if ja and loose
+Pass FF1F FULLWIDTH QUESTION MARK may appear at line start if ja and loose
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-hyphens-loose.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-hyphens-loose.txt
index a6216eaab6d..a508239f69d 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-hyphens-loose.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-hyphens-loose.txt
@@ -2,6 +2,6 @@ Harness status: OK
Found 2 tests
-2 Fail
-Fail 301C WAVE DASH may appear at line start if ja and loose
-Fail 30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN may appear at line start if ja and loose
\ No newline at end of file
+2 Pass
+Pass 301C WAVE DASH may appear at line start if ja and loose
+Pass 30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN may appear at line start if ja and loose
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-po-loose.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-po-loose.txt
index aa6e8f8e90b..b9c54c8e4b5 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-po-loose.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/ja/css-text-line-break-ja-po-loose.txt
@@ -2,14 +2,14 @@ Harness status: OK
Found 10 tests
-10 Fail
-Fail 00B0 DEGREE SIGN may appear at line start if ja and loose
-Fail 2030 PER MILLE SIGN may appear at line start if ja and loose
-Fail 2032 PRIME may appear at line start if ja and loose
-Fail 2033 DOUBLE PRIME may appear at line start if ja and loose
-Fail 2035 REVERSED PRIME may appear at line start if ja and loose
-Fail 2103 DEGREE CELSIUS may appear at line start if ja and loose
-Fail 2109 DEGREE FAHRENHEIT may appear at line start if ja and loose
-Fail FE6A SMALL PERCENT SIGN may appear at line start if ja and loose
-Fail FF05 FULLWIDTH PERCENT SIGN may appear at line start if ja and loose
-Fail FFE0 FULLWIDTH CENT SIGN may appear at line start if ja and loose
\ No newline at end of file
+10 Pass
+Pass 00B0 DEGREE SIGN may appear at line start if ja and loose
+Pass 2030 PER MILLE SIGN may appear at line start if ja and loose
+Pass 2032 PRIME may appear at line start if ja and loose
+Pass 2033 DOUBLE PRIME may appear at line start if ja and loose
+Pass 2035 REVERSED PRIME may appear at line start if ja and loose
+Pass 2103 DEGREE CELSIUS may appear at line start if ja and loose
+Pass 2109 DEGREE FAHRENHEIT may appear at line start if ja and loose
+Pass FE6A SMALL PERCENT SIGN may appear at line start if ja and loose
+Pass FF05 FULLWIDTH PERCENT SIGN may appear at line start if ja and loose
+Pass FFE0 FULLWIDTH CENT SIGN may appear at line start if ja and loose
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-cpm-loose.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-cpm-loose.txt
index add8adf11ef..6da30687f2d 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-cpm-loose.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-cpm-loose.txt
@@ -2,14 +2,14 @@ Harness status: OK
Found 10 tests
-10 Fail
-Fail 30FB KATAKANA MIDDLE DOT may appear at line start if zh and loose
-Fail FF1A FULLWIDTH COLON may appear at line start if zh and loose
-Fail FF1B FULLWIDTH SEMICOLON may appear at line start if zh and loose
-Fail FF65 HALFWIDTH KATAKANA MIDDLE DOT may appear at line start if zh and loose
-Fail 203C DOUBLE EXCLAMATION MARK may appear at line start if zh and loose
-Fail 2047 DOUBLE QUESTION MARK may appear at line start if zh and loose
-Fail 2048 QUESTION EXCLAMATION MARK may appear at line start if zh and loose
-Fail 2049 EXCLAMATION QUESTION MARK may appear at line start if zh and loose
-Fail FF01 FULLWIDTH EXCLAMATION MARK may appear at line start if zh and loose
-Fail FF1F FULLWIDTH QUESTION MARK may appear at line start if zh and loose
\ No newline at end of file
+10 Pass
+Pass 30FB KATAKANA MIDDLE DOT may appear at line start if zh and loose
+Pass FF1A FULLWIDTH COLON may appear at line start if zh and loose
+Pass FF1B FULLWIDTH SEMICOLON may appear at line start if zh and loose
+Pass FF65 HALFWIDTH KATAKANA MIDDLE DOT may appear at line start if zh and loose
+Pass 203C DOUBLE EXCLAMATION MARK may appear at line start if zh and loose
+Pass 2047 DOUBLE QUESTION MARK may appear at line start if zh and loose
+Pass 2048 QUESTION EXCLAMATION MARK may appear at line start if zh and loose
+Pass 2049 EXCLAMATION QUESTION MARK may appear at line start if zh and loose
+Pass FF01 FULLWIDTH EXCLAMATION MARK may appear at line start if zh and loose
+Pass FF1F FULLWIDTH QUESTION MARK may appear at line start if zh and loose
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-hyphens-loose.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-hyphens-loose.txt
index d81b47d9846..8b0f787c54f 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-hyphens-loose.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-hyphens-loose.txt
@@ -2,6 +2,6 @@ Harness status: OK
Found 2 tests
-2 Fail
-Fail 301C WAVE DASH may appear at line start if zh and loose
-Fail 30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN may appear at line start if zh and loose
\ No newline at end of file
+2 Pass
+Pass 301C WAVE DASH may appear at line start if zh and loose
+Pass 30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN may appear at line start if zh and loose
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-po-loose.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-po-loose.txt
index dfab6c01ca5..3de67335ff4 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-po-loose.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-text/i18n/zh/css-text-line-break-zh-po-loose.txt
@@ -2,14 +2,14 @@ Harness status: OK
Found 10 tests
-10 Fail
-Fail 00B0 DEGREE SIGN may appear at line start if zh and loose
-Fail 2030 PER MILLE SIGN may appear at line start if zh and loose
-Fail 2032 PRIME may appear at line start if zh and loose
-Fail 2033 DOUBLE PRIME may appear at line start if zh and loose
-Fail 2035 REVERSED PRIME may appear at line start if zh and loose
-Fail 2103 DEGREE CELSIUS may appear at line start if zh and loose
-Fail 2109 DEGREE FAHRENHEIT may appear at line start if zh and loose
-Fail FE6A SMALL PERCENT SIGN may appear at line start if zh and loose
-Fail FF05 FULLWIDTH PERCENT SIGN may appear at line start if zh and loose
-Fail FFE0 FULLWIDTH CENT SIGN may appear at line start if zh and loose
\ No newline at end of file
+10 Pass
+Pass 00B0 DEGREE SIGN may appear at line start if zh and loose
+Pass 2030 PER MILLE SIGN may appear at line start if zh and loose
+Pass 2032 PRIME may appear at line start if zh and loose
+Pass 2033 DOUBLE PRIME may appear at line start if zh and loose
+Pass 2035 REVERSED PRIME may appear at line start if zh and loose
+Pass 2103 DEGREE CELSIUS may appear at line start if zh and loose
+Pass 2109 DEGREE FAHRENHEIT may appear at line start if zh and loose
+Pass FE6A SMALL PERCENT SIGN may appear at line start if zh and loose
+Pass FF05 FULLWIDTH PERCENT SIGN may appear at line start if zh and loose
+Pass FFE0 FULLWIDTH CENT SIGN may appear at line start if zh and loose
\ No newline at end of file