mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1308502 - Allow line-break even within a cluster if the preceding character (i.e. base of cluster) is a space. r=m_kato
This commit is contained in:
parent
0844b5ebc4
commit
175dc497d0
@ -217,16 +217,21 @@ gfxTextRun::SetPotentialLineBreaks(Range aRange, uint8_t *aBreakBefore)
|
||||
NS_ASSERTION(aRange.end <= GetLength(), "Overflow");
|
||||
|
||||
uint32_t changed = 0;
|
||||
uint32_t i;
|
||||
CompressedGlyph *charGlyphs = mCharacterGlyphs + aRange.start;
|
||||
for (i = 0; i < aRange.Length(); ++i) {
|
||||
uint8_t canBreak = aBreakBefore[i];
|
||||
if (canBreak && !charGlyphs[i].IsClusterStart()) {
|
||||
// This can happen ... there is no guarantee that our linebreaking rules
|
||||
// align with the platform's idea of what constitutes a cluster.
|
||||
canBreak = CompressedGlyph::FLAG_BREAK_TYPE_NONE;
|
||||
CompressedGlyph* cg = mCharacterGlyphs + aRange.start;
|
||||
const CompressedGlyph* const end = cg + aRange.Length();
|
||||
while (cg < end) {
|
||||
uint8_t canBreak = *aBreakBefore++;
|
||||
if (canBreak && !cg->IsClusterStart()) {
|
||||
// XXX If we replace the line-breaker with one based more closely
|
||||
// on UAX#14 (e.g. using ICU), this may not be needed any more.
|
||||
// Avoid possible breaks inside a cluster, EXCEPT when the previous
|
||||
// character was a space (compare UAX#14 rules LB9, LB10).
|
||||
if (cg == mCharacterGlyphs || !(cg - 1)->CharIsSpace()) {
|
||||
canBreak = CompressedGlyph::FLAG_BREAK_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
changed |= charGlyphs[i].SetCanBreakBefore(canBreak);
|
||||
changed |= cg->SetCanBreakBefore(canBreak);
|
||||
++cg;
|
||||
}
|
||||
return changed != 0;
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ random-if(cocoaWidget) == ja-3.html ja-3-ref.html
|
||||
skip-if(gtkWidget) == quotationmarks-cjk-1.html quotationmarks-cjk-1-ref.html
|
||||
== smileys-1.html smileys-1-ref.html
|
||||
== smileys-2.html smileys-2-ref.html
|
||||
fails == space-cluster-1.html space-cluster-1-ref.html # bug 1308502
|
||||
fails == space-cluster-2.html space-cluster-2-ref.html # bug 1308502
|
||||
== space-cluster-1.html space-cluster-1-ref.html
|
||||
== space-cluster-2.html space-cluster-2-ref.html
|
||||
== url-1.html url-1-ref.html
|
||||
== url-2.html url-2-ref.html
|
||||
== url-3.html url-3-ref.html
|
||||
|
Loading…
Reference in New Issue
Block a user