Fix for bug #12195: [DOGFOOD] caret cruft left after a backspace at end of line

Added code to DrawCaretWithContext() that makes sure that the caret
doesn't hang outiside the left edge of a frame.
r=sfraser@netscape.com
This commit is contained in:
kin%netscape.com 1999-10-01 13:16:30 +00:00
Родитель c5e75f9503
Коммит 9f355e8678
2 изменённых файлов: 44 добавлений и 6 удалений

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

@ -575,14 +575,33 @@ void nsCaret::DrawCaretWithContext(nsIRenderingContext* inRendContext)
if (!mDrawn)
{
nsPoint framePos(0, 0);
nsRect caretRect = frameRect;
mLastCaretFrame->GetPointFromOffset(presContext, localRC, mLastContentOffset, &framePos);
frameRect += framePos;
caretRect += framePos;
//printf("Content offset %ld, frame offset %ld\n", focusOffset, framePos.x);
frameRect.width = mCaretWidth;
mCaretRect = frameRect;
caretRect.width = mCaretWidth;
// Avoid view redraw problems by making sure the
// caret doesn't hang outside the right edge of
// the frame. This insures that the caret gets
// erased properly if the frame's right edge gets
// invalidated.
nscoord cX = caretRect.x + caretRect.width;
nscoord fX = frameRect.x + frameRect.width;
if (cX > fX)
{
caretRect.x -= cX - fX;
if (caretRect.x < frameRect.x)
caretRect.x = frameRect.x;
}
mCaretRect = caretRect;
}
/*
if (mReadOnly)

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

@ -575,14 +575,33 @@ void nsCaret::DrawCaretWithContext(nsIRenderingContext* inRendContext)
if (!mDrawn)
{
nsPoint framePos(0, 0);
nsRect caretRect = frameRect;
mLastCaretFrame->GetPointFromOffset(presContext, localRC, mLastContentOffset, &framePos);
frameRect += framePos;
caretRect += framePos;
//printf("Content offset %ld, frame offset %ld\n", focusOffset, framePos.x);
frameRect.width = mCaretWidth;
mCaretRect = frameRect;
caretRect.width = mCaretWidth;
// Avoid view redraw problems by making sure the
// caret doesn't hang outside the right edge of
// the frame. This insures that the caret gets
// erased properly if the frame's right edge gets
// invalidated.
nscoord cX = caretRect.x + caretRect.width;
nscoord fX = frameRect.x + frameRect.width;
if (cX > fX)
{
caretRect.x -= cX - fX;
if (caretRect.x < frameRect.x)
caretRect.x = frameRect.x;
}
mCaretRect = caretRect;
}
/*
if (mReadOnly)