layout: Remove dependency on xi-unicode (#44303)

This functionality already provided by `icu_properties` which is already
in our dependency graph, so this change allows us to remove one
dependency.

Testing: This should not change behavior, so is covered by existing
tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-04-17 15:09:44 +02:00
committed by GitHub
parent 53d7a0e08a
commit 789974975f
5 changed files with 17 additions and 33 deletions

8
Cargo.lock generated
View File

@@ -8072,6 +8072,7 @@ dependencies = [
"data-url",
"euclid",
"icu_locid",
"icu_properties",
"icu_segmenter",
"itertools 0.14.0",
"kurbo 0.12.0",
@@ -8114,7 +8115,6 @@ dependencies = [
"url",
"web_atoms",
"webrender_api",
"xi-unicode",
]
[[package]]
@@ -12042,12 +12042,6 @@ version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b"
[[package]]
name = "xi-unicode"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a"
[[package]]
name = "xkbcommon-dl"
version = "0.4.2"

View File

@@ -221,7 +221,6 @@ winit = "0.30.13"
wio = "0.2"
wr_malloc_size_of = "0.2.2"
x25519-dalek = { version = "2.0.1", features = ["static_secrets"] }
xi-unicode = "0.3.0"
xml5ever = "0.39"
############################################################################################

View File

@@ -30,6 +30,7 @@ fonts = { workspace = true }
fonts_traits = { workspace = true }
web_atoms = { workspace = true }
icu_locid = { workspace = true }
icu_properties = { workspace = true, features = ["compiled_data"] }
icu_segmenter = { workspace = true }
itertools = { workspace = true }
kurbo = { workspace = true }
@@ -66,7 +67,6 @@ unicode-script = { workspace = true }
unicode_categories = { workspace = true }
url = { workspace = true }
webrender_api = { workspace = true }
xi-unicode = { workspace = true }
[dev-dependencies]
num-traits = { workspace = true }

View File

@@ -85,6 +85,7 @@ use construct::InlineFormattingContextBuilder;
use fonts::{FontMetrics, GlyphStore};
use icu_locid::LanguageIdentifier;
use icu_locid::subtags::{Language, language};
use icu_properties::{self, LineBreak as ICULineBreak};
use icu_segmenter::{LineBreakOptions, LineBreakStrictness, LineBreakWordOption};
use inline_box::{InlineBox, InlineBoxContainerState, InlineBoxIdentifier, InlineBoxes};
use layout_api::{LayoutNode, SharedSelection};
@@ -110,12 +111,8 @@ use style::values::generics::font::LineHeight;
use style::values::specified::box_::BaselineSource;
use style::values::specified::text::TextAlignKeyword;
use style::values::specified::{AlignmentBaseline, TextAlignLast, TextJustify};
use text_run::{
TextRun, XI_LINE_BREAKING_CLASS_GL, XI_LINE_BREAKING_CLASS_WJ, XI_LINE_BREAKING_CLASS_ZWJ,
get_font_for_first_font_for_style,
};
use text_run::{TextRun, get_font_for_first_font_for_style};
use unicode_bidi::{BidiInfo, Level};
use xi_unicode::linebreak_property;
use super::float::{Clear, PlacementAmongFloats};
use super::{IndependentFloatOrAtomicLayoutResult, IndependentFormattingContextLayoutResult};
@@ -2935,8 +2932,8 @@ fn char_prevents_soft_wrap_opportunity_when_before_or_after_atomic(character: ch
if character == '\u{00A0}' {
return false;
}
let class = linebreak_property(character);
class == XI_LINE_BREAKING_CLASS_GL ||
class == XI_LINE_BREAKING_CLASS_WJ ||
class == XI_LINE_BREAKING_CLASS_ZWJ
matches!(
icu_properties::maps::line_break().get(character),
ICULineBreak::Glue | ICULineBreak::WordJoiner | ICULineBreak::ZWJ
)
}

View File

@@ -9,6 +9,7 @@ use std::sync::Arc;
use app_units::Au;
use fonts::{FontContext, FontRef, GlyphStore, ShapingFlags, ShapingOptions};
use icu_locid::subtags::Language;
use icu_properties::{self, LineBreak};
use log::warn;
use malloc_size_of_derive::MallocSizeOf;
use servo_arc::Arc as ServoArc;
@@ -22,7 +23,6 @@ use style::str::char_is_whitespace;
use style::values::computed::OverflowWrap;
use unicode_bidi::{BidiInfo, Level};
use unicode_script::Script;
use xi_unicode::linebreak_property;
use super::line_breaker::LineBreaker;
use super::{InlineFormattingContextLayout, SharedInlineStyles};
@@ -31,14 +31,6 @@ use crate::dom::WeakLayoutBox;
use crate::flow::inline::line::TextRunOffsets;
use crate::fragment_tree::BaseFragmentInfo;
// These constants are the xi-unicode line breaking classes that are defined in
// `table.rs`. Unfortunately, they are only identified by number.
pub(crate) const XI_LINE_BREAKING_CLASS_CM: u8 = 9;
pub(crate) const XI_LINE_BREAKING_CLASS_GL: u8 = 12;
pub(crate) const XI_LINE_BREAKING_CLASS_ZW: u8 = 28;
pub(crate) const XI_LINE_BREAKING_CLASS_WJ: u8 = 30;
pub(crate) const XI_LINE_BREAKING_CLASS_ZWJ: u8 = 42;
// There are two reasons why we might want to break at the start:
//
// 1. The line breaker told us that a break was necessary between two separate
@@ -619,12 +611,14 @@ fn char_does_not_change_font(character: char) -> bool {
return false;
}
let class = linebreak_property(character);
class == XI_LINE_BREAKING_CLASS_CM ||
class == XI_LINE_BREAKING_CLASS_GL ||
class == XI_LINE_BREAKING_CLASS_ZW ||
class == XI_LINE_BREAKING_CLASS_WJ ||
class == XI_LINE_BREAKING_CLASS_ZWJ
matches!(
icu_properties::maps::line_break().get(character),
LineBreak::CombiningMark |
LineBreak::Glue |
LineBreak::ZWSpace |
LineBreak::WordJoiner |
LineBreak::ZWJ
)
}
pub(super) fn get_font_for_first_font_for_style(