From c2682acaa0f286b8f8be5952a3772613e64806fb Mon Sep 17 00:00:00 2001 From: "uriber%gmail.com" Date: Sat, 25 Feb 2006 16:08:05 +0000 Subject: [PATCH] Bug 298690: Caret skips blank line using down-arrow key in preformatted text (e.g. View Source). r+sr+a=roc git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@191241 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsFrame.cpp | 13 +++++-------- mozilla/layout/generic/nsLineBox.cpp | 2 +- mozilla/layout/generic/nsTextFrame.cpp | 11 +++++------ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 68f5846a121..8ffb0e39618 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -3336,14 +3336,11 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext, if (!resultFrame->HasView()) { rect = resultFrame->GetRect(); - if (!rect.width || !rect.height) - result = NS_ERROR_FAILURE; - else - result = resultFrame->GetContentAndOffsetsFromPoint(context,point, - getter_AddRefs(aPos->mResultContent), - aPos->mContentOffset, - aPos->mContentOffsetEnd, - aPos->mPreferLeft); + result = resultFrame->GetContentAndOffsetsFromPoint(context,point, + getter_AddRefs(aPos->mResultContent), + aPos->mContentOffset, + aPos->mContentOffsetEnd, + aPos->mPreferLeft); if (NS_SUCCEEDED(result)) { PRBool selectable; diff --git a/mozilla/layout/generic/nsLineBox.cpp b/mozilla/layout/generic/nsLineBox.cpp index 3f933990a58..04988cdcdb9 100644 --- a/mozilla/layout/generic/nsLineBox.cpp +++ b/mozilla/layout/generic/nsLineBox.cpp @@ -783,7 +783,7 @@ nsLineIterator::FindFrameAt(PRInt32 aLineNumber, return NS_OK; } - if (line->mBounds.width == 0) + if (line->mBounds.width == 0 && line->mBounds.height == 0) return NS_ERROR_FAILURE; nsIFrame* frame = line->mFirstChild; diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 71d600aa68e..5cab2c925dd 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -3880,11 +3880,6 @@ nsTextFrame::GetPosition(nsPresContext* aPresContext, // no need to worry about justification, that's always on the slow path PrepareUnicodeText(tx, &indexBuffer, &paintBuffer, &textLength); - if (textLength <=0) { - //invalid frame to get position on - return NS_ERROR_FAILURE; - } - nsPoint origin; nsIView * view; GetOffsetFromView(origin, &view); @@ -3910,7 +3905,11 @@ nsTextFrame::GetPosition(nsPresContext* aPresContext, } } - if (!outofstylehandled) //then we need to track based on the X coord only + if (textLength <= 0) { + aContentOffset = mContentOffset; + aContentOffsetEnd = aContentOffset; + } + else if (!outofstylehandled) //then we need to track based on the X coord only { //END STYLE IF PRInt32* ip = indexBuffer.mBuffer;