summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsTextRunTransformations.cpp
diff options
context:
space:
mode:
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);