diff --git a/content/base/src/nsPrintEngine.cpp b/content/base/src/nsPrintEngine.cpp index fdad55cbf51..f78f53c690d 100644 --- a/content/base/src/nsPrintEngine.cpp +++ b/content/base/src/nsPrintEngine.cpp @@ -3772,20 +3772,22 @@ nsPrintEngine::FindFrameByType(nsIPresContext* aPresContext, /** --------------------------------------------------- * Find by checking frames type */ -static nsresult FindSelectionBounds(nsIPresContext* aPresContext, - nsIRenderingContext& aRC, - nsIFrame * aParentFrame, - nsRect& aRect, - nsIFrame *& aStartFrame, - nsRect& aStartRect, - nsIFrame *& aEndFrame, - nsRect& aEndRect) +nsresult +nsPrintEngine::FindSelectionBoundsWithList(nsIPresContext* aPresContext, + nsIRenderingContext& aRC, + nsIAtom* aList, + nsIFrame * aParentFrame, + nsRect& aRect, + nsIFrame *& aStartFrame, + nsRect& aStartRect, + nsIFrame *& aEndFrame, + nsRect& aEndRect) { NS_ASSERTION(aPresContext, "Pointer is null!"); NS_ASSERTION(aParentFrame, "Pointer is null!"); nsIFrame * child; - aParentFrame->FirstChild(aPresContext, nsnull, &child); + aParentFrame->FirstChild(aPresContext, aList, &child); nsRect rect; aParentFrame->GetRect(rect); aRect.x += rect.x; @@ -3822,6 +3824,33 @@ static nsresult FindSelectionBounds(nsIPresContext* aPresContext, 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 * of the selection and also returns rect for each where diff --git a/content/base/src/nsPrintEngine.h b/content/base/src/nsPrintEngine.h index 3d5357619f6..5b8cd42dc1c 100644 --- a/content/base/src/nsPrintEngine.h +++ b/content/base/src/nsPrintEngine.h @@ -291,6 +291,25 @@ protected: nsIFrame*& aSeqFrame, 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, nsIPresContext* aPresContext, nsIRenderingContext& aRC, @@ -354,4 +373,3 @@ private: #endif #endif /* nsPrintEngine_h___ */ - diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index fdad55cbf51..f78f53c690d 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -3772,20 +3772,22 @@ nsPrintEngine::FindFrameByType(nsIPresContext* aPresContext, /** --------------------------------------------------- * Find by checking frames type */ -static nsresult FindSelectionBounds(nsIPresContext* aPresContext, - nsIRenderingContext& aRC, - nsIFrame * aParentFrame, - nsRect& aRect, - nsIFrame *& aStartFrame, - nsRect& aStartRect, - nsIFrame *& aEndFrame, - nsRect& aEndRect) +nsresult +nsPrintEngine::FindSelectionBoundsWithList(nsIPresContext* aPresContext, + nsIRenderingContext& aRC, + nsIAtom* aList, + nsIFrame * aParentFrame, + nsRect& aRect, + nsIFrame *& aStartFrame, + nsRect& aStartRect, + nsIFrame *& aEndFrame, + nsRect& aEndRect) { NS_ASSERTION(aPresContext, "Pointer is null!"); NS_ASSERTION(aParentFrame, "Pointer is null!"); nsIFrame * child; - aParentFrame->FirstChild(aPresContext, nsnull, &child); + aParentFrame->FirstChild(aPresContext, aList, &child); nsRect rect; aParentFrame->GetRect(rect); aRect.x += rect.x; @@ -3822,6 +3824,33 @@ static nsresult FindSelectionBounds(nsIPresContext* aPresContext, 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 * of the selection and also returns rect for each where diff --git a/layout/printing/nsPrintEngine.h b/layout/printing/nsPrintEngine.h index 3d5357619f6..5b8cd42dc1c 100644 --- a/layout/printing/nsPrintEngine.h +++ b/layout/printing/nsPrintEngine.h @@ -291,6 +291,25 @@ protected: nsIFrame*& aSeqFrame, 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, nsIPresContext* aPresContext, nsIRenderingContext& aRC, @@ -354,4 +373,3 @@ private: #endif #endif /* nsPrintEngine_h___ */ -