diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 8d4b2469c2c..65ab958103d 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -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 widget; + view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget)); nsCOMPtr ppContext = do_QueryInterface(aPresContext); - if (ppContext && widget != nsnull) { + if (ppContext && widget) { view->CreateWidget(kCChildCID); } } diff --git a/layout/generic/nsPageFrame.h b/layout/generic/nsPageFrame.h index 2a5d22da052..7d1d4aa26bb 100644 --- a/layout/generic/nsPageFrame.h +++ b/layout/generic/nsPageFrame.h @@ -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, diff --git a/layout/generic/nsSimplePageSequence.cpp b/layout/generic/nsSimplePageSequence.cpp index 8998a91ee54..1f250faa4e1 100644 --- a/layout/generic/nsSimplePageSequence.cpp +++ b/layout/generic/nsSimplePageSequence.cpp @@ -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; diff --git a/layout/html/base/src/nsPageFrame.cpp b/layout/html/base/src/nsPageFrame.cpp index 8d4b2469c2c..65ab958103d 100644 --- a/layout/html/base/src/nsPageFrame.cpp +++ b/layout/html/base/src/nsPageFrame.cpp @@ -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 widget; + view->GetOffsetFromWidget(&dx, &dy, *getter_AddRefs(widget)); nsCOMPtr ppContext = do_QueryInterface(aPresContext); - if (ppContext && widget != nsnull) { + if (ppContext && widget) { view->CreateWidget(kCChildCID); } } diff --git a/layout/html/base/src/nsPageFrame.h b/layout/html/base/src/nsPageFrame.h index 2a5d22da052..7d1d4aa26bb 100644 --- a/layout/html/base/src/nsPageFrame.h +++ b/layout/html/base/src/nsPageFrame.h @@ -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, diff --git a/layout/html/base/src/nsSimplePageSequence.cpp b/layout/html/base/src/nsSimplePageSequence.cpp index 8998a91ee54..1f250faa4e1 100644 --- a/layout/html/base/src/nsSimplePageSequence.cpp +++ b/layout/html/base/src/nsSimplePageSequence.cpp @@ -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;