Bug 449076: hang with 100% CPU on keyboard arrow trough text field. r+sr=roc.

This commit is contained in:
Uri Bernstein 2008-10-09 12:22:30 +02:00
Родитель 3481ddfc0c
Коммит 385520e48e
2 изменённых файлов: 13 добавлений и 6 удалений

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

@ -5077,7 +5077,7 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct* aPos)
nsIFrame *blockFrame = this;
while (NS_FAILED(result)){
PRInt32 thisLine = nsFrame::GetLineNumber(blockFrame, &blockFrame);
PRInt32 thisLine = nsFrame::GetLineNumber(blockFrame, aPos->mScrollViewStop, &blockFrame);
if (thisLine < 0)
return NS_ERROR_FAILURE;
result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(iter));
@ -5171,7 +5171,7 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct* aPos)
nsCOMPtr<nsILineIteratorNavigator> it;
// Adjusted so that the caret can't get confused when content changes
nsIFrame* blockFrame = AdjustFrameForSelectionStyles(this);
PRInt32 thisLine = nsFrame::GetLineNumber(blockFrame, &blockFrame);
PRInt32 thisLine = nsFrame::GetLineNumber(blockFrame, aPos->mScrollViewStop, &blockFrame);
if (thisLine < 0)
return NS_ERROR_FAILURE;
result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it));
@ -5336,7 +5336,7 @@ nsFrame::CheckVisibility(nsPresContext* , PRInt32 , PRInt32 , PRBool , PRBool *,
PRInt32
nsFrame::GetLineNumber(nsIFrame *aFrame, nsIFrame** aContainingBlock)
nsFrame::GetLineNumber(nsIFrame *aFrame, PRBool aLockScroll, nsIFrame** aContainingBlock)
{
NS_ASSERTION(aFrame, "null aFrame");
nsFrameManager* frameManager = aFrame->PresContext()->FrameManager();
@ -5362,6 +5362,8 @@ nsFrame::GetLineNumber(nsIFrame *aFrame, nsIFrame** aContainingBlock)
blockFrame = thisBlock->GetParent();
result = NS_OK;
if (blockFrame) {
if (aLockScroll && blockFrame->GetType() == nsGkAtoms::scrollFrame)
return -1;
result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it));
}
}
@ -5396,7 +5398,7 @@ nsIFrame::GetFrameFromDirection(nsDirection aDirection, PRBool aVisual,
nsIFrame *blockFrame;
nsCOMPtr<nsILineIteratorNavigator> it;
PRInt32 thisLine = nsFrame::GetLineNumber(traversedFrame, &blockFrame);
PRInt32 thisLine = nsFrame::GetLineNumber(traversedFrame, aScrollViewStop, &blockFrame);
if (thisLine < 0)
return NS_ERROR_FAILURE;
nsresult result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it));

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

@ -563,8 +563,13 @@ public:
static void GetLastLeaf(nsPresContext* aPresContext, nsIFrame **aFrame);
static void GetFirstLeaf(nsPresContext* aPresContext, nsIFrame **aFrame);
// return the line number of the aFrame, and (optionally) the containing block frame.
static PRInt32 GetLineNumber(nsIFrame *aFrame, nsIFrame** aContainingBlock = nsnull);
// Return the line number of the aFrame, and (optionally) the containing block
// frame.
// If aScrollLock is true, don't break outside scrollframes when looking for a
// containing block frame.
static PRInt32 GetLineNumber(nsIFrame *aFrame,
PRBool aLockScroll,
nsIFrame** aContainingBlock = nsnull);
protected: