For bug 17325. Changed signature of css loader methods. R=nisheeth.

This commit is contained in:
vidur%netscape.com 1999-12-04 01:29:18 +00:00
Родитель 7261da2144
Коммит a90864f224
13 изменённых файлов: 51 добавлений и 21 удалений

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

@ -1013,7 +1013,8 @@ nsChromeRegistry::ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocu
kNameSpaceID_Unknown, kNameSpaceID_Unknown,
aDocument->GetNumberOfStyleSheets(), aDocument->GetNumberOfStyleSheets(),
nsnull, nsnull,
doneLoading); // Ignore doneLoading. Don't care. doneLoading, // Ignore doneLoading. Don't care.
nsnull);
return rv; return rv;
} }

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

@ -1271,8 +1271,8 @@ nsXMLContentSink::ProcessCSSStyleLink(nsIContent* aElement,
PRBool doneLoading; PRBool doneLoading;
result = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown, result = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown,
mStyleSheetCount++, mStyleSheetCount++,
((blockParser) ? mParser : nsnull), ((blockParser) ? mParser : nsnull),
doneLoading); doneLoading, nsnull);
NS_RELEASE(url); NS_RELEASE(url);
if (NS_SUCCEEDED(result) && blockParser && (! doneLoading)) { if (NS_SUCCEEDED(result) && blockParser && (! doneLoading)) {
result = NS_ERROR_HTMLPARSER_BLOCK; result = NS_ERROR_HTMLPARSER_BLOCK;
@ -1610,7 +1610,7 @@ nsXMLContentSink::StartLayout()
NS_IMETHODIMP NS_IMETHODIMP
nsXMLContentSink::ResumeParsing() nsXMLContentSink::ResumeParsing()
{ {
if (nsnull != mParser) { if (mParser) {
mParser->EnableParser(PR_TRUE); mParser->EnableParser(PR_TRUE);
} }

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

@ -895,7 +895,7 @@ XULContentSinkImpl::ProcessStyleLink(nsIContent* aElement,
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown, rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown,
doc->GetNumberOfStyleSheets(), doc->GetNumberOfStyleSheets(),
((blockParser) ? mParser : nsnull), ((blockParser) ? mParser : nsnull),
doneLoading); doneLoading, nsnull);
if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) { if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) {
rv = NS_ERROR_HTMLPARSER_BLOCK; rv = NS_ERROR_HTMLPARSER_BLOCK;
} }

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

@ -947,7 +947,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
// We use null for the callback and data pointer because // We use null for the callback and data pointer because
// we MUST ONLY load synchronous local files (no @import) // we MUST ONLY load synchronous local files (no @import)
rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, nsnull, nsnull); rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, nsnull);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
// Synchronous loads should ALWAYS return completed // Synchronous loads should ALWAYS return completed

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

@ -351,6 +351,11 @@ NS_IMETHODIMP nsHTMLEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_ADDREF_THIS(); NS_ADDREF_THIS();
return NS_OK; return NS_OK;
} }
if (aIID.Equals(nsICSSLoaderObserver::GetIID())) {
*aInstancePtr = NS_STATIC_CAST(nsICSSLoaderObserver*, this);
NS_ADDREF_THIS();
return NS_OK;
}
return nsEditor::QueryInterface(aIID, aInstancePtr); return nsEditor::QueryInterface(aIID, aInstancePtr);
} }
@ -3029,7 +3034,7 @@ nsHTMLEditor::ApplyDocumentOrOverrideStyleSheet(const nsString& aURL, PRBool aOv
// We use null for the callback and data pointer because // We use null for the callback and data pointer because
// we MUST ONLY load synchronous local files (no @import) // we MUST ONLY load synchronous local files (no @import)
rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete,
nsnull, nsnull); nsnull);
// Synchronous loads should ALWAYS return completed // Synchronous loads should ALWAYS return completed
if (!complete || !cssStyleSheet) if (!complete || !cssStyleSheet)
@ -3054,7 +3059,6 @@ nsHTMLEditor::ApplyDocumentOrOverrideStyleSheet(const nsString& aURL, PRBool aOv
} }
else { else {
rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete,
ApplyStyleSheetToPresShellDocument,
this); this);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
@ -4093,6 +4097,12 @@ nsHTMLEditor::ReplaceStyleSheet(nsICSSStyleSheet *aNewSheet)
return rv; return rv;
} }
NS_IMETHODIMP
nsHTMLEditor::StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify)
{
ApplyStyleSheetToPresShellDocument(aSheet, this);
return NS_OK;
}
/* static callback */ /* static callback */
void nsHTMLEditor::ApplyStyleSheetToPresShellDocument(nsICSSStyleSheet* aSheet, void *aData) void nsHTMLEditor::ApplyStyleSheetToPresShellDocument(nsICSSStyleSheet* aSheet, void *aData)

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

