From 408d1057ca36e3d2abe206e54eafdddafdf314c5 Mon Sep 17 00:00:00 2001 From: "anthonyd%netscape.com" Date: Wed, 13 Sep 2000 00:05:29 +0000 Subject: [PATCH] bug fix for mjudges bug #45387 r=anthonyd --- content/base/src/nsSelection.cpp | 13 +++++++------ layout/base/nsCSSFrameConstructor.cpp | 4 ++++ layout/base/src/nsSelection.cpp | 13 +++++++------ layout/generic/nsSelection.cpp | 13 +++++++------ layout/html/style/src/nsCSSFrameConstructor.cpp | 4 ++++ 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/content/base/src/nsSelection.cpp b/content/base/src/nsSelection.cpp index 3bb2d445bef2..05e00ef67845 100644 --- a/content/base/src/nsSelection.cpp +++ b/content/base/src/nsSelection.cpp @@ -3694,12 +3694,13 @@ nsDOMSelection::selectFrames(nsIPresContext* aPresContext, while (NS_ENUMERATOR_FALSE == aInnerIter->IsDone()) { result = aInnerIter->CurrentNode(getter_AddRefs(innercontent)); - if (NS_FAILED(result) || !innercontent) - continue; - result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); - if (NS_SUCCEEDED(result) && frame) - //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame - frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + if (NS_SUCCEEDED(result) && innercontent) + { + result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); + if (NS_SUCCEEDED(result) && frame) + //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame + frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + } result = aInnerIter->Next(); if (NS_FAILED(result)) return result; diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index e6deca7c92d5..58b83734dbc2 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1187,6 +1187,10 @@ NS_NewGeneratedContentIterator(nsIPresContext* aPresContext, if (!aIterator) { return NS_ERROR_NULL_POINTER; } + NS_ENSURE_ARG_POINTER(aFrame); + if (!aFrame) { + return NS_ERROR_NULL_POINTER; + } // Make sure the frame corresponds to generated content #ifdef DEBUG diff --git a/layout/base/src/nsSelection.cpp b/layout/base/src/nsSelection.cpp index 3bb2d445bef2..05e00ef67845 100644 --- a/layout/base/src/nsSelection.cpp +++ b/layout/base/src/nsSelection.cpp @@ -3694,12 +3694,13 @@ nsDOMSelection::selectFrames(nsIPresContext* aPresContext, while (NS_ENUMERATOR_FALSE == aInnerIter->IsDone()) { result = aInnerIter->CurrentNode(getter_AddRefs(innercontent)); - if (NS_FAILED(result) || !innercontent) - continue; - result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); - if (NS_SUCCEEDED(result) && frame) - //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame - frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + if (NS_SUCCEEDED(result) && innercontent) + { + result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); + if (NS_SUCCEEDED(result) && frame) + //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame + frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + } result = aInnerIter->Next(); if (NS_FAILED(result)) return result; diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 3bb2d445bef2..05e00ef67845 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -3694,12 +3694,13 @@ nsDOMSelection::selectFrames(nsIPresContext* aPresContext, while (NS_ENUMERATOR_FALSE == aInnerIter->IsDone()) { result = aInnerIter->CurrentNode(getter_AddRefs(innercontent)); - if (NS_FAILED(result) || !innercontent) - continue; - result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); - if (NS_SUCCEEDED(result) && frame) - //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame - frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + if (NS_SUCCEEDED(result) && innercontent) + { + result = mFrameSelection->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); + if (NS_SUCCEEDED(result) && frame) + //NOTE: aRange and eSpreadDown are now IGNORED. Selected state is set only for given frame + frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + } result = aInnerIter->Next(); if (NS_FAILED(result)) return result; diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index e6deca7c92d5..58b83734dbc2 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -1187,6 +1187,10 @@ NS_NewGeneratedContentIterator(nsIPresContext* aPresContext, if (!aIterator) { return NS_ERROR_NULL_POINTER; } + NS_ENSURE_ARG_POINTER(aFrame); + if (!aFrame) { + return NS_ERROR_NULL_POINTER; + } // Make sure the frame corresponds to generated content #ifdef DEBUG