diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /layout/generic/nsTextRunTransformations.cpp | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/generic/nsTextRunTransformations.cpp')
-rw-r--r-- | layout/generic/nsTextRunTransformations.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index d18a7ec293..de9fd31fda 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -80,6 +80,26 @@ bool nsTransformedTextRun::SetPotentialLineBreaks(Range aRange, return changed; } +void nsTransformedTextRun::SetEmergencyWrapPositions() { + // This parallels part of what gfxShapedText::SetupClusterBoundaries() does + // for normal textruns. + bool prevWasHyphen = false; + for (uint32_t pos : IntegerRange(mString.Length())) { + const char16_t ch = mString[pos]; + if (prevWasHyphen) { + if (nsContentUtils::IsAlphanumeric(ch)) { + mCharacterGlyphs[pos].SetCanBreakBefore( + CompressedGlyph::FLAG_BREAK_TYPE_EMERGENCY_WRAP); + } + prevWasHyphen = false; + } + if (nsContentUtils::IsHyphen(ch) && pos && + nsContentUtils::IsAlphanumeric(mString[pos - 1])) { + prevWasHyphen = true; + } + } +} + size_t nsTransformedTextRun::SizeOfExcludingThis( mozilla::MallocSizeOf aMallocSizeOf) { size_t total = gfxTextRun::SizeOfExcludingThis(aMallocSizeOf); |