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
parent 2f7b9e111e
commit 4ceb7c15cd
2 changed files with 22 additions and 17 deletions

View File

@@ -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();
}

View File

@@ -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);
}
}
}