Caret not displayed in empty right-aligned text input fields. Bug 105397, r=kin, sr=sfraser.
git-svn-id: svn://10.0.0.236/trunk@136041 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
572842e45b
commit
d822833720
@ -1049,15 +1049,39 @@ void nsCaret::DrawCaret()
|
||||
// erased properly if the frame's right edge gets
|
||||
// invalidated.
|
||||
|
||||
nscoord cX = caretRect.x + caretRect.width;
|
||||
nscoord fX = frameRect.x + frameRect.width;
|
||||
nscoord caretXMost = caretRect.XMost();
|
||||
nscoord frameXMost = frameRect.XMost();
|
||||
|
||||
if (caretRect.x <= fX && cX > fX)
|
||||
if (caretRect.x <= frameXMost && caretXMost > frameXMost)
|
||||
{
|
||||
caretRect.x -= cX - fX;
|
||||
caretRect.x -= caretXMost - frameXMost;
|
||||
|
||||
if (caretRect.x < frameRect.x)
|
||||
caretRect.x = frameRect.x;
|
||||
const nsStyleVisibility* vis;
|
||||
const nsStyleText* textStyle;
|
||||
mLastCaretFrame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle);
|
||||
mLastCaretFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
|
||||
|
||||
if ((vis->mDirection == NS_STYLE_DIRECTION_LTR &&
|
||||
textStyle->mTextAlign == NS_STYLE_TEXT_ALIGN_RIGHT) ||
|
||||
(vis->mDirection == NS_STYLE_DIRECTION_RTL &&
|
||||
textStyle->mTextAlign == NS_STYLE_TEXT_ALIGN_DEFAULT))
|
||||
{
|
||||
// If the frame is aligned right, stick the caret to the left
|
||||
// edge of the frame.
|
||||
if (caretRect.XMost() >= frameXMost)
|
||||
{
|
||||
caretRect.x = frameXMost - caretRect.width - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the frame is aligned left, stick the caret to the right
|
||||
// edge of the frame.
|
||||
if (caretRect.x < frameRect.x)
|
||||
{
|
||||
caretRect.x = frameRect.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mCaretRect.IntersectRect(clipRect, caretRect);
|
||||
|
||||
@ -1049,15 +1049,39 @@ void nsCaret::DrawCaret()
|
||||
// erased properly if the frame's right edge gets
|
||||
// invalidated.
|
||||
|
||||
nscoord cX = caretRect.x + caretRect.width;
|
||||
nscoord fX = frameRect.x + frameRect.width;
|
||||
nscoord caretXMost = caretRect.XMost();
|
||||
nscoord frameXMost = frameRect.XMost();
|
||||
|
||||
if (caretRect.x <= fX && cX > fX)
|
||||
if (caretRect.x <= frameXMost && caretXMost > frameXMost)
|
||||
{
|
||||
caretRect.x -= cX - fX;
|
||||
caretRect.x -= caretXMost - frameXMost;
|
||||
|
||||
if (caretRect.x < frameRect.x)
|
||||
caretRect.x = frameRect.x;
|
||||
const nsStyleVisibility* vis;
|
||||
const nsStyleText* textStyle;
|
||||
mLastCaretFrame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textStyle);
|
||||
mLastCaretFrame->GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)vis);
|
||||
|
||||
if ((vis->mDirection == NS_STYLE_DIRECTION_LTR &&
|
||||
textStyle->mTextAlign == NS_STYLE_TEXT_ALIGN_RIGHT) ||
|
||||
(vis->mDirection == NS_STYLE_DIRECTION_RTL &&
|
||||
textStyle->mTextAlign == NS_STYLE_TEXT_ALIGN_DEFAULT))
|
||||
{
|
||||
// If the frame is aligned right, stick the caret to the left
|
||||
// edge of the frame.
|
||||
if (caretRect.XMost() >= frameXMost)
|
||||
{
|
||||
caretRect.x = frameXMost - caretRect.width - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the frame is aligned left, stick the caret to the right
|
||||
// edge of the frame.
|
||||
if (caretRect.x < frameRect.x)
|
||||
{
|
||||
caretRect.x = frameRect.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mCaretRect.IntersectRect(clipRect, caretRect);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user