Bug 1048752. Part 23: Remove aIgnoreDrawnState from MustDrawCaret. r=tn

--HG--
extra : rebase_source : 20e724ce09deec3987437838ac9f05e84ddbe2fd
This commit is contained in:
Robert O'Callahan 2014-08-06 17:19:28 +12:00
Родитель 39217b370a
Коммит 7de632d807
2 изменённых файлов: 9 добавлений и 14 удалений

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

@ -277,7 +277,7 @@ void nsCaret::SetCaretVisible(bool inMakeVisible)
nsresult nsCaret::GetCaretVisible(bool *outMakeVisible) nsresult nsCaret::GetCaretVisible(bool *outMakeVisible)
{ {
NS_ENSURE_ARG_POINTER(outMakeVisible); NS_ENSURE_ARG_POINTER(outMakeVisible);
*outMakeVisible = (mVisible && MustDrawCaret(true)); *outMakeVisible = (mVisible && MustDrawCaret());
return NS_OK; return NS_OK;
} }
@ -893,13 +893,13 @@ nsCaret::CheckCaretDrawingState()
{ {
if (mDrawn) { if (mDrawn) {
// The caret is drawn; if it shouldn't be, erase it. // The caret is drawn; if it shouldn't be, erase it.
if (!mVisible || !MustDrawCaret(true)) if (!mVisible || !MustDrawCaret())
EraseCaret(); EraseCaret();
} }
else else
{ {
// The caret is not drawn; if it should be, draw it. // The caret is not drawn; if it should be, draw it.
if (mPendingDraw && (mVisible && MustDrawCaret(true))) if (mPendingDraw && (mVisible && MustDrawCaret()))
DrawCaret(true); DrawCaret(true);
} }
} }
@ -935,11 +935,8 @@ size_t nsCaret::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
(see IsMenuPopupHidingCaret()). (see IsMenuPopupHidingCaret()).
----------------------------------------------------------------------------- */ ----------------------------------------------------------------------------- */
bool nsCaret::MustDrawCaret(bool aIgnoreDrawnState) bool nsCaret::MustDrawCaret()
{ {
if (!aIgnoreDrawnState && mDrawn)
return true;
nsCOMPtr<nsISelection> domSelection = do_QueryReferent(mDomSelectionWeak); nsCOMPtr<nsISelection> domSelection = do_QueryReferent(mDomSelectionWeak);
if (!domSelection) if (!domSelection)
return false; return false;
@ -1009,7 +1006,7 @@ bool nsCaret::IsMenuPopupHidingCaret()
void nsCaret::DrawCaret(bool aInvalidate) void nsCaret::DrawCaret(bool aInvalidate)
{ {
// Do we need to draw the caret at all? // Do we need to draw the caret at all?
if (!MustDrawCaret(false)) if (!mDrawn && !MustDrawCaret())
return; return;
// Can we draw the caret now? // Can we draw the caret now?

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

@ -188,12 +188,10 @@ protected:
nsRect* aRect, nsRect* aRect,
nscoord* aBidiIndicatorSize); nscoord* aBidiIndicatorSize);
// Returns true if the caret should be drawn. When |mDrawn| is true, // Returns true if the caret should be drawn. We don't take into account
// this returns true, so that we erase the drawn caret. If |aIgnoreDrawnState| // whether the caret is currently drawn or not. This can be used to
// is true, we don't take into account whether the caret is currently // determine if the caret is drawn when it shouldn't be.
// drawn or not. This can be used to determine if the caret is drawn when bool MustDrawCaret();
// it shouldn't be.
bool MustDrawCaret(bool aIgnoreDrawnState);
void DrawCaret(bool aInvalidate); void DrawCaret(bool aInvalidate);
void DrawCaretAfterBriefDelay(); void DrawCaretAfterBriefDelay();