Bug 1134216 - Preserve line-break flags properly when applying text-transform conversions. r=smontagu

This commit is contained in:
Jonathan Kew 2015-02-22 19:39:36 +00:00
Родитель 911ef245b5
Коммит 986898ce38
2 изменённых файлов: 22 добавлений и 17 удалений

Просмотреть файл

@ -103,38 +103,41 @@ public:
// Public textrun API for general use
bool IsClusterStart(uint32_t aPos) {
bool IsClusterStart(uint32_t aPos) const {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].IsClusterStart();
}
bool IsLigatureGroupStart(uint32_t aPos) {
bool IsLigatureGroupStart(uint32_t aPos) const {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].IsLigatureGroupStart();
}
bool CanBreakLineBefore(uint32_t aPos) {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].CanBreakBefore() ==
CompressedGlyph::FLAG_BREAK_TYPE_NORMAL;
bool CanBreakLineBefore(uint32_t aPos) const {
return CanBreakBefore(aPos) == CompressedGlyph::FLAG_BREAK_TYPE_NORMAL;
}
bool CanHyphenateBefore(uint32_t aPos) {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].CanBreakBefore() ==
CompressedGlyph::FLAG_BREAK_TYPE_HYPHEN;
bool CanHyphenateBefore(uint32_t aPos) const {
return CanBreakBefore(aPos) == CompressedGlyph::FLAG_BREAK_TYPE_HYPHEN;
}
bool CharIsSpace(uint32_t aPos) {
// Returns a gfxShapedText::CompressedGlyph::FLAG_BREAK_TYPE_* value
// as defined in gfxFont.h (may be NONE, NORMAL or HYPHEN).
uint8_t CanBreakBefore(uint32_t aPos) const {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].CanBreakBefore();
}
bool CharIsSpace(uint32_t aPos) const {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].CharIsSpace();
}
bool CharIsTab(uint32_t aPos) {
bool CharIsTab(uint32_t aPos) const {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].CharIsTab();
}
bool CharIsNewline(uint32_t aPos) {
bool CharIsNewline(uint32_t aPos) const {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].CharIsNewline();
}
bool CharIsLowSurrogate(uint32_t aPos) {
bool CharIsLowSurrogate(uint32_t aPos) const {
NS_ASSERTION(aPos < GetLength(), "aPos out of range");
return mCharacterGlyphs[aPos].CharIsLowSurrogate();
}

Просмотреть файл

@ -571,8 +571,9 @@ nsCaseTransformTextRunFactory::TransformString(
aCharsToMergeArray.AppendElement(false);
if (aTextRun) {
aStyleArray->AppendElement(charStyle);
aCanBreakBeforeArray->AppendElement(inhibitBreakBefore ? false :
aTextRun->CanBreakLineBefore(i));
aCanBreakBeforeArray->AppendElement(
inhibitBreakBefore ? gfxShapedText::CompressedGlyph::FLAG_BREAK_TYPE_NONE
: aTextRun->CanBreakBefore(i));
}
if (IS_IN_BMP(ch)) {
@ -591,7 +592,8 @@ nsCaseTransformTextRunFactory::TransformString(
aCharsToMergeArray.AppendElement(true);
if (aTextRun) {
aStyleArray->AppendElement(charStyle);
aCanBreakBeforeArray->AppendElement(false);
aCanBreakBeforeArray->AppendElement(
gfxShapedText::CompressedGlyph::FLAG_BREAK_TYPE_NONE);
}
}
}