@ -34,6 +34,7 @@
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDOMEventListener.h" #include "nsIDOMEventListener.h"
#include "nsICSSLoader.h" #include "nsICSSLoader.h"
#include "nsICSSLoaderObserver.h"
#include "nsITableLayout.h" #include "nsITableLayout.h"
#include "TypeInState.h" #include "TypeInState.h"
@ -49,7 +50,8 @@ class nsHTMLEditor : public nsEditor,
public nsIHTMLEditor, public nsIHTMLEditor,
public nsIEditorMailSupport, public nsIEditorMailSupport,
public nsITableEditor, public nsITableEditor,
public nsIEditorStyleSheets public nsIEditorStyleSheets,
public nsICSSLoaderObserver
{ {
typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType; typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
@ -221,6 +223,8 @@ public:
NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed); NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed);
/* ------------ nsICSSLoaderObserver -------------- */
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify);
/* ------------ Utility Routines, not part of public API -------------- */ /* ------------ Utility Routines, not part of public API -------------- */
NS_IMETHOD GetBodyStyleContext(nsIStyleContext** aStyleContext); NS_IMETHOD GetBodyStyleContext(nsIStyleContext** aStyleContext);

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

@ -947,7 +947,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
// We use null for the callback and data pointer because // We use null for the callback and data pointer because
// we MUST ONLY load synchronous local files (no @import) // we MUST ONLY load synchronous local files (no @import)
rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, nsnull, nsnull); rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, nsnull);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
{ {
// Synchronous loads should ALWAYS return completed // Synchronous loads should ALWAYS return completed

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

@ -351,6 +351,11 @@ NS_IMETHODIMP nsHTMLEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_ADDREF_THIS(); NS_ADDREF_THIS();
return NS_OK; return NS_OK;
} }
if (aIID.Equals(nsICSSLoaderObserver::GetIID())) {
*aInstancePtr = NS_STATIC_CAST(nsICSSLoaderObserver*, this);
NS_ADDREF_THIS();
return NS_OK;
}
return nsEditor::QueryInterface(aIID, aInstancePtr); return nsEditor::QueryInterface(aIID, aInstancePtr);
} }
@ -3029,7 +3034,7 @@ nsHTMLEditor::ApplyDocumentOrOverrideStyleSheet(const nsString& aURL, PRBool aOv
// We use null for the callback and data pointer because // We use null for the callback and data pointer because
// we MUST ONLY load synchronous local files (no @import) // we MUST ONLY load synchronous local files (no @import)
rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete,
nsnull, nsnull); nsnull);
// Synchronous loads should ALWAYS return completed // Synchronous loads should ALWAYS return completed
if (!complete || !cssStyleSheet) if (!complete || !cssStyleSheet)
@ -3054,7 +3059,6 @@ nsHTMLEditor::ApplyDocumentOrOverrideStyleSheet(const nsString& aURL, PRBool aOv
} }
else { else {
rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete, rv = cssLoader->LoadAgentSheet(uaURL, *getter_AddRefs(cssStyleSheet), complete,
ApplyStyleSheetToPresShellDocument,
this); this);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
@ -4093,6 +4097,12 @@ nsHTMLEditor::ReplaceStyleSheet(nsICSSStyleSheet *aNewSheet)
return rv; return rv;
} }
NS_IMETHODIMP
nsHTMLEditor::StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify)
{
ApplyStyleSheetToPresShellDocument(aSheet, this);
return NS_OK;
}
/* static callback */ /* static callback */
void nsHTMLEditor::ApplyStyleSheetToPresShellDocument(nsICSSStyleSheet* aSheet, void *aData) void nsHTMLEditor::ApplyStyleSheetToPresShellDocument(nsICSSStyleSheet* aSheet, void *aData)

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

