зеркало из https://github.com/mozilla/gecko-dev.git
Caret not displayed in empty right-aligned text input fields. Bug 105397, r=kin, sr=sfraser.
This commit is contained in:
Родитель
9367f107b6
Коммит
50972ff560
|
@ -1049,16 +1049,40 @@ 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;
|
||||
|
||||
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);
|
||||
#ifdef IBMBIDI
|
||||
|
|
|
@ -1049,16 +1049,40 @@ 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;
|
||||
|
||||
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);
|
||||
#ifdef IBMBIDI
|
||||
|
|
Загрузка…
Ссылка в новой задаче