fix bug 18398. Make sure the startOffset and textWidth get reset in the while loop

This commit is contained in:
ftang%netscape.com 1999-11-30 22:16:12 +00:00
parent 37a95b7bc6
commit 6773500b62
2 changed files with 16 additions and 14 deletions

View File

@ -1099,13 +1099,14 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
if (aDetails){
nsRect rect;
GetRect(rect);
PRInt32 startOffset = 0;
PRInt32 textWidth = 0;
while(aDetails){
const nscoord* sp= aSpacing;
PRInt32 startOffset = 0;
PRInt32 textWidth = 0;
PRInt32 start = PR_MAX(0,(aDetails->mStart - (PRInt32)aIndex));
PRInt32 end = PR_MIN((PRInt32)aLength,(aDetails->mEnd - (PRInt32)aIndex));
PRInt32 i;
if (start < end && (aLength - start) > 0)
if ((start < end) && ((aLength - start) > 0))
{
//aDetails allready processed to have offsets from frame start not content offsets
if (start < end){
@ -1113,18 +1114,18 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
textWidth = aWidth;
else {
if (aDetails->mStart > 0){
if (aSpacing)
if (sp)
{
for (i = 0; i < start;i ++){
startOffset += *aSpacing ++;
startOffset += *sp ++;
}
}
else
aRenderingContext.GetWidth(aText, start, startOffset);
}
if (aSpacing){
if (sp){
for (i = start; i < end;i ++){
textWidth += *aSpacing ++;
textWidth += *sp ++;
}
}
else

View File

@ -1099,13 +1099,14 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
if (aDetails){
nsRect rect;
GetRect(rect);
PRInt32 startOffset = 0;
PRInt32 textWidth = 0;
while(aDetails){
const nscoord* sp= aSpacing;
PRInt32 startOffset = 0;
PRInt32 textWidth = 0;
PRInt32 start = PR_MAX(0,(aDetails->mStart - (PRInt32)aIndex));
PRInt32 end = PR_MIN((PRInt32)aLength,(aDetails->mEnd - (PRInt32)aIndex));
PRInt32 i;
if (start < end && (aLength - start) > 0)
if ((start < end) && ((aLength - start) > 0))
{
//aDetails allready processed to have offsets from frame start not content offsets
if (start < end){
@ -1113,18 +1114,18 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
textWidth = aWidth;
else {
if (aDetails->mStart > 0){
if (aSpacing)
if (sp)
{
for (i = 0; i < start;i ++){
startOffset += *aSpacing ++;
startOffset += *sp ++;
}
}
else
aRenderingContext.GetWidth(aText, start, startOffset);
}
if (aSpacing){
if (sp){
for (i = start; i < end;i ++){
textWidth += *aSpacing ++;
textWidth += *sp ++;
}
}
else