@ -34,6 +34,7 @@
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDOMEventListener.h" #include "nsIDOMEventListener.h"
#include "nsICSSLoader.h" #include "nsICSSLoader.h"
#include "nsICSSLoaderObserver.h"
#include "nsITableLayout.h" #include "nsITableLayout.h"
#include "TypeInState.h" #include "TypeInState.h"
@ -49,7 +50,8 @@ class nsHTMLEditor : public nsEditor,
public nsIHTMLEditor, public nsIHTMLEditor,
public nsIEditorMailSupport, public nsIEditorMailSupport,
public nsITableEditor, public nsITableEditor,
public nsIEditorStyleSheets public nsIEditorStyleSheets,
public nsICSSLoaderObserver
{ {
typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType; typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
@ -221,6 +223,8 @@ public:
NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed); NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed);
/* ------------ nsICSSLoaderObserver -------------- */
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify);
/* ------------ Utility Routines, not part of public API -------------- */ /* ------------ Utility Routines, not part of public API -------------- */
NS_IMETHOD GetBodyStyleContext(nsIStyleContext** aStyleContext); NS_IMETHOD GetBodyStyleContext(nsIStyleContext** aStyleContext);

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

@ -208,7 +208,7 @@ nsLayoutModule::Initialize()
if (cssLoader) { if (cssLoader) {
PRBool complete; PRBool complete;
rv = cssLoader->LoadAgentSheet(uaURL, gUAStyleSheet, complete, rv = cssLoader->LoadAgentSheet(uaURL, gUAStyleSheet, complete,
nsnull, nsnull); nsnull);
} }
} }
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {

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

@ -1271,8 +1271,8 @@ nsXMLContentSink::ProcessCSSStyleLink(nsIContent* aElement,
PRBool doneLoading; PRBool doneLoading;
result = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown, result = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown,
mStyleSheetCount++, mStyleSheetCount++,
((blockParser) ? mParser : nsnull), ((blockParser) ? mParser : nsnull),
doneLoading); doneLoading, nsnull);
NS_RELEASE(url); NS_RELEASE(url);
if (NS_SUCCEEDED(result) && blockParser && (! doneLoading)) { if (NS_SUCCEEDED(result) && blockParser && (! doneLoading)) {
result = NS_ERROR_HTMLPARSER_BLOCK; result = NS_ERROR_HTMLPARSER_BLOCK;
@ -1610,7 +1610,7 @@ nsXMLContentSink::StartLayout()
NS_IMETHODIMP NS_IMETHODIMP
nsXMLContentSink::ResumeParsing() nsXMLContentSink::ResumeParsing()
{ {
if (nsnull != mParser) { if (mParser) {
mParser->EnableParser(PR_TRUE); mParser->EnableParser(PR_TRUE);
} }

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

@ -1013,7 +1013,8 @@ nsChromeRegistry::ProcessStyleSheet(nsIURL* aURL, nsICSSLoader* aLoader, nsIDocu
kNameSpaceID_Unknown, kNameSpaceID_Unknown,
aDocument->GetNumberOfStyleSheets(), aDocument->GetNumberOfStyleSheets(),
nsnull, nsnull,
doneLoading); // Ignore doneLoading. Don't care. doneLoading, // Ignore doneLoading. Don't care.
nsnull);
return rv; return rv;
} }

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

@ -895,7 +895,7 @@ XULContentSinkImpl::ProcessStyleLink(nsIContent* aElement,
rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown, rv = mCSSLoader->LoadStyleLink(aElement, url, aTitle, aMedia, kNameSpaceID_Unknown,
doc->GetNumberOfStyleSheets(), doc->GetNumberOfStyleSheets(),
((blockParser) ? mParser : nsnull), ((blockParser) ? mParser : nsnull),
doneLoading); doneLoading, nsnull);
if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) { if (NS_SUCCEEDED(rv) && blockParser && (! doneLoading)) {
rv = NS_ERROR_HTMLPARSER_BLOCK; rv = NS_ERROR_HTMLPARSER_BLOCK;
} }