bug 1034403 - update index to step past the second half of a surrogate pair. r=roc

This commit is contained in:
Jonathan Kew 2014-07-06 12:51:27 +01:00
parent e5c6ba3311
commit 65a2f6fb2d
3 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body style="font-variant: small-caps; font-family: 'Times New Roman';">
<div>x&#xE0131;</div>
</body>
</html>

View File

@ -108,3 +108,4 @@ load 893572-1.html
load 893572-2.html
load 893572-3.html
load 893572-4.html
load 1034403-1.html

View File

@ -5764,6 +5764,9 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext,
uint32_t runStart = 0;
for (uint32_t i = 0; i <= aLength; ++i) {
uint32_t extraCodeUnits = 0; // Will be set to 1 if we need to consume
// a trailing surrogate as well as the
// current code unit.
RunCaseAction chAction = kNoChange;
// Unless we're at the end, figure out what treatment the current
// character will need.
@ -5772,6 +5775,7 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext,
if (NS_IS_HIGH_SURROGATE(ch) && i < aLength - 1 &&
NS_IS_LOW_SURROGATE(aText[i + 1])) {
ch = SURROGATE_TO_UCS4(ch, aText[i + 1]);
extraCodeUnits = 1;
}
// Characters that aren't the start of a cluster are ignored here.
// They get added to whatever lowercase/non-lowercase run we're in.
@ -5885,6 +5889,7 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext,
runStart = i;
}
i += extraCodeUnits;
if (i < aLength) {
runAction = chAction;
}