Bug 1697980 - Implement new uppercase mapping of eszett (U+00DF) to U+1E9E, but preffed-off by default due to inconsistent font support. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D175620
This commit is contained in:
Jonathan Kew 2023-04-17 12:46:49 +00:00
Родитель fffc801961
Коммит e8a99621ca
7 изменённых файлов: 41 добавлений и 0 удалений

Просмотреть файл

@ -333,6 +333,7 @@ static const char* gExactCallbackPrefs[] = {
"intl.accept_languages",
"layout.css.devPixelsPerPx",
"layout.css.dpi",
"layout.css.text-transform.uppercase-eszett.enabled",
"privacy.trackingprotection.enabled",
"ui.use_standins_for_native_colors",
nullptr,
@ -613,6 +614,11 @@ void nsPresContext::PreferenceChanged(const char* aPrefName) {
}
}
if (prefName.EqualsLiteral(
"layout.css.text-transform.uppercase-eszett.enabled")) {
changeHint |= NS_STYLE_HINT_REFLOW;
}
// We will end up calling InvalidatePreferenceSheets one from each pres
// context, but all it's doing is clearing its cached sheet pointers, so it
// won't be wastefully recreating the sheet multiple times.

Просмотреть файл

@ -12,6 +12,7 @@
#include "IrishCasing.h"
#include "mozilla/ComputedStyleInlines.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/TextEditor.h"
#include "mozilla/gfx/2D.h"
#include "nsGkAtoms.h"
@ -622,6 +623,16 @@ bool nsCaseTransformTextRunFactory::TransformString(
// to check for special uppercase (ß)
}
// Updated mapping for German eszett, not currently reflected in the
// Unicode data files. This is behind a pref, as it may not work well
// with many (esp. older) fonts.
if (ch == 0x00DF &&
StaticPrefs::
layout_css_text_transform_uppercase_eszett_enabled()) {
ch = 0x1E9E;
break;
}
mcm = mozilla::unicode::SpecialUpper(ch);
if (mcm) {
int j = 0;

Просмотреть файл

@ -42,5 +42,8 @@ fuzzy(0-1,0-80) == all-title.html all-title-ref.html
== fullwidth-2.html fullwidth-2-ref.html
== fullwidth-all.html fullwidth-all-ref.html
pref(layout.css.text-transform.uppercase-eszett.enabled,false) == uppercase-eszett-1.html uppercase-eszett-1a-ref.html
pref(layout.css.text-transform.uppercase-eszett.enabled,true) == uppercase-eszett-1.html uppercase-eszett-1b-ref.html
# Reset default prefs
defaults

Просмотреть файл

@ -0,0 +1,5 @@
<!DOCTYPE html>
<meta charset=utf-8>
<div style="text-transform: uppercase;">
Straße
Großmann

Просмотреть файл

@ -0,0 +1,5 @@
<!DOCTYPE html>
<meta charset=utf-8>
<div>
STRASSE
GROSSMANN

Просмотреть файл

@ -0,0 +1,5 @@
<!DOCTYPE html>
<meta charset=utf-8>
<div>
STRAẞE
GROẞMANN

Просмотреть файл

@ -8964,6 +8964,12 @@
value: 50 # 50%
mirror: always
# Whether the "modern" uppercase mapping of ß to ẞ (rather than SS) is used.
- name: layout.css.text-transform.uppercase-eszett.enabled
type: bool
value: false
mirror: always
# Whether to block large cursors intersecting UI.
- name: layout.cursor.block.enabled
type: bool