From cb26a6d16dcb83c7db7ea7b706f1ca92b2a692c4 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Sat, 28 Jul 2018 09:23:11 +0100 Subject: [PATCH] Bug 1478574 - Fix off-by-one error in marking explicit hyphens, so we don't introduce spurious pre-hyphen breaks. r=dbaron --- layout/generic/nsTextFrame.cpp | 4 +++- layout/reftests/text/reftest.list | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index cca4410a5653..2e2aa6793443 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -3643,7 +3643,9 @@ PropertyProvider::GetHyphenationBreaks(Range aRange, HyphenType* aBreakBefore) c uint32_t currentFragOffset = mStart.GetOriginalOffset(); for (uint32_t i = 0; i < aRange.Length(); ++i) { if (IS_HYPHEN(mFrag->CharAt(currentFragOffset + i))) { - aBreakBefore[i] = HyphenType::Explicit; + if (i < aRange.Length() - 1) { + aBreakBefore[i + 1] = HyphenType::Explicit; + } continue; } diff --git a/layout/reftests/text/reftest.list b/layout/reftests/text/reftest.list index 4683bafb643c..0a723b5c9d1b 100644 --- a/layout/reftests/text/reftest.list +++ b/layout/reftests/text/reftest.list @@ -321,7 +321,7 @@ pref(gfx.font_rendering.graphite.enabled,true) == glyph-decomposition-graphite.h == hyphenation-control-2.html hyphenation-control-2-ref.html == hyphenation-control-3.html hyphenation-control-3-ref.html == hyphenation-control-4.html hyphenation-control-4-ref.html -fails == hyphenation-control-5.html hyphenation-control-5-ref.html # bug 1478574 +== hyphenation-control-5.html hyphenation-control-5-ref.html # osx-font-smoothing - with and without subpixel AA, only under OSX fails-if(!cocoaWidget) != osx-font-smoothing.html osx-font-smoothing-ref.html