From 92ddeb3cb60c28aa42747f677b035e5856a35349 Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Thu, 12 Apr 2001 23:38:32 +0000 Subject: [PATCH] 53151 68396 sr=kin r= kin. removing some ifdefs of dead ender-lite code and fixing a mail news lockup in text traversal git-svn-id: svn://10.0.0.236/trunk@92123 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 8 +--- mozilla/layout/forms/nsFileControlFrame.h | 5 --- mozilla/layout/forms/nsITextControlFrame.h | 25 ----------- mozilla/layout/forms/nsIsIndexFrame.h | 5 --- mozilla/layout/generic/nsFrame.cpp | 43 +++++++++++-------- mozilla/layout/html/base/src/nsFrame.cpp | 43 +++++++++++-------- .../forms/public/nsIGfxTextControlFrame.h | 25 ----------- .../html/forms/public/nsITextControlFrame.h | 25 ----------- .../html/forms/src/nsFileControlFrame.h | 5 --- .../layout/html/forms/src/nsIsIndexFrame.h | 5 --- .../html/style/src/nsCSSFrameConstructor.cpp | 8 +--- 11 files changed, 52 insertions(+), 145 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 75a5b22082b..63aaeb031af 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -82,6 +82,7 @@ #include "nsIXBLBinding.h" #include "nsIElementFactory.h" #include "nsContentCID.h" +#include "nsFormControlHelper.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -107,7 +108,6 @@ static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID); #include "nsInlineFrame.h" #include "nsBlockFrame.h" -#include "nsGfxTextControlFrame.h" #include "nsIScrollableFrame.h" #include "nsIServiceManager.h" @@ -4105,12 +4105,6 @@ nsCSSFrameConstructor::ConstructTextControlFrame(nsIPresShell* aPresShell if (NS_FAILED(rv)) { aNewFrame = nsnull; } - if (aNewFrame) - { -#ifndef ENDER_LITE - ((nsGfxTextControlFrame*)aNewFrame)->SetFrameConstructor(this); -#endif - } } if (!aNewFrame) { diff --git a/mozilla/layout/forms/nsFileControlFrame.h b/mozilla/layout/forms/nsFileControlFrame.h index 73eeb5bf685..418ef1211c4 100644 --- a/mozilla/layout/forms/nsFileControlFrame.h +++ b/mozilla/layout/forms/nsFileControlFrame.h @@ -31,14 +31,9 @@ #include "nsCOMPtr.h" #include "nsIHTMLContent.h" -#ifndef ENDER_LITE -#include "nsGfxTextControlFrame.h" -typedef nsGfxTextControlFrame nsNewFrame; -#else #include "nsGfxTextControlFrame2.h" #include "nsFormControlHelper.h" typedef nsGfxTextControlFrame2 nsNewFrame; -#endif class nsIPresState; class nsFormFrame; diff --git a/mozilla/layout/forms/nsITextControlFrame.h b/mozilla/layout/forms/nsITextControlFrame.h index 8e8506f0734..4bd35dd856c 100644 --- a/mozilla/layout/forms/nsITextControlFrame.h +++ b/mozilla/layout/forms/nsITextControlFrame.h @@ -26,31 +26,6 @@ class nsIEditor; class nsIDocShell; class nsISelectionController; - -#define NS_IGFXTEXTCONTROLFRAME_IID \ -{/* d3ea33ea-9e00-11d3-bccc-0060b0fc76bd*/ \ -0xd3ea33ea, 0x9e00, 0x11d3, \ -{0xbc, 0xcc, 0x0, 0x60, 0xb0, 0xfc, 0x76, 0xbd} } - -class nsIGfxTextControlFrame : public nsISupports -{ -public: - static const nsIID& GetIID() { static nsIID iid = NS_IGFXTEXTCONTROLFRAME_IID; return iid; } - - NS_IMETHOD GetEditor(nsIEditor **aEditor) = 0; - NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) = 0; - NS_IMETHOD SetInnerFocus() = 0; - - NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0; - - NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart) = 0; - NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd) = 0; - - NS_IMETHOD SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd) = 0; - NS_IMETHOD GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd) = 0; - -}; - #define NS_IGFXTEXTCONTROLFRAME2_IID \ {/* A744CFC9-2DA8-416d-A058-ADB1D4B3B534*/ \ 0xa744cfc9, 0x2da8, 0x416d, \ diff --git a/mozilla/layout/forms/nsIsIndexFrame.h b/mozilla/layout/forms/nsIsIndexFrame.h index 30278148b60..297de44bf52 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.h +++ b/mozilla/layout/forms/nsIsIndexFrame.h @@ -30,14 +30,9 @@ #include "nsIUnicodeEncoder.h" #include "nsIDOMKeyListener.h" -#ifndef ENDER_LITE -#include "nsGfxTextControlFrame.h" -typedef nsGfxTextControlFrame nsNewFrame; -#else #include "nsGfxTextControlFrame2.h" #include "nsFormControlHelper.h" typedef nsGfxTextControlFrame2 nsNewFrame; -#endif class nsIPresState; class nsISupportsArray; diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 57bc1d992b0..88504b9f0cd 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -3298,7 +3298,7 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) }break; case eSelectLine : { - nsCOMPtr it; + nsCOMPtr iter; nsIFrame *blockFrame = this; nsIFrame *thisBlock = this; PRInt32 thisLine; @@ -3308,36 +3308,36 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) result = blockFrame->GetParent(&blockFrame); if (NS_FAILED(result) || !blockFrame) //if at line 0 then nothing to do return result; - result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); + result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(iter)); while (NS_FAILED(result) && blockFrame) { thisBlock = blockFrame; result = blockFrame->GetParent(&blockFrame); if (NS_SUCCEEDED(result) && blockFrame){ - result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); + result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(iter)); } } //this block is now one child down from blockframe - if (NS_FAILED(result) || !it || !blockFrame || !thisBlock) + if (NS_FAILED(result) || !iter || !blockFrame || !thisBlock) { return ((result) ? result : NS_ERROR_FAILURE); } - result = it->FindLineContaining(thisBlock, &thisLine); + result = iter->FindLineContaining(thisBlock, &thisLine); if (NS_FAILED(result) || thisLine <0) return result; int edgeCase = 0;//no edge case. this should look at thisLine PRBool doneLooping = PR_FALSE;//tells us when no more block frames hit. //this part will find a frame or a block frame. if its a block frame //it will "drill down" to find a viable frame or it will return an error. + nsIFrame *lastFrame = this; do { - result = GetNextPrevLineFromeBlockFrame(aPresContext, - aPos, - blockFrame, - thisLine, - edgeCase //start from thisLine - ); - if (aPos->mResultFrame == this)//we came back to same spot! keep going + aPos, + blockFrame, + thisLine, + edgeCase //start from thisLine + ); + if (NS_SUCCEEDED(result) && (!aPos->mResultFrame || aPos->mResultFrame == lastFrame))//we came back to same spot! keep going { aPos->mResultFrame = nsnull; if (aPos->mDirection == eDirPrevious) @@ -3345,12 +3345,17 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) else thisLine++; } - else + else //if failure or success with different frame. doneLooping = PR_TRUE; //do not continue with while loop - if (NS_SUCCEEDED(result) && aPos->mResultFrame && blockFrame != aPos->mResultFrame)// make sure block element is not the same as the one we had before. + + lastFrame = aPos->mResultFrame; //set last frame + + if (NS_SUCCEEDED(result) && aPos->mResultFrame + && blockFrame != aPos->mResultFrame)// make sure block element is not the same as the one we had before { - result = aPos->mResultFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); - if (NS_SUCCEEDED(result) && it)//we have struck another block element! + result = aPos->mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator), + getter_AddRefs(iter)); + if (NS_SUCCEEDED(result) && iter)//we've struck another block element! { doneLooping = PR_FALSE; if (aPos->mDirection == eDirPrevious) @@ -3363,10 +3368,12 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) } else + { result = NS_OK;//THIS is to mean that everything is ok to the containing while loop + break; + } } - }while(!doneLooping); - + } while (!doneLooping); } break; } diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 57bc1d992b0..88504b9f0cd 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -3298,7 +3298,7 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) }break; case eSelectLine : { - nsCOMPtr it; + nsCOMPtr iter; nsIFrame *blockFrame = this; nsIFrame *thisBlock = this; PRInt32 thisLine; @@ -3308,36 +3308,36 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) result = blockFrame->GetParent(&blockFrame); if (NS_FAILED(result) || !blockFrame) //if at line 0 then nothing to do return result; - result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); + result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(iter)); while (NS_FAILED(result) && blockFrame) { thisBlock = blockFrame; result = blockFrame->GetParent(&blockFrame); if (NS_SUCCEEDED(result) && blockFrame){ - result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); + result = blockFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(iter)); } } //this block is now one child down from blockframe - if (NS_FAILED(result) || !it || !blockFrame || !thisBlock) + if (NS_FAILED(result) || !iter || !blockFrame || !thisBlock) { return ((result) ? result : NS_ERROR_FAILURE); } - result = it->FindLineContaining(thisBlock, &thisLine); + result = iter->FindLineContaining(thisBlock, &thisLine); if (NS_FAILED(result) || thisLine <0) return result; int edgeCase = 0;//no edge case. this should look at thisLine PRBool doneLooping = PR_FALSE;//tells us when no more block frames hit. //this part will find a frame or a block frame. if its a block frame //it will "drill down" to find a viable frame or it will return an error. + nsIFrame *lastFrame = this; do { - result = GetNextPrevLineFromeBlockFrame(aPresContext, - aPos, - blockFrame, - thisLine, - edgeCase //start from thisLine - ); - if (aPos->mResultFrame == this)//we came back to same spot! keep going + aPos, + blockFrame, + thisLine, + edgeCase //start from thisLine + ); + if (NS_SUCCEEDED(result) && (!aPos->mResultFrame || aPos->mResultFrame == lastFrame))//we came back to same spot! keep going { aPos->mResultFrame = nsnull; if (aPos->mDirection == eDirPrevious) @@ -3345,12 +3345,17 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) else thisLine++; } - else + else //if failure or success with different frame. doneLooping = PR_TRUE; //do not continue with while loop - if (NS_SUCCEEDED(result) && aPos->mResultFrame && blockFrame != aPos->mResultFrame)// make sure block element is not the same as the one we had before. + + lastFrame = aPos->mResultFrame; //set last frame + + if (NS_SUCCEEDED(result) && aPos->mResultFrame + && blockFrame != aPos->mResultFrame)// make sure block element is not the same as the one we had before { - result = aPos->mResultFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(it)); - if (NS_SUCCEEDED(result) && it)//we have struck another block element! + result = aPos->mResultFrame->QueryInterface(NS_GET_IID(nsILineIterator), + getter_AddRefs(iter)); + if (NS_SUCCEEDED(result) && iter)//we've struck another block element! { doneLooping = PR_FALSE; if (aPos->mDirection == eDirPrevious) @@ -3363,10 +3368,12 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) } else + { result = NS_OK;//THIS is to mean that everything is ok to the containing while loop + break; + } } - }while(!doneLooping); - + } while (!doneLooping); } break; } diff --git a/mozilla/layout/html/forms/public/nsIGfxTextControlFrame.h b/mozilla/layout/html/forms/public/nsIGfxTextControlFrame.h index 8e8506f0734..4bd35dd856c 100644 --- a/mozilla/layout/html/forms/public/nsIGfxTextControlFrame.h +++ b/mozilla/layout/html/forms/public/nsIGfxTextControlFrame.h @@ -26,31 +26,6 @@ class nsIEditor; class nsIDocShell; class nsISelectionController; - -#define NS_IGFXTEXTCONTROLFRAME_IID \ -{/* d3ea33ea-9e00-11d3-bccc-0060b0fc76bd*/ \ -0xd3ea33ea, 0x9e00, 0x11d3, \ -{0xbc, 0xcc, 0x0, 0x60, 0xb0, 0xfc, 0x76, 0xbd} } - -class nsIGfxTextControlFrame : public nsISupports -{ -public: - static const nsIID& GetIID() { static nsIID iid = NS_IGFXTEXTCONTROLFRAME_IID; return iid; } - - NS_IMETHOD GetEditor(nsIEditor **aEditor) = 0; - NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) = 0; - NS_IMETHOD SetInnerFocus() = 0; - - NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0; - - NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart) = 0; - NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd) = 0; - - NS_IMETHOD SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd) = 0; - NS_IMETHOD GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd) = 0; - -}; - #define NS_IGFXTEXTCONTROLFRAME2_IID \ {/* A744CFC9-2DA8-416d-A058-ADB1D4B3B534*/ \ 0xa744cfc9, 0x2da8, 0x416d, \ diff --git a/mozilla/layout/html/forms/public/nsITextControlFrame.h b/mozilla/layout/html/forms/public/nsITextControlFrame.h index 8e8506f0734..4bd35dd856c 100644 --- a/mozilla/layout/html/forms/public/nsITextControlFrame.h +++ b/mozilla/layout/html/forms/public/nsITextControlFrame.h @@ -26,31 +26,6 @@ class nsIEditor; class nsIDocShell; class nsISelectionController; - -#define NS_IGFXTEXTCONTROLFRAME_IID \ -{/* d3ea33ea-9e00-11d3-bccc-0060b0fc76bd*/ \ -0xd3ea33ea, 0x9e00, 0x11d3, \ -{0xbc, 0xcc, 0x0, 0x60, 0xb0, 0xfc, 0x76, 0xbd} } - -class nsIGfxTextControlFrame : public nsISupports -{ -public: - static const nsIID& GetIID() { static nsIID iid = NS_IGFXTEXTCONTROLFRAME_IID; return iid; } - - NS_IMETHOD GetEditor(nsIEditor **aEditor) = 0; - NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) = 0; - NS_IMETHOD SetInnerFocus() = 0; - - NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0; - - NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart) = 0; - NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd) = 0; - - NS_IMETHOD SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd) = 0; - NS_IMETHOD GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd) = 0; - -}; - #define NS_IGFXTEXTCONTROLFRAME2_IID \ {/* A744CFC9-2DA8-416d-A058-ADB1D4B3B534*/ \ 0xa744cfc9, 0x2da8, 0x416d, \ diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.h b/mozilla/layout/html/forms/src/nsFileControlFrame.h index 73eeb5bf685..418ef1211c4 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.h @@ -31,14 +31,9 @@ #include "nsCOMPtr.h" #include "nsIHTMLContent.h" -#ifndef ENDER_LITE -#include "nsGfxTextControlFrame.h" -typedef nsGfxTextControlFrame nsNewFrame; -#else #include "nsGfxTextControlFrame2.h" #include "nsFormControlHelper.h" typedef nsGfxTextControlFrame2 nsNewFrame; -#endif class nsIPresState; class nsFormFrame; diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.h b/mozilla/layout/html/forms/src/nsIsIndexFrame.h index 30278148b60..297de44bf52 100644 --- a/mozilla/layout/html/forms/src/nsIsIndexFrame.h +++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.h @@ -30,14 +30,9 @@ #include "nsIUnicodeEncoder.h" #include "nsIDOMKeyListener.h" -#ifndef ENDER_LITE -#include "nsGfxTextControlFrame.h" -typedef nsGfxTextControlFrame nsNewFrame; -#else #include "nsGfxTextControlFrame2.h" #include "nsFormControlHelper.h" typedef nsGfxTextControlFrame2 nsNewFrame; -#endif class nsIPresState; class nsISupportsArray; diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 75a5b22082b..63aaeb031af 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -82,6 +82,7 @@ #include "nsIXBLBinding.h" #include "nsIElementFactory.h" #include "nsContentCID.h" +#include "nsFormControlHelper.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -107,7 +108,6 @@ static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID); #include "nsInlineFrame.h" #include "nsBlockFrame.h" -#include "nsGfxTextControlFrame.h" #include "nsIScrollableFrame.h" #include "nsIServiceManager.h" @@ -4105,12 +4105,6 @@ nsCSSFrameConstructor::ConstructTextControlFrame(nsIPresShell* aPresShell if (NS_FAILED(rv)) { aNewFrame = nsnull; } - if (aNewFrame) - { -#ifndef ENDER_LITE - ((nsGfxTextControlFrame*)aNewFrame)->SetFrameConstructor(this); -#endif - } } if (!aNewFrame) {