зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
7dcdb2dd9c
Коммит
f4dfc5cb1e
|
@ -95,6 +95,8 @@ static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
||||||
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
|
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// XXX Part of Temporary fix for Bug 127263
|
||||||
|
PRBool nsPageFrame::mDoCreateWidget = PR_TRUE;
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||||
|
@ -130,12 +132,12 @@ nsPageFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||||
{
|
{
|
||||||
nsIView * view;
|
nsIView * view;
|
||||||
aChildList->GetView(aPresContext, &view);
|
aChildList->GetView(aPresContext, &view);
|
||||||
if (view != nsnull) {
|
if (view != nsnull && mDoCreateWidget) {
|
||||||
nscoord dx, dy;
|
nscoord dx, dy;
|
||||||
nsIWidget* widget;
|
nsCOMPtr<nsIWidget> widget;
|
||||||
view->GetOffsetFromWidget(&dx, &dy, widget);
|
view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget));
|
||||||
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
||||||
if (ppContext && widget != nsnull) {
|
if (ppContext && widget) {
|
||||||
view->CreateWidget(kCChildCID);
|
view->CreateWidget(kCChildCID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,10 @@ public:
|
||||||
|
|
||||||
virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
|
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:
|
protected:
|
||||||
nsPageFrame();
|
nsPageFrame();
|
||||||
virtual ~nsPageFrame();
|
virtual ~nsPageFrame();
|
||||||
|
@ -139,6 +143,9 @@ protected:
|
||||||
|
|
||||||
nsSharedPageData* mPD;
|
nsSharedPageData* mPD;
|
||||||
|
|
||||||
|
// XXX Part of Temporary fix for Bug 127263
|
||||||
|
static PRBool mDoCreateWidget;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawBackground(nsIPresContext* aPresContext,
|
void DrawBackground(nsIPresContext* aPresContext,
|
||||||
nsIRenderingContext& aRenderingContext,
|
nsIRenderingContext& aRenderingContext,
|
||||||
|
|
|
@ -391,6 +391,9 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
// in fact, all we want is the initial reflow
|
// in fact, all we want is the initial reflow
|
||||||
y = mRect.height;
|
y = mRect.height;
|
||||||
} else {
|
} else {
|
||||||
|
// XXX Part of Temporary fix for Bug 127263
|
||||||
|
nsPageFrame::SetCreateWidget(PR_TRUE);
|
||||||
|
|
||||||
nsReflowReason reflowReason = aReflowState.reason;
|
nsReflowReason reflowReason = aReflowState.reason;
|
||||||
|
|
||||||
SetPageSizes(pageSize, margin);
|
SetPageSizes(pageSize, margin);
|
||||||
|
@ -435,6 +438,17 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
|
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
|
||||||
y += kidSize.height;
|
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
|
// Leave a slight gap between the pages
|
||||||
y += deadSpaceGap;
|
y += deadSpaceGap;
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
||||||
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
|
#define PRINT_DEBUG_MSG5(_msg1, _msg2, _msg3, _msg4, _msg5)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// XXX Part of Temporary fix for Bug 127263
|
||||||
|
PRBool nsPageFrame::mDoCreateWidget = PR_TRUE;
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
NS_NewPageFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||||
|
@ -130,12 +132,12 @@ nsPageFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||||
{
|
{
|
||||||
nsIView * view;
|
nsIView * view;
|
||||||
aChildList->GetView(aPresContext, &view);
|
aChildList->GetView(aPresContext, &view);
|
||||||
if (view != nsnull) {
|
if (view != nsnull && mDoCreateWidget) {
|
||||||
nscoord dx, dy;
|
nscoord dx, dy;
|
||||||
nsIWidget* widget;
|
nsCOMPtr<nsIWidget> widget;
|
||||||
view->GetOffsetFromWidget(&dx, &dy, widget);
|
view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget));
|
||||||
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
nsCOMPtr<nsIPrintPreviewContext> ppContext = do_QueryInterface(aPresContext);
|
||||||
if (ppContext && widget != nsnull) {
|
if (ppContext && widget) {
|
||||||
view->CreateWidget(kCChildCID);
|
view->CreateWidget(kCChildCID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,10 @@ public:
|
||||||
|
|
||||||
virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
|
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:
|
protected:
|
||||||
nsPageFrame();
|
nsPageFrame();
|
||||||
virtual ~nsPageFrame();
|
virtual ~nsPageFrame();
|
||||||
|
@ -139,6 +143,9 @@ protected:
|
||||||
|
|
||||||
nsSharedPageData* mPD;
|
nsSharedPageData* mPD;
|
||||||
|
|
||||||
|
// XXX Part of Temporary fix for Bug 127263
|
||||||
|
static PRBool mDoCreateWidget;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawBackground(nsIPresContext* aPresContext,
|
void DrawBackground(nsIPresContext* aPresContext,
|
||||||
nsIRenderingContext& aRenderingContext,
|
nsIRenderingContext& aRenderingContext,
|
||||||
|
|
|
@ -391,6 +391,9 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
// in fact, all we want is the initial reflow
|
// in fact, all we want is the initial reflow
|
||||||
y = mRect.height;
|
y = mRect.height;
|
||||||
} else {
|
} else {
|
||||||
|
// XXX Part of Temporary fix for Bug 127263
|
||||||
|
nsPageFrame::SetCreateWidget(PR_TRUE);
|
||||||
|
|
||||||
nsReflowReason reflowReason = aReflowState.reason;
|
nsReflowReason reflowReason = aReflowState.reason;
|
||||||
|
|
||||||
SetPageSizes(pageSize, margin);
|
SetPageSizes(pageSize, margin);
|
||||||
|
@ -435,6 +438,17 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
|
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
|
||||||
y += kidSize.height;
|
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
|
// Leave a slight gap between the pages
|
||||||
y += deadSpaceGap;
|
y += deadSpaceGap;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче