The search for the selected frames was not looking in all the child lisst for each frame

Bug 181228 r=dcone sr=jst
This commit is contained in:
rods%netscape.com 2002-11-22 13:02:05 +00:00
Родитель 31f6fe5b14
Коммит 63bf52851b
4 изменённых файлов: 114 добавлений и 20 удалений

Просмотреть файл

@ -3772,20 +3772,22 @@ nsPrintEngine::FindFrameByType(nsIPresContext* aPresContext,
/** --------------------------------------------------- /** ---------------------------------------------------
* Find by checking frames type * Find by checking frames type
*/ */
static nsresult FindSelectionBounds(nsIPresContext* aPresContext, nsresult
nsIRenderingContext& aRC, nsPrintEngine::FindSelectionBoundsWithList(nsIPresContext* aPresContext,
nsIFrame * aParentFrame, nsIRenderingContext& aRC,
nsRect& aRect, nsIAtom* aList,
nsIFrame *& aStartFrame, nsIFrame * aParentFrame,
nsRect& aStartRect, nsRect& aRect,
nsIFrame *& aEndFrame, nsIFrame *& aStartFrame,
nsRect& aEndRect) nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect)
{ {
NS_ASSERTION(aPresContext, "Pointer is null!"); NS_ASSERTION(aPresContext, "Pointer is null!");
NS_ASSERTION(aParentFrame, "Pointer is null!"); NS_ASSERTION(aParentFrame, "Pointer is null!");
nsIFrame * child; nsIFrame * child;
aParentFrame->FirstChild(aPresContext, nsnull, &child); aParentFrame->FirstChild(aPresContext, aList, &child);
nsRect rect; nsRect rect;
aParentFrame->GetRect(rect); aParentFrame->GetRect(rect);
aRect.x += rect.x; aRect.x += rect.x;
@ -3822,6 +3824,33 @@ static nsresult FindSelectionBounds(nsIPresContext* aPresContext,
return NS_OK; return NS_OK;
} }
//-------------------------------------------------------
// Find the Frame that is XMost
nsresult
nsPrintEngine::FindSelectionBounds(nsIPresContext* aPresContext,
nsIRenderingContext& aRC,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect)
{
NS_ASSERTION(aPresContext, "Pointer is null!");
NS_ASSERTION(aParentFrame, "Pointer is null!");
// loop thru named child lists
nsIAtom* childListName = nsnull;
PRInt32 childListIndex = 0;
do {
nsresult rv = FindSelectionBoundsWithList(aPresContext, aRC, childListName, aParentFrame, aRect, aStartFrame, aStartRect, aEndFrame, aEndRect);
NS_IF_RELEASE(childListName);
NS_ENSURE_SUCCESS(rv, rv);
aParentFrame->GetAdditionalChildListName(childListIndex++, &childListName);
} while (childListName);
return NS_OK;
}
/** --------------------------------------------------- /** ---------------------------------------------------
* This method finds the starting and ending page numbers * This method finds the starting and ending page numbers
* of the selection and also returns rect for each where * of the selection and also returns rect for each where

Просмотреть файл

@ -291,6 +291,25 @@ protected:
nsIFrame*& aSeqFrame, nsIFrame*& aSeqFrame,
PRInt32& aCount); PRInt32& aCount);
static nsresult FindSelectionBoundsWithList(nsIPresContext* aPresContext,
nsIRenderingContext& aRC,
nsIAtom* aList,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect);
static nsresult FindSelectionBounds(nsIPresContext* aPresContext,
nsIRenderingContext& aRC,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect);
static nsresult GetPageRangeForSelection(nsIPresShell * aPresShell, static nsresult GetPageRangeForSelection(nsIPresShell * aPresShell,
nsIPresContext* aPresContext, nsIPresContext* aPresContext,
nsIRenderingContext& aRC, nsIRenderingContext& aRC,
@ -354,4 +373,3 @@ private:
#endif #endif
#endif /* nsPrintEngine_h___ */ #endif /* nsPrintEngine_h___ */

Просмотреть файл

@ -3772,20 +3772,22 @@ nsPrintEngine::FindFrameByType(nsIPresContext* aPresContext,
/** --------------------------------------------------- /** ---------------------------------------------------
* Find by checking frames type * Find by checking frames type
*/ */
static nsresult FindSelectionBounds(nsIPresContext* aPresContext, nsresult
nsIRenderingContext& aRC, nsPrintEngine::FindSelectionBoundsWithList(nsIPresContext* aPresContext,
nsIFrame * aParentFrame, nsIRenderingContext& aRC,
nsRect& aRect, nsIAtom* aList,
nsIFrame *& aStartFrame, nsIFrame * aParentFrame,
nsRect& aStartRect, nsRect& aRect,
nsIFrame *& aEndFrame, nsIFrame *& aStartFrame,
nsRect& aEndRect) nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect)
{ {
NS_ASSERTION(aPresContext, "Pointer is null!"); NS_ASSERTION(aPresContext, "Pointer is null!");
NS_ASSERTION(aParentFrame, "Pointer is null!"); NS_ASSERTION(aParentFrame, "Pointer is null!");
nsIFrame * child; nsIFrame * child;
aParentFrame->FirstChild(aPresContext, nsnull, &child); aParentFrame->FirstChild(aPresContext, aList, &child);
nsRect rect; nsRect rect;
aParentFrame->GetRect(rect); aParentFrame->GetRect(rect);
aRect.x += rect.x; aRect.x += rect.x;
@ -3822,6 +3824,33 @@ static nsresult FindSelectionBounds(nsIPresContext* aPresContext,
return NS_OK; return NS_OK;
} }
//-------------------------------------------------------
// Find the Frame that is XMost
nsresult
nsPrintEngine::FindSelectionBounds(nsIPresContext* aPresContext,
nsIRenderingContext& aRC,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect)
{
NS_ASSERTION(aPresContext, "Pointer is null!");
NS_ASSERTION(aParentFrame, "Pointer is null!");
// loop thru named child lists
nsIAtom* childListName = nsnull;
PRInt32 childListIndex = 0;
do {
nsresult rv = FindSelectionBoundsWithList(aPresContext, aRC, childListName, aParentFrame, aRect, aStartFrame, aStartRect, aEndFrame, aEndRect);
NS_IF_RELEASE(childListName);
NS_ENSURE_SUCCESS(rv, rv);
aParentFrame->GetAdditionalChildListName(childListIndex++, &childListName);
} while (childListName);
return NS_OK;
}
/** --------------------------------------------------- /** ---------------------------------------------------
* This method finds the starting and ending page numbers * This method finds the starting and ending page numbers
* of the selection and also returns rect for each where * of the selection and also returns rect for each where

Просмотреть файл

@ -291,6 +291,25 @@ protected:
nsIFrame*& aSeqFrame, nsIFrame*& aSeqFrame,
PRInt32& aCount); PRInt32& aCount);
static nsresult FindSelectionBoundsWithList(nsIPresContext* aPresContext,
nsIRenderingContext& aRC,
nsIAtom* aList,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect);
static nsresult FindSelectionBounds(nsIPresContext* aPresContext,
nsIRenderingContext& aRC,
nsIFrame * aParentFrame,
nsRect& aRect,
nsIFrame *& aStartFrame,
nsRect& aStartRect,
nsIFrame *& aEndFrame,
nsRect& aEndRect);
static nsresult GetPageRangeForSelection(nsIPresShell * aPresShell, static nsresult GetPageRangeForSelection(nsIPresShell * aPresShell,
nsIPresContext* aPresContext, nsIPresContext* aPresContext,
nsIRenderingContext& aRC, nsIRenderingContext& aRC,
@ -354,4 +373,3 @@ private:
#endif #endif
#endif /* nsPrintEngine_h___ */ #endif /* nsPrintEngine_h___ */