Putting changes back in. This wasn't the cause of the slower page loads

This commit is contained in:
rods%netscape.com 2002-01-03 13:23:47 +00:00
Родитель 69e5a9f10c
Коммит b45789e738
8 изменённых файлов: 47 добавлений и 40 удалений

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

@ -554,13 +554,6 @@ public:
extern NS_EXPORT nsresult
NS_NewGalleyContext(nsIPresContext** aInstancePtrResult);
// Factory method to create a "paginated" presentation context for
// the screen.
extern NS_EXPORT nsresult
NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult);
#ifdef MOZ_REFLOW_PERF
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \

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

@ -178,6 +178,7 @@
static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
// supporting bugs 31816, 20760, 22963
// define USE_OVERRIDE to put prefs in as an override stylesheet
@ -7003,7 +7004,10 @@ PresShell::VerifyIncrementalReflow()
PRBool isPaginated = PR_FALSE;
mPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
rv = NS_NewPrintPreviewContext(&cx);
nsCOMPtr<nsIPrintPreviewContext> ppx = do_CreateInstance(kPrintPreviewContextCID, &rv);
if (NS_SUCCEEDED(rv)) {
ppx->QueryInterface(NS_GET_IID(nsIPresContext),(void**)&cx);
}
}
else {
rv = NS_NewGalleyContext(&cx);

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

@ -554,13 +554,6 @@ public:
extern NS_EXPORT nsresult
NS_NewGalleyContext(nsIPresContext** aInstancePtrResult);
// Factory method to create a "paginated" presentation context for
// the screen.
extern NS_EXPORT nsresult
NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult);
#ifdef MOZ_REFLOW_PERF
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \

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

@ -554,13 +554,6 @@ public:
extern NS_EXPORT nsresult
NS_NewGalleyContext(nsIPresContext** aInstancePtrResult);
// Factory method to create a "paginated" presentation context for
// the screen.
extern NS_EXPORT nsresult
NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult);
#ifdef MOZ_REFLOW_PERF
#define DO_GLOBAL_REFLOW_COUNT(_name, _type) \

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

@ -43,14 +43,9 @@
#include "nsGfxCIID.h"
#include "nsLayoutAtoms.h"
#include "prlog.h"
#include "nsIPrintSettings.h"
// Print Options
#include "nsIPrintOptions.h"
#include "nsGfxCIID.h"
#include "nsIServiceManager.h"
static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID);
class PrintPreviewContext : public nsPresContext {
class PrintPreviewContext : public nsPresContext, nsIPrintPreviewContext {
public:
PrintPreviewContext();
~PrintPreviewContext();
@ -66,10 +61,13 @@ public:
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect);
NS_IMETHOD SetPageDim(nsRect* aRect);
NS_IMETHOD SetPrintSettings(nsIPrintSettings* aPS);
NS_IMETHOD GetPrintSettings(nsIPrintSettings** aPS);
protected:
nsRect mPageDim;
PRBool mCanPaginatedScroll;
nsCOMPtr<nsIPrintSettings> mPrintSettings;
};
PrintPreviewContext::PrintPreviewContext() :
@ -147,8 +145,27 @@ PrintPreviewContext::SetPageDim(nsRect* aPageDim)
return NS_OK;
}
NS_IMETHODIMP
PrintPreviewContext::SetPrintSettings(nsIPrintSettings * aPrintSettings)
{
NS_ENSURE_ARG_POINTER(aPrintSettings);
mPrintSettings = aPrintSettings;
return NS_OK;
}
NS_IMETHODIMP
PrintPreviewContext::GetPrintSettings(nsIPrintSettings * *aPrintSettings)
{
NS_ENSURE_ARG_POINTER(aPrintSettings);
*aPrintSettings = mPrintSettings;
NS_IF_ADDREF(*aPrintSettings);
return NS_OK;
}
NS_EXPORT nsresult
NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult)
NS_NewPrintPreviewContext(nsIPrintPreviewContext** aInstancePtrResult)
{
if (aInstancePtrResult == nsnull) {
return NS_ERROR_NULL_POINTER;
@ -160,5 +177,5 @@ NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult)
return NS_ERROR_OUT_OF_MEMORY;
}
return it->QueryInterface(NS_GET_IID(nsIPresContext), (void **) aInstancePtrResult);
return it->QueryInterface(NS_GET_IID(nsIPrintPreviewContext), (void **) aInstancePtrResult);
}

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

