[text-autospace] Change EastAsianSpacingType::kOther
to 0
In the review of crrev.com/c/6342273, we intentionally set `kNarrow` to be 0 because `kNarrow` is the largest set in the data file[1]. It turned out that this decision was wrong, and that this patch changes `kOther` to be 0. 1. The data file[1] defines that the default is `kOther`. Meaning any values that are not set must be `kOther`, but `CharacterPropertyValues` sets the default value to 0. `InlineTextAutoSpaceTest/HtmlTest.Apply/11` tests U+739AD is `kOther`, but the current code returns `kNarrow`. 2. The review assumed `kNarrow` is the largest set by counting the value in the data file[1]. It missed that the file has: # @missing: 0000..10FFFF; O meaning the omitted code points are O. This change reduced `kSerializedCharacterDataSize` from 21,264 to 15,680 bytes. [1] https://unicode.org/reports/tr59/#data Bug: 40275399 Change-Id: I0141e2b658ffc1d418b48a2a084a51d672e5cd8f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6579828 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Auto-Submit: Koji Ishii <kojii@chromium.org> Commit-Queue: Koji Ishii <kojii@chromium.org> Cr-Commit-Position: refs/heads/main@{#1464585}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
54fe177800
commit
aa06bd1073
third_party/blink/renderer/platform/text
@ -237,15 +237,13 @@ class CharacterPropertyValues {
|
||||
// The intersection set of kWide and kConditional is not empty, so remove
|
||||
// the chars which have been assigned the kWide property from narrow.
|
||||
narrow.removeAll(ideographs);
|
||||
SetForUnicodeSet(narrow,
|
||||
ToCharacterProperty(EastAsianSpacingType::kNarrow),
|
||||
CharacterProperty::kEastAsianSpacingShiftedMask);
|
||||
|
||||
// The remaining assigned codes are kOther.
|
||||
icu::UnicodeSet all(0, kMaxCodepoint);
|
||||
all.removeAll(unassigned);
|
||||
all.removeAll(narrow);
|
||||
all.removeAll(ideographs);
|
||||
all.removeAll(conditional);
|
||||
SetForUnicodeSet(all, ToCharacterProperty(EastAsianSpacingType::kOther),
|
||||
CharacterProperty::kEastAsianSpacingShiftedMask);
|
||||
// The flag is initialized by 0, no need to set them.
|
||||
static_assert(static_cast<int>(EastAsianSpacingType::kOther) == 0);
|
||||
}
|
||||
|
||||
static CharacterProperty ToCharacterProperty(HanKerningCharType value) {
|
||||
|
@ -12,8 +12,8 @@ namespace blink {
|
||||
// Represents the East Asian Spacing property, as defined in
|
||||
// https://unicode.org/reports/tr59/.
|
||||
enum class EastAsianSpacingType : uint16_t {
|
||||
kOther = 0,
|
||||
kNarrow,
|
||||
kOther,
|
||||
kConditional,
|
||||
kWide,
|
||||
// When adding values, ensure `CharacterProperty` has enough storage.
|
||||
|
Reference in New Issue
Block a user