Caret drawn at incorrect position after typing a single LTR character in a blank RTL input field (or vice versa) while caret is visible. b=307533 r=uriber sr=bzbarsky
git-svn-id: svn://10.0.0.236/trunk@179957 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -100,6 +100,7 @@ nsCaret::nsCaret()
|
||||
, mLastContentOffset(0)
|
||||
, mLastHint(nsIFrameSelection::HINTLEFT)
|
||||
#ifdef IBMBIDI
|
||||
, mLastBidiLevel(0)
|
||||
, mKeyboardRTL(PR_FALSE)
|
||||
#endif
|
||||
{
|
||||
@@ -534,22 +535,27 @@ nsCaret::DrawAtPositionWithHint(nsIDOMNode* aNode,
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
if (presContext && presContext->BidiEnabled())
|
||||
{
|
||||
presShell->GetCaretBidiLevel(&bidiLevel);
|
||||
if (bidiLevel & BIDI_LEVEL_UNDEFINED)
|
||||
{
|
||||
PRUint8 newBidiLevel;
|
||||
bidiLevel &= ~BIDI_LEVEL_UNDEFINED;
|
||||
// There has been a reflow, so we reset the cursor Bidi level to the level of the current frame
|
||||
if (!presContext) // Use the style default or default to 0
|
||||
if (mDrawn) {
|
||||
bidiLevel = mLastBidiLevel;
|
||||
} else {
|
||||
presShell->GetCaretBidiLevel(&bidiLevel);
|
||||
if (bidiLevel & BIDI_LEVEL_UNDEFINED)
|
||||
{
|
||||
newBidiLevel = theFrame->GetStyleVisibility()->mDirection;
|
||||
}
|
||||
else
|
||||
{
|
||||
newBidiLevel = NS_GET_EMBEDDING_LEVEL(theFrame);
|
||||
presShell->SetCaretBidiLevel(newBidiLevel);
|
||||
bidiLevel = newBidiLevel;
|
||||
PRUint8 newBidiLevel;
|
||||
bidiLevel &= ~BIDI_LEVEL_UNDEFINED;
|
||||
// There has been a reflow, so we reset the cursor Bidi level to the level of the current frame
|
||||
if (!presContext) // Use the style default or default to 0
|
||||
{
|
||||
newBidiLevel = theFrame->GetStyleVisibility()->mDirection;
|
||||
}
|
||||
else
|
||||
{
|
||||
newBidiLevel = NS_GET_EMBEDDING_LEVEL(theFrame);
|
||||
presShell->SetCaretBidiLevel(newBidiLevel);
|
||||
bidiLevel = newBidiLevel;
|
||||
}
|
||||
}
|
||||
mLastBidiLevel = bidiLevel;
|
||||
}
|
||||
|
||||
PRInt32 start;
|
||||
|
||||
@@ -121,10 +121,11 @@ protected:
|
||||
nsCOMPtr<nsIContent> mLastContent; // store the content the caret was last requested to be drawn in (by DrawAtPosition()/DrawCaret()),
|
||||
// note that this can be different than where it was actually drawn (anon <BR> in text control)
|
||||
PRInt32 mLastContentOffset; // the offset for the last request
|
||||
nsIFrameSelection::HINT mLastHint; // the hint associated with the last request
|
||||
nsIFrameSelection::HINT mLastHint; // the hint associated with the last request, see also mLastBidiLevel below
|
||||
#ifdef IBMBIDI
|
||||
nsRect mHookRect; // directional hook on the caret
|
||||
nsCOMPtr<nsIBidiKeyboard> mBidiKeyboard; // Bidi keyboard object to set and query keyboard language
|
||||
PRUint8 mLastBidiLevel; // saved bidi level of the last draw request, to use when we erase
|
||||
PRPackedBool mKeyboardRTL; // is the keyboard language right-to-left
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user