From 545ba4350fec504a55bd56c2456317460743d703 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Sun, 19 Sep 1999 00:59:38 +0000 Subject: [PATCH] Backed out some changes that aren't needed and were fixed with a change to the frame construction code git-svn-id: svn://10.0.0.236/trunk@48233 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsTextFrame.cpp | 26 ++++++-------------- mozilla/layout/html/base/src/nsTextFrame.cpp | 26 ++++++-------------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 5956c39df0b..3430cf9ad4a 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -929,10 +929,8 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext, { nsCOMPtr doc(getter_AddRefs(GetDocument(aPresContext))); - PRBool displaySelection = PR_FALSE; - NS_ASSERTION(doc, "PaintUnicodeText: PresContext has no document!"); - if (doc) - displaySelection = doc->GetDisplaySelection(); + PRBool displaySelection; + displaySelection = doc->GetDisplaySelection(); // Make enough space to transform PRUnichar wordBufMem[WORD_BUF_SIZE]; @@ -949,8 +947,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext, // Transform text from content into renderable form nsCOMPtr lb; - if (doc) - doc->GetLineBreaker(getter_AddRefs(lb)); + doc->GetLineBreaker(getter_AddRefs(lb)); // nsCOMPtr wb; // doc->GetWordBreaker(getter_AddRefs(wb)); nsTextTransformer tx(wordBufMem, WORD_BUF_SIZE,lb,nsnull); @@ -2107,8 +2104,8 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) PrepareUnicodeText(tx, ip, paintBuf, &textLength); nsIFrame *frameUsed = nsnull; - PRBool keepSearching=PR_FALSE; //if you run out of chars before you hit the end of word, maybe next frame has more text to select? - PRInt32 start=0; + PRBool keepSearching; //if you run out of chars before you hit the end of word, maybe next frame has more text to select? + PRInt32 start; PRBool found = PR_FALSE; PRBool isWhitespace; PRInt32 wordLen, contentLen; @@ -2392,11 +2389,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, // Setup text transformer to transform this frames text content PRUnichar wordBuf[WORD_BUF_SIZE]; nsCOMPtr lb; - NS_ASSERTION(doc, "Reflow: mContent has no document!"); - if (doc) - doc->GetLineBreaker(getter_AddRefs(lb)); - if (doc) - doc->GetLineBreaker(getter_AddRefs(lb)); + doc->GetLineBreaker(getter_AddRefs(lb)); nsTextTransformer tx(wordBuf, WORD_BUF_SIZE,lb,nsnull); nsresult rv = tx.Init(this, mContent, startingOffset); if (NS_OK != rv) { @@ -2424,7 +2417,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, PRInt32 prevColumn = column; mColumn = column; PRBool breakable = lineLayout.LineIsBreakable(); - PRInt32 lastWordLen=0; + PRInt32 lastWordLen; PRUnichar* bp = nsnull; PRBool measureText = PR_TRUE; @@ -3006,10 +2999,7 @@ nsTextFrame::ComputeWordFragmentWidth(nsIPresContext* aPresContext, PRUint32 breakP=0; PRBool needMore=PR_TRUE; - nsresult lres = NS_ERROR_FAILURE; - NS_ASSERTION(aLineBreaker, "ComputeWordFragmentWidth: No line breaker!"); - if (aLineBreaker) - lres = aLineBreaker->Next(aWordBuf, aWordBufLen+wordLen, 0, &breakP, &needMore); + nsresult lres = aLineBreaker->Next(aWordBuf, aWordBufLen+wordLen, 0, &breakP, &needMore); if(NS_SUCCEEDED(lres)) { // when we look at two pieces text together, we might decide to break diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 5956c39df0b..3430cf9ad4a 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -929,10 +929,8 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext, { nsCOMPtr doc(getter_AddRefs(GetDocument(aPresContext))); - PRBool displaySelection = PR_FALSE; - NS_ASSERTION(doc, "PaintUnicodeText: PresContext has no document!"); - if (doc) - displaySelection = doc->GetDisplaySelection(); + PRBool displaySelection; + displaySelection = doc->GetDisplaySelection(); // Make enough space to transform PRUnichar wordBufMem[WORD_BUF_SIZE]; @@ -949,8 +947,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext, // Transform text from content into renderable form nsCOMPtr lb; - if (doc) - doc->GetLineBreaker(getter_AddRefs(lb)); + doc->GetLineBreaker(getter_AddRefs(lb)); // nsCOMPtr wb; // doc->GetWordBreaker(getter_AddRefs(wb)); nsTextTransformer tx(wordBufMem, WORD_BUF_SIZE,lb,nsnull); @@ -2107,8 +2104,8 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) PrepareUnicodeText(tx, ip, paintBuf, &textLength); nsIFrame *frameUsed = nsnull; - PRBool keepSearching=PR_FALSE; //if you run out of chars before you hit the end of word, maybe next frame has more text to select? - PRInt32 start=0; + PRBool keepSearching; //if you run out of chars before you hit the end of word, maybe next frame has more text to select? + PRInt32 start; PRBool found = PR_FALSE; PRBool isWhitespace; PRInt32 wordLen, contentLen; @@ -2392,11 +2389,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, // Setup text transformer to transform this frames text content PRUnichar wordBuf[WORD_BUF_SIZE]; nsCOMPtr lb; - NS_ASSERTION(doc, "Reflow: mContent has no document!"); - if (doc) - doc->GetLineBreaker(getter_AddRefs(lb)); - if (doc) - doc->GetLineBreaker(getter_AddRefs(lb)); + doc->GetLineBreaker(getter_AddRefs(lb)); nsTextTransformer tx(wordBuf, WORD_BUF_SIZE,lb,nsnull); nsresult rv = tx.Init(this, mContent, startingOffset); if (NS_OK != rv) { @@ -2424,7 +2417,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, PRInt32 prevColumn = column; mColumn = column; PRBool breakable = lineLayout.LineIsBreakable(); - PRInt32 lastWordLen=0; + PRInt32 lastWordLen; PRUnichar* bp = nsnull; PRBool measureText = PR_TRUE; @@ -3006,10 +2999,7 @@ nsTextFrame::ComputeWordFragmentWidth(nsIPresContext* aPresContext, PRUint32 breakP=0; PRBool needMore=PR_TRUE; - nsresult lres = NS_ERROR_FAILURE; - NS_ASSERTION(aLineBreaker, "ComputeWordFragmentWidth: No line breaker!"); - if (aLineBreaker) - lres = aLineBreaker->Next(aWordBuf, aWordBufLen+wordLen, 0, &breakP, &needMore); + nsresult lres = aLineBreaker->Next(aWordBuf, aWordBufLen+wordLen, 0, &breakP, &needMore); if(NS_SUCCEEDED(lres)) { // when we look at two pieces text together, we might decide to break