mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
bug 941940 - don't render stray <CR> characters ( entities) in the DOM as hexboxes, just leave them invisible. r=roc
This commit is contained in:
parent
8534fcb01d
commit
edffd828e9
@ -3311,6 +3311,17 @@ gfxFont::ShapeFragmentWithoutWordCache(gfxContext *aContext,
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Check if aCh is an unhandled control character that should be displayed
|
||||
// as a hexbox rather than rendered by some random font on the system.
|
||||
// We exclude \r as stray s are rather common (bug 941940).
|
||||
// Note that \n and \t don't come through here, as they have specific
|
||||
// meanings that have already been handled.
|
||||
static bool
|
||||
IsInvalidControlChar(uint32_t aCh)
|
||||
{
|
||||
return aCh != '\r' && ((aCh & 0x7f) < 0x20 || aCh == 0x7f);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool
|
||||
gfxFont::ShapeTextWithoutWordCache(gfxContext *aContext,
|
||||
@ -3350,7 +3361,7 @@ gfxFont::ShapeTextWithoutWordCache(gfxContext *aContext,
|
||||
aTextRun->SetIsTab(aOffset + i);
|
||||
} else if (ch == '\n') {
|
||||
aTextRun->SetIsNewline(aOffset + i);
|
||||
} else if ((ch & 0x7f) < 0x20 || ch == 0x7f) {
|
||||
} else if (IsInvalidControlChar(ch)) {
|
||||
aTextRun->SetMissingGlyph(aOffset + i, ch, this);
|
||||
}
|
||||
fragStart = i + 1;
|
||||
@ -3494,7 +3505,7 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext,
|
||||
aTextRun->SetIsTab(aRunStart + i);
|
||||
} else if (ch == '\n') {
|
||||
aTextRun->SetIsNewline(aRunStart + i);
|
||||
} else if ((ch & 0x7f) < 0x20 || ch == 0x7f) {
|
||||
} else if (IsInvalidControlChar(ch)) {
|
||||
aTextRun->SetMissingGlyph(aRunStart + i, ch, this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user