зеркало из https://github.com/mozilla/pjs.git
Fixing bug 124412. Making nsXULDocument inherit nsXMLDocument to avoid the need to duplicate a large amount of code in nsXULDocument. Also removing nsMarkupDocument and nsIDOMEventCapturer that are no longer needed. Changing the inheritance of nsIDOMXULDocument to avoid ~60 or so forwarding methods, and doing a *lot* of code cleanup. r=bugmail@sicking.cc, sr=peterv@netscape.com
This commit is contained in:
Родитель
aa317c4d6b
Коммит
14882c9d0c
|
@ -89,7 +89,7 @@
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIDOMXULButtonElement.h"
|
#include "nsIDOMXULButtonElement.h"
|
||||||
#include "nsIDOMXULCheckboxElement.h"
|
#include "nsIDOMXULCheckboxElement.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMXULElement.h"
|
#include "nsIDOMXULElement.h"
|
||||||
#include "nsIDOMXULLabelElement.h"
|
#include "nsIDOMXULLabelElement.h"
|
||||||
#include "nsIDOMXULSelectCntrlEl.h"
|
#include "nsIDOMXULSelectCntrlEl.h"
|
||||||
|
|
|
@ -926,9 +926,7 @@ NS_IMETHODIMP nsDocAccessibleMixin::GetURL(nsAString& aURL)
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocAccessibleMixin::GetTitle(nsAString& aTitle)
|
NS_IMETHODIMP nsDocAccessibleMixin::GetTitle(nsAString& aTitle)
|
||||||
{
|
{
|
||||||
// This doesn't leak - we don't own the const pointer that's returned
|
return mDocument->GetDocumentTitle(aTitle);
|
||||||
aTitle = *(mDocument->GetDocumentTitle());
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocAccessibleMixin::GetMimeType(nsAString& aMimeType)
|
NS_IMETHODIMP nsDocAccessibleMixin::GetMimeType(nsAString& aMimeType)
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsEvent.h"
|
#include "nsEvent.h"
|
||||||
#include "nsAString.h"
|
#include "nsAString.h"
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsChangeHint.h"
|
#include "nsChangeHint.h"
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
|
|
||||||
|
@ -78,7 +77,6 @@ class nsIBindingManager;
|
||||||
class nsIObserver;
|
class nsIObserver;
|
||||||
class nsISupportsArray;
|
class nsISupportsArray;
|
||||||
class nsIScriptLoader;
|
class nsIScriptLoader;
|
||||||
class nsString;
|
|
||||||
class nsIContentSink;
|
class nsIContentSink;
|
||||||
class nsIScriptEventManager;
|
class nsIScriptEventManager;
|
||||||
|
|
||||||
|
@ -118,7 +116,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return the title of the document. May return null.
|
* Return the title of the document. May return null.
|
||||||
*/
|
*/
|
||||||
virtual const nsString* GetDocumentTitle() const = 0;
|
NS_IMETHOD GetDocumentTitle(nsAString& aTitle) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the URL for the document. May return null.
|
* Return the URL for the document. May return null.
|
||||||
|
@ -143,7 +141,8 @@ public:
|
||||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup** aGroup) const = 0;
|
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup** aGroup) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the base URL for relative URLs in the document. May return null (or the document URL).
|
* Return the base URL for relative URLs in the document. May return
|
||||||
|
* null (or the document URL).
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const = 0;
|
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const = 0;
|
||||||
NS_IMETHOD SetBaseURL(nsIURI* aURL) = 0;
|
NS_IMETHOD SetBaseURL(nsIURI* aURL) = 0;
|
||||||
|
@ -155,8 +154,9 @@ public:
|
||||||
NS_IMETHOD SetBaseTarget(const nsAString &aBaseTarget)=0;
|
NS_IMETHOD SetBaseTarget(const nsAString &aBaseTarget)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a standard name for the document's character set. This will
|
* Return a standard name for the document's character set. This
|
||||||
* trigger a startDocumentLoad if necessary to answer the question.
|
* will trigger a startDocumentLoad if necessary to answer the
|
||||||
|
* question.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetDocumentCharacterSet(nsAString& oCharSetID) = 0;
|
NS_IMETHOD GetDocumentCharacterSet(nsAString& oCharSetID) = 0;
|
||||||
NS_IMETHOD SetDocumentCharacterSet(const nsAString& aCharSetID) = 0;
|
NS_IMETHOD SetDocumentCharacterSet(const nsAString& aCharSetID) = 0;
|
||||||
|
@ -188,8 +188,8 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetContentLanguage(nsAString& aContentLanguage) const = 0;
|
NS_IMETHOD GetContentLanguage(nsAString& aContentLanguage) const = 0;
|
||||||
|
|
||||||
// The state BidiEnabled should persist across multiple views (screen, print)
|
// The state BidiEnabled should persist across multiple views
|
||||||
// of the same document.
|
// (screen, print) of the same document.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the document contains bidi data.
|
* Check if the document contains bidi data.
|
||||||
|
@ -214,15 +214,15 @@ public:
|
||||||
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) = 0;
|
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access HTTP header data (this may also get set from other sources, like
|
* Access HTTP header data (this may also get set from other
|
||||||
* HTML META tags).
|
* sources, like HTML META tags).
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAString& aData) const = 0;
|
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAString& aData) const = 0;
|
||||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAString& aData) = 0;
|
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAString& aData) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new presentation shell that will use aContext for
|
* Create a new presentation shell that will use aContext for it's
|
||||||
* it's presentation context (presentation context's <b>must not</b> be
|
* presentation context (presentation context's <b>must not</b> be
|
||||||
* shared among multiple presentation shell's).
|
* shared among multiple presentation shell's).
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||||
|
@ -431,8 +431,6 @@ public:
|
||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsEventStatus* aEventStatus) = 0;
|
nsEventStatus* aEventStatus) = 0;
|
||||||
|
|
||||||
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement) = 0;
|
|
||||||
|
|
||||||
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE,
|
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE,
|
||||||
PRBool aUpdateViews=PR_FALSE) = 0;
|
PRBool aUpdateViews=PR_FALSE) = 0;
|
||||||
|
|
||||||
|
|
|
@ -510,6 +510,7 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
||||||
#endif
|
#endif
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||||
aTrustedNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
aTrustedNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||||
|
|
||||||
if (!domDoc) {
|
if (!domDoc) {
|
||||||
// In theory this should never happen. But since theory and reality are
|
// In theory this should never happen. But since theory and reality are
|
||||||
// different for XUL elements we'll try to get the principal from the
|
// different for XUL elements we'll try to get the principal from the
|
||||||
|
@ -530,8 +531,7 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
||||||
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
trustedDoc = do_QueryInterface(domDoc);
|
trustedDoc = do_QueryInterface(domDoc);
|
||||||
NS_ASSERTION(trustedDoc, "QI to nsIDocument failed");
|
NS_ASSERTION(trustedDoc, "QI to nsIDocument failed");
|
||||||
}
|
}
|
||||||
|
@ -560,13 +560,16 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// If they are in the same document then everything is just fine
|
// If they are in the same document then everything is just fine
|
||||||
if (trustedDoc == unTrustedDoc && trustedDoc)
|
if (trustedDoc == unTrustedDoc && trustedDoc) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!trustedPrincipal) {
|
if (!trustedPrincipal) {
|
||||||
trustedDoc->GetPrincipal(getter_AddRefs(trustedPrincipal));
|
trustedDoc->GetPrincipal(getter_AddRefs(trustedPrincipal));
|
||||||
|
|
||||||
if (!trustedPrincipal) {
|
if (!trustedPrincipal) {
|
||||||
// If the trusted node doesn't have a principal we can't check security against it
|
// If the trusted node doesn't have a principal we can't check
|
||||||
|
// security against it
|
||||||
|
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
}
|
}
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -38,9 +38,13 @@
|
||||||
#ifndef nsDocument_h___
|
#ifndef nsDocument_h___
|
||||||
#define nsDocument_h___
|
#define nsDocument_h___
|
||||||
|
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsAutoPtr.h"
|
||||||
|
#include "nsCRT.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
#include "nsWeakPtr.h"
|
#include "nsWeakPtr.h"
|
||||||
|
#include "nsIArena.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsIDOMXMLDocument.h"
|
#include "nsIDOMXMLDocument.h"
|
||||||
#include "nsIDOMDocumentView.h"
|
#include "nsIDOMDocumentView.h"
|
||||||
|
@ -56,6 +60,7 @@
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsIDOMEventTarget.h"
|
#include "nsIDOMEventTarget.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
|
#include "nsIEventListenerManager.h"
|
||||||
#include "nsGenericDOMNodeList.h"
|
#include "nsGenericDOMNodeList.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsIBindingManager.h"
|
#include "nsIBindingManager.h"
|
||||||
|
@ -84,51 +89,25 @@ class nsIDTD;
|
||||||
class nsXPathDocumentTearoff;
|
class nsXPathDocumentTearoff;
|
||||||
class nsIRadioVisitor;
|
class nsIRadioVisitor;
|
||||||
class nsIFormControl;
|
class nsIFormControl;
|
||||||
|
|
||||||
struct nsRadioGroupStruct;
|
struct nsRadioGroupStruct;
|
||||||
|
|
||||||
#if 0
|
|
||||||
class nsPostData : public nsIPostData {
|
|
||||||
public:
|
|
||||||
nsPostData(PRBool aIsFile, char* aData);
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
virtual PRBool IsFile();
|
|
||||||
virtual const char* GetData();
|
|
||||||
virtual PRInt32 GetDataLength();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~nsPostData();
|
|
||||||
|
|
||||||
PRBool mIsFile;
|
|
||||||
char* mData;
|
|
||||||
PRInt32 mDataLen;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class nsDocHeaderData
|
class nsDocHeaderData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsDocHeaderData(nsIAtom* aField, const nsAString& aData)
|
nsDocHeaderData(nsIAtom* aField, const nsAString& aData)
|
||||||
|
: mField(aField), mData(aData), mNext(nsnull)
|
||||||
{
|
{
|
||||||
mField = aField;
|
|
||||||
NS_IF_ADDREF(mField);
|
|
||||||
mData.Assign(aData);
|
|
||||||
mNext = nsnull;
|
|
||||||
}
|
|
||||||
~nsDocHeaderData(void)
|
|
||||||
{
|
|
||||||
NS_IF_RELEASE(mField);
|
|
||||||
if (nsnull != mNext) {
|
|
||||||
delete mNext;
|
|
||||||
mNext = nsnull;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIAtom* mField;
|
~nsDocHeaderData(void)
|
||||||
nsString mData;
|
{
|
||||||
nsDocHeaderData* mNext;
|
delete mNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIAtom> mField;
|
||||||
|
nsString mData;
|
||||||
|
nsDocHeaderData* mNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Represents the children of a document (prolog, epilog and
|
// Represents the children of a document (prolog, epilog and
|
||||||
|
@ -145,6 +124,8 @@ public:
|
||||||
void DropReference();
|
void DropReference();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
nsDocumentChildNodes(); // Not implemented
|
||||||
|
|
||||||
nsIDocument* mDocument;
|
nsIDocument* mDocument;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,7 +140,7 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
NS_DECL_NSIDOMSTYLESHEETLIST
|
NS_DECL_NSIDOMSTYLESHEETLIST
|
||||||
|
|
||||||
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||||
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||||
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
|
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
|
||||||
|
@ -167,7 +148,7 @@ public:
|
||||||
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
|
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
|
||||||
nsIPresShell* aShell) { return NS_OK; }
|
nsIPresShell* aShell) { return NS_OK; }
|
||||||
NS_IMETHOD EndReflow(nsIDocument *aDocument,
|
NS_IMETHOD EndReflow(nsIDocument *aDocument,
|
||||||
nsIPresShell* aShell) { return NS_OK; }
|
nsIPresShell* aShell) { return NS_OK; }
|
||||||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
nsISupports* aSubContent) { return NS_OK; }
|
nsISupports* aSubContent) { return NS_OK; }
|
||||||
|
@ -183,7 +164,7 @@ public:
|
||||||
nsChangeHint aHint) { return NS_OK; }
|
nsChangeHint aHint) { return NS_OK; }
|
||||||
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
||||||
nsIContent* aContainer,
|
nsIContent* aContainer,
|
||||||
PRInt32 aNewIndexInContainer)
|
PRInt32 aNewIndexInContainer)
|
||||||
{ return NS_OK; }
|
{ return NS_OK; }
|
||||||
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
||||||
nsIContent* aContainer,
|
nsIContent* aContainer,
|
||||||
|
@ -224,28 +205,6 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Helper structs for the content->subdoc map
|
|
||||||
|
|
||||||
class SubDocMapEntry : public PLDHashEntryHdr
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// Both of these are strong references
|
|
||||||
nsIContent *mKey; // must be first, to look like PLDHashEntryStub
|
|
||||||
nsIDocument *mSubDocument;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FindContentData
|
|
||||||
{
|
|
||||||
FindContentData(nsIDocument *aSubDoc)
|
|
||||||
: mSubDocument(aSubDoc), mResult(nsnull)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsISupports *mSubDocument;
|
|
||||||
nsIContent *mResult;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Base class for our document implementations.
|
// Base class for our document implementations.
|
||||||
//
|
//
|
||||||
// Note that this class *implements* nsIDOMXMLDocument, but it's not
|
// Note that this class *implements* nsIDOMXMLDocument, but it's not
|
||||||
|
@ -255,8 +214,8 @@ struct FindContentData
|
||||||
// nsIDOMXMLDocument's. nsDocument's QI should *not* claim to support
|
// nsIDOMXMLDocument's. nsDocument's QI should *not* claim to support
|
||||||
// nsIDOMXMLDocument unless someone writes a real implementation of
|
// nsIDOMXMLDocument unless someone writes a real implementation of
|
||||||
// the interface.
|
// the interface.
|
||||||
class nsDocument : public nsIDocument,
|
class nsDocument : public nsIDocument,
|
||||||
public nsIDOMXMLDocument, // inherits nsIDOMDocument
|
public nsIDOMXMLDocument, // inherits nsIDOMDocument
|
||||||
public nsIDOMNSDocument,
|
public nsIDOMNSDocument,
|
||||||
public nsIDOMDocumentEvent,
|
public nsIDOMDocumentEvent,
|
||||||
public nsIDOM3DocumentEvent,
|
public nsIDOM3DocumentEvent,
|
||||||
|
@ -275,6 +234,8 @@ class nsDocument : public nsIDocument,
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||||
|
|
||||||
NS_IMETHOD GetArena(nsIArena** aArena);
|
NS_IMETHOD GetArena(nsIArena** aArena);
|
||||||
|
|
||||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||||
|
@ -293,7 +254,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return the title of the document. May return null.
|
* Return the title of the document. May return null.
|
||||||
*/
|
*/
|
||||||
virtual const nsString* GetDocumentTitle() const;
|
NS_IMETHOD GetDocumentTitle(nsAString& aTitle) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the URL for the document. May return null.
|
* Return the URL for the document. May return null.
|
||||||
|
@ -396,13 +357,10 @@ public:
|
||||||
* it's presentation context (presentation context's <b>must not</b> be
|
* it's presentation context (presentation context's <b>must not</b> be
|
||||||
* shared among multiple presentation shell's).
|
* shared among multiple presentation shell's).
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
// XXX Temp hack: moved to nsMarkupDocument
|
|
||||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||||
nsIViewManager* aViewManager,
|
nsIViewManager* aViewManager,
|
||||||
nsIStyleSet* aStyleSet,
|
nsIStyleSet* aStyleSet,
|
||||||
nsIPresShell** aInstancePtrResult);
|
nsIPresShell** aInstancePtrResult);
|
||||||
#endif
|
|
||||||
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
||||||
virtual PRInt32 GetNumberOfShells();
|
virtual PRInt32 GetNumberOfShells();
|
||||||
NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell);
|
NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell);
|
||||||
|
@ -425,7 +383,7 @@ public:
|
||||||
NS_IMETHOD GetRootContent(nsIContent** aRoot);
|
NS_IMETHOD GetRootContent(nsIContent** aRoot);
|
||||||
NS_IMETHOD SetRootContent(nsIContent* aRoot);
|
NS_IMETHOD SetRootContent(nsIContent* aRoot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the direct children of the document - content in
|
* Get the direct children of the document - content in
|
||||||
* the prolog, the root content and content in the epilog.
|
* the prolog, the root content and content in the epilog.
|
||||||
*/
|
*/
|
||||||
|
@ -444,7 +402,7 @@ public:
|
||||||
NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex);
|
NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex);
|
||||||
virtual void AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
|
virtual void AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
|
||||||
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet);
|
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet);
|
||||||
|
|
||||||
NS_IMETHOD UpdateStyleSheets(nsCOMArray<nsIStyleSheet>& aOldSheets,
|
NS_IMETHOD UpdateStyleSheets(nsCOMArray<nsIStyleSheet>& aOldSheets,
|
||||||
nsCOMArray<nsIStyleSheet>& aNewSheets);
|
nsCOMArray<nsIStyleSheet>& aNewSheets);
|
||||||
virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet);
|
virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet);
|
||||||
|
@ -456,7 +414,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the object from which a document can get a script context.
|
* Set the object from which a document can get a script context.
|
||||||
* This is the context within which all scripts (during document
|
* This is the context within which all scripts (during document
|
||||||
* creation and during event handling) will run.
|
* creation and during event handling) will run.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject);
|
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject);
|
||||||
|
@ -464,7 +422,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the script loader for this document
|
* Get the script loader for this document
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader);
|
NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -543,7 +501,7 @@ public:
|
||||||
nsIFormControl* aRadio);
|
nsIFormControl* aRadio);
|
||||||
NS_IMETHOD RemoveFromRadioGroup(const nsAString& aName,
|
NS_IMETHOD RemoveFromRadioGroup(const nsAString& aName,
|
||||||
nsIFormControl* aRadio);
|
nsIFormControl* aRadio);
|
||||||
|
|
||||||
// for radio group
|
// for radio group
|
||||||
nsresult GetRadioGroup(const nsAString& aName,
|
nsresult GetRadioGroup(const nsAString& aName,
|
||||||
nsRadioGroupStruct **aRadioGroup);
|
nsRadioGroupStruct **aRadioGroup);
|
||||||
|
@ -599,15 +557,10 @@ public:
|
||||||
// nsIDOM3EventTarget
|
// nsIDOM3EventTarget
|
||||||
NS_DECL_NSIDOM3EVENTTARGET
|
NS_DECL_NSIDOM3EVENTTARGET
|
||||||
|
|
||||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
|
||||||
nsEvent* aEvent,
|
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
|
||||||
nsIDOMEvent** aDOMEvent,
|
|
||||||
PRUint32 aFlags,
|
|
||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
|
|
||||||
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement);
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHOD SetDocumentURL(nsIURI* aURI);
|
NS_IMETHOD SetDocumentURL(nsIURI* aURI);
|
||||||
|
|
||||||
virtual nsresult Init();
|
virtual nsresult Init();
|
||||||
|
@ -621,56 +574,74 @@ protected:
|
||||||
virtual already_AddRefed<nsIStyleSheet> InternalGetStyleSheetAt(PRInt32 aIndex);
|
virtual already_AddRefed<nsIStyleSheet> InternalGetStyleSheetAt(PRInt32 aIndex);
|
||||||
virtual PRInt32 InternalGetNumberOfStyleSheets();
|
virtual PRInt32 InternalGetNumberOfStyleSheets();
|
||||||
|
|
||||||
nsDocument();
|
nsresult doCreateShell(nsIPresContext* aContext,
|
||||||
virtual ~nsDocument();
|
nsIViewManager* aViewManager, nsIStyleSet* aStyleSet,
|
||||||
|
nsCompatibility aCompatMode,
|
||||||
|
nsIPresShell** aInstancePtrResult);
|
||||||
|
|
||||||
nsIArena* mArena;
|
nsDocument();
|
||||||
|
virtual ~nsDocument();
|
||||||
|
|
||||||
|
nsCOMPtr<nsIArena> mArena;
|
||||||
nsString mDocumentTitle;
|
nsString mDocumentTitle;
|
||||||
nsIURI* mDocumentURL;
|
nsCOMPtr<nsIURI> mDocumentURL;
|
||||||
nsCOMPtr<nsIURI> mDocumentBaseURL;
|
nsCOMPtr<nsIURI> mDocumentBaseURL;
|
||||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||||
PRUint32 mLoadFlags; // load flags of the document's channel
|
|
||||||
nsWeakPtr mDocumentLoadGroup;
|
nsWeakPtr mDocumentLoadGroup;
|
||||||
|
|
||||||
nsWeakPtr mDocumentContainer;
|
nsWeakPtr mDocumentContainer;
|
||||||
|
|
||||||
nsString mCharacterSet;
|
nsString mCharacterSet;
|
||||||
PRInt32 mCharacterSetSource;
|
PRInt32 mCharacterSetSource;
|
||||||
|
|
||||||
nsVoidArray mCharSetObservers;
|
nsVoidArray mCharSetObservers;
|
||||||
nsIDocument* mParentDocument;
|
nsIDocument* mParentDocument;
|
||||||
|
|
||||||
PLDHashTable *mSubDocuments;
|
PLDHashTable *mSubDocuments;
|
||||||
|
|
||||||
nsVoidArray mPresShells;
|
nsSmallVoidArray mPresShells;
|
||||||
nsCOMArray<nsIContent> mChildren; // contains owning references
|
|
||||||
nsIContent* mRootContent; // a weak reference to the only element in
|
// Array of owning references to all children
|
||||||
// mChildren, or null if no such element exists.
|
nsCOMArray<nsIContent> mChildren;
|
||||||
|
|
||||||
|
// A weak reference to the only element in mChildren, or null if no
|
||||||
|
// such element exists.
|
||||||
|
nsIContent* mRootContent;
|
||||||
|
|
||||||
nsCOMArray<nsIStyleSheet> mStyleSheets;
|
nsCOMArray<nsIStyleSheet> mStyleSheets;
|
||||||
nsAutoVoidArray mObservers; // basically always has at least 1 entry
|
|
||||||
|
// Basically always has at least 1 entry
|
||||||
|
nsAutoVoidArray mObservers;
|
||||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||||
nsIEventListenerManager* mListenerManager;
|
nsCOMPtr<nsIEventListenerManager> mListenerManager;
|
||||||
PRBool mInDestructor;
|
|
||||||
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
|
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
|
||||||
nsCOMPtr<nsIScriptLoader> mScriptLoader;
|
nsCOMPtr<nsIScriptLoader> mScriptLoader;
|
||||||
nsDocHeaderData* mHeaderData;
|
nsDocHeaderData* mHeaderData;
|
||||||
nsCOMPtr<nsILineBreaker> mLineBreaker;
|
nsCOMPtr<nsILineBreaker> mLineBreaker;
|
||||||
nsCOMPtr<nsIWordBreaker> mWordBreaker;
|
nsCOMPtr<nsIWordBreaker> mWordBreaker;
|
||||||
nsDocumentChildNodes* mChildNodes;
|
|
||||||
// A content ID counter used to give a monotonically increasing ID to the content
|
nsRefPtr<nsDocumentChildNodes> mChildNodes;
|
||||||
// objects in the document's content model
|
|
||||||
|
// A content ID counter used to give a monotonically increasing ID
|
||||||
|
// to the content objects in the document's content model
|
||||||
PRInt32 mNextContentID;
|
PRInt32 mNextContentID;
|
||||||
|
|
||||||
nsHashtable mRadioGroups;
|
nsHashtable mRadioGroups;
|
||||||
|
|
||||||
PRBool mBidiEnabled;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIBindingManager> mBindingManager;
|
nsCOMPtr<nsIBindingManager> mBindingManager;
|
||||||
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager;
|
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager;
|
||||||
|
|
||||||
PRBool mIsGoingAway; // True if the document is being destroyed.
|
// True if the document is being destroyed.
|
||||||
|
PRPackedBool mIsGoingAway;
|
||||||
|
|
||||||
|
// True if BIDI is enabled.
|
||||||
|
PRPackedBool mBidiEnabled;
|
||||||
|
|
||||||
|
// True if the document is being destroyed.
|
||||||
|
PRPackedBool mInDestructor;
|
||||||
|
|
||||||
nsSupportsHashtable* mBoxObjectTable;
|
nsSupportsHashtable* mBoxObjectTable;
|
||||||
PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery.
|
|
||||||
|
|
||||||
nsSupportsHashtable mContentWrapperHash;
|
nsSupportsHashtable mContentWrapperHash;
|
||||||
|
|
||||||
|
|
|
@ -1166,7 +1166,7 @@ NS_IMETHODIMP
|
||||||
DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult)
|
DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||||
return CallQueryInterface(mDocument.get(), aResult);
|
return CallQueryInterface(mDocument, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -1873,9 +1873,10 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell,
|
||||||
*aTitle = nsnull;
|
*aTitle = nsnull;
|
||||||
*aURLStr = nsnull;
|
*aURLStr = nsnull;
|
||||||
|
|
||||||
const nsString* docTitle = aDoc->GetDocumentTitle();
|
nsAutoString docTitle;
|
||||||
if (docTitle && !docTitle->IsEmpty()) {
|
aDoc->GetDocumentTitle(docTitle);
|
||||||
*aTitle = ToNewUnicode(*docTitle);
|
if (!docTitle.IsEmpty()) {
|
||||||
|
*aTitle = ToNewUnicode(docTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> url;
|
nsCOMPtr<nsIURI> url;
|
||||||
|
|
|
@ -444,7 +444,6 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
||||||
*getter_AddRefs(attrPrefix));
|
*getter_AddRefs(attrPrefix));
|
||||||
|
|
||||||
if (namespaceID == kNameSpaceID_XMLNS) {
|
if (namespaceID == kNameSpaceID_XMLNS) {
|
||||||
PRBool hasPrefix = attrPrefix ? PR_TRUE : PR_FALSE;
|
|
||||||
content->GetAttr(namespaceID, attrName, uriStr);
|
content->GetAttr(namespaceID, attrName, uriStr);
|
||||||
|
|
||||||
if (!attrPrefix) {
|
if (!attrPrefix) {
|
||||||
|
|
|
@ -1529,10 +1529,10 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
nsresult
|
||||||
nsIPresContext* aPresContext,
|
NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
const nsAString& aEventType,
|
nsIPresContext* aPresContext, const nsAString& aEventType,
|
||||||
nsEvent *aEvent)
|
nsEvent *aEvent)
|
||||||
{
|
{
|
||||||
nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent, aEventType);
|
nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent, aEventType);
|
||||||
|
|
||||||
|
@ -1543,7 +1543,9 @@ nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
return CallQueryInterface(it, aInstancePtrResult);
|
return CallQueryInterface(it, aInstancePtrResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext, nsEvent *aEvent)
|
nsresult
|
||||||
|
NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsIPresContext* aPresContext,
|
||||||
|
nsEvent *aEvent)
|
||||||
{
|
{
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -493,19 +493,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||||
listeners->AppendElement((void*)ls);
|
listeners->AppendElement((void*)ls);
|
||||||
NS_ADDREF(aListener);
|
NS_ADDREF(aListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFlags & NS_EVENT_FLAG_CAPTURE) {
|
|
||||||
//If a capturer is set up on a content object it must register that with its doc
|
|
||||||
nsCOMPtr<nsIDocument> document;
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTarget));
|
|
||||||
if (content) {
|
|
||||||
content->GetDocument(*getter_AddRefs(document));
|
|
||||||
if (document) {
|
|
||||||
//Increment capturers by 1
|
|
||||||
document->EventCaptureRegistration(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -561,19 +548,6 @@ nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listenerRemoved && aFlags & NS_EVENT_FLAG_CAPTURE) {
|
|
||||||
//If a capturer is set up on a content object it must register that with its doc
|
|
||||||
nsCOMPtr<nsIDocument> document;
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTarget));
|
|
||||||
if (content) {
|
|
||||||
content->GetDocument(*getter_AddRefs(document));
|
|
||||||
if (document) {
|
|
||||||
//Decrement capturers by 1
|
|
||||||
document->EventCaptureRegistration(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
|
|
||||||
#include "nsXULAtoms.h"
|
#include "nsXULAtoms.h"
|
||||||
#include "nsIDOMXULElement.h"
|
#include "nsIDOMXULElement.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMKeyEvent.h"
|
#include "nsIDOMKeyEvent.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
|
@ -641,7 +641,6 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
|
||||||
nsCOMPtr<nsIFocusController> focusController;
|
nsCOMPtr<nsIFocusController> focusController;
|
||||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||||
nsCOMPtr<nsIDOMWindowInternal> focusedWindow;
|
nsCOMPtr<nsIDOMWindowInternal> focusedWindow;
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(mDocument);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObj;
|
nsCOMPtr<nsIScriptGlobalObject> globalObj;
|
||||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObj));
|
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObj));
|
||||||
|
@ -4479,7 +4478,7 @@ nsEventStateManager::DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*aPreventDefault = status == nsEventStatus_eConsumeNoDefault ? PR_FALSE : PR_TRUE;
|
*aPreventDefault = status != nsEventStatus_eConsumeNoDefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ CPPSRCS = \
|
||||||
nsMediaDocument.cpp \
|
nsMediaDocument.cpp \
|
||||||
nsPluginDocument.cpp \
|
nsPluginDocument.cpp \
|
||||||
nsImageDocument.cpp \
|
nsImageDocument.cpp \
|
||||||
nsMarkupDocument.cpp \
|
|
||||||
nsWyciwygChannel.cpp \
|
nsWyciwygChannel.cpp \
|
||||||
nsWyciwygProtocolHandler.cpp \
|
nsWyciwygProtocolHandler.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -39,12 +39,14 @@
|
||||||
#define nsHTMLDocument_h___
|
#define nsHTMLDocument_h___
|
||||||
|
|
||||||
#include "nsDocument.h"
|
#include "nsDocument.h"
|
||||||
#include "nsMarkupDocument.h"
|
|
||||||
#include "nsIHTMLDocument.h"
|
#include "nsIHTMLDocument.h"
|
||||||
#include "nsIDOMHTMLDocument.h"
|
#include "nsIDOMHTMLDocument.h"
|
||||||
#include "nsIDOMNSHTMLDocument.h"
|
#include "nsIDOMNSHTMLDocument.h"
|
||||||
#include "nsIDOMHTMLBodyElement.h"
|
#include "nsIDOMHTMLBodyElement.h"
|
||||||
|
#include "nsIDOMHTMLMapElement.h"
|
||||||
|
#include "nsIDOMHTMLCollection.h"
|
||||||
#include "nsIHTMLContentContainer.h"
|
#include "nsIHTMLContentContainer.h"
|
||||||
|
#include "nsIParser.h"
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "rdf.h"
|
#include "rdf.h"
|
||||||
#include "nsRDFCID.h"
|
#include "nsRDFCID.h"
|
||||||
|
@ -61,8 +63,6 @@
|
||||||
|
|
||||||
#include "nsICommandManager.h"
|
#include "nsICommandManager.h"
|
||||||
|
|
||||||
class nsBaseContentList;
|
|
||||||
class nsContentList;
|
|
||||||
class nsIParser;
|
class nsIParser;
|
||||||
class nsICSSLoader;
|
class nsICSSLoader;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
|
@ -70,7 +70,7 @@ class nsIMarkupDocumentViewer;
|
||||||
class nsIDocumentCharsetInfo;
|
class nsIDocumentCharsetInfo;
|
||||||
class nsICacheEntryDescriptor;
|
class nsICacheEntryDescriptor;
|
||||||
|
|
||||||
class nsHTMLDocument : public nsMarkupDocument,
|
class nsHTMLDocument : public nsDocument,
|
||||||
public nsIHTMLDocument,
|
public nsIHTMLDocument,
|
||||||
public nsIDOMHTMLDocument,
|
public nsIDOMHTMLDocument,
|
||||||
public nsIDOMNSHTMLDocument,
|
public nsIDOMNSHTMLDocument,
|
||||||
|
@ -86,6 +86,7 @@ public:
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||||
|
|
||||||
|
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||||
NS_IMETHOD ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup);
|
NS_IMETHOD ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup);
|
||||||
|
|
||||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||||
|
@ -116,7 +117,6 @@ public:
|
||||||
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aStyleSheet);
|
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aStyleSheet);
|
||||||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
||||||
|
|
||||||
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const;
|
|
||||||
NS_IMETHOD GetBaseTarget(nsAString& aTarget);
|
NS_IMETHOD GetBaseTarget(nsAString& aTarget);
|
||||||
NS_IMETHOD SetBaseTarget(const nsAString& aTarget);
|
NS_IMETHOD SetBaseTarget(const nsAString& aTarget);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public:
|
||||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||||
PRInt32 aNameSpaceID,
|
PRInt32 aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
PRInt32 aModType,
|
PRInt32 aModType,
|
||||||
nsChangeHint aHint);
|
nsChangeHint aHint);
|
||||||
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
|
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
|
||||||
PRInt32 aNameSpaceID,
|
PRInt32 aNameSpaceID,
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
NS_IMETHOD Write(const nsAString & text);
|
NS_IMETHOD Write(const nsAString & text);
|
||||||
NS_IMETHOD Writeln(const nsAString & text);
|
NS_IMETHOD Writeln(const nsAString & text);
|
||||||
NS_IMETHOD GetElementsByName(const nsAString & elementName,
|
NS_IMETHOD GetElementsByName(const nsAString & elementName,
|
||||||
nsIDOMNodeList **_retval);
|
nsIDOMNodeList **_retval);
|
||||||
|
|
||||||
// nsIDOMNSHTMLDocument interface
|
// nsIDOMNSHTMLDocument interface
|
||||||
NS_DECL_NSIDOMNSHTMLDOCUMENT
|
NS_DECL_NSIDOMNSHTMLDOCUMENT
|
||||||
|
@ -236,9 +236,9 @@ protected:
|
||||||
static void DocumentWriteTerminationFunc(nsISupports *aRef);
|
static void DocumentWriteTerminationFunc(nsISupports *aRef);
|
||||||
|
|
||||||
PRBool GetBodyContent();
|
PRBool GetBodyContent();
|
||||||
NS_IMETHOD GetBodyElement(nsIDOMHTMLBodyElement** aBody);
|
void GetBodyElement(nsIDOMHTMLBodyElement** aBody);
|
||||||
|
|
||||||
NS_IMETHOD GetDomainURI(nsIURI **uri);
|
void GetDomainURI(nsIURI **uri);
|
||||||
|
|
||||||
nsresult WriteCommon(const nsAString& aText,
|
nsresult WriteCommon(const nsAString& aText,
|
||||||
PRBool aNewlineTerminate);
|
PRBool aNewlineTerminate);
|
||||||
|
@ -254,73 +254,75 @@ protected:
|
||||||
|
|
||||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
||||||
nsCOMPtr<nsIHTMLCSSStyleSheet> mStyleAttrStyleSheet;
|
nsCOMPtr<nsIHTMLCSSStyleSheet> mStyleAttrStyleSheet;
|
||||||
nsIURI* mBaseURL;
|
|
||||||
nsString* mBaseTarget;
|
|
||||||
nsString* mLastModified;
|
|
||||||
nsString* mReferrer;
|
|
||||||
nsCOMPtr<nsIHttpChannel> mHttpChannel;
|
|
||||||
nsCompatibility mCompatMode;
|
|
||||||
nsCOMPtr<nsISupportsArray> mImageMaps;
|
|
||||||
|
|
||||||
nsContentList *mImages;
|
nsString mBaseTarget;
|
||||||
nsContentList *mApplets;
|
nsString mLastModified;
|
||||||
nsContentList *mEmbeds;
|
nsString mReferrer;
|
||||||
nsContentList *mLinks;
|
|
||||||
nsContentList *mAnchors;
|
nsCOMPtr<nsIHttpChannel> mHttpChannel;
|
||||||
nsContentList *mForms;
|
|
||||||
nsContentList *mLayers;
|
nsCompatibility mCompatMode;
|
||||||
|
|
||||||
nsIParser *mParser;
|
nsCOMArray<nsIDOMHTMLMapElement> mImageMaps;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMHTMLCollection> mImages;
|
||||||
|
nsCOMPtr<nsIDOMHTMLCollection> mApplets;
|
||||||
|
nsCOMPtr<nsIDOMHTMLCollection> mEmbeds;
|
||||||
|
nsCOMPtr<nsIDOMHTMLCollection> mLinks;
|
||||||
|
nsCOMPtr<nsIDOMHTMLCollection> mAnchors;
|
||||||
|
nsCOMPtr<nsIDOMHTMLCollection> mForms;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIParser> mParser;
|
||||||
|
|
||||||
/** # of forms in the document, synchronously set */
|
/** # of forms in the document, synchronously set */
|
||||||
PRInt32 mNumForms;
|
PRInt32 mNumForms;
|
||||||
|
|
||||||
//ahmed 12-2
|
// ahmed 12-2
|
||||||
PRInt32 mTexttype;
|
PRInt32 mTexttype;
|
||||||
|
|
||||||
static nsrefcnt gRefCntRDFService;
|
static nsrefcnt gRefCntRDFService;
|
||||||
static nsIRDFService* gRDF;
|
static nsIRDFService* gRDF;
|
||||||
|
|
||||||
static PRBool TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
static PRBool TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||||
PRInt32& aCharsetSource,
|
PRInt32& aCharsetSource,
|
||||||
nsAString& aCharset);
|
nsAString& aCharset);
|
||||||
static PRBool TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
static PRBool TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||||
nsIDocumentCharsetInfo* aDocInfo,
|
nsIDocumentCharsetInfo* aDocInfo,
|
||||||
PRInt32& aCharsetSource,
|
PRInt32& aCharsetSource,
|
||||||
nsAString& aCharset);
|
nsAString& aCharset);
|
||||||
static PRBool TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor,
|
static PRBool TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor,
|
||||||
PRInt32& aCharsetSource,
|
PRInt32& aCharsetSource,
|
||||||
nsAString& aCharset);
|
nsAString& aCharset);
|
||||||
static PRBool TryBookmarkCharset(nsAFlatCString* aUrlSpec,
|
static PRBool TryBookmarkCharset(nsAFlatCString* aUrlSpec,
|
||||||
PRInt32& aCharsetSource,
|
PRInt32& aCharsetSource,
|
||||||
nsAString& aCharset);
|
nsAString& aCharset);
|
||||||
static PRBool TryParentCharset(nsIDocumentCharsetInfo* aDocInfo,
|
static PRBool TryParentCharset(nsIDocumentCharsetInfo* aDocInfo,
|
||||||
PRInt32& charsetSource,
|
PRInt32& charsetSource, nsAString& aCharset);
|
||||||
nsAString& aCharset);
|
static PRBool UseWeakDocTypeDefault(PRInt32& aCharsetSource,
|
||||||
static PRBool UseWeakDocTypeDefault(PRInt32& aCharsetSource,
|
|
||||||
nsAString& aCharset);
|
nsAString& aCharset);
|
||||||
static PRBool TryChannelCharset(nsIChannel *aChannel,
|
static PRBool TryChannelCharset(nsIChannel *aChannel,
|
||||||
PRInt32& aCharsetSource,
|
PRInt32& aCharsetSource,
|
||||||
nsAString& aCharset);
|
nsAString& aCharset);
|
||||||
static PRBool TryDefaultCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
static PRBool TryDefaultCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||||
PRInt32& aCharsetSource,
|
PRInt32& aCharsetSource,
|
||||||
nsAString& aCharset);
|
nsAString& aCharset);
|
||||||
|
|
||||||
void StartAutodetection(nsIDocShell *aDocShell,
|
void StartAutodetection(nsIDocShell *aDocShell, nsAString& aCharset,
|
||||||
nsAString& aCharset,
|
|
||||||
const char* aCommand);
|
const char* aCommand);
|
||||||
|
|
||||||
PRUint32 mIsWriting : 1;
|
PRUint32 mIsWriting : 1;
|
||||||
PRUint32 mWriteLevel : 31;
|
PRUint32 mWriteLevel : 31;
|
||||||
PRUint32 mWyciwygSessionCnt;
|
PRUint32 mWyciwygSessionCnt;
|
||||||
|
|
||||||
|
// Load flags of the document's channel
|
||||||
|
PRUint32 mLoadFlags;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> mBodyContent;
|
nsCOMPtr<nsIDOMNode> mBodyContent;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bug 13871: Frameset spoofing - find out if document.domain was set
|
* Bug 13871: Frameset spoofing - find out if document.domain was set
|
||||||
*/
|
*/
|
||||||
PRPackedBool mDomainWasSet;
|
PRPackedBool mDomainWasSet;
|
||||||
PRPackedBool mIdAndNameHashIsLive;
|
|
||||||
|
|
||||||
PLDHashTable mIdAndNameHashTable;
|
PLDHashTable mIdAndNameHashTable;
|
||||||
|
|
||||||
|
@ -339,7 +341,7 @@ protected:
|
||||||
|
|
||||||
nsresult DoClipboardSecurityCheck(PRBool aPaste);
|
nsresult DoClipboardSecurityCheck(PRBool aPaste);
|
||||||
static jsval sCutCopyInternal_id;
|
static jsval sCutCopyInternal_id;
|
||||||
static jsval sPasteInternal_id;
|
static jsval sPasteInternal_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsHTMLDocument_h___ */
|
#endif /* nsHTMLDocument_h___ */
|
||||||
|
|
|
@ -832,7 +832,7 @@ nsHTMLFragmentContentSink::AddTextToContent(nsIHTMLContent* aContent,const nsStr
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
text->SetText(aText, PR_TRUE);
|
text->SetText(aText, PR_TRUE);
|
||||||
|
|
||||||
result=aContent->AppendChildTo(text, PR_FALSE, PR_FALSE);
|
result = aContent->AppendChildTo(text, PR_FALSE, PR_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,6 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetNumFormsSynchronous(PRInt32* aNumForms) = 0;
|
NS_IMETHOD GetNumFormsSynchronous(PRInt32* aNumForms) = 0;
|
||||||
|
|
||||||
NS_IMETHOD GetBodyElement(nsIDOMHTMLBodyElement** aBody) = 0;
|
|
||||||
|
|
||||||
NS_IMETHOD_(PRBool) IsWriting() = 0;
|
NS_IMETHOD_(PRBool) IsWriting() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -180,15 +180,16 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
||||||
return nsMediaDocumentStreamListener::OnStopRequest(request, ctxt, status);
|
return nsMediaDocumentStreamListener::OnStopRequest(request, ctxt, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
|
// bother initializing members to 0.
|
||||||
|
|
||||||
nsImageDocument::nsImageDocument()
|
nsImageDocument::nsImageDocument()
|
||||||
: mVisibleWidth(0),
|
|
||||||
mVisibleHeight(0),
|
|
||||||
mImageWidth(0),
|
|
||||||
mImageHeight(0),
|
|
||||||
mImageResizingEnabled(PR_FALSE),
|
|
||||||
mImageIsOverflowing(PR_FALSE),
|
|
||||||
mImageIsResized(PR_FALSE)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
|
// bother initializing members to 0.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsImageDocument::~nsImageDocument()
|
nsImageDocument::~nsImageDocument()
|
||||||
|
@ -198,8 +199,8 @@ nsImageDocument::~nsImageDocument()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsHTMLDocument)
|
NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsMediaDocument)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsHTMLDocument)
|
NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsMediaDocument)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsImageDocument)
|
NS_INTERFACE_MAP_BEGIN(nsImageDocument)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIImageDocument)
|
NS_INTERFACE_MAP_ENTRY(nsIImageDocument)
|
||||||
|
@ -207,7 +208,7 @@ NS_INTERFACE_MAP_BEGIN(nsImageDocument)
|
||||||
NS_INTERFACE_MAP_ENTRY(imgIContainerObserver)
|
NS_INTERFACE_MAP_ENTRY(imgIContainerObserver)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
|
||||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ImageDocument)
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ImageDocument)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(nsHTMLDocument)
|
NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument)
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -243,9 +244,10 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
|
||||||
PRBool aReset,
|
PRBool aReset,
|
||||||
nsIContentSink* aSink)
|
nsIContentSink* aSink)
|
||||||
{
|
{
|
||||||
nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
nsresult rv =
|
||||||
aContainer, aDocListener, aReset,
|
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
||||||
aSink);
|
aContainer, aDocListener, aReset,
|
||||||
|
aSink);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +280,8 @@ nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObjec
|
||||||
|
|
||||||
target = do_QueryInterface(mScriptGlobalObject);
|
target = do_QueryInterface(mScriptGlobalObject);
|
||||||
target->RemoveEventListener(NS_LITERAL_STRING("resize"), this, PR_FALSE);
|
target->RemoveEventListener(NS_LITERAL_STRING("resize"), this, PR_FALSE);
|
||||||
target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, PR_FALSE);
|
target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this,
|
||||||
|
PR_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +291,7 @@ nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObjec
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aScriptGlobalObject) {
|
if (aScriptGlobalObject) {
|
||||||
// Create synthetic document
|
// Create synthetic document
|
||||||
rv = CreateSyntheticDocument();
|
rv = CreateSyntheticDocument();
|
||||||
|
@ -512,8 +515,9 @@ nsImageDocument::CreateSyntheticDocument()
|
||||||
if (mStringBundle) {
|
if (mStringBundle) {
|
||||||
const PRUnichar* formatString[1] = { srcString.get() };
|
const PRUnichar* formatString[1] = { srcString.get() };
|
||||||
nsXPIDLString errorMsg;
|
nsXPIDLString errorMsg;
|
||||||
rv = mStringBundle->FormatStringFromName(NS_LITERAL_STRING("InvalidImage").get(),
|
NS_NAMED_LITERAL_STRING(str, "InvalidImage");
|
||||||
formatString, 1, getter_Copies(errorMsg));
|
mStringBundle->FormatStringFromName(str.get(), formatString, 1,
|
||||||
|
getter_Copies(errorMsg));
|
||||||
|
|
||||||
image->SetAttr(kNameSpaceID_None, nsHTMLAtoms::alt, errorMsg, PR_FALSE);
|
image->SetAttr(kNameSpaceID_None, nsHTMLAtoms::alt, errorMsg, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -539,7 +543,8 @@ nsImageDocument::CheckOverflowing()
|
||||||
context->GetVisibleArea(visibleArea);
|
context->GetVisibleArea(visibleArea);
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mBodyContent);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(mBodyContent);
|
||||||
nsRefPtr<nsStyleContext> styleContext = context->ResolveStyleContextFor(content, nsnull);
|
nsRefPtr<nsStyleContext> styleContext =
|
||||||
|
context->ResolveStyleContextFor(content, nsnull);
|
||||||
|
|
||||||
const nsStyleMargin* marginData =
|
const nsStyleMargin* marginData =
|
||||||
(const nsStyleMargin*)styleContext->GetStyleData(eStyleStruct_Margin);
|
(const nsStyleMargin*)styleContext->GetStyleData(eStyleStruct_Margin);
|
||||||
|
@ -557,7 +562,8 @@ nsImageDocument::CheckOverflowing()
|
||||||
mVisibleWidth = NSTwipsToIntPixels(visibleArea.width, t2p);
|
mVisibleWidth = NSTwipsToIntPixels(visibleArea.width, t2p);
|
||||||
mVisibleHeight = NSTwipsToIntPixels(visibleArea.height, t2p);
|
mVisibleHeight = NSTwipsToIntPixels(visibleArea.height, t2p);
|
||||||
|
|
||||||
mImageIsOverflowing = mImageWidth > mVisibleWidth || mImageHeight > mVisibleHeight;
|
mImageIsOverflowing =
|
||||||
|
mImageWidth > mVisibleWidth || mImageHeight > mVisibleHeight;
|
||||||
|
|
||||||
if (mImageIsOverflowing) {
|
if (mImageIsOverflowing) {
|
||||||
ShrinkToFit();
|
ShrinkToFit();
|
||||||
|
@ -569,8 +575,8 @@ nsImageDocument::CheckOverflowing()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
nsresult nsImageDocument::UpdateTitle()
|
nsImageDocument::UpdateTitle()
|
||||||
{
|
{
|
||||||
if (mStringBundle) {
|
if (mStringBundle) {
|
||||||
nsXPIDLString fileStr;
|
nsXPIDLString fileStr;
|
||||||
|
@ -584,12 +590,13 @@ nsresult nsImageDocument::UpdateTitle()
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCAutoString fileName;
|
nsCAutoString fileName;
|
||||||
url->GetFileName(fileName);
|
url->GetFileName(fileName);
|
||||||
nsCOMPtr<nsITextToSubURI> textToSubURI = do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
|
nsCOMPtr<nsITextToSubURI> textToSubURI =
|
||||||
|
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
{
|
{
|
||||||
nsCAutoString originCharset;
|
nsCAutoString originCharset;
|
||||||
rv = url->GetOriginCharset(originCharset);
|
rv = url->GetOriginCharset(originCharset);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = textToSubURI->UnEscapeURIForUI(originCharset, fileName, fileStr);
|
rv = textToSubURI->UnEscapeURIForUI(originCharset, fileName, fileStr);
|
||||||
}
|
}
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
|
@ -607,7 +614,8 @@ nsresult nsImageDocument::UpdateTitle()
|
||||||
mimeType.BeginReading(start);
|
mimeType.BeginReading(start);
|
||||||
mimeType.EndReading(end);
|
mimeType.EndReading(end);
|
||||||
nsXPIDLCString::const_iterator iter = end;
|
nsXPIDLCString::const_iterator iter = end;
|
||||||
if (FindInReadable(NS_LITERAL_CSTRING("IMAGE/"), start, iter) && iter != end) {
|
if (FindInReadable(NS_LITERAL_CSTRING("IMAGE/"), start, iter) &&
|
||||||
|
iter != end) {
|
||||||
// strip out "X-" if any
|
// strip out "X-" if any
|
||||||
if (*iter == 'X') {
|
if (*iter == 'X') {
|
||||||
++iter;
|
++iter;
|
||||||
|
@ -631,20 +639,46 @@ nsresult nsImageDocument::UpdateTitle()
|
||||||
if (!fileStr.IsEmpty()) {
|
if (!fileStr.IsEmpty()) {
|
||||||
// if we got a valid size (sometimes we do not) then display it
|
// if we got a valid size (sometimes we do not) then display it
|
||||||
if (mImageWidth != 0 && mImageHeight != 0){
|
if (mImageWidth != 0 && mImageHeight != 0){
|
||||||
const PRUnichar *formatStrings[4] = {fileStr.get(), typeStr.get(), widthStr.get(), heightStr.get()};
|
const PRUnichar *formatStrings[4] =
|
||||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithDimensionsAndFile").get(), formatStrings, 4, getter_Copies(valUni));
|
{
|
||||||
|
fileStr.get(),
|
||||||
|
typeStr.get(),
|
||||||
|
widthStr.get(),
|
||||||
|
heightStr.get()
|
||||||
|
};
|
||||||
|
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithDimensionsAndFile");
|
||||||
|
mStringBundle->FormatStringFromName(str.get(), formatStrings, 4,
|
||||||
|
getter_Copies(valUni));
|
||||||
} else {
|
} else {
|
||||||
const PRUnichar *formatStrings[2] = {fileStr.get(), typeStr.get()};
|
const PRUnichar *formatStrings[2] =
|
||||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithoutDimensions").get(), formatStrings, 2, getter_Copies(valUni));
|
{
|
||||||
|
fileStr.get(),
|
||||||
|
typeStr.get()
|
||||||
|
};
|
||||||
|
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithoutDimensions");
|
||||||
|
mStringBundle->FormatStringFromName(str.get(), formatStrings, 2,
|
||||||
|
getter_Copies(valUni));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if we got a valid size (sometimes we do not) then display it
|
// if we got a valid size (sometimes we do not) then display it
|
||||||
if (mImageWidth != 0 && mImageHeight != 0){
|
if (mImageWidth != 0 && mImageHeight != 0){
|
||||||
const PRUnichar *formatStrings[3] = {typeStr.get(), widthStr.get(), heightStr.get()};
|
const PRUnichar *formatStrings[3] =
|
||||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithDimensions").get(), formatStrings, 3, getter_Copies(valUni));
|
{
|
||||||
|
typeStr.get(),
|
||||||
|
widthStr.get(),
|
||||||
|
heightStr.get()
|
||||||
|
};
|
||||||
|
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithDimensions");
|
||||||
|
mStringBundle->FormatStringFromName(str.get(), formatStrings, 3,
|
||||||
|
getter_Copies(valUni));
|
||||||
} else {
|
} else {
|
||||||
const PRUnichar *formatStrings[1] = {typeStr.get()};
|
const PRUnichar *formatStrings[1] =
|
||||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithNeitherDimensionsNorFile").get(), formatStrings, 1, getter_Copies(valUni));
|
{
|
||||||
|
typeStr.get()
|
||||||
|
};
|
||||||
|
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithNeitherDimensionsNorFile");
|
||||||
|
mStringBundle->FormatStringFromName(str.get(), formatStrings, 1,
|
||||||
|
getter_Copies(valUni));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,25 +62,34 @@ public:
|
||||||
nsIContentSink* aSink = nsnull);
|
nsIContentSink* aSink = nsnull);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsresult CreateSyntheticDocument(nsACString &aMimeType);
|
nsresult CreateSyntheticPluginDocument(nsACString &aMimeType);
|
||||||
|
|
||||||
nsCOMPtr<nsIHTMLContent> mPluginContent;
|
nsCOMPtr<nsIHTMLContent> mPluginContent;
|
||||||
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
|
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
|
// bother initializing members to 0.
|
||||||
|
|
||||||
nsPluginDocument::nsPluginDocument()
|
nsPluginDocument::nsPluginDocument()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
|
// bother initializing members to 0.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsPluginDocument::~nsPluginDocument()
|
nsPluginDocument::~nsPluginDocument()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsHTMLDocument)
|
NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsMediaDocument)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsHTMLDocument)
|
NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsMediaDocument)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsPluginDocument)
|
NS_INTERFACE_MAP_BEGIN(nsPluginDocument)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIPluginDocument)
|
NS_INTERFACE_MAP_ENTRY(nsIPluginDocument)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(nsHTMLDocument)
|
NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -92,9 +101,10 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
|
||||||
PRBool aReset,
|
PRBool aReset,
|
||||||
nsIContentSink* aSink)
|
nsIContentSink* aSink)
|
||||||
{
|
{
|
||||||
nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
nsresult rv =
|
||||||
aContainer, aDocListener, aReset,
|
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
||||||
aSink);
|
aContainer, aDocListener, aReset,
|
||||||
|
aSink);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +116,7 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create synthetic document
|
// Create synthetic document
|
||||||
rv = CreateSyntheticDocument(mimeType);
|
rv = CreateSyntheticPluginDocument(mimeType);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +130,8 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsPluginDocument::CreateSyntheticDocument(nsACString &aMimeType)
|
nsresult
|
||||||
|
nsPluginDocument::CreateSyntheticPluginDocument(nsACString &aMimeType)
|
||||||
{
|
{
|
||||||
// do not allow message panes to host full-page plugins
|
// do not allow message panes to host full-page plugins
|
||||||
// returning an error causes helper apps to take over
|
// returning an error causes helper apps to take over
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -792,7 +792,7 @@ nsXBLPrototypeBinding::InitClass(const nsCString& aClassName,
|
||||||
nsIScriptContext * aContext,
|
nsIScriptContext * aContext,
|
||||||
void * aScriptObject, void ** aClassObject)
|
void * aScriptObject, void ** aClassObject)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER (aClassObject);
|
NS_ENSURE_ARG_POINTER(aClassObject);
|
||||||
|
|
||||||
*aClassObject = nsnull;
|
*aClassObject = nsnull;
|
||||||
|
|
||||||
|
|
|
@ -1266,22 +1266,23 @@ nsXMLContentSink::FlushText(PRBool aCreateTextNode, PRBool* aDidFlush)
|
||||||
PRBool didFlush = PR_FALSE;
|
PRBool didFlush = PR_FALSE;
|
||||||
if (0 != mTextLength) {
|
if (0 != mTextLength) {
|
||||||
if (aCreateTextNode) {
|
if (aCreateTextNode) {
|
||||||
nsCOMPtr<nsITextContent> content;
|
nsCOMPtr<nsITextContent> textContent;
|
||||||
rv = NS_NewTextNode(getter_AddRefs(content));
|
rv = NS_NewTextNode(getter_AddRefs(textContent));
|
||||||
if (NS_OK == rv) {
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
// Set the content's document
|
|
||||||
content->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
|
||||||
|
|
||||||
// Set the text in the text node
|
// Set the content's document
|
||||||
content->SetText(mText, mTextLength, PR_FALSE);
|
textContent->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
||||||
|
|
||||||
// Add text to its parent
|
// Set the text in the text node
|
||||||
AddContentAsLeaf(content);
|
textContent->SetText(mText, mTextLength, PR_FALSE);
|
||||||
}
|
|
||||||
|
// Add text to its parent
|
||||||
|
AddContentAsLeaf(textContent);
|
||||||
}
|
}
|
||||||
mTextLength = 0;
|
mTextLength = 0;
|
||||||
didFlush = PR_TRUE;
|
didFlush = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != aDidFlush) {
|
if (nsnull != aDidFlush) {
|
||||||
*aDidFlush = didFlush;
|
*aDidFlush = didFlush;
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,12 +183,15 @@ NS_NewXMLDocument(nsIDocument** aInstancePtrResult)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
|
// bother initializing members to 0.
|
||||||
|
|
||||||
nsXMLDocument::nsXMLDocument()
|
nsXMLDocument::nsXMLDocument()
|
||||||
: mCountCatalogSheets(0), mCrossSiteAccessEnabled(PR_FALSE),
|
: mAsync(PR_TRUE)
|
||||||
mLoadedAsData(PR_FALSE), mAsync(PR_TRUE),
|
|
||||||
mLoopingForSyncLoad(PR_FALSE), mXMLDeclarationBits(0)
|
|
||||||
{
|
{
|
||||||
mEventQService = do_GetService(kEventQueueServiceCID);
|
|
||||||
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
|
// bother initializing members to 0.
|
||||||
}
|
}
|
||||||
|
|
||||||
nsXMLDocument::~nsXMLDocument()
|
nsXMLDocument::~nsXMLDocument()
|
||||||
|
@ -223,6 +226,17 @@ NS_IMPL_ADDREF_INHERITED(nsXMLDocument, nsDocument)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsXMLDocument, nsDocument)
|
NS_IMPL_RELEASE_INHERITED(nsXMLDocument, nsDocument)
|
||||||
|
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsXMLDocument::Init()
|
||||||
|
{
|
||||||
|
nsresult rv = nsDocument::Init();
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
mEventQService = do_GetService(kEventQueueServiceCID, &rv);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
nsXMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
||||||
{
|
{
|
||||||
|
@ -390,19 +404,20 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn)
|
||||||
|
|
||||||
// Partial Reset, need to restore principal for security reasons and
|
// Partial Reset, need to restore principal for security reasons and
|
||||||
// event listener manager so that load listeners etc. will remain.
|
// event listener manager so that load listeners etc. will remain.
|
||||||
nsCOMPtr<nsIPrincipal> principal = mPrincipal;
|
|
||||||
nsCOMPtr<nsIEventListenerManager> elm = mListenerManager;
|
nsCOMPtr<nsIPrincipal> principal(mPrincipal);
|
||||||
|
nsCOMPtr<nsIEventListenerManager> elm(mListenerManager);
|
||||||
|
|
||||||
Reset(nsnull, nsnull);
|
Reset(nsnull, nsnull);
|
||||||
|
|
||||||
mPrincipal = principal;
|
mPrincipal = principal;
|
||||||
mListenerManager = elm;
|
mListenerManager = elm;
|
||||||
NS_IF_ADDREF(mListenerManager);
|
|
||||||
|
|
||||||
SetDocumentURL(uri);
|
SetDocumentURL(uri);
|
||||||
SetBaseURL(uri);
|
SetBaseURL(uri);
|
||||||
|
|
||||||
// Store script context, if any, in case we encounter redirect (because we need it there)
|
// Store script context, if any, in case we encounter redirect
|
||||||
|
// (because we need it there)
|
||||||
nsCOMPtr<nsIJSContextStack> stack =
|
nsCOMPtr<nsIJSContextStack> stack =
|
||||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||||
if (stack) {
|
if (stack) {
|
||||||
|
@ -415,10 +430,11 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find out if UniversalBrowserRead privileges are enabled - we will need this
|
// Find out if UniversalBrowserRead privileges are enabled - we will
|
||||||
// in case of a redirect
|
// need this in case of a redirect
|
||||||
PRBool crossSiteAccessEnabled;
|
PRBool crossSiteAccessEnabled;
|
||||||
rv = secMan->IsCapabilityEnabled("UniversalBrowserRead", &crossSiteAccessEnabled);
|
rv = secMan->IsCapabilityEnabled("UniversalBrowserRead",
|
||||||
|
&crossSiteAccessEnabled);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
mCrossSiteAccessEnabled = crossSiteAccessEnabled;
|
mCrossSiteAccessEnabled = crossSiteAccessEnabled;
|
||||||
|
@ -428,15 +444,15 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn)
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// Set a principal for this document
|
// Set a principal for this document
|
||||||
mPrincipal = nsnull;
|
|
||||||
nsCOMPtr<nsISupports> channelOwner;
|
nsCOMPtr<nsISupports> channelOwner;
|
||||||
rv = channel->GetOwner(getter_AddRefs(channelOwner));
|
rv = channel->GetOwner(getter_AddRefs(channelOwner));
|
||||||
if (NS_SUCCEEDED(rv) && channelOwner) {
|
|
||||||
mPrincipal = do_QueryInterface(channelOwner, &rv);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NS_FAILED(rv) || !channelOwner)
|
// We don't care if GetOwner() succeeded here, if it failed,
|
||||||
{
|
// channelOwner will be null, which is what we want in that case.
|
||||||
|
|
||||||
|
mPrincipal = do_QueryInterface(channelOwner);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv) || !mPrincipal) {
|
||||||
rv = secMan->GetCodebasePrincipal(uri, getter_AddRefs(mPrincipal));
|
rv = secMan->GetCodebasePrincipal(uri, getter_AddRefs(mPrincipal));
|
||||||
NS_ENSURE_TRUE(mPrincipal, rv);
|
NS_ENSURE_TRUE(mPrincipal, rv);
|
||||||
}
|
}
|
||||||
|
@ -661,19 +677,20 @@ nsXMLDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
// subclass hook for sheet ordering
|
// subclass hook for sheet ordering
|
||||||
void nsXMLDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags)
|
void
|
||||||
|
nsXMLDocument::InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags)
|
||||||
{
|
{
|
||||||
// XXXbz this catalog stuff should be in the UA level in the cascade!
|
// XXXbz this catalog stuff should be in the UA level in the cascade!
|
||||||
if (aFlags & NS_STYLESHEET_FROM_CATALOG) {
|
if (aFlags & NS_STYLESHEET_FROM_CATALOG) {
|
||||||
// always after other catalog sheets
|
// always after other catalog sheets
|
||||||
mStyleSheets.InsertObjectAt(aSheet, mCountCatalogSheets);
|
mStyleSheets.InsertObjectAt(aSheet, mCatalogSheetCount);
|
||||||
++mCountCatalogSheets;
|
++mCatalogSheetCount;
|
||||||
}
|
}
|
||||||
else if (aSheet == mAttrStyleSheet) { // always after catalog sheets
|
else if (aSheet == mAttrStyleSheet) { // always after catalog sheets
|
||||||
NS_ASSERTION(mStyleSheets.Count() == 0 ||
|
NS_ASSERTION(mStyleSheets.Count() == 0 ||
|
||||||
mAttrStyleSheet != mStyleSheets[0],
|
mAttrStyleSheet != mStyleSheets[0],
|
||||||
"Adding attr sheet twice!");
|
"Adding attr sheet twice!");
|
||||||
mStyleSheets.InsertObjectAt(aSheet, mCountCatalogSheets);
|
mStyleSheets.InsertObjectAt(aSheet, mCatalogSheetCount);
|
||||||
}
|
}
|
||||||
else if (aSheet == mInlineStyleSheet) { // always last
|
else if (aSheet == mInlineStyleSheet) { // always last
|
||||||
NS_ASSERTION(mStyleSheets.Count() == 0 ||
|
NS_ASSERTION(mStyleSheets.Count() == 0 ||
|
||||||
|
@ -702,13 +719,13 @@ nsXMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex)
|
||||||
/* Don't count Attribute stylesheet */
|
/* Don't count Attribute stylesheet */
|
||||||
- 1
|
- 1
|
||||||
/* Don't count catalog sheets */
|
/* Don't count catalog sheets */
|
||||||
- mCountCatalogSheets
|
- mCatalogSheetCount
|
||||||
/* No insertion allowed after StyleAttr stylesheet */
|
/* No insertion allowed after StyleAttr stylesheet */
|
||||||
- (mInlineStyleSheet ? 1: 0)
|
- (mInlineStyleSheet ? 1: 0)
|
||||||
),
|
),
|
||||||
"index out of bounds");
|
"index out of bounds");
|
||||||
// offset w.r.t. catalog style sheets and the attr style sheet
|
// offset w.r.t. catalog style sheets and the attr style sheet
|
||||||
mStyleSheets.InsertObjectAt(aSheet, aIndex + mCountCatalogSheets + 1);
|
mStyleSheets.InsertObjectAt(aSheet, aIndex + mCatalogSheetCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIStyleSheet>
|
already_AddRefed<nsIStyleSheet>
|
||||||
|
@ -717,7 +734,7 @@ nsXMLDocument::InternalGetStyleSheetAt(PRInt32 aIndex)
|
||||||
PRInt32 count = InternalGetNumberOfStyleSheets();
|
PRInt32 count = InternalGetNumberOfStyleSheets();
|
||||||
|
|
||||||
if (aIndex >= 0 && aIndex < count) {
|
if (aIndex >= 0 && aIndex < count) {
|
||||||
nsIStyleSheet* sheet = mStyleSheets[aIndex + mCountCatalogSheets + 1];
|
nsIStyleSheet* sheet = mStyleSheets[aIndex + mCatalogSheetCount + 1];
|
||||||
NS_ADDREF(sheet);
|
NS_ADDREF(sheet);
|
||||||
return sheet;
|
return sheet;
|
||||||
} else {
|
} else {
|
||||||
|
@ -730,10 +747,21 @@ PRInt32
|
||||||
nsXMLDocument::InternalGetNumberOfStyleSheets()
|
nsXMLDocument::InternalGetNumberOfStyleSheets()
|
||||||
{
|
{
|
||||||
PRInt32 count = mStyleSheets.Count();
|
PRInt32 count = mStyleSheets.Count();
|
||||||
if (count != 0 && mInlineStyleSheet == mStyleSheets[count - 1])
|
|
||||||
|
if (count != 0 && mInlineStyleSheet == mStyleSheets[count - 1]) {
|
||||||
|
// subtract the inline style sheet
|
||||||
--count;
|
--count;
|
||||||
count -= (mCountCatalogSheets + 1); // +1 for the attr sheet
|
}
|
||||||
NS_ASSERTION(count >= 0, "Why did we end up with a negative count?");
|
|
||||||
|
if (count != 0 && mAttrStyleSheet == mStyleSheets[mCatalogSheetCount]) {
|
||||||
|
// subtract the attr sheet
|
||||||
|
--count;
|
||||||
|
}
|
||||||
|
|
||||||
|
count -= mCatalogSheetCount;
|
||||||
|
|
||||||
|
NS_ASSERTION(count >= 0, "How did we get a negative count?");
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,7 +773,8 @@ nsXMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn)
|
nsXMLDocument::CreateCDATASection(const nsAString& aData,
|
||||||
|
nsIDOMCDATASection** aReturn)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aReturn);
|
NS_ENSURE_ARG_POINTER(aReturn);
|
||||||
*aReturn = nsnull;
|
*aReturn = nsnull;
|
||||||
|
@ -769,7 +798,8 @@ nsXMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** a
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXMLDocument::CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn)
|
nsXMLDocument::CreateEntityReference(const nsAString& aName,
|
||||||
|
nsIDOMEntityReference** aReturn)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aReturn);
|
NS_ENSURE_ARG_POINTER(aReturn);
|
||||||
|
|
||||||
|
@ -1085,18 +1115,19 @@ nsXMLDocument::GetBaseTarget(nsAString &aBaseTarget)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
nsXMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
||||||
{
|
{
|
||||||
nsresult result = NS_OK;
|
if (!mCSSLoader) {
|
||||||
if (! mCSSLoader) {
|
nsresult rv = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader));
|
||||||
result = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader));
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
if (mCSSLoader) {
|
|
||||||
mCSSLoader->SetCaseSensitive(PR_TRUE);
|
mCSSLoader->SetCaseSensitive(PR_TRUE);
|
||||||
// No quirks in XML
|
// no quirks in XML
|
||||||
mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards);
|
mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aLoader = mCSSLoader;
|
aLoader = mCSSLoader;
|
||||||
NS_IF_ADDREF(aLoader);
|
NS_IF_ADDREF(aLoader);
|
||||||
return result;
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#ifndef nsXMLDocument_h___
|
#ifndef nsXMLDocument_h___
|
||||||
#define nsXMLDocument_h___
|
#define nsXMLDocument_h___
|
||||||
|
|
||||||
#include "nsMarkupDocument.h"
|
#include "nsDocument.h"
|
||||||
#include "nsIXMLDocument.h"
|
#include "nsIXMLDocument.h"
|
||||||
#include "nsIHTMLContentContainer.h"
|
#include "nsIHTMLContentContainer.h"
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
@ -61,7 +61,7 @@ class nsIURI;
|
||||||
#define XML_DECLARATION_BITS_STANDALONE_EXISTS 4
|
#define XML_DECLARATION_BITS_STANDALONE_EXISTS 4
|
||||||
#define XML_DECLARATION_BITS_STANDALONE_YES 8
|
#define XML_DECLARATION_BITS_STANDALONE_YES 8
|
||||||
|
|
||||||
class nsXMLDocument : public nsMarkupDocument,
|
class nsXMLDocument : public nsDocument,
|
||||||
public nsIXMLDocument,
|
public nsIXMLDocument,
|
||||||
public nsIHTMLContentContainer,
|
public nsIHTMLContentContainer,
|
||||||
public nsIInterfaceRequestor,
|
public nsIInterfaceRequestor,
|
||||||
|
@ -78,8 +78,7 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||||
|
|
||||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* channel,
|
||||||
nsIChannel* channel,
|
|
||||||
nsILoadGroup* aLoadGroup,
|
nsILoadGroup* aLoadGroup,
|
||||||
nsISupports* aContainer,
|
nsISupports* aContainer,
|
||||||
nsIStreamListener **aDocListener,
|
nsIStreamListener **aDocListener,
|
||||||
|
@ -95,23 +94,25 @@ public:
|
||||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||||
|
|
||||||
// nsIDOMDocument interface
|
// nsIDOMDocument interface
|
||||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType);
|
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType);
|
||||||
NS_IMETHOD CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn);
|
NS_IMETHOD CreateCDATASection(const nsAString& aData,
|
||||||
NS_IMETHOD CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn);
|
nsIDOMCDATASection** aReturn);
|
||||||
NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget, const nsAString& aData, nsIDOMProcessingInstruction** aReturn);
|
NS_IMETHOD CreateEntityReference(const nsAString& aName,
|
||||||
NS_IMETHOD CreateElement(const nsAString& aTagName,
|
nsIDOMEntityReference** aReturn);
|
||||||
nsIDOMElement** aReturn);
|
NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget,
|
||||||
NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode,
|
const nsAString& aData,
|
||||||
PRBool aDeep,
|
nsIDOMProcessingInstruction** aReturn);
|
||||||
nsIDOMNode** aReturn);
|
NS_IMETHOD CreateElement(const nsAString& aTagName, nsIDOMElement** aReturn);
|
||||||
NS_IMETHOD CreateElementNS(const nsAString& aNamespaceURI,
|
NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep,
|
||||||
|
nsIDOMNode** aReturn);
|
||||||
|
NS_IMETHOD CreateElementNS(const nsAString& aNamespaceURI,
|
||||||
|
const nsAString& aQualifiedName,
|
||||||
|
nsIDOMElement** aReturn);
|
||||||
|
NS_IMETHOD CreateAttributeNS(const nsAString& aNamespaceURI,
|
||||||
const nsAString& aQualifiedName,
|
const nsAString& aQualifiedName,
|
||||||
nsIDOMElement** aReturn);
|
nsIDOMAttr** aReturn);
|
||||||
NS_IMETHOD CreateAttributeNS(const nsAString& aNamespaceURI,
|
NS_IMETHOD GetElementById(const nsAString& aElementId,
|
||||||
const nsAString& aQualifiedName,
|
nsIDOMElement** aReturn);
|
||||||
nsIDOMAttr** aReturn);
|
|
||||||
NS_IMETHOD GetElementById(const nsAString& aElementId,
|
|
||||||
nsIDOMElement** aReturn);
|
|
||||||
|
|
||||||
// nsIXMLDocument interface
|
// nsIXMLDocument interface
|
||||||
NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl);
|
NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl);
|
||||||
|
@ -128,7 +129,7 @@ public:
|
||||||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
||||||
|
|
||||||
// nsIInterfaceRequestor
|
// nsIInterfaceRequestor
|
||||||
NS_IMETHOD GetInterface(const nsIID& aIID, void** aSink);
|
NS_DECL_NSIINTERFACEREQUESTOR
|
||||||
|
|
||||||
// nsIHTTPEventSink
|
// nsIHTTPEventSink
|
||||||
NS_DECL_NSIHTTPEVENTSINK
|
NS_DECL_NSIHTTPEVENTSINK
|
||||||
|
@ -136,6 +137,8 @@ public:
|
||||||
// nsIDOMXMLDocument
|
// nsIDOMXMLDocument
|
||||||
NS_DECL_NSIDOMXMLDOCUMENT
|
NS_DECL_NSIDOMXMLDOCUMENT
|
||||||
|
|
||||||
|
virtual nsresult Init();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// subclass hooks for sheet ordering
|
// subclass hooks for sheet ordering
|
||||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
|
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
|
||||||
|
@ -144,7 +147,7 @@ protected:
|
||||||
virtual PRInt32 InternalGetNumberOfStyleSheets();
|
virtual PRInt32 InternalGetNumberOfStyleSheets();
|
||||||
|
|
||||||
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIDOMElement** aResult);
|
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIDOMElement** aResult);
|
||||||
|
|
||||||
// For HTML elements in our content model
|
// For HTML elements in our content model
|
||||||
// XXX This is not clean, but is there a better way?
|
// XXX This is not clean, but is there a better way?
|
||||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
||||||
|
@ -152,7 +155,7 @@ protected:
|
||||||
// For additional catalog sheets (if any) needed to layout the XML vocabulary
|
// For additional catalog sheets (if any) needed to layout the XML vocabulary
|
||||||
// of the document. Catalog sheets are kept at the beginning of our array of
|
// of the document. Catalog sheets are kept at the beginning of our array of
|
||||||
// style sheets and this counter is used as an offset to distinguish them
|
// style sheets and this counter is used as an offset to distinguish them
|
||||||
PRInt32 mCountCatalogSheets;
|
PRInt32 mCatalogSheetCount;
|
||||||
nsString mBaseTarget;
|
nsString mBaseTarget;
|
||||||
|
|
||||||
nsCOMPtr<nsIEventQueueService> mEventQService;
|
nsCOMPtr<nsIEventQueueService> mEventQService;
|
||||||
|
|
|
@ -1,418 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*/
|
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is mozilla.org code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Netscape Communications Corporation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Heikki Toivonen <heikki@netscape.com> (original author)
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation for the XPointer family of specifications, practically the
|
|
||||||
* XPointer Processor. The processor can call optional modules that implement
|
|
||||||
* some XPointer schemes that were not implemented in this file. Please note
|
|
||||||
* that implementation of the xmlns scheme is left to the optional scheme
|
|
||||||
* implementations - all the information they need will be passed in.
|
|
||||||
*
|
|
||||||
* The framework:
|
|
||||||
* http://www.w3.org/TR/xptr-framework/
|
|
||||||
* The element scheme:
|
|
||||||
* http://www.w3.org/TR/xptr-element/
|
|
||||||
*
|
|
||||||
* Additionally this module implements 'fixptr' scheme for the FIXptr
|
|
||||||
* W3C proposal:
|
|
||||||
* http://lists.w3.org/Archives/Public/www-xml-linking-comments/2001AprJun/att-0074/01-NOTE-FIXptr-20010425.htm
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// - xpointer scheme
|
|
||||||
|
|
||||||
|
|
||||||
#include "nsIDOMNode.h"
|
|
||||||
#include "nsIDOMNodeList.h"
|
|
||||||
#include "nsIDOMRange.h"
|
|
||||||
#include "nsIDOMElement.h"
|
|
||||||
#include "nsIDOMDocument.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsXPointer.h"
|
|
||||||
#include "nsIModifyableXPointer.h"
|
|
||||||
#include "nsISupports.h"
|
|
||||||
#include "nsISupportsUtils.h"
|
|
||||||
#include "nsIXPointer.h"
|
|
||||||
#include "nsFIXptr.h"
|
|
||||||
#include "nsCOMArray.h"
|
|
||||||
#include "nsIServiceManager.h"
|
|
||||||
#include "nsContentUtils.h"
|
|
||||||
|
|
||||||
#include "nsContentCID.h"
|
|
||||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
|
||||||
|
|
||||||
class nsXPointerResult : public nsIModifyableXPointerResult {
|
|
||||||
public:
|
|
||||||
nsXPointerResult();
|
|
||||||
virtual ~nsXPointerResult();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_DECL_NSIXPOINTERRESULT
|
|
||||||
NS_DECL_NSIMODIFYABLEXPOINTERRESULT
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsCOMArray<nsIDOMRange> mArray;
|
|
||||||
};
|
|
||||||
|
|
||||||
nsXPointerResult::nsXPointerResult()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsXPointerResult::~nsXPointerResult()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsXPointerResult)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIXPointerResult)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIModifyableXPointerResult)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XPointerResult)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsXPointerResult)
|
|
||||||
NS_IMPL_RELEASE(nsXPointerResult)
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXPointerResult::AppendRange(nsIDOMRange* aRange)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG(aRange);
|
|
||||||
|
|
||||||
if (!mArray.AppendObject(aRange)) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXPointerResult::Item(PRUint32 aIndex, nsIDOMRange** aReturn)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aReturn);
|
|
||||||
|
|
||||||
if (aIndex >= mArray.Count()) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aReturn = mArray.ObjectAt(aIndex);
|
|
||||||
NS_IF_ADDREF(*aReturn);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXPointerResult::GetLength(PRUint32* aLength)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aLength);
|
|
||||||
|
|
||||||
*aLength = mArray.Count();
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult NS_NewXPointerResult(nsIXPointerResult **aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
|
||||||
|
|
||||||
*aResult = new nsXPointerResult();
|
|
||||||
if (!*aResult) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_ADDREF(*aResult);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsresult NS_NewXPointerResult(nsIDOMRange *aRange,
|
|
||||||
nsIXPointerResult **aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG(aRange);
|
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
|
||||||
|
|
||||||
nsCOMPtr<nsXPointerResult> result(new nsXPointerResult());
|
|
||||||
if (!result) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = result->AppendRange(aRange);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aResult = result.get();
|
|
||||||
NS_ADDREF(*aResult);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsresult NS_NewXPointerResult(nsIDOMNode *aNode,
|
|
||||||
nsIXPointerResult **aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG(aNode);
|
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID));
|
|
||||||
if (!range) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = range->SelectNode(aNode);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_NewXPointerResult(range, aResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// nsXPointerSchemeContext
|
|
||||||
|
|
||||||
class nsXPointerSchemeContext : public nsIXPointerSchemeContext
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsXPointerSchemeContext() {};
|
|
||||||
virtual ~nsXPointerSchemeContext() {};
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIXPOINTERSCHEMECONTEXT
|
|
||||||
|
|
||||||
nsresult Append(const nsAString &aScheme, const nsAString &aData);
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsStringArray mSchemes;
|
|
||||||
nsStringArray mDatas;
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsXPointerSchemeContext, nsIXPointerSchemeContext)
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXPointerSchemeContext::GetCount(PRUint32 *aCount)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
|
||||||
|
|
||||||
*aCount = mSchemes.Count();
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsXPointerSchemeContext::Append(const nsAString &aScheme,
|
|
||||||
const nsAString &aData)
|
|
||||||
{
|
|
||||||
if (!mSchemes.AppendString(aScheme)) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mDatas.AppendString(aData)) {
|
|
||||||
// Keep mDatas and mSchemes in sync
|
|
||||||
mSchemes.RemoveStringAt(mSchemes.Count() - 1);
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsXPointerSchemeContext::GetSchemeData(PRUint32 aIndex,
|
|
||||||
nsAString &aScheme,
|
|
||||||
nsAString &aData)
|
|
||||||
{
|
|
||||||
if (aIndex >= mSchemes.Count()) {
|
|
||||||
aScheme.Truncate();
|
|
||||||
aData.Truncate();
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSchemes.StringAt(aIndex, aScheme);
|
|
||||||
mDatas.StringAt(aIndex, aData);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// XPointer
|
|
||||||
|
|
||||||
nsXPointer::nsXPointer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
nsXPointer::~nsXPointer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static nsresult GetNextSchemeNameAndData(nsString& aExpression,
|
|
||||||
nsString &aScheme,
|
|
||||||
nsString& aData)
|
|
||||||
{
|
|
||||||
aScheme.Truncate();
|
|
||||||
aData.Truncate();
|
|
||||||
|
|
||||||
PRInt32 lp = aExpression.FindChar('(');
|
|
||||||
if (lp < 1) {
|
|
||||||
return NS_ERROR_FAILURE; // format |scheme + '(' [ + data + ] + ')'| required
|
|
||||||
}
|
|
||||||
|
|
||||||
PRInt32 i = lp + 1, len = aExpression.Length();
|
|
||||||
if (i >= len) {
|
|
||||||
return NS_ERROR_FAILURE; // format |scheme + '(' [ + data + ] + ')'| required
|
|
||||||
}
|
|
||||||
|
|
||||||
aScheme = Substring(aExpression, 0, lp);
|
|
||||||
aScheme.CompressWhitespace(PR_TRUE, PR_FALSE);
|
|
||||||
if (aScheme.FindCharInSet(" \t\r\n") > 0) {
|
|
||||||
return NS_ERROR_FAILURE; // scheme name can't contain ws (we'd really need to check a lot more...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX perf: Switch to string iterators
|
|
||||||
PRBool escapeOn = PR_FALSE;
|
|
||||||
PRInt32 balance = 1;
|
|
||||||
for (; i < len; ++i) {
|
|
||||||
// Circumflex is the escape character that can precede ^, ( and ) only
|
|
||||||
if (aExpression[i] == '^') {
|
|
||||||
if (!escapeOn) {
|
|
||||||
escapeOn = PR_TRUE;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else if (escapeOn) {
|
|
||||||
if ((aExpression[i] != '(') && (aExpression[i] != ')')) {
|
|
||||||
return NS_ERROR_FAILURE; // illegal use of ^
|
|
||||||
}
|
|
||||||
} else if (aExpression[i] == '(') {
|
|
||||||
++balance;
|
|
||||||
} else if (aExpression[i] == ')') {
|
|
||||||
if (--balance == 0) {
|
|
||||||
aExpression.Cut(0, i + 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
aData.Append(aExpression[i]);
|
|
||||||
escapeOn = PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (balance != 0) {
|
|
||||||
return NS_ERROR_FAILURE; // format |scheme + '(' [ + data + ] + ')'| required
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsXPointer::Evaluate(nsIDOMDocument *aDocument,
|
|
||||||
const nsAString& aExpression,
|
|
||||||
nsIXPointerResult **aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aDocument);
|
|
||||||
NS_ENSURE_ARG_POINTER(aResult);
|
|
||||||
*aResult = nsnull;
|
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
|
|
||||||
if (aExpression.FindChar('(') < 0) {
|
|
||||||
// Must be shorthand, i.e. plain id
|
|
||||||
nsCOMPtr<nsIDOMElement> element;
|
|
||||||
aDocument->GetElementById(aExpression, getter_AddRefs(element));
|
|
||||||
if (element) {
|
|
||||||
rv = NS_NewXPointerResult(element, aResult);
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString expression(aExpression), scheme, data;
|
|
||||||
|
|
||||||
NS_NAMED_LITERAL_STRING(element, "element");
|
|
||||||
NS_NAMED_LITERAL_STRING(fixptr, "fixptr");
|
|
||||||
NS_NAMED_LITERAL_CSTRING(baseSchemeProgID, NS_XPOINTER_SCHEME_PROCESSOR_BASE);
|
|
||||||
nsCOMPtr<nsXPointerSchemeContext> contextSchemeDataArray(new nsXPointerSchemeContext());
|
|
||||||
if (!contextSchemeDataArray) {
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep trying the schemes from left to right until one finds a subresource
|
|
||||||
while (!expression.IsEmpty()) {
|
|
||||||
rv = GetNextSchemeNameAndData(expression, scheme, data);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Built in schemes
|
|
||||||
if (scheme.Equals(element)) {
|
|
||||||
// We implement element scheme by using the FIXptr processor.
|
|
||||||
// Check there are no parenthesis (legal in FIXptr data).
|
|
||||||
if (data.FindChar('(') < 0) {
|
|
||||||
nsCOMPtr<nsIDOMRange> range;
|
|
||||||
rv = nsFIXptr::Evaluate(aDocument, data, getter_AddRefs(range));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
break;
|
|
||||||
if (range) {
|
|
||||||
return NS_NewXPointerResult(range, aResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (scheme.Equals(fixptr)) {
|
|
||||||
nsCOMPtr<nsIDOMRange> range;
|
|
||||||
rv = nsFIXptr::Evaluate(aDocument, data, getter_AddRefs(range));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
break;
|
|
||||||
if (range) {
|
|
||||||
return NS_NewXPointerResult(range, aResult);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Add-on schemes
|
|
||||||
nsCAutoString progid(baseSchemeProgID + NS_ConvertUCS2toUTF8(scheme));
|
|
||||||
nsCOMPtr<nsIXPointerSchemeProcessor> p(do_CreateInstance(progid.get()));
|
|
||||||
if (p) {
|
|
||||||
rv = p->Evaluate(aDocument, contextSchemeDataArray, data, aResult);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
break;
|
|
||||||
if (*aResult)
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = contextSchemeDataArray->Append(scheme, data);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
|
@ -57,7 +57,8 @@ CPPSRCS = \
|
||||||
nsXULPopupListener.cpp \
|
nsXULPopupListener.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
# we don't want the shared lib, but we want to force the creation of a
|
||||||
|
# static lib.
|
||||||
FORCE_STATIC_LIB = 1
|
FORCE_STATIC_LIB = 1
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
@ -67,5 +68,6 @@ LOCAL_INCLUDES = \
|
||||||
-I$(srcdir)/../../document/src \
|
-I$(srcdir)/../../document/src \
|
||||||
-I$(srcdir)/../../../xml/content/src \
|
-I$(srcdir)/../../../xml/content/src \
|
||||||
-I$(srcdir)/../../../base/src \
|
-I$(srcdir)/../../../base/src \
|
||||||
|
-I$(srcdir)/../../../xml/document/src \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
|
@ -2850,7 +2850,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID,
|
||||||
if (xuldoc) {
|
if (xuldoc) {
|
||||||
// Do a getElementById to retrieve the broadcaster
|
// Do a getElementById to retrieve the broadcaster
|
||||||
nsCOMPtr<nsIDOMElement> broadcaster;
|
nsCOMPtr<nsIDOMElement> broadcaster;
|
||||||
nsCOMPtr<nsIDOMXULDocument> domDoc = do_QueryInterface(mDocument);
|
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
|
||||||
domDoc->GetElementById(oldValue, getter_AddRefs(broadcaster));
|
domDoc->GetElementById(oldValue, getter_AddRefs(broadcaster));
|
||||||
if (broadcaster) {
|
if (broadcaster) {
|
||||||
xuldoc->RemoveBroadcastListenerFor(broadcaster,
|
xuldoc->RemoveBroadcastListenerFor(broadcaster,
|
||||||
|
@ -4498,6 +4498,8 @@ nsXULElement::EnsureSlots()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
NS_ASSERTION(mPrototype->mNodeInfo, "prototype has null nodeinfo!");
|
NS_ASSERTION(mPrototype->mNodeInfo, "prototype has null nodeinfo!");
|
||||||
|
// XXX this is broken, we need to get a new nodeinfo from the
|
||||||
|
// document's nodeinfo manager!!!
|
||||||
mSlots->mNodeInfo = mPrototype->mNodeInfo;
|
mSlots->mNodeInfo = mPrototype->mNodeInfo;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIDOMXULElement.h"
|
#include "nsIDOMXULElement.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMDocumentXBL.h"
|
#include "nsIDOMDocumentXBL.h"
|
||||||
#include "nsIXULPopupListener.h"
|
#include "nsIXULPopupListener.h"
|
||||||
#include "nsIDOMMouseListener.h"
|
#include "nsIDOMMouseListener.h"
|
||||||
|
@ -520,9 +521,9 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn the document into a XUL document so we can use getElementById
|
// Turn the document into a DOM document so we can use getElementById
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(document);
|
||||||
if (xulDocument == nsnull) {
|
if (!domDocument) {
|
||||||
NS_ERROR("Popup attached to an element that isn't in XUL!");
|
NS_ERROR("Popup attached to an element that isn't in XUL!");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +540,7 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
||||||
if (popup)
|
if (popup)
|
||||||
popupContent = do_QueryInterface(popup);
|
popupContent = do_QueryInterface(popup);
|
||||||
else {
|
else {
|
||||||
nsCOMPtr<nsIDOMDocumentXBL> nsDoc(do_QueryInterface(xulDocument));
|
nsCOMPtr<nsIDOMDocumentXBL> nsDoc(do_QueryInterface(domDocument));
|
||||||
nsCOMPtr<nsIDOMNodeList> list;
|
nsCOMPtr<nsIDOMNodeList> list;
|
||||||
nsDoc->GetAnonymousNodes(mElement, getter_AddRefs(list));
|
nsDoc->GetAnonymousNodes(mElement, getter_AddRefs(list));
|
||||||
if (list) {
|
if (list) {
|
||||||
|
@ -559,7 +560,8 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (NS_FAILED(rv = xulDocument->GetElementById(identifier, getter_AddRefs(popupContent)))) {
|
else if (NS_FAILED(rv = domDocument->GetElementById(identifier,
|
||||||
|
getter_AddRefs(popupContent)))) {
|
||||||
// Use getElementById to obtain the popup content and gracefully fail if
|
// Use getElementById to obtain the popup content and gracefully fail if
|
||||||
// we didn't find any popup content in the document.
|
// we didn't find any popup content in the document.
|
||||||
NS_ERROR("GetElementById had some kind of spasm.");
|
NS_ERROR("GetElementById had some kind of spasm.");
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
class nsIContent; // XXX nsIXMLDocument.h is bad and doesn't declare this class...
|
class nsIContent; // XXX nsIXMLDocument.h is bad and doesn't declare this class...
|
||||||
|
|
||||||
#include "nsIXMLDocument.h"
|
#include "nsISupports.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
class nsForwardReference;
|
class nsForwardReference;
|
||||||
|
@ -65,7 +65,7 @@ class nsIXULTemplateBuilder;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
|
|
||||||
// {954F0811-81DC-11d2-B52A-000000000000}
|
// {954F0811-81DC-11d2-B52A-000000000000}
|
||||||
#define NS_IRDFDOCUMENT_IID \
|
#define NS_IXULDOCUMENT_IID \
|
||||||
{ 0x954f0811, 0x81dc, 0x11d2, { 0xb5, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
{ 0x954f0811, 0x81dc, 0x11d2, { 0xb5, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,10 +75,10 @@ class nsIURI;
|
||||||
class nsIRDFDataSource;
|
class nsIRDFDataSource;
|
||||||
class nsIXULPrototypeDocument;
|
class nsIXULPrototypeDocument;
|
||||||
|
|
||||||
class nsIXULDocument : public nsIXMLDocument
|
class nsIXULDocument : public nsISupports
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRDFDOCUMENT_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXULDOCUMENT_IID)
|
||||||
|
|
||||||
// The resource-to-element map is a one-to-many mapping of RDF
|
// The resource-to-element map is a one-to-many mapping of RDF
|
||||||
// resources to content elements.
|
// resources to content elements.
|
||||||
|
|
|
@ -66,7 +66,8 @@ CPPSRCS = \
|
||||||
nsXULPrototypeDocument.cpp \
|
nsXULPrototypeDocument.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
# we don't want the shared lib, but we want to force the creation of a
|
||||||
|
# static lib.
|
||||||
FORCE_STATIC_LIB = 1
|
FORCE_STATIC_LIB = 1
|
||||||
|
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
@ -74,5 +75,6 @@ include $(topsrcdir)/config/rules.mk
|
||||||
LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \
|
LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \
|
||||||
-I$(srcdir)/../../content/src \
|
-I$(srcdir)/../../content/src \
|
||||||
-I$(srcdir)/../../templates/src \
|
-I$(srcdir)/../../templates/src \
|
||||||
|
-I$(srcdir)/../../../xml/document/src \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
#include "nsIFormControl.h"
|
#include "nsIFormControl.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsIHTMLContentContainer.h"
|
#include "nsIHTMLContentContainer.h"
|
||||||
|
#include "nsIHTMLStyleSheet.h"
|
||||||
#include "nsINameSpace.h"
|
#include "nsINameSpace.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsINodeInfo.h"
|
#include "nsINodeInfo.h"
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -42,61 +42,22 @@
|
||||||
#define nsXULDocument_h__
|
#define nsXULDocument_h__
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsXMLDocument.h"
|
||||||
#include "nsElementMap.h"
|
#include "nsElementMap.h"
|
||||||
#include "nsForwardReference.h"
|
#include "nsForwardReference.h"
|
||||||
#include "nsIArena.h"
|
|
||||||
#include "nsICSSLoader.h"
|
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIDOM3EventTarget.h"
|
|
||||||
#include "nsIDOMNSDocument.h"
|
|
||||||
#include "nsIDOMDocumentStyle.h"
|
|
||||||
#include "nsIDOMDocumentView.h"
|
|
||||||
#include "nsIDOMDocumentXBL.h"
|
|
||||||
#include "nsIDOMDocumentRange.h"
|
|
||||||
#include "nsIDOMDocumentTraversal.h"
|
|
||||||
#include "nsIDOMStyleSheetList.h"
|
|
||||||
#include "nsISelection.h"
|
|
||||||
#include "nsIDOMXULCommandDispatcher.h"
|
#include "nsIDOMXULCommandDispatcher.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMXULDocument.h"
|
||||||
#include "nsIDocument.h"
|
|
||||||
#include "nsIEventListenerManager.h"
|
|
||||||
#include "nsIHTMLCSSStyleSheet.h"
|
|
||||||
#include "nsIHTMLContentContainer.h"
|
|
||||||
#include "nsIHTMLStyleSheet.h"
|
|
||||||
#include "nsILineBreakerFactory.h"
|
|
||||||
#include "nsIParser.h"
|
|
||||||
#include "nsIPrincipal.h"
|
|
||||||
#include "nsIRDFDataSource.h"
|
|
||||||
#include "nsIScriptGlobalObject.h"
|
|
||||||
#include "nsIScriptSecurityManager.h"
|
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsIWordBreakerFactory.h"
|
|
||||||
#include "nsIXULDocument.h"
|
#include "nsIXULDocument.h"
|
||||||
#include "nsIXULPrototypeDocument.h"
|
#include "nsIXULPrototypeDocument.h"
|
||||||
#include "nsRDFDOMNodeList.h"
|
|
||||||
#include "nsTime.h"
|
|
||||||
#include "nsVoidArray.h"
|
|
||||||
#include "nsWeakPtr.h"
|
|
||||||
#include "nsWeakReference.h"
|
|
||||||
#include "nsIStreamLoader.h"
|
|
||||||
#include "nsIBindingManager.h"
|
|
||||||
#include "nsINodeInfo.h"
|
|
||||||
#include "nsIDOMDocumentEvent.h"
|
|
||||||
#include "nsIDOM3DocumentEvent.h"
|
|
||||||
#include "nsScriptLoader.h"
|
#include "nsScriptLoader.h"
|
||||||
#include "pldhash.h"
|
|
||||||
|
|
||||||
class nsIAtom;
|
|
||||||
class nsIElementFactory;
|
|
||||||
class nsIFile;
|
|
||||||
class nsILoadGroup;
|
|
||||||
class nsIRDFResource;
|
class nsIRDFResource;
|
||||||
class nsIRDFService;
|
class nsIRDFService;
|
||||||
class nsITimer;
|
|
||||||
class nsIXULContentUtils;
|
|
||||||
class nsIXULPrototypeCache;
|
class nsIXULPrototypeCache;
|
||||||
class nsIFocusController;
|
class nsIFocusController;
|
||||||
#if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript))
|
#if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript))
|
||||||
|
@ -117,35 +78,20 @@ struct PRLogModuleInfo;
|
||||||
/**
|
/**
|
||||||
* The XUL document class
|
* The XUL document class
|
||||||
*/
|
*/
|
||||||
class nsXULDocument : public nsIDocument,
|
class nsXULDocument : public nsXMLDocument,
|
||||||
public nsIXULDocument,
|
public nsIXULDocument,
|
||||||
public nsIDOMXULDocument,
|
public nsIDOMXULDocument,
|
||||||
public nsIDOMDocumentEvent,
|
public nsIStreamLoaderObserver
|
||||||
public nsIDOM3DocumentEvent,
|
|
||||||
public nsIDOMDocumentView,
|
|
||||||
public nsIDOMDocumentXBL,
|
|
||||||
public nsIDOMDocumentRange,
|
|
||||||
public nsIDOMDocumentTraversal,
|
|
||||||
public nsIDOMNSDocument,
|
|
||||||
public nsIDOM3Node,
|
|
||||||
public nsIDOMDocumentStyle,
|
|
||||||
public nsIDOMEventReceiver,
|
|
||||||
public nsIDOM3EventTarget,
|
|
||||||
public nsIHTMLContentContainer,
|
|
||||||
public nsIStreamLoaderObserver,
|
|
||||||
public nsSupportsWeakReference
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsXULDocument();
|
nsXULDocument();
|
||||||
virtual ~nsXULDocument();
|
virtual ~nsXULDocument();
|
||||||
|
|
||||||
// nsISupports interface
|
// nsISupports interface
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_NSISTREAMLOADEROBSERVER
|
NS_DECL_NSISTREAMLOADEROBSERVER
|
||||||
|
|
||||||
// nsIDocument interface
|
// nsIDocument interface
|
||||||
NS_IMETHOD GetArena(nsIArena** aArena);
|
|
||||||
|
|
||||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||||
NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup);
|
NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup);
|
||||||
|
|
||||||
|
@ -157,144 +103,14 @@ public:
|
||||||
PRBool aReset = PR_TRUE,
|
PRBool aReset = PR_TRUE,
|
||||||
nsIContentSink* aSink = nsnull);
|
nsIContentSink* aSink = nsnull);
|
||||||
|
|
||||||
NS_IMETHOD StopDocumentLoad();
|
|
||||||
|
|
||||||
virtual const nsString* GetDocumentTitle() const;
|
|
||||||
|
|
||||||
NS_IMETHOD GetDocumentURL(nsIURI** aURI) const;
|
|
||||||
|
|
||||||
NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal);
|
NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal);
|
||||||
|
|
||||||
NS_IMETHOD AddPrincipal(nsIPrincipal *aPrincipal);
|
NS_IMETHOD AddPrincipal(nsIPrincipal *aPrincipal);
|
||||||
|
|
||||||
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup **aGroup) const;
|
|
||||||
|
|
||||||
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const;
|
|
||||||
|
|
||||||
NS_IMETHOD SetBaseURL(nsIURI *aURI);
|
|
||||||
|
|
||||||
NS_IMETHOD GetBaseTarget(nsAString &aBaseTarget);
|
|
||||||
|
|
||||||
NS_IMETHOD SetBaseTarget(const nsAString &aBaseTarget);
|
|
||||||
|
|
||||||
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets);
|
|
||||||
|
|
||||||
NS_IMETHOD GetDocumentCharacterSet(nsAString& oCharSetID);
|
|
||||||
|
|
||||||
NS_IMETHOD SetDocumentCharacterSet(const nsAString& aCharSetID);
|
|
||||||
|
|
||||||
NS_IMETHOD GetDocumentCharacterSetSource(PRInt32* aCharsetSource);
|
|
||||||
|
|
||||||
NS_IMETHOD SetDocumentCharacterSetSource(PRInt32 aCharsetSource);
|
|
||||||
|
|
||||||
// NS_IMETHOD GetContentType(nsAString& aContentType);
|
|
||||||
// Already declared in nsIDOMNSDocument
|
|
||||||
|
|
||||||
NS_IMETHOD SetContentType(const nsAString& aContentType);
|
NS_IMETHOD SetContentType(const nsAString& aContentType);
|
||||||
|
|
||||||
NS_IMETHOD GetContentLanguage(nsAString& aContentLanguage) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve and get bidi state of the document
|
|
||||||
* (set depending on presence of bidi data).
|
|
||||||
*/
|
|
||||||
NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const;
|
|
||||||
NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled);
|
|
||||||
|
|
||||||
NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver);
|
|
||||||
NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver);
|
|
||||||
|
|
||||||
NS_IMETHOD GetLineBreaker(nsILineBreaker** aResult) ;
|
|
||||||
NS_IMETHOD SetLineBreaker(nsILineBreaker* aLineBreaker) ;
|
|
||||||
NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) ;
|
|
||||||
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) ;
|
|
||||||
|
|
||||||
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField,
|
|
||||||
nsAString& aData) const;
|
|
||||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField,
|
|
||||||
const nsAString& aData);
|
|
||||||
|
|
||||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
|
||||||
nsIViewManager* aViewManager,
|
|
||||||
nsIStyleSet* aStyleSet,
|
|
||||||
nsIPresShell** aInstancePtrResult);
|
|
||||||
|
|
||||||
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
|
||||||
|
|
||||||
virtual PRInt32 GetNumberOfShells();
|
|
||||||
|
|
||||||
NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell);
|
|
||||||
|
|
||||||
NS_IMETHOD GetParentDocument(nsIDocument** aParent);
|
|
||||||
|
|
||||||
NS_IMETHOD SetParentDocument(nsIDocument* aParent);
|
|
||||||
|
|
||||||
NS_IMETHOD SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc);
|
|
||||||
|
|
||||||
NS_IMETHOD GetSubDocumentFor(nsIContent *aContent, nsIDocument** aSubDoc);
|
|
||||||
|
|
||||||
NS_IMETHOD FindContentForSubDocument(nsIDocument *aDocument,
|
|
||||||
nsIContent **aContent);
|
|
||||||
|
|
||||||
NS_IMETHOD GetRootContent(nsIContent** aRoot);
|
|
||||||
|
|
||||||
NS_IMETHOD SetRootContent(nsIContent* aRoot);
|
|
||||||
|
|
||||||
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const;
|
|
||||||
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const;
|
|
||||||
NS_IMETHOD GetChildCount(PRInt32& aCount);
|
|
||||||
|
|
||||||
NS_IMETHOD GetNumberOfStyleSheets(PRBool aIncludeSpecialSheets,
|
|
||||||
PRInt32* aCount);
|
|
||||||
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, PRBool aIncludeSpecialSheets,
|
|
||||||
nsIStyleSheet** aSheet);
|
|
||||||
NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex);
|
|
||||||
|
|
||||||
virtual void AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
|
|
||||||
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet);
|
|
||||||
NS_IMETHOD UpdateStyleSheets(nsCOMArray<nsIStyleSheet>& aOldSheets,
|
|
||||||
nsCOMArray<nsIStyleSheet>& aNewSheets);
|
|
||||||
void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet);
|
|
||||||
void RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet);
|
|
||||||
|
|
||||||
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex);
|
|
||||||
|
|
||||||
virtual void SetStyleSheetApplicableState(nsIStyleSheet* aSheet,
|
|
||||||
PRBool aApplicable);
|
|
||||||
|
|
||||||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
|
||||||
|
|
||||||
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aScriptGlobalObject);
|
|
||||||
|
|
||||||
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
|
|
||||||
|
|
||||||
NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader);
|
|
||||||
|
|
||||||
virtual void AddObserver(nsIDocumentObserver* aObserver);
|
|
||||||
|
|
||||||
virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver);
|
|
||||||
|
|
||||||
NS_IMETHOD BeginUpdate();
|
|
||||||
|
|
||||||
NS_IMETHOD EndUpdate();
|
|
||||||
|
|
||||||
NS_IMETHOD BeginLoad();
|
|
||||||
|
|
||||||
NS_IMETHOD EndLoad();
|
NS_IMETHOD EndLoad();
|
||||||
|
|
||||||
NS_IMETHOD ContentChanged(nsIContent* aContent,
|
|
||||||
nsISupports* aSubContent);
|
|
||||||
|
|
||||||
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1,
|
|
||||||
nsIContent* aContent2,
|
|
||||||
PRInt32 aStateMask);
|
|
||||||
|
|
||||||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
|
||||||
PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAttribute,
|
|
||||||
PRInt32 aModType,
|
|
||||||
nsChangeHint aHint);
|
|
||||||
|
|
||||||
NS_IMETHOD ContentAppended(nsIContent* aContainer,
|
NS_IMETHOD ContentAppended(nsIContent* aContainer,
|
||||||
PRInt32 aNewIndexInContainer);
|
PRInt32 aNewIndexInContainer);
|
||||||
|
|
||||||
|
@ -310,54 +126,19 @@ public:
|
||||||
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
|
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
|
||||||
nsIContent* aChild,
|
nsIContent* aChild,
|
||||||
PRInt32 aIndexInContainer);
|
PRInt32 aIndexInContainer);
|
||||||
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
|
|
||||||
PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAttribute);
|
|
||||||
|
|
||||||
NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet,
|
NS_IMETHOD AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID,
|
||||||
nsIStyleRule* aStyleRule,
|
nsIAtom* aAttribute, PRInt32 aModType,
|
||||||
nsChangeHint aHint);
|
nsChangeHint aHint);
|
||||||
|
|
||||||
NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet,
|
|
||||||
nsIStyleRule* aStyleRule);
|
|
||||||
|
|
||||||
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
|
||||||
nsIStyleRule* aStyleRule);
|
|
||||||
|
|
||||||
NS_IMETHOD GetSelection(nsISelection** aSelection);
|
|
||||||
|
|
||||||
NS_IMETHOD SelectAll();
|
|
||||||
|
|
||||||
NS_IMETHOD FindNext(const nsAString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
|
|
||||||
|
|
||||||
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE, PRBool aUpdateViews = PR_FALSE);
|
|
||||||
|
|
||||||
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID);
|
|
||||||
|
|
||||||
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult);
|
|
||||||
|
|
||||||
NS_IMETHOD GetNodeInfoManager(class nsINodeInfoManager *&aNodeInfoManager);
|
|
||||||
|
|
||||||
NS_IMETHOD AddReference(void *aKey, nsISupports *aReference);
|
|
||||||
NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference);
|
|
||||||
NS_IMETHOD SetContainer(nsISupports *aContainer);
|
|
||||||
NS_IMETHOD GetContainer(nsISupports **aContainer);
|
|
||||||
NS_IMETHOD GetScriptEventManager(nsIScriptEventManager **aResult);
|
|
||||||
|
|
||||||
virtual void SetDisplaySelection(PRInt8 aToggle);
|
|
||||||
|
|
||||||
virtual PRInt8 GetDisplaySelection() const;
|
|
||||||
|
|
||||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||||
nsEvent* aEvent,
|
nsEvent* aEvent,
|
||||||
nsIDOMEvent** aDOMEvent,
|
nsIDOMEvent** aDOMEvent,
|
||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement);
|
|
||||||
|
|
||||||
// nsIXMLDocument interface
|
// nsIXMLDocument interface
|
||||||
NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl);
|
NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl);
|
||||||
NS_IMETHOD SetTitle(const PRUnichar *aTitle);
|
|
||||||
NS_IMETHOD SetXMLDeclaration(const nsAString& aVersion,
|
NS_IMETHOD SetXMLDeclaration(const nsAString& aVersion,
|
||||||
const nsAString& aEncoding,
|
const nsAString& aEncoding,
|
||||||
const nsAString& Standalone);
|
const nsAString& Standalone);
|
||||||
|
@ -368,66 +149,37 @@ public:
|
||||||
// nsIXULDocument interface
|
// nsIXULDocument interface
|
||||||
NS_IMETHOD AddElementForID(const nsAString& aID, nsIContent* aElement);
|
NS_IMETHOD AddElementForID(const nsAString& aID, nsIContent* aElement);
|
||||||
NS_IMETHOD RemoveElementForID(const nsAString& aID, nsIContent* aElement);
|
NS_IMETHOD RemoveElementForID(const nsAString& aID, nsIContent* aElement);
|
||||||
NS_IMETHOD GetElementsForID(const nsAString& aID, nsISupportsArray* aElements);
|
NS_IMETHOD GetElementsForID(const nsAString& aID,
|
||||||
|
nsISupportsArray* aElements);
|
||||||
NS_IMETHOD AddForwardReference(nsForwardReference* aRef);
|
NS_IMETHOD AddForwardReference(nsForwardReference* aRef);
|
||||||
NS_IMETHOD ResolveForwardReferences();
|
NS_IMETHOD ResolveForwardReferences();
|
||||||
NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument);
|
NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument);
|
||||||
NS_IMETHOD GetMasterPrototype(nsIXULPrototypeDocument** aDocument);
|
NS_IMETHOD GetMasterPrototype(nsIXULPrototypeDocument** aDocument);
|
||||||
NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument);
|
NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument);
|
||||||
NS_IMETHOD SetDocumentURL(nsIURI* anURL);
|
|
||||||
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
|
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
|
||||||
NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement);
|
NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement);
|
||||||
NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement);
|
NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement);
|
||||||
NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder);
|
NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent,
|
||||||
NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult);
|
nsIXULTemplateBuilder* aBuilder);
|
||||||
|
NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent,
|
||||||
|
nsIXULTemplateBuilder** aResult);
|
||||||
NS_IMETHOD OnPrototypeLoadDone();
|
NS_IMETHOD OnPrototypeLoadDone();
|
||||||
NS_IMETHOD OnHide();
|
NS_IMETHOD OnHide();
|
||||||
|
|
||||||
// nsIDOMEventReceiver interface
|
// nsIDOMNode interface overrides
|
||||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
NS_IMETHOD CloneNode(PRBool deep, nsIDOMNode **_retval);
|
||||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
|
||||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
|
||||||
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
|
||||||
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
|
|
||||||
|
|
||||||
// nsIDOMEventTarget interface
|
// nsIDOMDocument interface overrides
|
||||||
NS_DECL_NSIDOMEVENTTARGET
|
NS_IMETHOD CreateElement(const nsAString & tagName,
|
||||||
|
nsIDOMElement **_retval);
|
||||||
// nsIDOM3EventTarget interface
|
NS_IMETHOD GetElementById(const nsAString & elementId,
|
||||||
NS_DECL_NSIDOM3EVENTTARGET
|
nsIDOMElement **_retval);
|
||||||
|
|
||||||
// nsIDOMDocument interface
|
|
||||||
NS_DECL_NSIDOMDOCUMENT
|
|
||||||
|
|
||||||
// nsIDOMDocumentEvent interface
|
|
||||||
NS_DECL_NSIDOMDOCUMENTEVENT
|
|
||||||
|
|
||||||
// nsIDOM3DocumentEvent interface
|
|
||||||
NS_DECL_NSIDOM3DOCUMENTEVENT
|
|
||||||
|
|
||||||
// nsIDOMDocumentView interface
|
|
||||||
NS_DECL_NSIDOMDOCUMENTVIEW
|
|
||||||
|
|
||||||
// nsIDOMDocumentXBL interface
|
|
||||||
NS_DECL_NSIDOMDOCUMENTXBL
|
|
||||||
|
|
||||||
// nsIDOMDocumentRange interface
|
|
||||||
NS_DECL_NSIDOMDOCUMENTRANGE
|
|
||||||
|
|
||||||
// nsIDOMDocumentTraversal interface
|
|
||||||
NS_DECL_NSIDOMDOCUMENTTRAVERSAL
|
|
||||||
|
|
||||||
// nsIDOMNSDocument interface
|
|
||||||
NS_DECL_NSIDOMNSDOCUMENT
|
|
||||||
|
|
||||||
// nsIDOMXULDocument interface
|
// nsIDOMXULDocument interface
|
||||||
NS_DECL_NSIDOMXULDOCUMENT
|
NS_DECL_NSIDOMXULDOCUMENT
|
||||||
|
|
||||||
// nsIDOMNode interface
|
// nsIDOMNSDocument
|
||||||
NS_DECL_NSIDOMNODE
|
NS_IMETHOD GetContentType(nsAString& aContentType);
|
||||||
|
|
||||||
// nsIDOM3Node interface
|
|
||||||
NS_DECL_NSIDOM3NODE
|
|
||||||
|
|
||||||
// nsIHTMLContentContainer interface
|
// nsIHTMLContentContainer interface
|
||||||
NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult);
|
NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult);
|
||||||
|
@ -461,10 +213,6 @@ protected:
|
||||||
const nsAString& aValue,
|
const nsAString& aValue,
|
||||||
nsRDFDOMNodeList* aElements);
|
nsRDFDOMNodeList* aElements);
|
||||||
|
|
||||||
nsresult
|
|
||||||
ParseTagString(const nsAString& aTagName, nsIAtom*& aName,
|
|
||||||
nsIAtom*& aPrefix);
|
|
||||||
|
|
||||||
void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; };
|
void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; };
|
||||||
|
|
||||||
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIContent** aResult);
|
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIContent** aResult);
|
||||||
|
@ -482,7 +230,8 @@ protected:
|
||||||
nsIParser** aResult);
|
nsIParser** aResult);
|
||||||
|
|
||||||
nsresult ApplyPersistentAttributes();
|
nsresult ApplyPersistentAttributes();
|
||||||
nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource, nsISupportsArray* aElements);
|
nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
|
||||||
|
nsISupportsArray* aElements);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
AddElementToDocumentPre(nsIContent* aElement);
|
AddElementToDocumentPre(nsIContent* aElement);
|
||||||
|
@ -511,12 +260,12 @@ protected:
|
||||||
static nsIElementFactory* gHTMLElementFactory;
|
static nsIElementFactory* gHTMLElementFactory;
|
||||||
static nsIElementFactory* gXMLElementFactory;
|
static nsIElementFactory* gXMLElementFactory;
|
||||||
|
|
||||||
static nsIXULContentUtils* gXULUtils;
|
|
||||||
static nsIXULPrototypeCache* gXULCache;
|
static nsIXULPrototypeCache* gXULCache;
|
||||||
|
|
||||||
static PRLogModuleInfo* gXULLog;
|
static PRLogModuleInfo* gXULLog;
|
||||||
|
|
||||||
static void GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult);
|
static void GetElementFactory(PRInt32 aNameSpaceID,
|
||||||
|
nsIElementFactory** aResult);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute);
|
Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute);
|
||||||
|
@ -524,67 +273,30 @@ protected:
|
||||||
nsresult
|
nsresult
|
||||||
DestroyForwardReferences();
|
DestroyForwardReferences();
|
||||||
|
|
||||||
// IMPORTANT: The ownership implicit in the following member variables has been
|
// IMPORTANT: The ownership implicit in the following member
|
||||||
// explicitly checked and set using nsCOMPtr for owning pointers and raw COM interface
|
// variables has been explicitly checked and set using nsCOMPtr
|
||||||
// pointers for weak (ie, non owning) references. If you add any members to this
|
// for owning pointers and raw COM interface pointers for weak
|
||||||
|
// (ie, non owning) references. If you add any members to this
|
||||||
// class, please make the ownership explicit (pinkerton, scc).
|
// class, please make the ownership explicit (pinkerton, scc).
|
||||||
// NOTE, THIS IS STILL IN PROGRESS, TALK TO PINK OR SCC BEFORE CHANGING
|
// NOTE, THIS IS STILL IN PROGRESS, TALK TO PINK OR SCC BEFORE
|
||||||
|
// CHANGING
|
||||||
|
|
||||||
nsCOMPtr<nsIArena> mArena;
|
|
||||||
// This always has at least one observer
|
|
||||||
nsAutoVoidArray mObservers;
|
|
||||||
nsString mDocumentTitle;
|
|
||||||
nsCOMPtr<nsIURI> mDocumentURL; // [OWNER] ??? compare with loader
|
|
||||||
nsCOMPtr<nsIURI> mDocumentBaseURL;
|
|
||||||
nsWeakPtr mDocumentLoadGroup; // [WEAK] leads to loader
|
|
||||||
nsWeakPtr mDocumentContainer; // [WEAK] leads to container
|
|
||||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal; // [OWNER]
|
|
||||||
nsCOMPtr<nsIContent> mRootContent; // [OWNER]
|
|
||||||
nsIDocument* mParentDocument; // [WEAK]
|
|
||||||
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets; // [OWNER]
|
|
||||||
nsIScriptGlobalObject* mScriptGlobalObject; // [WEAK]
|
|
||||||
nsXULDocument* mNextSrcLoadWaiter; // [OWNER] but not COMPtr
|
nsXULDocument* mNextSrcLoadWaiter; // [OWNER] but not COMPtr
|
||||||
nsString mCharSetID;
|
|
||||||
PRInt32 mCharacterSetSource;
|
|
||||||
|
|
||||||
// This is set in nsPresContext::Init, which calls SetShell.
|
|
||||||
// Since I think this is almost always done, take the 32-byte hit for
|
|
||||||
// an nsAutoVoidArray instead of having it be a separate allocation.
|
|
||||||
nsAutoVoidArray mCharSetObservers;
|
|
||||||
nsVoidArray mStyleSheets;
|
|
||||||
nsCOMPtr<nsISelection> mSelection; // [OWNER]
|
|
||||||
PRInt8 mDisplaySelection;
|
|
||||||
// if we're attached to a DocumentViewImpl, we have a presshell
|
|
||||||
nsAutoVoidArray mPresShells;
|
|
||||||
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
|
|
||||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet; // [OWNER]
|
|
||||||
nsCOMPtr<nsIHTMLCSSStyleSheet> mInlineStyleSheet; // [OWNER]
|
|
||||||
nsCOMPtr<nsICSSLoader> mCSSLoader; // [OWNER]
|
|
||||||
nsCOMPtr<nsIScriptLoader> mScriptLoader; // [OWNER]
|
|
||||||
nsElementMap mElementMap;
|
nsElementMap mElementMap;
|
||||||
nsCOMPtr<nsIRDFDataSource> mLocalStore;
|
nsCOMPtr<nsIRDFDataSource> mLocalStore;
|
||||||
nsCOMPtr<nsILineBreaker> mLineBreaker; // [OWNER]
|
|
||||||
nsCOMPtr<nsIWordBreaker> mWordBreaker; // [OWNER]
|
|
||||||
PLDHashTable *mSubDocuments; // [OWNER] of subelements
|
|
||||||
PRPackedBool mIsPopup;
|
PRPackedBool mIsPopup;
|
||||||
PRPackedBool mIsFastLoad;
|
PRPackedBool mIsFastLoad;
|
||||||
PRPackedBool mApplyingPersistedAttrs;
|
PRPackedBool mApplyingPersistedAttrs;
|
||||||
PRPackedBool mIsWritingFastLoad;
|
PRPackedBool mIsWritingFastLoad;
|
||||||
nsCOMPtr<nsIDOMXULCommandDispatcher> mCommandDispatcher; // [OWNER] of the focus tracker
|
nsCOMPtr<nsIDOMXULCommandDispatcher> mCommandDispatcher; // [OWNER] of the focus tracker
|
||||||
|
|
||||||
nsCOMPtr<nsIBindingManager> mBindingManager; // [OWNER] of all bindings
|
|
||||||
nsSupportsHashtable* mBoxObjectTable; // Box objects for content nodes.
|
|
||||||
|
|
||||||
// Maintains the template builders that have been attached to
|
// Maintains the template builders that have been attached to
|
||||||
// content elements
|
// content elements
|
||||||
nsSupportsHashtable* mTemplateBuilderTable;
|
nsSupportsHashtable* mTemplateBuilderTable;
|
||||||
|
|
||||||
nsVoidArray mForwardReferences;
|
nsVoidArray mForwardReferences;
|
||||||
nsForwardReference::Phase mResolutionPhase;
|
nsForwardReference::Phase mResolutionPhase;
|
||||||
PRInt32 mNextContentID;
|
|
||||||
PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery.
|
|
||||||
|
|
||||||
PRBool mBidiEnabled;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX dr
|
* XXX dr
|
||||||
|
@ -604,7 +316,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> mTooltipNode; // [OWNER] element triggering the tooltip
|
nsCOMPtr<nsIDOMNode> mTooltipNode; // [OWNER] element triggering the tooltip
|
||||||
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager; // [OWNER] list of names in the document
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context stack, which maintains the state of the Builder and allows
|
* Context stack, which maintains the state of the Builder and allows
|
||||||
|
@ -722,10 +433,13 @@ protected:
|
||||||
PRBool mResolved;
|
PRBool mResolved;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BroadcasterHookup(nsXULDocument* aDocument, nsIContent* aObservesElement) :
|
BroadcasterHookup(nsXULDocument* aDocument,
|
||||||
mDocument(aDocument),
|
nsIContent* aObservesElement)
|
||||||
mObservesElement(aObservesElement),
|
: mDocument(aDocument),
|
||||||
mResolved(PR_FALSE) {}
|
mObservesElement(aObservesElement),
|
||||||
|
mResolved(PR_FALSE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~BroadcasterHookup();
|
virtual ~BroadcasterHookup();
|
||||||
|
|
||||||
|
@ -797,7 +511,7 @@ protected:
|
||||||
* Owning references to all of the prototype documents that were
|
* Owning references to all of the prototype documents that were
|
||||||
* used to construct this document.
|
* used to construct this document.
|
||||||
*/
|
*/
|
||||||
nsCOMPtr<nsISupportsArray> mPrototypes;
|
nsCOMArray<nsIXULPrototypeDocument> mPrototypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare to walk the current prototype.
|
* Prepare to walk the current prototype.
|
||||||
|
@ -829,7 +543,8 @@ protected:
|
||||||
virtual ~CachedChromeStreamListener();
|
virtual ~CachedChromeStreamListener();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CachedChromeStreamListener(nsXULDocument* aDocument, PRBool aProtoLoaded);
|
CachedChromeStreamListener(nsXULDocument* aDocument,
|
||||||
|
PRBool aProtoLoaded);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIREQUESTOBSERVER
|
NS_DECL_NSIREQUESTOBSERVER
|
||||||
|
@ -853,8 +568,6 @@ protected:
|
||||||
|
|
||||||
friend class ParserObserver;
|
friend class ParserObserver;
|
||||||
|
|
||||||
nsSupportsHashtable mContentWrapperHash;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map from a broadcaster element to a list of listener elements.
|
* A map from a broadcaster element to a list of listener elements.
|
||||||
*/
|
*/
|
||||||
|
@ -865,6 +578,4 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // nsXULDocument_h__
|
#endif // nsXULDocument_h__
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMXULElement.h"
|
#include "nsIDOMXULElement.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIBindingManager.h"
|
#include "nsIBindingManager.h"
|
||||||
|
@ -1408,13 +1408,13 @@ nsXULTemplateBuilder::GetTemplateRoot(nsIContent** aResult)
|
||||||
if (! doc)
|
if (! doc)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(doc);
|
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
|
||||||
NS_ASSERTION(xulDoc != nsnull, "expected a XUL document");
|
NS_ASSERTION(domDoc, "expected a XUL document");
|
||||||
if (! xulDoc)
|
if (! domDoc)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> domElement;
|
nsCOMPtr<nsIDOMElement> domElement;
|
||||||
xulDoc->GetElementById(templateID, getter_AddRefs(domElement));
|
domDoc->GetElementById(templateID, getter_AddRefs(domElement));
|
||||||
|
|
||||||
if (domElement)
|
if (domElement)
|
||||||
return CallQueryInterface(domElement, aResult);
|
return CallQueryInterface(domElement, aResult);
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#
|
|
||||||
# This is a list of local files which get copied to the mozilla:dist:dom directory
|
|
||||||
#
|
|
||||||
|
|
||||||
nsIDOMEventCapturer.h
|
|
||||||
nsIDOMEventReceiver.h
|
|
||||||
nsIDOMFocusListener.h
|
|
||||||
nsIDOMFormListener.h
|
|
||||||
nsIDOMKeyListener.h
|
|
||||||
nsIDOMLoadListener.h
|
|
||||||
nsIDOMMouseListener.h
|
|
||||||
nsIDOMMouseMotionListener.h
|
|
||||||
nsIDOMMutationListener.h
|
|
||||||
nsIDOMDragListener.h
|
|
||||||
nsIDOMPaintListener.h
|
|
||||||
nsIDOMTextListener.h
|
|
||||||
nsIDOMCompositionListener.h
|
|
||||||
nsIDOMXULListener.h
|
|
||||||
nsIDOMScrollListener.h
|
|
||||||
nsIDOMContextMenuListener.h
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||||
MODULE = dom
|
MODULE = dom
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
nsIDOMEventCapturer.h \
|
|
||||||
nsIDOMEventReceiver.h \
|
nsIDOMEventReceiver.h \
|
||||||
nsIDOMFocusListener.h \
|
nsIDOMFocusListener.h \
|
||||||
nsIDOMFormListener.h \
|
nsIDOMFormListener.h \
|
||||||
|
|
|
@ -38,13 +38,13 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsIDOMDocument.idl"
|
#include "domstubs.idl"
|
||||||
|
|
||||||
interface nsIDOMXULCommandDispatcher;
|
interface nsIDOMXULCommandDispatcher;
|
||||||
|
|
||||||
|
|
||||||
[scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)]
|
[scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)]
|
||||||
interface nsIDOMXULDocument : nsIDOMDocument
|
interface nsIDOMXULDocument : nsISupports
|
||||||
{
|
{
|
||||||
attribute nsIDOMNode popupNode;
|
attribute nsIDOMNode popupNode;
|
||||||
attribute nsIDOMNode tooltipNode;
|
attribute nsIDOMNode tooltipNode;
|
||||||
|
|
|
@ -1892,6 +1892,7 @@ nsDOMClassInfo::Init()
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(XULDocument, nsIDOMXULDocument)
|
DOM_CLASSINFO_MAP_BEGIN(XULDocument, nsIDOMXULDocument)
|
||||||
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIPrefBranchInternal.h"
|
#include "nsIPrefBranchInternal.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "nsIDOMProcessingInstruction.h"
|
#include "nsIDOMProcessingInstruction.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
// Need to determine if these are well-chosen.
|
// Need to determine if these are well-chosen.
|
||||||
#define WRAPPER_INITIAL_SIZE 256
|
#define WRAPPER_INITIAL_SIZE 256
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "txAtoms.h"
|
#include "txAtoms.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
MOZ_DECL_CTOR_COUNTER(Node)
|
MOZ_DECL_CTOR_COUNTER(Node)
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
#include "nsIModifyableXPointer.h"
|
#include "nsIModifyableXPointer.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||||
|
|
|
@ -126,7 +126,7 @@ nsXPointerResult::Item(PRUint32 aIndex, nsIDOMRange** aReturn)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aReturn);
|
NS_ENSURE_ARG_POINTER(aReturn);
|
||||||
|
|
||||||
if (aIndex >= mArray.Count()) {
|
if (aIndex >= (PRUint32)mArray.Count()) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ nsXPointerSchemeContext::GetSchemeData(PRUint32 aIndex,
|
||||||
nsAString &aScheme,
|
nsAString &aScheme,
|
||||||
nsAString &aData)
|
nsAString &aData)
|
||||||
{
|
{
|
||||||
if (aIndex >= mSchemes.Count()) {
|
if (aIndex >= (PRUint32)mSchemes.Count()) {
|
||||||
aScheme.Truncate();
|
aScheme.Truncate();
|
||||||
aData.Truncate();
|
aData.Truncate();
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class nsILineBreakerFactory : public nsISupports
|
||||||
public:
|
public:
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILINEBREAKERFACTORY_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILINEBREAKERFACTORY_IID)
|
||||||
NS_IMETHOD GetBreaker(nsString& aParam, nsILineBreaker** breaker) = 0;
|
NS_IMETHOD GetBreaker(const nsAString& aParam, nsILineBreaker** breaker) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class nsIWordBreakerFactory : public nsISupports
|
||||||
public:
|
public:
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWORDBREAKERFACTORY_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWORDBREAKERFACTORY_IID)
|
||||||
NS_IMETHOD GetBreaker(nsString& aParam, nsIWordBreaker** breaker) = 0;
|
NS_IMETHOD GetBreaker(const nsAString& aParam, nsIWordBreaker** breaker) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
NS_IMPL_ADDREF ( nsLWBreakerFImp );
|
NS_IMPL_ADDREF ( nsLWBreakerFImp );
|
||||||
NS_IMPL_RELEASE ( nsLWBreakerFImp );
|
NS_IMPL_RELEASE ( nsLWBreakerFImp );
|
||||||
|
|
||||||
nsresult nsLWBreakerFImp::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
nsresult
|
||||||
|
nsLWBreakerFImp::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
{
|
{
|
||||||
|
|
||||||
if( NULL == aInstancePtr) {
|
if( NULL == aInstancePtr) {
|
||||||
|
@ -119,7 +120,8 @@ static const PRUnichar gCnNoEnd[] =
|
||||||
{
|
{
|
||||||
0xfffd // to be changed
|
0xfffd // to be changed
|
||||||
};
|
};
|
||||||
nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsILineBreaker** oResult)
|
nsresult
|
||||||
|
nsLWBreakerFImp::GetBreaker(const nsAString& aParam, nsILineBreaker** oResult)
|
||||||
{
|
{
|
||||||
if( NULL == oResult) {
|
if( NULL == oResult) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -158,7 +160,8 @@ nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsILineBreaker** oResult)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsIWordBreaker** oResult)
|
nsresult
|
||||||
|
nsLWBreakerFImp::GetBreaker(const nsAString& aParam, nsIWordBreaker** oResult)
|
||||||
{
|
{
|
||||||
if( NULL == oResult) {
|
if( NULL == oResult) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
|
@ -58,8 +58,8 @@ public:
|
||||||
nsLWBreakerFImp();
|
nsLWBreakerFImp();
|
||||||
virtual ~nsLWBreakerFImp();
|
virtual ~nsLWBreakerFImp();
|
||||||
|
|
||||||
NS_IMETHOD GetBreaker(nsString& aParam, nsILineBreaker** breaker);
|
NS_IMETHOD GetBreaker(const nsAString& aParam, nsILineBreaker** breaker);
|
||||||
NS_IMETHOD GetBreaker(nsString& aParam, nsIWordBreaker** breaker);
|
NS_IMETHOD GetBreaker(const nsAString& aParam, nsIWordBreaker** breaker);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1166,7 +1166,7 @@ NS_IMETHODIMP
|
||||||
DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult)
|
DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||||
return CallQueryInterface(mDocument.get(), aResult);
|
return CallQueryInterface(mDocument, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -155,7 +155,6 @@ class nsIDocumentLoaderFactory;
|
||||||
|
|
||||||
|
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
#include "nsIXULContentSink.h"
|
|
||||||
#include "nsIXULDocument.h"
|
#include "nsIXULDocument.h"
|
||||||
#include "nsIXULPopupListener.h"
|
#include "nsIXULPopupListener.h"
|
||||||
#include "nsIXULPrototypeCache.h"
|
#include "nsIXULPrototypeCache.h"
|
||||||
|
@ -521,7 +520,6 @@ MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewCom
|
||||||
MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
|
MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
|
||||||
// NS_NewXULContentBuilder
|
// NS_NewXULContentBuilder
|
||||||
// NS_NewXULTreeBuilder
|
// NS_NewXULTreeBuilder
|
||||||
MAKE_CTOR(CreateXULContentSink, nsIXULContentSink, NS_NewXULContentSink)
|
|
||||||
MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
|
MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
|
||||||
MAKE_CTOR(CreateXULPopupListener, nsIXULPopupListener, NS_NewXULPopupListener)
|
MAKE_CTOR(CreateXULPopupListener, nsIXULPopupListener, NS_NewXULPopupListener)
|
||||||
// NS_NewXULControllers
|
// NS_NewXULControllers
|
||||||
|
@ -1129,11 +1127,6 @@ static const nsModuleComponentInfo gComponents[] = {
|
||||||
"@mozilla.org/xul/xul-tree-builder;1",
|
"@mozilla.org/xul/xul-tree-builder;1",
|
||||||
NS_NewXULTreeBuilder },
|
NS_NewXULTreeBuilder },
|
||||||
|
|
||||||
{ "XUL Content Sink",
|
|
||||||
NS_XULCONTENTSINK_CID,
|
|
||||||
"@mozilla.org/xul/xul-content-sink;1",
|
|
||||||
CreateXULContentSink },
|
|
||||||
|
|
||||||
{ "XUL Document",
|
{ "XUL Document",
|
||||||
NS_XULDOCUMENT_CID,
|
NS_XULDOCUMENT_CID,
|
||||||
"@mozilla.org/xul/xul-document;1",
|
"@mozilla.org/xul/xul-document;1",
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsDocument.h"
|
#include "nsDocument.h"
|
||||||
#include "nsMarkupDocument.h"
|
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
|
@ -188,7 +187,7 @@ void testStrings(nsIDocument* aDoc) {
|
||||||
printf("string tests complete\n");
|
printf("string tests complete\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyDocument : public nsMarkupDocument {
|
class MyDocument : public nsDocument {
|
||||||
public:
|
public:
|
||||||
MyDocument();
|
MyDocument();
|
||||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||||
|
|
|
@ -1873,9 +1873,10 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell,
|
||||||
*aTitle = nsnull;
|
*aTitle = nsnull;
|
||||||
*aURLStr = nsnull;
|
*aURLStr = nsnull;
|
||||||
|
|
||||||
const nsString* docTitle = aDoc->GetDocumentTitle();
|
nsAutoString docTitle;
|
||||||
if (docTitle && !docTitle->IsEmpty()) {
|
aDoc->GetDocumentTitle(docTitle);
|
||||||
*aTitle = ToNewUnicode(*docTitle);
|
if (!docTitle.IsEmpty()) {
|
||||||
|
*aTitle = ToNewUnicode(docTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> url;
|
nsCOMPtr<nsIURI> url;
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include "nsButtonBoxFrame.h"
|
#include "nsButtonBoxFrame.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsHTMLAtoms.h"
|
#include "nsHTMLAtoms.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMNSDocument.h"
|
#include "nsIDOMNSDocument.h"
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsISupportsArray.h"
|
#include "nsISupportsArray.h"
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
|
@ -1523,13 +1522,13 @@ nsMenuFrame::BuildAcceleratorText()
|
||||||
nsCOMPtr<nsIDocument> document;
|
nsCOMPtr<nsIDocument> document;
|
||||||
mContent->GetDocument(*getter_AddRefs(document));
|
mContent->GetDocument(*getter_AddRefs(document));
|
||||||
|
|
||||||
// Turn the document into a XUL document so we can use getElementById
|
// Turn the document into a DOM document so we can use getElementById
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDocument(do_QueryInterface(document));
|
nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(document));
|
||||||
if (!xulDocument)
|
if (!domDocument)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> keyDOMElement;
|
nsCOMPtr<nsIDOMElement> keyDOMElement;
|
||||||
xulDocument->GetElementById(keyValue, getter_AddRefs(keyDOMElement));
|
domDocument->GetElementById(keyValue, getter_AddRefs(keyDOMElement));
|
||||||
if (!keyDOMElement)
|
if (!keyDOMElement)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include "nsIDOMMouseEvent.h"
|
#include "nsIDOMMouseEvent.h"
|
||||||
#include "nsIDOMEventTarget.h"
|
#include "nsIDOMEventTarget.h"
|
||||||
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMXULDocument.h"
|
||||||
#include "nsIDOMXULElement.h"
|
#include "nsIDOMXULElement.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
@ -579,14 +580,15 @@ nsXULTooltipListener::GetTooltipFor(nsIContent* aTarget, nsIContent** aTooltip)
|
||||||
} else {
|
} else {
|
||||||
if (!tooltipId.IsEmpty()) {
|
if (!tooltipId.IsEmpty()) {
|
||||||
// tooltip must be an id, use getElementById to find it
|
// tooltip must be an id, use getElementById to find it
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
nsCOMPtr<nsIDOMDocument> domDocument =
|
||||||
if (!xulDocument) {
|
do_QueryInterface(document);
|
||||||
NS_ERROR("tooltip attached to an element that isn't in XUL!");
|
if (!domDocument) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> tooltipEl;
|
nsCOMPtr<nsIDOMElement> tooltipEl;
|
||||||
xulDocument->GetElementById(tooltipId, getter_AddRefs(tooltipEl));
|
domDocument->GetElementById(tooltipId,
|
||||||
|
getter_AddRefs(tooltipEl));
|
||||||
|
|
||||||
if (tooltipEl) {
|
if (tooltipEl) {
|
||||||
mNeedTitletip = PR_FALSE;
|
mNeedTitletip = PR_FALSE;
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include "nsIDocumentViewer.h"
|
#include "nsIDocumentViewer.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsIChannel.h"
|
#include "nsIChannel.h"
|
||||||
|
|
|
@ -56,7 +56,7 @@ interface nsIDOMXULTreeElement : nsIDOMXULElement {};
|
||||||
interface nsIDOMXULCommandDispatcher : nsISupports {};
|
interface nsIDOMXULCommandDispatcher : nsISupports {};
|
||||||
|
|
||||||
[scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)]
|
[scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)]
|
||||||
interface nsIDOMXULDocument : nsIDOMDocument {};
|
interface nsIDOMXULDocument : nsISupports {};
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
#include "nsIDocumentViewer.h"
|
#include "nsIDocumentViewer.h"
|
||||||
#include "nsIDocumentObserver.h"
|
#include "nsIDocumentObserver.h"
|
||||||
|
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsWidgetAtoms.h"
|
#include "nsWidgetAtoms.h"
|
||||||
|
|
||||||
#include <Menus.h>
|
#include <Menus.h>
|
||||||
|
@ -337,10 +337,10 @@ nsMenuBarX :: CommandEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
||||||
// the 'about' command is special because we don't have a nsIMenu or nsIMenuItem
|
// the 'about' command is special because we don't have a nsIMenu or nsIMenuItem
|
||||||
// for the apple menu. Grovel for the content node with an id of "aboutName"
|
// for the apple menu. Grovel for the content node with an id of "aboutName"
|
||||||
// and call it directly.
|
// and call it directly.
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(self->mDocument);
|
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(self->mDocument);
|
||||||
if ( xulDoc ) {
|
if ( domDoc ) {
|
||||||
nsCOMPtr<nsIDOMElement> domElement;
|
nsCOMPtr<nsIDOMElement> domElement;
|
||||||
xulDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement));
|
domDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement));
|
||||||
nsCOMPtr<nsIContent> aboutContent ( do_QueryInterface(domElement) );
|
nsCOMPtr<nsIContent> aboutContent ( do_QueryInterface(domElement) );
|
||||||
self->ExecuteCommand(aboutContent);
|
self->ExecuteCommand(aboutContent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDocumentViewer.h"
|
#include "nsIDocumentViewer.h"
|
||||||
#include "nsIDocumentObserver.h"
|
#include "nsIDocumentObserver.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
|
@ -875,13 +875,13 @@ void nsMenuX::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent
|
||||||
inMenuItemContent->GetDocument(*getter_AddRefs(document));
|
inMenuItemContent->GetDocument(*getter_AddRefs(document));
|
||||||
if ( !document )
|
if ( !document )
|
||||||
return;
|
return;
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(document);
|
||||||
if ( !xulDocument )
|
if ( !domDocument )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> keyElement;
|
nsCOMPtr<nsIDOMElement> keyElement;
|
||||||
if (!keyValue.IsEmpty())
|
if (!keyValue.IsEmpty())
|
||||||
xulDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
domDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
||||||
if ( keyElement ) {
|
if ( keyElement ) {
|
||||||
nsCOMPtr<nsIContent> keyContent ( do_QueryInterface(keyElement) );
|
nsCOMPtr<nsIContent> keyContent ( do_QueryInterface(keyElement) );
|
||||||
nsAutoString keyChar(NS_LITERAL_STRING(" "));
|
nsAutoString keyChar(NS_LITERAL_STRING(" "));
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDocumentViewer.h"
|
#include "nsIDocumentViewer.h"
|
||||||
#include "nsIDocumentObserver.h"
|
#include "nsIDocumentObserver.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
|
@ -559,9 +559,9 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||||
mMenuContent->GetDocument(*getter_AddRefs(doc));
|
mMenuContent->GetDocument(*getter_AddRefs(doc));
|
||||||
if (!doc)
|
if (!doc)
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(doc);
|
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
|
||||||
if (!xulDoc) {
|
if (!domDoc) {
|
||||||
NS_ERROR("nsIDOMDocument to nsIDOMXULDocument QI failed.");
|
NS_ERROR("nsIDocument to nsIDOMDocument QI failed.");
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,8 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
||||||
// <menuitem/>. This is the glue code which causes any script code
|
// <menuitem/>. This is the glue code which causes any script code
|
||||||
// in the <menuitem/> to be executed.
|
// in the <menuitem/> to be executed.
|
||||||
nsCOMPtr<nsIDOMElement> domElement;
|
nsCOMPtr<nsIDOMElement> domElement;
|
||||||
xulDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement));
|
domDoc->GetElementById(NS_LITERAL_STRING("aboutName"),
|
||||||
|
getter_AddRefs(domElement));
|
||||||
if (!domElement)
|
if (!domElement)
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
|
|
||||||
|
@ -1067,13 +1068,13 @@ nsMenu::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent )
|
||||||
inMenuItemContent->GetDocument(*getter_AddRefs(document));
|
inMenuItemContent->GetDocument(*getter_AddRefs(document));
|
||||||
if ( !document )
|
if ( !document )
|
||||||
return;
|
return;
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(document);
|
||||||
if ( !xulDocument )
|
if ( !domDocument )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> keyElement;
|
nsCOMPtr<nsIDOMElement> keyElement;
|
||||||
if (!keyValue.IsEmpty())
|
if (!keyValue.IsEmpty())
|
||||||
xulDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
domDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
||||||
if ( keyElement ) {
|
if ( keyElement ) {
|
||||||
nsCOMPtr<nsIContent> keyContent ( do_QueryInterface(keyElement) );
|
nsCOMPtr<nsIContent> keyContent ( do_QueryInterface(keyElement) );
|
||||||
nsAutoString keyChar(NS_LITERAL_STRING(" "));
|
nsAutoString keyChar(NS_LITERAL_STRING(" "));
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
#include "nsWidgetAtoms.h"
|
#include "nsWidgetAtoms.h"
|
||||||
|
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
|
|
||||||
#include <Menus.h>
|
#include <Menus.h>
|
||||||
#include <TextUtils.h>
|
#include <TextUtils.h>
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
#include "nsIDocumentViewer.h"
|
#include "nsIDocumentViewer.h"
|
||||||
#include "nsIDocumentObserver.h"
|
#include "nsIDocumentObserver.h"
|
||||||
|
|
||||||
#include "nsIDOMXULDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsWidgetAtoms.h"
|
#include "nsWidgetAtoms.h"
|
||||||
|
|
||||||
#include <Menus.h>
|
#include <Menus.h>
|
||||||
|
@ -339,13 +339,15 @@ nsMenuBarX :: CommandEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
||||||
|
|
||||||
case kHICommandAbout:
|
case kHICommandAbout:
|
||||||
{
|
{
|
||||||
// the 'about' command is special because we don't have a nsIMenu or nsIMenuItem
|
// the 'about' command is special because we don't have a
|
||||||
// for the apple menu. Grovel for the content node with an id of "aboutName"
|
// nsIMenu or nsIMenuItem for the apple menu. Grovel for the
|
||||||
// and call it directly.
|
// content node with an id of "aboutName" and call it
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(self->mDocument);
|
// directly.
|
||||||
if ( xulDoc ) {
|
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(self->mDocument);
|
||||||
|
if ( domDoc ) {
|
||||||
nsCOMPtr<nsIDOMElement> domElement;
|
nsCOMPtr<nsIDOMElement> domElement;
|
||||||
xulDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement));
|
domDoc->GetElementById(NS_LITERAL_STRING("aboutName"),
|
||||||
|
getter_AddRefs(domElement));
|
||||||
nsCOMPtr<nsIContent> aboutContent ( do_QueryInterface(domElement) );
|
nsCOMPtr<nsIContent> aboutContent ( do_QueryInterface(domElement) );
|
||||||
self->ExecuteCommand(aboutContent);
|
self->ExecuteCommand(aboutContent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,12 +197,6 @@ nsIDOMWindow = { /* a6cf906b-15b3-11d2-932e-00805f8add32 */
|
||||||
0x11d2,
|
0x11d2,
|
||||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}
|
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}
|
||||||
};
|
};
|
||||||
nsIDOMEventCapturer = { /* a6cf906c-15b3-11d2-932e-00805f8add32 */
|
|
||||||
0xa6cf906c,
|
|
||||||
0x15b3,
|
|
||||||
0x11d2,
|
|
||||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}
|
|
||||||
};
|
|
||||||
nsIDOMLocation = { /* a6cf906d-15b3-11d2-932e-00805f8add32 */
|
nsIDOMLocation = { /* a6cf906d-15b3-11d2-932e-00805f8add32 */
|
||||||
0xa6cf906d,
|
0xa6cf906d,
|
||||||
0x15b3,
|
0x15b3,
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
#include "nsIDOMElement.h"
|
#include "nsIDOMElement.h"
|
||||||
#include "nsIDOMWindowInternal.h"
|
#include "nsIDOMWindowInternal.h"
|
||||||
#include "nsIDOMScreen.h"
|
#include "nsIDOMScreen.h"
|
||||||
#include "nsIDOMXULDocument.h"
|
|
||||||
#include "nsIEmbeddingSiteWindow.h"
|
#include "nsIEmbeddingSiteWindow.h"
|
||||||
#include "nsIEmbeddingSiteWindow2.h"
|
#include "nsIEmbeddingSiteWindow2.h"
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
@ -1414,7 +1413,7 @@ NS_IMETHODIMP nsXULWindow::GetDOMElementById(char* aID, nsIDOMElement** aDOMElem
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> doc;
|
nsCOMPtr<nsIDocument> doc;
|
||||||
docv->GetDocument(*getter_AddRefs(doc));
|
docv->GetDocument(*getter_AddRefs(doc));
|
||||||
nsCOMPtr<nsIDOMXULDocument> domdoc(do_QueryInterface(doc));
|
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(doc));
|
||||||
if(!domdoc)
|
if(!domdoc)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче