зеркало из https://github.com/mozilla/pjs.git
Bug 607857. If caret is in a frame that needs reflow we can wrongly position the caret rect. r=roc a=blocking-final
This commit is contained in:
Родитель
c7737244d2
Коммит
d9d7267141
|
@ -357,14 +357,17 @@ void nsCaret::SetCaretReadOnly(PRBool inMakeReadonly)
|
||||||
mReadOnly = inMakeReadonly;
|
mReadOnly = inMakeReadonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
nsresult
|
||||||
nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
|
nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
|
||||||
PRInt32 aFrameOffset,
|
PRInt32 aFrameOffset,
|
||||||
nsRect* aRect,
|
nsRect* aRect,
|
||||||
nscoord* aBidiIndicatorSize)
|
nscoord* aBidiIndicatorSize)
|
||||||
{
|
{
|
||||||
nsPoint framePos(0, 0);
|
nsPoint framePos(0, 0);
|
||||||
aFrame->GetPointFromOffset(aFrameOffset, &framePos);
|
nsresult rv = aFrame->GetPointFromOffset(aFrameOffset, &framePos);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
nsIFrame *frame = aFrame->GetContentInsertionFrame();
|
nsIFrame *frame = aFrame->GetContentInsertionFrame();
|
||||||
NS_ASSERTION(frame, "We should not be in the middle of reflow");
|
NS_ASSERTION(frame, "We should not be in the middle of reflow");
|
||||||
nscoord baseline = frame->GetCaretBaseline();
|
nscoord baseline = frame->GetCaretBaseline();
|
||||||
|
@ -401,6 +404,8 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
|
||||||
|
|
||||||
if (aBidiIndicatorSize)
|
if (aBidiIndicatorSize)
|
||||||
*aBidiIndicatorSize = caretMetrics.mBidiIndicatorSize;
|
*aBidiIndicatorSize = caretMetrics.mBidiIndicatorSize;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame* nsCaret::GetGeometry(nsISelection* aSelection, nsRect* aRect,
|
nsIFrame* nsCaret::GetGeometry(nsISelection* aSelection, nsRect* aRect,
|
||||||
|
@ -1089,7 +1094,11 @@ nsCaret::UpdateCaretRects(nsIFrame* aFrame, PRInt32 aFrameOffset)
|
||||||
NS_ASSERTION(aFrame, "Should have a frame here");
|
NS_ASSERTION(aFrame, "Should have a frame here");
|
||||||
|
|
||||||
nscoord bidiIndicatorSize;
|
nscoord bidiIndicatorSize;
|
||||||
GetGeometryForFrame(aFrame, aFrameOffset, &mCaretRect, &bidiIndicatorSize);
|
nsresult rv =
|
||||||
|
GetGeometryForFrame(aFrame, aFrameOffset, &mCaretRect, &bidiIndicatorSize);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// on RTL frames the right edge of mCaretRect must be equal to framePos
|
// on RTL frames the right edge of mCaretRect must be equal to framePos
|
||||||
const nsStyleVisibility* vis = aFrame->GetStyleVisibility();
|
const nsStyleVisibility* vis = aFrame->GetStyleVisibility();
|
||||||
|
|
|
@ -217,10 +217,10 @@ protected:
|
||||||
nscoord mCaretWidth; // full caret width including bidi indicator
|
nscoord mCaretWidth; // full caret width including bidi indicator
|
||||||
};
|
};
|
||||||
Metrics ComputeMetrics(nsIFrame* aFrame, PRInt32 aOffset, nscoord aCaretHeight);
|
Metrics ComputeMetrics(nsIFrame* aFrame, PRInt32 aOffset, nscoord aCaretHeight);
|
||||||
void GetGeometryForFrame(nsIFrame* aFrame,
|
nsresult GetGeometryForFrame(nsIFrame* aFrame,
|
||||||
PRInt32 aFrameOffset,
|
PRInt32 aFrameOffset,
|
||||||
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. When |mDrawn| is true,
|
||||||
// this returns true, so that we erase the drawn caret. If |aIgnoreDrawnState|
|
// this returns true, so that we erase the drawn caret. If |aIgnoreDrawnState|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче