summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsTextRunTransformations.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /layout/generic/nsTextRunTransformations.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 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.cpp20
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);