mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
The problem is that on windows widget can only be positioned to a y coord of
32767. This ends up being about 32 pages. The nsPageFrame's view creates a widget for clipping absolutely positioned content and plugins. This fix will allow a document to have up to 32 pages of clipping after that it stops creating the widget. The down side is that any absolutely positioned content or plugins beyond page 32 will not be clippe din print preview. Also, fixed a leaked widget Bug 127263 r=dcone sr=attinasi a=asa
This commit is contained in:
parent
b04e03e883
commit
25274d642f
@ -95,6 +95,8 @@ static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
||||
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
|
||||
#endif
|
||||
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
PRBool nsPageFrame::mDoCreateWidget = PR_TRUE;
|
||||
|
||||
nsresult
|
||||
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
@ -130,12 +132,12 @@ nsPageFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsIView * view;
|
||||
aChildList->GetView(aPresContext, &view);
|
||||
if (view != nsnull) {
|
||||
if (view != nsnull && mDoCreateWidget) {
|
||||
nscoord dx, dy;
|
||||
nsIWidget* widget;
|
||||
view->GetOffsetFromWidget(&dx, &dy, widget);
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget));
|
||||
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
||||
if (ppContext && widget != nsnull) {
|
||||
if (ppContext && widget) {
|
||||
view->CreateWidget(kCChildCID);
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,10 @@ public:
|
||||
|
||||
virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
|
||||
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
static void SetCreateWidget(PRBool aDoCreateWidget) { mDoCreateWidget = aDoCreateWidget; }
|
||||
static PRBool GetCreateWidget() { return mDoCreateWidget; }
|
||||
|
||||
protected:
|
||||
nsPageFrame();
|
||||
virtual ~nsPageFrame();
|
||||
@ -139,6 +143,9 @@ protected:
|
||||
|
||||
nsSharedPageData* mPD;
|
||||
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
static PRBool mDoCreateWidget;
|
||||
|
||||
private:
|
||||
void DrawBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -391,6 +391,9 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||
// in fact, all we want is the initial reflow
|
||||
y = mRect.height;
|
||||
} else {
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
nsPageFrame::SetCreateWidget(PR_TRUE);
|
||||
|
||||
nsReflowReason reflowReason = aReflowState.reason;
|
||||
|
||||
SetPageSizes(pageSize, margin);
|
||||
@ -435,6 +438,17 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
|
||||
y += kidSize.height;
|
||||
|
||||
// XXX Temporary fix for Bug 127263
|
||||
// This tells the nsPageFrame class to stop creating clipping widgets
|
||||
// once we reach the 32k boundary for positioning
|
||||
if (nsPageFrame::GetCreateWidget()) {
|
||||
float t2p;
|
||||
aPresContext->GetTwipsToPixels(&t2p);
|
||||
nscoord xp = NSTwipsToIntPixels(x, t2p);
|
||||
nscoord yp = NSTwipsToIntPixels(y, t2p);
|
||||
nsPageFrame::SetCreateWidget(xp < 0x8000 && yp < 0x8000);
|
||||
}
|
||||
|
||||
// Leave a slight gap between the pages
|
||||
y += deadSpaceGap;
|
||||
|
||||
|
@ -95,6 +95,8 @@ static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
||||
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
|
||||
#endif
|
||||
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
PRBool nsPageFrame::mDoCreateWidget = PR_TRUE;
|
||||
|
||||
nsresult
|
||||
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
@ -130,12 +132,12 @@ nsPageFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsIView * view;
|
||||
aChildList->GetView(aPresContext, &view);
|
||||
if (view != nsnull) {
|
||||
if (view != nsnull && mDoCreateWidget) {
|
||||
nscoord dx, dy;
|
||||
nsIWidget* widget;
|
||||
view->GetOffsetFromWidget(&dx, &dy, widget);
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget));
|
||||
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
||||
if (ppContext && widget != nsnull) {
|
||||
if (ppContext && widget) {
|
||||
view->CreateWidget(kCChildCID);
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,10 @@ public:
|
||||
|
||||
virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
|
||||
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
static void SetCreateWidget(PRBool aDoCreateWidget) { mDoCreateWidget = aDoCreateWidget; }
|
||||
static PRBool GetCreateWidget() { return mDoCreateWidget; }
|
||||
|
||||
protected:
|
||||
nsPageFrame();
|
||||
virtual ~nsPageFrame();
|
||||
@ -139,6 +143,9 @@ protected:
|
||||
|
||||
nsSharedPageData* mPD;
|
||||
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
static PRBool mDoCreateWidget;
|
||||
|
||||
private:
|
||||
void DrawBackground(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
|
@ -391,6 +391,9 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||
// in fact, all we want is the initial reflow
|
||||
y = mRect.height;
|
||||
} else {
|
||||
// XXX Part of Temporary fix for Bug 127263
|
||||
nsPageFrame::SetCreateWidget(PR_TRUE);
|
||||
|
||||
nsReflowReason reflowReason = aReflowState.reason;
|
||||
|
||||
SetPageSizes(pageSize, margin);
|
||||
@ -435,6 +438,17 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
|
||||
y += kidSize.height;
|
||||
|
||||
// XXX Temporary fix for Bug 127263
|
||||
// This tells the nsPageFrame class to stop creating clipping widgets
|
||||
// once we reach the 32k boundary for positioning
|
||||
if (nsPageFrame::GetCreateWidget()) {
|
||||
float t2p;
|
||||
aPresContext->GetTwipsToPixels(&t2p);
|
||||
nscoord xp = NSTwipsToIntPixels(x, t2p);
|
||||
nscoord yp = NSTwipsToIntPixels(y, t2p);
|
||||
nsPageFrame::SetCreateWidget(xp < 0x8000 && yp < 0x8000);
|
||||
}
|
||||
|
||||
// Leave a slight gap between the pages
|
||||
y += deadSpaceGap;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user