From 6ffc96481fa7947a07909ff3f8013ae86f8637f4 Mon Sep 17 00:00:00 2001 From: "ftang%netscape.com" Date: Wed, 16 May 2001 12:18:19 +0000 Subject: [PATCH] fix 76003. fix bidi rendering context state corrupting check in for simon@softel.co.il r=dbaron@fas.harvard.edu sr=kin@netscape.com --- layout/base/nsCaret.cpp | 12 ++++++++++++ layout/base/src/nsCaret.cpp | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index 17b5879f5160..0df550d981d7 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -1016,12 +1016,24 @@ void nsCaret::DrawCaret() { if (bidiLevel != mKeyboardRTL) { + /* if the caret bidi level and the keyboard language direction are not in + * synch, the keyboard language must have been changed by the + * user, and if the caret is in a boundary condition (between left-to-right and + * right-to-left characters) it may have to change position to + * reflect the location in which the next character typed will + * appear. We will call |SelectionLanguageChange| and exit + * without drawing the caret in the old position. + */ mKeyboardRTL = bidiLevel; nsCOMPtr domSelection = do_QueryReferent(mDomSelectionWeak); if (domSelection) { if (NS_SUCCEEDED(domSelection->SelectionLanguageChange(mKeyboardRTL))) + { + PRBool emptyClip; + mRendContext->PopState(emptyClip); return; + } } } // If keyboard language is RTL, draw the hook on the left; if LTR, to the right diff --git a/layout/base/src/nsCaret.cpp b/layout/base/src/nsCaret.cpp index 17b5879f5160..0df550d981d7 100644 --- a/layout/base/src/nsCaret.cpp +++ b/layout/base/src/nsCaret.cpp @@ -1016,12 +1016,24 @@ void nsCaret::DrawCaret() { if (bidiLevel != mKeyboardRTL) { + /* if the caret bidi level and the keyboard language direction are not in + * synch, the keyboard language must have been changed by the + * user, and if the caret is in a boundary condition (between left-to-right and + * right-to-left characters) it may have to change position to + * reflect the location in which the next character typed will + * appear. We will call |SelectionLanguageChange| and exit + * without drawing the caret in the old position. + */ mKeyboardRTL = bidiLevel; nsCOMPtr domSelection = do_QueryReferent(mDomSelectionWeak); if (domSelection) { if (NS_SUCCEEDED(domSelection->SelectionLanguageChange(mKeyboardRTL))) + { + PRBool emptyClip; + mRendContext->PopState(emptyClip); return; + } } } // If keyboard language is RTL, draw the hook on the left; if LTR, to the right