@ -42,6 +42,7 @@
#include "nsIPresShell.h"
#include "nsIPrintContext.h"
#include "nsIPresContext.h"
#include "nsIPrintPreviewContext.h"
#include "nsIStyleSet.h"
#include "nsIDocument.h"
#include "nsHTMLParts.h"
@ -52,9 +53,10 @@ void XXXNeverCalled()
nsIPresShell* ps;
NS_NewPresShell(&ps);
nsIPresContext* cx;
nsIPrintContext *px;
NS_NewGalleyContext(&cx);
NS_NewPrintPreviewContext(&cx);
nsIPrintPreviewContext *ppx;
NS_NewPrintPreviewContext(&ppx);
nsIPrintContext *px;
NS_NewPrintContext(&px);
nsIFrame* f;
NS_NewTextFrame(ps, &f);

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

@ -50,6 +50,7 @@
#include "nsIPresShell.h"
#include "nsIPresState.h"
#include "nsIPrintContext.h"
#include "nsIPrintPreviewContext.h"
#include "nsTextTransformer.h"
#include "nsXBLAtoms.h" // to addref/release table
@ -209,7 +210,6 @@ MAKE_CTOR(CreateNewFrameUtil, nsIFrameUtil, NS_NewFrameUtil)
MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
#endif
MAKE_CTOR(CreateNewPrintPreviewContext, nsIPresContext, NS_NewPrintPreviewContext)
MAKE_CTOR(CreateNewCSSFrameConstructor, nsICSSFrameConstructor, NS_CreateCSSFrameConstructor)
MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
MAKE_CTOR(CreateNewLayoutHistoryState, nsILayoutHistoryState, NS_NewLayoutHistoryState)
@ -217,6 +217,7 @@ MAKE_CTOR(CreateNewPresShell, nsIPresShell, NS_NewPresShell)
MAKE_CTOR(CreateNewPresState, nsIPresState, NS_NewPresState)
MAKE_CTOR(CreateNewGalleyContext, nsIPresContext, NS_NewGalleyContext)
MAKE_CTOR(CreateNewPrintContext, nsIPrintContext, NS_NewPrintContext)
MAKE_CTOR(CreateNewPrintPreviewContext, nsIPrintPreviewContext, NS_NewPrintPreviewContext)
MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject)
MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject)
@ -242,11 +243,6 @@ static nsModuleComponentInfo gComponents[] = {
CreateNewLayoutDebugger },
#endif
{ "Print preview context",
NS_PRINT_PREVIEW_CONTEXT_CID,
nsnull,
CreateNewPrintPreviewContext },
{ "CSS Frame Constructor",
NS_CSSFRAMECONSTRUCTOR_CID,
nsnull,
@ -282,6 +278,11 @@ static nsModuleComponentInfo gComponents[] = {
NS_PRINTCONTEXT_CID,
nsnull,
CreateNewPrintContext },
{ "Print Preview context",
NS_PRINT_PREVIEW_CONTEXT_CID,
nsnull,
CreateNewPrintPreviewContext },
// XXX end ick
{ "XUL Box Object",

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

@ -178,6 +178,7 @@
static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
static NS_DEFINE_CID(kStyleSetCID, NS_STYLESET_CID);
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
// supporting bugs 31816, 20760, 22963
// define USE_OVERRIDE to put prefs in as an override stylesheet
@ -7003,7 +7004,10 @@ PresShell::VerifyIncrementalReflow()
PRBool isPaginated = PR_FALSE;
mPresContext->IsPaginated(&isPaginated);
if (isPaginated) {
rv = NS_NewPrintPreviewContext(&cx);
nsCOMPtr<nsIPrintPreviewContext> ppx = do_CreateInstance(kPrintPreviewContextCID, &rv);
if (NS_SUCCEEDED(rv)) {
ppx->QueryInterface(NS_GET_IID(nsIPresContext),(void**)&cx);
}
}
else {
rv = NS_NewGalleyContext(&cx);