зеркало из https://github.com/mozilla/pjs.git
added css loader support
This commit is contained in:
Родитель
37a45d3fbd
Коммит
6041f44153
|
@ -24,6 +24,7 @@
|
|||
#include "nsString.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsICSSLoader;
|
||||
|
||||
#define NS_IXMLDOCUMENT_IID \
|
||||
{ 0xa6cf90ca, 0x15b3, 0x11d2, \
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsIDOMProcessingInstruction.h"
|
||||
#include "nsExpatDTD.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsICSSLoader.h"
|
||||
|
||||
// XXX The XML world depends on the html atoms
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
@ -80,6 +81,7 @@ nsXMLDocument::nsXMLDocument()
|
|||
mParser = nsnull;
|
||||
mAttrStyleSheet = nsnull;
|
||||
mInlineStyleSheet = nsnull;
|
||||
mCSSLoader = nsnull;
|
||||
|
||||
// XXX The XML world depends on the html atoms
|
||||
nsHTMLAtoms::AddrefAtoms();
|
||||
|
@ -100,6 +102,7 @@ nsXMLDocument::~nsXMLDocument()
|
|||
mInlineStyleSheet->SetOwningDocument(nsnull);
|
||||
NS_RELEASE(mInlineStyleSheet);
|
||||
}
|
||||
NS_IF_RELEASE(mCSSLoader);
|
||||
#ifdef INCLUDE_XUL
|
||||
nsXULAtoms::ReleaseAtoms();
|
||||
#endif
|
||||
|
@ -290,6 +293,12 @@ void nsXMLDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet) // subclass ho
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex)
|
||||
{
|
||||
mStyleSheets.InsertElementAt(aSheet, aIndex + 1); // offset one for the attr style sheet
|
||||
}
|
||||
|
||||
// nsIDOMDocument interface
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType)
|
||||
|
@ -448,4 +457,15 @@ nsXMLDocument::GetContentById(const nsString& aName, nsIContent** aContent)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (! mCSSLoader) {
|
||||
result = NS_NewCSSLoader(this, &mCSSLoader);
|
||||
}
|
||||
aLoader = mCSSLoader;
|
||||
NS_IF_ADDREF(aLoader);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
class nsIParser;
|
||||
class nsIDOMNode;
|
||||
class nsICSSLoader;
|
||||
|
||||
|
||||
class nsXMLDocument : public nsMarkupDocument,
|
||||
|
@ -67,9 +68,11 @@ public:
|
|||
// nsIHTMLContentContainer
|
||||
NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult);
|
||||
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult);
|
||||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
||||
|
||||
protected:
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); // subclass hook for sheet ordering
|
||||
virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex);
|
||||
virtual nsresult Reset(nsIURL* aUrl);
|
||||
|
||||
// For HTML elements in our content model
|
||||
|
@ -77,6 +80,7 @@ protected:
|
|||
nsIHTMLCSSStyleSheet* mInlineStyleSheet;
|
||||
|
||||
nsIParser *mParser;
|
||||
nsICSSLoader* mCSSLoader;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "nsString.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsICSSLoader;
|
||||
|
||||
#define NS_IXMLDOCUMENT_IID \
|
||||
{ 0xa6cf90ca, 0x15b3, 0x11d2, \
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsIDOMProcessingInstruction.h"
|
||||
#include "nsExpatDTD.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsICSSLoader.h"
|
||||
|
||||
// XXX The XML world depends on the html atoms
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
@ -80,6 +81,7 @@ nsXMLDocument::nsXMLDocument()
|
|||
mParser = nsnull;
|
||||
mAttrStyleSheet = nsnull;
|
||||
mInlineStyleSheet = nsnull;
|
||||
mCSSLoader = nsnull;
|
||||
|
||||
// XXX The XML world depends on the html atoms
|
||||
nsHTMLAtoms::AddrefAtoms();
|
||||
|
@ -100,6 +102,7 @@ nsXMLDocument::~nsXMLDocument()
|
|||
mInlineStyleSheet->SetOwningDocument(nsnull);
|
||||
NS_RELEASE(mInlineStyleSheet);
|
||||
}
|
||||
NS_IF_RELEASE(mCSSLoader);
|
||||
#ifdef INCLUDE_XUL
|
||||
nsXULAtoms::ReleaseAtoms();
|
||||
#endif
|
||||
|
@ -290,6 +293,12 @@ void nsXMLDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet) // subclass ho
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex)
|
||||
{
|
||||
mStyleSheets.InsertElementAt(aSheet, aIndex + 1); // offset one for the attr style sheet
|
||||
}
|
||||
|
||||
// nsIDOMDocument interface
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType)
|
||||
|
@ -448,4 +457,15 @@ nsXMLDocument::GetContentById(const nsString& aName, nsIContent** aContent)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (! mCSSLoader) {
|
||||
result = NS_NewCSSLoader(this, &mCSSLoader);
|
||||
}
|
||||
aLoader = mCSSLoader;
|
||||
NS_IF_ADDREF(aLoader);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
class nsIParser;
|
||||
class nsIDOMNode;
|
||||
class nsICSSLoader;
|
||||
|
||||
|
||||
class nsXMLDocument : public nsMarkupDocument,
|
||||
|
@ -67,9 +68,11 @@ public:
|
|||
// nsIHTMLContentContainer
|
||||
NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult);
|
||||
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult);
|
||||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
||||
|
||||
protected:
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); // subclass hook for sheet ordering
|
||||
virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex);
|
||||
virtual nsresult Reset(nsIURL* aUrl);
|
||||
|
||||
// For HTML elements in our content model
|
||||
|
@ -77,6 +80,7 @@ protected:
|
|||
nsIHTMLCSSStyleSheet* mInlineStyleSheet;
|
||||
|
||||
nsIParser *mParser;
|
||||
nsICSSLoader* mCSSLoader;
|
||||
};
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче