tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 9f85cbd0235de94e712beeae9d6f56a0970cb785
parent 91742328b3cd66a9ba94b2211a4a5457a82cea94
Author: Jonathan Kew <jkew@mozilla.com>
Date:   Sun, 21 Dec 2025 13:20:54 +0000

Bug 2006237 - Don't allow intercharacter justification to be applied to cursive scripts. r=layout-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D277284

Diffstat:
Mintl/components/src/UnicodeProperties.h | 9+++++++++
Mlayout/generic/nsTextFrame.cpp | 4++++
Dtesting/web-platform/meta/css/css-text/text-justify/text-justify-inter-character-cursive.html.ini | 2--
3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/intl/components/src/UnicodeProperties.h b/intl/components/src/UnicodeProperties.h @@ -335,6 +335,15 @@ class UnicodeProperties final { sc == Script::SUNDANESE || sc == Script::LAO; } + // Return true if aChar belongs to a cursive script for which inter-character + // justification should be disabled. + static bool IsCursiveScript(char32_t aChar) { + Script sc = GetScriptCode(aChar); + return sc == Script::ARABIC || sc == Script::SYRIAC || sc == Script::NKO || + sc == Script::MANDAIC || sc == Script::MONGOLIAN || + sc == Script::PHAGS_PA || sc == Script::HANIFI_ROHINGYA; + } + // The code point which has the most script extensions is 0x0965, which has 21 // script extensions, so choose the vector size as 32 to prevent heap // allocation. diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp @@ -3333,6 +3333,10 @@ static bool IsJustifiableCharacter(const nsStyleText* aTextStyle, } if (justifyStyle == StyleTextJustify::InterCharacter) { + char32_t u = aBuffer.ScalarValueAt(AssertedCast<uint32_t>(aPos)); + if (intl::UnicodeProperties::IsCursiveScript(u)) { + return false; + } return true; } else if (justifyStyle == StyleTextJustify::InterWord) { return false; diff --git a/testing/web-platform/meta/css/css-text/text-justify/text-justify-inter-character-cursive.html.ini b/testing/web-platform/meta/css/css-text/text-justify/text-justify-inter-character-cursive.html.ini @@ -1,2 +0,0 @@ -[text-justify-inter-character-cursive.html] - expected: FAIL