Fix to make printing OBJECTs safer bug 73846 a=av sr=waterson

This commit is contained in:
peterlubczynski%netscape.com 2001-03-30 03:07:52 +00:00
Родитель 14a5173f4b
Коммит 6c7b4a707c
2 изменённых файлов: 50 добавлений и 18 удалений

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

@ -64,6 +64,7 @@
#include "nsIDocumentEncoder.h" #include "nsIDocumentEncoder.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsIDOMRange.h" #include "nsIDOMRange.h"
#include "nsIPrintContext.h"
// XXX For temporary paint code // XXX For temporary paint code
#include "nsIStyleContext.h" #include "nsIStyleContext.h"
@ -674,6 +675,13 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
if(child != nsnull) if(child != nsnull)
return HandleImage(aPresContext, aMetrics, aReflowState, aStatus, child); return HandleImage(aPresContext, aMetrics, aReflowState, aStatus, child);
// determine if we are a printcontext
nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);
if (thePrinterContext) {
// we are printing bail for now
return rv;
}
// if mInstance is null, we need to determine what kind of object we are and instantiate ourselves // if mInstance is null, we need to determine what kind of object we are and instantiate ourselves
if(!mInstanceOwner) if(!mInstanceOwner)
{ {
@ -1324,16 +1332,24 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer) nsFramePaintLayer aWhichLayer)
{ {
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); // determine if we are a printcontext
if ((disp != nsnull) && !disp->IsVisibleOrCollapsed()) { nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);
return NS_OK; if (thePrinterContext) {
} // we are printing bail for now
return NS_OK;
}
nsIFrame * child = mFrames.FirstChild();
if (child != NULL) { // This is an image const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if ((disp != nsnull) && !disp->IsVisibleOrCollapsed()) {
return NS_OK; return NS_OK;
} }
nsIFrame * child = mFrames.FirstChild();
if (child != NULL) { // This is an image
nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
return NS_OK;
}
#if defined (XP_MAC) #if defined (XP_MAC)
// delegate all painting to the plugin instance. // delegate all painting to the plugin instance.

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

@ -64,6 +64,7 @@
#include "nsIDocumentEncoder.h" #include "nsIDocumentEncoder.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsIDOMRange.h" #include "nsIDOMRange.h"
#include "nsIPrintContext.h"
// XXX For temporary paint code // XXX For temporary paint code
#include "nsIStyleContext.h" #include "nsIStyleContext.h"
@ -674,6 +675,13 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
if(child != nsnull) if(child != nsnull)
return HandleImage(aPresContext, aMetrics, aReflowState, aStatus, child); return HandleImage(aPresContext, aMetrics, aReflowState, aStatus, child);
// determine if we are a printcontext
nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);
if (thePrinterContext) {
// we are printing bail for now
return rv;
}
// if mInstance is null, we need to determine what kind of object we are and instantiate ourselves // if mInstance is null, we need to determine what kind of object we are and instantiate ourselves
if(!mInstanceOwner) if(!mInstanceOwner)
{ {
@ -1324,16 +1332,24 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsFramePaintLayer aWhichLayer) nsFramePaintLayer aWhichLayer)
{ {
const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display); // determine if we are a printcontext
if ((disp != nsnull) && !disp->IsVisibleOrCollapsed()) { nsCOMPtr<nsIPrintContext> thePrinterContext = do_QueryInterface(aPresContext);
return NS_OK; if (thePrinterContext) {
} // we are printing bail for now
return NS_OK;
}
nsIFrame * child = mFrames.FirstChild();
if (child != NULL) { // This is an image const nsStyleDisplay* disp = (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if ((disp != nsnull) && !disp->IsVisibleOrCollapsed()) {
return NS_OK; return NS_OK;
} }
nsIFrame * child = mFrames.FirstChild();
if (child != NULL) { // This is an image
nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
return NS_OK;
}
#if defined (XP_MAC) #if defined (XP_MAC)
// delegate all painting to the plugin instance. // delegate all painting to the plugin instance.