From 8ceacf042edc586dd4de89c843424af88efd55f8 Mon Sep 17 00:00:00 2001 From: "uriber%gmail.com" Date: Fri, 4 Aug 2006 05:40:57 +0000 Subject: [PATCH] Handle returning nulls from CheckLineOrder correctly. bug=345616 r=smotagu sr=roc --- layout/generic/nsFrame.cpp | 16 ++++++++++------ layout/generic/nsLineBox.cpp | 2 ++ layout/tables/nsTableRowGroupFrame.cpp | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 61818eebef6..65828bbfc2b 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4491,14 +4491,18 @@ nsFrame::GetFrameFromDirection(nsPresContext* aPresContext, nsPeekOffsetStruct * PRBool isReordered; result = it->CheckLineOrder(thisLine, &isReordered, &firstFrame, &lastFrame); nsIFrame** framePtr = aPos->mDirection == eDirPrevious ? &firstFrame : &lastFrame; - nsBidiLevel embeddingLevel = nsBidiPresUtils::GetFrameEmbeddingLevel(*framePtr); - if (((embeddingLevel & 1) && lineIsRTL || !(embeddingLevel & 1) && !lineIsRTL) == - (aPos->mDirection == eDirPrevious)) { - GetFirstLeaf(aPresContext, framePtr); + if (*framePtr) { + nsBidiLevel embeddingLevel = nsBidiPresUtils::GetFrameEmbeddingLevel(*framePtr); + if (((embeddingLevel & 1) && lineIsRTL || !(embeddingLevel & 1) && !lineIsRTL) == + (aPos->mDirection == eDirPrevious)) { + GetFirstLeaf(aPresContext, framePtr); + } else { + GetLastLeaf(aPresContext, framePtr); + } + atLineEdge = *framePtr == traversedFrame; } else { - GetLastLeaf(aPresContext, framePtr); + atLineEdge = PR_TRUE; } - atLineEdge = *framePtr == traversedFrame; } else #endif { diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp index b2753bf098f..731dacd3498 100644 --- a/layout/generic/nsLineBox.cpp +++ b/layout/generic/nsLineBox.cpp @@ -741,6 +741,8 @@ nsLineIterator::CheckLineOrder(PRInt32 aLine, if (!line->mFirstChild) { // empty line *aIsReordered = PR_FALSE; + *aFirstVisual = nsnull; + *aLastVisual = nsnull; return NS_OK; } diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 11e499b10ed..374f292ee67 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1946,6 +1946,8 @@ nsTableRowGroupFrame::CheckLineOrder(PRInt32 aLine, nsIFrame **aLastVisual) { *aIsReordered = PR_FALSE; + *aFirstVisual = nsnull; + *aLastVisual = nsnull; return NS_OK; } #endif // IBMBIDI