diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index aa9419f8635..1bda957fbf8 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -178,7 +178,6 @@ nsCaret::nsCaret() #endif , mLastContentOffset(0) , mLastHint(nsFrameSelection::HINTLEFT) -, mLastFrameOffset(0) { } @@ -301,7 +300,6 @@ void nsCaret::Terminate() mPresShell = nsnull; mLastContent = nsnull; - mLastFrame = nsnull; } //----------------------------------------------------------------------------- @@ -505,8 +503,8 @@ nsIFrame * nsCaret::GetCaretFrame(PRInt32 *aOffset) if (!mDrawn) return nsnull; - // Recompute the frame that we're supposed to draw in if the cached frame - // is stale (dead). + // Recompute the frame that we're supposed to draw in to guarantee that + // we're not going to try to draw into a stale (dead) frame. PRInt32 offset; nsIFrame *frame = nsnull; nsresult rv = GetCaretFrameForNodeOffset(mLastContent, mLastContentOffset, @@ -742,16 +740,6 @@ nsCaret::GetCaretFrameForNodeOffset(nsIContent* aContentNode, nsIFrame** aReturnFrame, PRInt32* aReturnOffset) { - // Try to see if we can use our cached frame - if (mLastFrame.IsAlive() && - mLastContent == aContentNode && - mLastContentOffset == aOffset && - mLastHint == aFrameHint && - mLastBidiLevel == aBidiLevel) { - *aReturnFrame = mLastFrame; - *aReturnOffset = mLastFrameOffset; - return NS_OK; - } //get frame selection and find out what frame to use... nsCOMPtr presShell = do_QueryReferent(mPresShell); @@ -912,8 +900,6 @@ nsCaret::GetCaretFrameForNodeOffset(nsIContent* aContentNode, } *aReturnFrame = theFrame; *aReturnOffset = theFrameOffset; - mLastFrame = theFrame; - mLastFrameOffset = theFrameOffset; return NS_OK; } diff --git a/layout/base/nsCaret.h b/layout/base/nsCaret.h index 2f43cff5dcb..74346d81986 100644 --- a/layout/base/nsCaret.h +++ b/layout/base/nsCaret.h @@ -293,11 +293,8 @@ protected: // actually drawn (anon
in text control) PRInt32 mLastContentOffset; // the offset for the last request - nsFrameSelection::HINT mLastHint; // the hint associated with the last request, see also - // mLastBidiLevel above - - nsWeakFrame mLastFrame; // the last frame on which the caret has been drawn. - PRInt32 mLastFrameOffset; // the frame offset for the last caret position + nsFrameSelection::HINT mLastHint; // the hint associated with the last request, see also + // mLastBidiLevel below };