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 "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULLabelElement.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
|
|
|
@ -926,9 +926,7 @@ NS_IMETHODIMP nsDocAccessibleMixin::GetURL(nsAString& aURL)
|
|||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetTitle(nsAString& aTitle)
|
||||
{
|
||||
// This doesn't leak - we don't own the const pointer that's returned
|
||||
aTitle = *(mDocument->GetDocumentTitle());
|
||||
return NS_OK;
|
||||
return mDocument->GetDocumentTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleMixin::GetMimeType(nsAString& aMimeType)
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nsISupports.h"
|
||||
#include "nsEvent.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsString.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
|
@ -78,7 +77,6 @@ class nsIBindingManager;
|
|||
class nsIObserver;
|
||||
class nsISupportsArray;
|
||||
class nsIScriptLoader;
|
||||
class nsString;
|
||||
class nsIContentSink;
|
||||
class nsIScriptEventManager;
|
||||
|
||||
|
@ -118,7 +116,7 @@ public:
|
|||
/**
|
||||
* 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.
|
||||
|
@ -143,7 +141,8 @@ public:
|
|||
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 SetBaseURL(nsIURI* aURL) = 0;
|
||||
|
@ -155,8 +154,9 @@ public:
|
|||
NS_IMETHOD SetBaseTarget(const nsAString &aBaseTarget)=0;
|
||||
|
||||
/**
|
||||
* Return a standard name for the document's character set. This will
|
||||
* trigger a startDocumentLoad if necessary to answer the question.
|
||||
* Return a standard name for the document's character set. This
|
||||
* will trigger a startDocumentLoad if necessary to answer the
|
||||
* question.
|
||||
*/
|
||||
NS_IMETHOD GetDocumentCharacterSet(nsAString& oCharSetID) = 0;
|
||||
NS_IMETHOD SetDocumentCharacterSet(const nsAString& aCharSetID) = 0;
|
||||
|
@ -188,8 +188,8 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetContentLanguage(nsAString& aContentLanguage) const = 0;
|
||||
|
||||
// The state BidiEnabled should persist across multiple views (screen, print)
|
||||
// of the same document.
|
||||
// The state BidiEnabled should persist across multiple views
|
||||
// (screen, print) of the same document.
|
||||
|
||||
/**
|
||||
* Check if the document contains bidi data.
|
||||
|
@ -214,15 +214,15 @@ public:
|
|||
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) = 0;
|
||||
|
||||
/**
|
||||
* Access HTTP header data (this may also get set from other sources, like
|
||||
* HTML META tags).
|
||||
* Access HTTP header data (this may also get set from other
|
||||
* sources, like HTML META tags).
|
||||
*/
|
||||
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAString& aData) const = 0;
|
||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAString& aData) = 0;
|
||||
|
||||
/**
|
||||
* Create a new presentation shell that will use aContext for
|
||||
* it's presentation context (presentation context's <b>must not</b> be
|
||||
* Create a new presentation shell that will use aContext for it's
|
||||
* presentation context (presentation context's <b>must not</b> be
|
||||
* shared among multiple presentation shell's).
|
||||
*/
|
||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||
|
@ -431,8 +431,6 @@ public:
|
|||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus) = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement) = 0;
|
||||
|
||||
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE,
|
||||
PRBool aUpdateViews=PR_FALSE) = 0;
|
||||
|
||||
|
|
|
@ -510,6 +510,7 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
|||
#endif
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aTrustedNode->GetOwnerDocument(getter_AddRefs(domDoc));
|
||||
|
||||
if (!domDoc) {
|
||||
// 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
|
||||
|
@ -530,8 +531,7 @@ nsContentUtils::CheckSameOrigin(nsIDOMNode *aTrustedNode,
|
|||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
trustedDoc = do_QueryInterface(domDoc);
|
||||
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 (trustedDoc == unTrustedDoc && trustedDoc)
|
||||
if (trustedDoc == unTrustedDoc && trustedDoc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!trustedPrincipal) {
|
||||
trustedDoc->GetPrincipal(getter_AddRefs(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;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -38,9 +38,13 @@
|
|||
#ifndef nsDocument_h___
|
||||
#define nsDocument_h___
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMDocumentView.h"
|
||||
|
@ -56,6 +60,7 @@
|
|||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIEventListenerManager.h"
|
||||
#include "nsGenericDOMNodeList.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIBindingManager.h"
|
||||
|
@ -84,51 +89,25 @@ class nsIDTD;
|
|||
class nsXPathDocumentTearoff;
|
||||
class nsIRadioVisitor;
|
||||
class nsIFormControl;
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
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;
|
||||
nsString mData;
|
||||
nsDocHeaderData* mNext;
|
||||
~nsDocHeaderData(void)
|
||||
{
|
||||
delete mNext;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> mField;
|
||||
nsString mData;
|
||||
nsDocHeaderData* mNext;
|
||||
};
|
||||
|
||||
// Represents the children of a document (prolog, epilog and
|
||||
|
@ -145,6 +124,8 @@ public:
|
|||
void DropReference();
|
||||
|
||||
protected:
|
||||
nsDocumentChildNodes(); // Not implemented
|
||||
|
||||
nsIDocument* mDocument;
|
||||
};
|
||||
|
||||
|
@ -159,7 +140,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIDOMSTYLESHEETLIST
|
||||
|
||||
|
||||
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
|
||||
|
@ -167,7 +148,7 @@ public:
|
|||
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
|
||||
nsIPresShell* aShell) { return NS_OK; }
|
||||
NS_IMETHOD EndReflow(nsIDocument *aDocument,
|
||||
nsIPresShell* aShell) { return NS_OK; }
|
||||
nsIPresShell* aShell) { return NS_OK; }
|
||||
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) { return NS_OK; }
|
||||
|
@ -183,7 +164,7 @@ public:
|
|||
nsChangeHint aHint) { return NS_OK; }
|
||||
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer)
|
||||
PRInt32 aNewIndexInContainer)
|
||||
{ return NS_OK; }
|
||||
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
|
||||
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.
|
||||
//
|
||||
// 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 unless someone writes a real implementation of
|
||||
// the interface.
|
||||
class nsDocument : public nsIDocument,
|
||||
public nsIDOMXMLDocument, // inherits nsIDOMDocument
|
||||
class nsDocument : public nsIDocument,
|
||||
public nsIDOMXMLDocument, // inherits nsIDOMDocument
|
||||
public nsIDOMNSDocument,
|
||||
public nsIDOMDocumentEvent,
|
||||
public nsIDOM3DocumentEvent,
|
||||
|
@ -275,6 +234,8 @@ class nsDocument : public nsIDocument,
|
|||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
|
||||
NS_IMETHOD GetArena(nsIArena** aArena);
|
||||
|
||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||
|
@ -293,7 +254,7 @@ public:
|
|||
/**
|
||||
* 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.
|
||||
|
@ -396,13 +357,10 @@ public:
|
|||
* it's presentation context (presentation context's <b>must not</b> be
|
||||
* shared among multiple presentation shell's).
|
||||
*/
|
||||
#if 0
|
||||
// XXX Temp hack: moved to nsMarkupDocument
|
||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||
nsIViewManager* aViewManager,
|
||||
nsIStyleSet* aStyleSet,
|
||||
nsIPresShell** aInstancePtrResult);
|
||||
#endif
|
||||
virtual PRBool DeleteShell(nsIPresShell* aShell);
|
||||
virtual PRInt32 GetNumberOfShells();
|
||||
NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell);
|
||||
|
@ -425,7 +383,7 @@ public:
|
|||
NS_IMETHOD GetRootContent(nsIContent** aRoot);
|
||||
NS_IMETHOD SetRootContent(nsIContent* aRoot);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get the direct children of the document - content in
|
||||
* the prolog, the root content and content in the epilog.
|
||||
*/
|
||||
|
@ -444,7 +402,7 @@ public:
|
|||
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);
|
||||
virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet);
|
||||
|
@ -456,7 +414,7 @@ public:
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject);
|
||||
|
@ -464,7 +422,7 @@ public:
|
|||
|
||||
/**
|
||||
* Get the script loader for this document
|
||||
*/
|
||||
*/
|
||||
NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader);
|
||||
|
||||
/**
|
||||
|
@ -543,7 +501,7 @@ public:
|
|||
nsIFormControl* aRadio);
|
||||
NS_IMETHOD RemoveFromRadioGroup(const nsAString& aName,
|
||||
nsIFormControl* aRadio);
|
||||
|
||||
|
||||
// for radio group
|
||||
nsresult GetRadioGroup(const nsAString& aName,
|
||||
nsRadioGroupStruct **aRadioGroup);
|
||||
|
@ -599,15 +557,10 @@ public:
|
|||
// nsIDOM3EventTarget
|
||||
NS_DECL_NSIDOM3EVENTTARGET
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
||||
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement);
|
||||
|
||||
|
||||
NS_IMETHOD SetDocumentURL(nsIURI* aURI);
|
||||
|
||||
virtual nsresult Init();
|
||||
|
@ -621,56 +574,74 @@ protected:
|
|||
virtual already_AddRefed<nsIStyleSheet> InternalGetStyleSheetAt(PRInt32 aIndex);
|
||||
virtual PRInt32 InternalGetNumberOfStyleSheets();
|
||||
|
||||
nsDocument();
|
||||
virtual ~nsDocument();
|
||||
nsresult doCreateShell(nsIPresContext* aContext,
|
||||
nsIViewManager* aViewManager, nsIStyleSet* aStyleSet,
|
||||
nsCompatibility aCompatMode,
|
||||
nsIPresShell** aInstancePtrResult);
|
||||
|
||||
nsIArena* mArena;
|
||||
nsDocument();
|
||||
virtual ~nsDocument();
|
||||
|
||||
nsCOMPtr<nsIArena> mArena;
|
||||
nsString mDocumentTitle;
|
||||
nsIURI* mDocumentURL;
|
||||
nsCOMPtr<nsIURI> mDocumentURL;
|
||||
nsCOMPtr<nsIURI> mDocumentBaseURL;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
PRUint32 mLoadFlags; // load flags of the document's channel
|
||||
|
||||
nsWeakPtr mDocumentLoadGroup;
|
||||
|
||||
nsWeakPtr mDocumentContainer;
|
||||
|
||||
nsString mCharacterSet;
|
||||
PRInt32 mCharacterSetSource;
|
||||
|
||||
|
||||
nsVoidArray mCharSetObservers;
|
||||
nsIDocument* mParentDocument;
|
||||
|
||||
PLDHashTable *mSubDocuments;
|
||||
|
||||
nsVoidArray mPresShells;
|
||||
nsCOMArray<nsIContent> mChildren; // contains owning references
|
||||
nsIContent* mRootContent; // a weak reference to the only element in
|
||||
// mChildren, or null if no such element exists.
|
||||
nsSmallVoidArray mPresShells;
|
||||
|
||||
// Array of owning references to all children
|
||||
nsCOMArray<nsIContent> mChildren;
|
||||
|
||||
// A weak reference to the only element in mChildren, or null if no
|
||||
// such element exists.
|
||||
nsIContent* mRootContent;
|
||||
|
||||
nsCOMArray<nsIStyleSheet> mStyleSheets;
|
||||
nsAutoVoidArray mObservers; // basically always has at least 1 entry
|
||||
|
||||
// Basically always has at least 1 entry
|
||||
nsAutoVoidArray mObservers;
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||
nsIEventListenerManager* mListenerManager;
|
||||
PRBool mInDestructor;
|
||||
nsCOMPtr<nsIEventListenerManager> mListenerManager;
|
||||
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
|
||||
nsCOMPtr<nsIScriptLoader> mScriptLoader;
|
||||
nsDocHeaderData* mHeaderData;
|
||||
nsCOMPtr<nsILineBreaker> mLineBreaker;
|
||||
nsCOMPtr<nsIWordBreaker> mWordBreaker;
|
||||
nsDocumentChildNodes* mChildNodes;
|
||||
// A content ID counter used to give a monotonically increasing ID to the content
|
||||
// objects in the document's content model
|
||||
|
||||
nsRefPtr<nsDocumentChildNodes> mChildNodes;
|
||||
|
||||
// A content ID counter used to give a monotonically increasing ID
|
||||
// to the content objects in the document's content model
|
||||
PRInt32 mNextContentID;
|
||||
|
||||
nsHashtable mRadioGroups;
|
||||
|
||||
PRBool mBidiEnabled;
|
||||
|
||||
nsCOMPtr<nsIBindingManager> mBindingManager;
|
||||
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;
|
||||
PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery.
|
||||
|
||||
nsSupportsHashtable mContentWrapperHash;
|
||||
|
||||
|
|
|
@ -1166,7 +1166,7 @@ NS_IMETHODIMP
|
|||
DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
return CallQueryInterface(mDocument.get(), aResult);
|
||||
return CallQueryInterface(mDocument, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1873,9 +1873,10 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell,
|
|||
*aTitle = nsnull;
|
||||
*aURLStr = nsnull;
|
||||
|
||||
const nsString* docTitle = aDoc->GetDocumentTitle();
|
||||
if (docTitle && !docTitle->IsEmpty()) {
|
||||
*aTitle = ToNewUnicode(*docTitle);
|
||||
nsAutoString docTitle;
|
||||
aDoc->GetDocumentTitle(docTitle);
|
||||
if (!docTitle.IsEmpty()) {
|
||||
*aTitle = ToNewUnicode(docTitle);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> url;
|
||||
|
|
|
@ -444,7 +444,6 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||
*getter_AddRefs(attrPrefix));
|
||||
|
||||
if (namespaceID == kNameSpaceID_XMLNS) {
|
||||
PRBool hasPrefix = attrPrefix ? PR_TRUE : PR_FALSE;
|
||||
content->GetAttr(namespaceID, attrName, uriStr);
|
||||
|
||||
if (!attrPrefix) {
|
||||
|
|
|
@ -1529,10 +1529,10 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsIPresContext* aPresContext,
|
||||
const nsAString& aEventType,
|
||||
nsEvent *aEvent)
|
||||
nsresult
|
||||
NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsIPresContext* aPresContext, const nsAString& aEventType,
|
||||
nsEvent *aEvent)
|
||||
{
|
||||
nsDOMEvent* it = new nsDOMEvent(aPresContext, aEvent, aEventType);
|
||||
|
||||
|
@ -1543,7 +1543,9 @@ nsresult NS_NewDOMUIEvent(nsIDOMEvent** 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;
|
||||
}
|
||||
|
|
|
@ -493,19 +493,6 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
|||
listeners->AppendElement((void*)ls);
|
||||
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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -641,7 +641,6 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsIFocusController> focusController;
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
nsCOMPtr<nsIDOMWindowInternal> focusedWindow;
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(mDocument);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> 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 \
|
||||
nsPluginDocument.cpp \
|
||||
nsImageDocument.cpp \
|
||||
nsMarkupDocument.cpp \
|
||||
nsWyciwygChannel.cpp \
|
||||
nsWyciwygProtocolHandler.cpp \
|
||||
$(NULL)
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -39,12 +39,14 @@
|
|||
#define nsHTMLDocument_h___
|
||||
|
||||
#include "nsDocument.h"
|
||||
#include "nsMarkupDocument.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsIDOMHTMLMapElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIHTMLContentContainer.h"
|
||||
#include "nsIParser.h"
|
||||
#include "jsapi.h"
|
||||
#include "rdf.h"
|
||||
#include "nsRDFCID.h"
|
||||
|
@ -61,8 +63,6 @@
|
|||
|
||||
#include "nsICommandManager.h"
|
||||
|
||||
class nsBaseContentList;
|
||||
class nsContentList;
|
||||
class nsIParser;
|
||||
class nsICSSLoader;
|
||||
class nsIURI;
|
||||
|
@ -70,7 +70,7 @@ class nsIMarkupDocumentViewer;
|
|||
class nsIDocumentCharsetInfo;
|
||||
class nsICacheEntryDescriptor;
|
||||
|
||||
class nsHTMLDocument : public nsMarkupDocument,
|
||||
class nsHTMLDocument : public nsDocument,
|
||||
public nsIHTMLDocument,
|
||||
public nsIDOMHTMLDocument,
|
||||
public nsIDOMNSHTMLDocument,
|
||||
|
@ -86,6 +86,7 @@ public:
|
|||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||
NS_IMETHOD ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup);
|
||||
|
||||
NS_IMETHOD CreateShell(nsIPresContext* aContext,
|
||||
|
@ -116,7 +117,6 @@ public:
|
|||
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aStyleSheet);
|
||||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
||||
|
||||
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const;
|
||||
NS_IMETHOD GetBaseTarget(nsAString& aTarget);
|
||||
NS_IMETHOD SetBaseTarget(const nsAString& aTarget);
|
||||
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint aHint);
|
||||
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
|
@ -180,7 +180,7 @@ public:
|
|||
NS_IMETHOD Write(const nsAString & text);
|
||||
NS_IMETHOD Writeln(const nsAString & text);
|
||||
NS_IMETHOD GetElementsByName(const nsAString & elementName,
|
||||
nsIDOMNodeList **_retval);
|
||||
nsIDOMNodeList **_retval);
|
||||
|
||||
// nsIDOMNSHTMLDocument interface
|
||||
NS_DECL_NSIDOMNSHTMLDOCUMENT
|
||||
|
@ -236,9 +236,9 @@ protected:
|
|||
static void DocumentWriteTerminationFunc(nsISupports *aRef);
|
||||
|
||||
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,
|
||||
PRBool aNewlineTerminate);
|
||||
|
@ -254,73 +254,75 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
||||
nsCOMPtr<nsIHTMLCSSStyleSheet> mStyleAttrStyleSheet;
|
||||
nsIURI* mBaseURL;
|
||||
nsString* mBaseTarget;
|
||||
nsString* mLastModified;
|
||||
nsString* mReferrer;
|
||||
nsCOMPtr<nsIHttpChannel> mHttpChannel;
|
||||
nsCompatibility mCompatMode;
|
||||
nsCOMPtr<nsISupportsArray> mImageMaps;
|
||||
|
||||
nsContentList *mImages;
|
||||
nsContentList *mApplets;
|
||||
nsContentList *mEmbeds;
|
||||
nsContentList *mLinks;
|
||||
nsContentList *mAnchors;
|
||||
nsContentList *mForms;
|
||||
nsContentList *mLayers;
|
||||
|
||||
nsIParser *mParser;
|
||||
nsString mBaseTarget;
|
||||
nsString mLastModified;
|
||||
nsString mReferrer;
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> mHttpChannel;
|
||||
|
||||
nsCompatibility mCompatMode;
|
||||
|
||||
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 */
|
||||
PRInt32 mNumForms;
|
||||
|
||||
//ahmed 12-2
|
||||
// ahmed 12-2
|
||||
PRInt32 mTexttype;
|
||||
|
||||
|
||||
static nsrefcnt gRefCntRDFService;
|
||||
static nsIRDFService* gRDF;
|
||||
|
||||
|
||||
static PRBool TryHintCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
PRInt32& aCharsetSource,
|
||||
PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
static PRBool TryUserForcedCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
nsIDocumentCharsetInfo* aDocInfo,
|
||||
PRInt32& aCharsetSource,
|
||||
PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
static PRBool TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor,
|
||||
PRInt32& aCharsetSource,
|
||||
static PRBool TryCacheCharset(nsICacheEntryDescriptor* aCacheDescriptor,
|
||||
PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
static PRBool TryBookmarkCharset(nsAFlatCString* aUrlSpec,
|
||||
PRInt32& aCharsetSource,
|
||||
PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
static PRBool TryParentCharset(nsIDocumentCharsetInfo* aDocInfo,
|
||||
PRInt32& charsetSource,
|
||||
nsAString& aCharset);
|
||||
static PRBool UseWeakDocTypeDefault(PRInt32& aCharsetSource,
|
||||
PRInt32& charsetSource, nsAString& aCharset);
|
||||
static PRBool UseWeakDocTypeDefault(PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
static PRBool TryChannelCharset(nsIChannel *aChannel,
|
||||
PRInt32& aCharsetSource,
|
||||
static PRBool TryChannelCharset(nsIChannel *aChannel,
|
||||
PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
static PRBool TryDefaultCharset(nsIMarkupDocumentViewer* aMarkupDV,
|
||||
PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
PRInt32& aCharsetSource,
|
||||
nsAString& aCharset);
|
||||
|
||||
void StartAutodetection(nsIDocShell *aDocShell,
|
||||
nsAString& aCharset,
|
||||
void StartAutodetection(nsIDocShell *aDocShell, nsAString& aCharset,
|
||||
const char* aCommand);
|
||||
|
||||
PRUint32 mIsWriting : 1;
|
||||
PRUint32 mWriteLevel : 31;
|
||||
PRUint32 mWyciwygSessionCnt;
|
||||
|
||||
// Load flags of the document's channel
|
||||
PRUint32 mLoadFlags;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mBodyContent;
|
||||
|
||||
/*
|
||||
* Bug 13871: Frameset spoofing - find out if document.domain was set
|
||||
*/
|
||||
PRPackedBool mDomainWasSet;
|
||||
PRPackedBool mIdAndNameHashIsLive;
|
||||
|
||||
PLDHashTable mIdAndNameHashTable;
|
||||
|
||||
|
@ -339,7 +341,7 @@ protected:
|
|||
|
||||
nsresult DoClipboardSecurityCheck(PRBool aPaste);
|
||||
static jsval sCutCopyInternal_id;
|
||||
static jsval sPasteInternal_id;
|
||||
static jsval sPasteInternal_id;
|
||||
};
|
||||
|
||||
#endif /* nsHTMLDocument_h___ */
|
||||
|
|
|
@ -832,7 +832,7 @@ nsHTMLFragmentContentSink::AddTextToContent(nsIHTMLContent* aContent,const nsStr
|
|||
if (NS_SUCCEEDED(result)) {
|
||||
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 GetBodyElement(nsIDOMHTMLBodyElement** aBody) = 0;
|
||||
|
||||
NS_IMETHOD_(PRBool) IsWriting() = 0;
|
||||
|
||||
};
|
||||
|
|
|
@ -180,15 +180,16 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
|
|||
return nsMediaDocumentStreamListener::OnStopRequest(request, ctxt, status);
|
||||
}
|
||||
|
||||
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
|
||||
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()
|
||||
|
@ -198,8 +199,8 @@ nsImageDocument::~nsImageDocument()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsHTMLDocument)
|
||||
NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsHTMLDocument)
|
||||
NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsMediaDocument)
|
||||
NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsMediaDocument)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsImageDocument)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIImageDocument)
|
||||
|
@ -207,7 +208,7 @@ NS_INTERFACE_MAP_BEGIN(nsImageDocument)
|
|||
NS_INTERFACE_MAP_ENTRY(imgIContainerObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ImageDocument)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsHTMLDocument)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument)
|
||||
|
||||
|
||||
nsresult
|
||||
|
@ -243,9 +244,10 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
|
|||
PRBool aReset,
|
||||
nsIContentSink* aSink)
|
||||
{
|
||||
nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
||||
aContainer, aDocListener, aReset,
|
||||
aSink);
|
||||
nsresult rv =
|
||||
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
||||
aContainer, aDocListener, aReset,
|
||||
aSink);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -278,7 +280,8 @@ nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObjec
|
|||
|
||||
target = do_QueryInterface(mScriptGlobalObject);
|
||||
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)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
if (aScriptGlobalObject) {
|
||||
// Create synthetic document
|
||||
rv = CreateSyntheticDocument();
|
||||
|
@ -512,8 +515,9 @@ nsImageDocument::CreateSyntheticDocument()
|
|||
if (mStringBundle) {
|
||||
const PRUnichar* formatString[1] = { srcString.get() };
|
||||
nsXPIDLString errorMsg;
|
||||
rv = mStringBundle->FormatStringFromName(NS_LITERAL_STRING("InvalidImage").get(),
|
||||
formatString, 1, getter_Copies(errorMsg));
|
||||
NS_NAMED_LITERAL_STRING(str, "InvalidImage");
|
||||
mStringBundle->FormatStringFromName(str.get(), formatString, 1,
|
||||
getter_Copies(errorMsg));
|
||||
|
||||
image->SetAttr(kNameSpaceID_None, nsHTMLAtoms::alt, errorMsg, PR_FALSE);
|
||||
}
|
||||
|
@ -539,7 +543,8 @@ nsImageDocument::CheckOverflowing()
|
|||
context->GetVisibleArea(visibleArea);
|
||||
|
||||
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*)styleContext->GetStyleData(eStyleStruct_Margin);
|
||||
|
@ -557,7 +562,8 @@ nsImageDocument::CheckOverflowing()
|
|||
mVisibleWidth = NSTwipsToIntPixels(visibleArea.width, t2p);
|
||||
mVisibleHeight = NSTwipsToIntPixels(visibleArea.height, t2p);
|
||||
|
||||
mImageIsOverflowing = mImageWidth > mVisibleWidth || mImageHeight > mVisibleHeight;
|
||||
mImageIsOverflowing =
|
||||
mImageWidth > mVisibleWidth || mImageHeight > mVisibleHeight;
|
||||
|
||||
if (mImageIsOverflowing) {
|
||||
ShrinkToFit();
|
||||
|
@ -569,8 +575,8 @@ nsImageDocument::CheckOverflowing()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsImageDocument::UpdateTitle()
|
||||
nsresult
|
||||
nsImageDocument::UpdateTitle()
|
||||
{
|
||||
if (mStringBundle) {
|
||||
nsXPIDLString fileStr;
|
||||
|
@ -584,12 +590,13 @@ nsresult nsImageDocument::UpdateTitle()
|
|||
nsresult rv;
|
||||
nsCAutoString 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))
|
||||
{
|
||||
nsCAutoString originCharset;
|
||||
rv = url->GetOriginCharset(originCharset);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = textToSubURI->UnEscapeURIForUI(originCharset, fileName, fileStr);
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -607,7 +614,8 @@ nsresult nsImageDocument::UpdateTitle()
|
|||
mimeType.BeginReading(start);
|
||||
mimeType.EndReading(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
|
||||
if (*iter == 'X') {
|
||||
++iter;
|
||||
|
@ -631,20 +639,46 @@ nsresult nsImageDocument::UpdateTitle()
|
|||
if (!fileStr.IsEmpty()) {
|
||||
// if we got a valid size (sometimes we do not) then display it
|
||||
if (mImageWidth != 0 && mImageHeight != 0){
|
||||
const PRUnichar *formatStrings[4] = {fileStr.get(), typeStr.get(), widthStr.get(), heightStr.get()};
|
||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithDimensionsAndFile").get(), formatStrings, 4, getter_Copies(valUni));
|
||||
const PRUnichar *formatStrings[4] =
|
||||
{
|
||||
fileStr.get(),
|
||||
typeStr.get(),
|
||||
widthStr.get(),
|
||||
heightStr.get()
|
||||
};
|
||||
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithDimensionsAndFile");
|
||||
mStringBundle->FormatStringFromName(str.get(), formatStrings, 4,
|
||||
getter_Copies(valUni));
|
||||
} else {
|
||||
const PRUnichar *formatStrings[2] = {fileStr.get(), typeStr.get()};
|
||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithoutDimensions").get(), formatStrings, 2, getter_Copies(valUni));
|
||||
const PRUnichar *formatStrings[2] =
|
||||
{
|
||||
fileStr.get(),
|
||||
typeStr.get()
|
||||
};
|
||||
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithoutDimensions");
|
||||
mStringBundle->FormatStringFromName(str.get(), formatStrings, 2,
|
||||
getter_Copies(valUni));
|
||||
}
|
||||
} else {
|
||||
// if we got a valid size (sometimes we do not) then display it
|
||||
if (mImageWidth != 0 && mImageHeight != 0){
|
||||
const PRUnichar *formatStrings[3] = {typeStr.get(), widthStr.get(), heightStr.get()};
|
||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithDimensions").get(), formatStrings, 3, getter_Copies(valUni));
|
||||
const PRUnichar *formatStrings[3] =
|
||||
{
|
||||
typeStr.get(),
|
||||
widthStr.get(),
|
||||
heightStr.get()
|
||||
};
|
||||
NS_NAMED_LITERAL_STRING(str, "ImageTitleWithDimensions");
|
||||
mStringBundle->FormatStringFromName(str.get(), formatStrings, 3,
|
||||
getter_Copies(valUni));
|
||||
} else {
|
||||
const PRUnichar *formatStrings[1] = {typeStr.get()};
|
||||
mStringBundle->FormatStringFromName(NS_LITERAL_STRING("ImageTitleWithNeitherDimensionsNorFile").get(), formatStrings, 1, getter_Copies(valUni));
|
||||
const PRUnichar *formatStrings[1] =
|
||||
{
|
||||
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);
|
||||
|
||||
protected:
|
||||
nsresult CreateSyntheticDocument(nsACString &aMimeType);
|
||||
nsresult CreateSyntheticPluginDocument(nsACString &aMimeType);
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> mPluginContent;
|
||||
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
|
||||
};
|
||||
|
||||
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
|
||||
nsPluginDocument::nsPluginDocument()
|
||||
{
|
||||
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
|
||||
}
|
||||
|
||||
nsPluginDocument::~nsPluginDocument()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsHTMLDocument)
|
||||
NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsHTMLDocument)
|
||||
NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsMediaDocument)
|
||||
NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsMediaDocument)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsPluginDocument)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPluginDocument)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsHTMLDocument)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -92,9 +101,10 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
|
|||
PRBool aReset,
|
||||
nsIContentSink* aSink)
|
||||
{
|
||||
nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
||||
aContainer, aDocListener, aReset,
|
||||
aSink);
|
||||
nsresult rv =
|
||||
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
||||
aContainer, aDocListener, aReset,
|
||||
aSink);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -106,7 +116,7 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
|
|||
}
|
||||
|
||||
// Create synthetic document
|
||||
rv = CreateSyntheticDocument(mimeType);
|
||||
rv = CreateSyntheticPluginDocument(mimeType);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -120,7 +130,8 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsPluginDocument::CreateSyntheticDocument(nsACString &aMimeType)
|
||||
nsresult
|
||||
nsPluginDocument::CreateSyntheticPluginDocument(nsACString &aMimeType)
|
||||
{
|
||||
// do not allow message panes to host full-page plugins
|
||||
// returning an error causes helper apps to take over
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -792,7 +792,7 @@ nsXBLPrototypeBinding::InitClass(const nsCString& aClassName,
|
|||
nsIScriptContext * aContext,
|
||||
void * aScriptObject, void ** aClassObject)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER (aClassObject);
|
||||
NS_ENSURE_ARG_POINTER(aClassObject);
|
||||
|
||||
*aClassObject = nsnull;
|
||||
|
||||
|
|
|
@ -1266,22 +1266,23 @@ nsXMLContentSink::FlushText(PRBool aCreateTextNode, PRBool* aDidFlush)
|
|||
PRBool didFlush = PR_FALSE;
|
||||
if (0 != mTextLength) {
|
||||
if (aCreateTextNode) {
|
||||
nsCOMPtr<nsITextContent> content;
|
||||
rv = NS_NewTextNode(getter_AddRefs(content));
|
||||
if (NS_OK == rv) {
|
||||
// Set the content's document
|
||||
content->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
||||
nsCOMPtr<nsITextContent> textContent;
|
||||
rv = NS_NewTextNode(getter_AddRefs(textContent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Set the text in the text node
|
||||
content->SetText(mText, mTextLength, PR_FALSE);
|
||||
// Set the content's document
|
||||
textContent->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
||||
|
||||
// Add text to its parent
|
||||
AddContentAsLeaf(content);
|
||||
}
|
||||
// Set the text in the text node
|
||||
textContent->SetText(mText, mTextLength, PR_FALSE);
|
||||
|
||||
// Add text to its parent
|
||||
AddContentAsLeaf(textContent);
|
||||
}
|
||||
mTextLength = 0;
|
||||
didFlush = PR_TRUE;
|
||||
}
|
||||
|
||||
if (nsnull != aDidFlush) {
|
||||
*aDidFlush = didFlush;
|
||||
}
|
||||
|
|
|
@ -183,12 +183,15 @@ NS_NewXMLDocument(nsIDocument** aInstancePtrResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
|
||||
nsXMLDocument::nsXMLDocument()
|
||||
: mCountCatalogSheets(0), mCrossSiteAccessEnabled(PR_FALSE),
|
||||
mLoadedAsData(PR_FALSE), mAsync(PR_TRUE),
|
||||
mLoopingForSyncLoad(PR_FALSE), mXMLDeclarationBits(0)
|
||||
: mAsync(PR_TRUE)
|
||||
{
|
||||
mEventQService = do_GetService(kEventQueueServiceCID);
|
||||
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
}
|
||||
|
||||
nsXMLDocument::~nsXMLDocument()
|
||||
|
@ -223,6 +226,17 @@ NS_IMPL_ADDREF_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
|
||||
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
|
||||
// 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);
|
||||
|
||||
mPrincipal = principal;
|
||||
mListenerManager = elm;
|
||||
NS_IF_ADDREF(mListenerManager);
|
||||
|
||||
SetDocumentURL(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 =
|
||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||
if (stack) {
|
||||
|
@ -415,10 +430,11 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn)
|
|||
}
|
||||
}
|
||||
|
||||
// Find out if UniversalBrowserRead privileges are enabled - we will need this
|
||||
// in case of a redirect
|
||||
// Find out if UniversalBrowserRead privileges are enabled - we will
|
||||
// need this in case of a redirect
|
||||
PRBool crossSiteAccessEnabled;
|
||||
rv = secMan->IsCapabilityEnabled("UniversalBrowserRead", &crossSiteAccessEnabled);
|
||||
rv = secMan->IsCapabilityEnabled("UniversalBrowserRead",
|
||||
&crossSiteAccessEnabled);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mCrossSiteAccessEnabled = crossSiteAccessEnabled;
|
||||
|
@ -428,15 +444,15 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Set a principal for this document
|
||||
mPrincipal = nsnull;
|
||||
nsCOMPtr<nsISupports> 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));
|
||||
NS_ENSURE_TRUE(mPrincipal, rv);
|
||||
}
|
||||
|
@ -661,19 +677,20 @@ nsXMLDocument::GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult)
|
|||
}
|
||||
|
||||
// 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!
|
||||
if (aFlags & NS_STYLESHEET_FROM_CATALOG) {
|
||||
// always after other catalog sheets
|
||||
mStyleSheets.InsertObjectAt(aSheet, mCountCatalogSheets);
|
||||
++mCountCatalogSheets;
|
||||
mStyleSheets.InsertObjectAt(aSheet, mCatalogSheetCount);
|
||||
++mCatalogSheetCount;
|
||||
}
|
||||
else if (aSheet == mAttrStyleSheet) { // always after catalog sheets
|
||||
NS_ASSERTION(mStyleSheets.Count() == 0 ||
|
||||
mAttrStyleSheet != mStyleSheets[0],
|
||||
"Adding attr sheet twice!");
|
||||
mStyleSheets.InsertObjectAt(aSheet, mCountCatalogSheets);
|
||||
mStyleSheets.InsertObjectAt(aSheet, mCatalogSheetCount);
|
||||
}
|
||||
else if (aSheet == mInlineStyleSheet) { // always last
|
||||
NS_ASSERTION(mStyleSheets.Count() == 0 ||
|
||||
|
@ -702,13 +719,13 @@ nsXMLDocument::InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex)
|
|||
/* Don't count Attribute stylesheet */
|
||||
- 1
|
||||
/* Don't count catalog sheets */
|
||||
- mCountCatalogSheets
|
||||
- mCatalogSheetCount
|
||||
/* No insertion allowed after StyleAttr stylesheet */
|
||||
- (mInlineStyleSheet ? 1: 0)
|
||||
),
|
||||
"index out of bounds");
|
||||
// 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>
|
||||
|
@ -717,7 +734,7 @@ nsXMLDocument::InternalGetStyleSheetAt(PRInt32 aIndex)
|
|||
PRInt32 count = InternalGetNumberOfStyleSheets();
|
||||
|
||||
if (aIndex >= 0 && aIndex < count) {
|
||||
nsIStyleSheet* sheet = mStyleSheets[aIndex + mCountCatalogSheets + 1];
|
||||
nsIStyleSheet* sheet = mStyleSheets[aIndex + mCatalogSheetCount + 1];
|
||||
NS_ADDREF(sheet);
|
||||
return sheet;
|
||||
} else {
|
||||
|
@ -730,10 +747,21 @@ PRInt32
|
|||
nsXMLDocument::InternalGetNumberOfStyleSheets()
|
||||
{
|
||||
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 -= (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;
|
||||
}
|
||||
|
||||
|
@ -745,7 +773,8 @@ nsXMLDocument::GetDoctype(nsIDOMDocumentType** aDocumentType)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn)
|
||||
nsXMLDocument::CreateCDATASection(const nsAString& aData,
|
||||
nsIDOMCDATASection** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
@ -769,7 +798,8 @@ nsXMLDocument::CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** a
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLDocument::CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn)
|
||||
nsXMLDocument::CreateEntityReference(const nsAString& aName,
|
||||
nsIDOMEntityReference** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
||||
|
@ -1085,18 +1115,19 @@ nsXMLDocument::GetBaseTarget(nsAString &aBaseTarget)
|
|||
NS_IMETHODIMP
|
||||
nsXMLDocument::GetCSSLoader(nsICSSLoader*& aLoader)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (! mCSSLoader) {
|
||||
result = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader));
|
||||
if (mCSSLoader) {
|
||||
mCSSLoader->SetCaseSensitive(PR_TRUE);
|
||||
// No quirks in XML
|
||||
mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards);
|
||||
}
|
||||
if (!mCSSLoader) {
|
||||
nsresult rv = NS_NewCSSLoader(this, getter_AddRefs(mCSSLoader));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mCSSLoader->SetCaseSensitive(PR_TRUE);
|
||||
// no quirks in XML
|
||||
mCSSLoader->SetCompatibilityMode(eCompatibility_FullStandards);
|
||||
}
|
||||
|
||||
aLoader = mCSSLoader;
|
||||
NS_IF_ADDREF(aLoader);
|
||||
return result;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#ifndef nsXMLDocument_h___
|
||||
#define nsXMLDocument_h___
|
||||
|
||||
#include "nsMarkupDocument.h"
|
||||
#include "nsDocument.h"
|
||||
#include "nsIXMLDocument.h"
|
||||
#include "nsIHTMLContentContainer.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
@ -61,7 +61,7 @@ class nsIURI;
|
|||
#define XML_DECLARATION_BITS_STANDALONE_EXISTS 4
|
||||
#define XML_DECLARATION_BITS_STANDALONE_YES 8
|
||||
|
||||
class nsXMLDocument : public nsMarkupDocument,
|
||||
class nsXMLDocument : public nsDocument,
|
||||
public nsIXMLDocument,
|
||||
public nsIHTMLContentContainer,
|
||||
public nsIInterfaceRequestor,
|
||||
|
@ -78,8 +78,7 @@ public:
|
|||
|
||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||
nsIChannel* channel,
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* channel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
nsISupports* aContainer,
|
||||
nsIStreamListener **aDocListener,
|
||||
|
@ -95,23 +94,25 @@ public:
|
|||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
|
||||
// nsIDOMDocument interface
|
||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType);
|
||||
NS_IMETHOD CreateCDATASection(const nsAString& aData, nsIDOMCDATASection** aReturn);
|
||||
NS_IMETHOD CreateEntityReference(const nsAString& aName, nsIDOMEntityReference** aReturn);
|
||||
NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget, const nsAString& aData, nsIDOMProcessingInstruction** aReturn);
|
||||
NS_IMETHOD CreateElement(const nsAString& aTagName,
|
||||
nsIDOMElement** aReturn);
|
||||
NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode,
|
||||
PRBool aDeep,
|
||||
nsIDOMNode** aReturn);
|
||||
NS_IMETHOD CreateElementNS(const nsAString& aNamespaceURI,
|
||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType);
|
||||
NS_IMETHOD CreateCDATASection(const nsAString& aData,
|
||||
nsIDOMCDATASection** aReturn);
|
||||
NS_IMETHOD CreateEntityReference(const nsAString& aName,
|
||||
nsIDOMEntityReference** aReturn);
|
||||
NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget,
|
||||
const nsAString& aData,
|
||||
nsIDOMProcessingInstruction** aReturn);
|
||||
NS_IMETHOD CreateElement(const nsAString& aTagName, nsIDOMElement** aReturn);
|
||||
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,
|
||||
nsIDOMElement** aReturn);
|
||||
NS_IMETHOD CreateAttributeNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aQualifiedName,
|
||||
nsIDOMAttr** aReturn);
|
||||
NS_IMETHOD GetElementById(const nsAString& aElementId,
|
||||
nsIDOMElement** aReturn);
|
||||
nsIDOMAttr** aReturn);
|
||||
NS_IMETHOD GetElementById(const nsAString& aElementId,
|
||||
nsIDOMElement** aReturn);
|
||||
|
||||
// nsIXMLDocument interface
|
||||
NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl);
|
||||
|
@ -128,7 +129,7 @@ public:
|
|||
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
||||
|
||||
// nsIInterfaceRequestor
|
||||
NS_IMETHOD GetInterface(const nsIID& aIID, void** aSink);
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
// nsIHTTPEventSink
|
||||
NS_DECL_NSIHTTPEVENTSINK
|
||||
|
@ -136,6 +137,8 @@ public:
|
|||
// nsIDOMXMLDocument
|
||||
NS_DECL_NSIDOMXMLDOCUMENT
|
||||
|
||||
virtual nsresult Init();
|
||||
|
||||
protected:
|
||||
// subclass hooks for sheet ordering
|
||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
|
||||
|
@ -144,7 +147,7 @@ protected:
|
|||
virtual PRInt32 InternalGetNumberOfStyleSheets();
|
||||
|
||||
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIDOMElement** aResult);
|
||||
|
||||
|
||||
// For HTML elements in our content model
|
||||
// XXX This is not clean, but is there a better way?
|
||||
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
||||
|
@ -152,7 +155,7 @@ protected:
|
|||
// 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
|
||||
// style sheets and this counter is used as an offset to distinguish them
|
||||
PRInt32 mCountCatalogSheets;
|
||||
PRInt32 mCatalogSheetCount;
|
||||
nsString mBaseTarget;
|
||||
|
||||
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 \
|
||||
$(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
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -67,5 +68,6 @@ LOCAL_INCLUDES = \
|
|||
-I$(srcdir)/../../document/src \
|
||||
-I$(srcdir)/../../../xml/content/src \
|
||||
-I$(srcdir)/../../../base/src \
|
||||
-I$(srcdir)/../../../xml/document/src \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -2850,7 +2850,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID,
|
|||
if (xuldoc) {
|
||||
// Do a getElementById to retrieve the broadcaster
|
||||
nsCOMPtr<nsIDOMElement> broadcaster;
|
||||
nsCOMPtr<nsIDOMXULDocument> domDoc = do_QueryInterface(mDocument);
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
|
||||
domDoc->GetElementById(oldValue, getter_AddRefs(broadcaster));
|
||||
if (broadcaster) {
|
||||
xuldoc->RemoveBroadcastListenerFor(broadcaster,
|
||||
|
@ -4498,6 +4498,8 @@ nsXULElement::EnsureSlots()
|
|||
return NS_OK;
|
||||
|
||||
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;
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "nsIXULPopupListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
|
@ -520,9 +521,9 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// Turn the document into a XUL document so we can use getElementById
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
||||
if (xulDocument == nsnull) {
|
||||
// Turn the document into a DOM document so we can use getElementById
|
||||
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(document);
|
||||
if (!domDocument) {
|
||||
NS_ERROR("Popup attached to an element that isn't in XUL!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -539,7 +540,7 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
|||
if (popup)
|
||||
popupContent = do_QueryInterface(popup);
|
||||
else {
|
||||
nsCOMPtr<nsIDOMDocumentXBL> nsDoc(do_QueryInterface(xulDocument));
|
||||
nsCOMPtr<nsIDOMDocumentXBL> nsDoc(do_QueryInterface(domDocument));
|
||||
nsCOMPtr<nsIDOMNodeList> list;
|
||||
nsDoc->GetAnonymousNodes(mElement, getter_AddRefs(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
|
||||
// we didn't find any popup content in the document.
|
||||
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...
|
||||
|
||||
#include "nsIXMLDocument.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsForwardReference;
|
||||
|
@ -65,7 +65,7 @@ class nsIXULTemplateBuilder;
|
|||
class nsIURI;
|
||||
|
||||
// {954F0811-81DC-11d2-B52A-000000000000}
|
||||
#define NS_IRDFDOCUMENT_IID \
|
||||
#define NS_IXULDOCUMENT_IID \
|
||||
{ 0x954f0811, 0x81dc, 0x11d2, { 0xb5, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
/**
|
||||
|
@ -75,10 +75,10 @@ class nsIURI;
|
|||
class nsIRDFDataSource;
|
||||
class nsIXULPrototypeDocument;
|
||||
|
||||
class nsIXULDocument : public nsIXMLDocument
|
||||
class nsIXULDocument : public nsISupports
|
||||
{
|
||||
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
|
||||
// resources to content elements.
|
||||
|
|
|
@ -66,7 +66,8 @@ CPPSRCS = \
|
|||
nsXULPrototypeDocument.cpp \
|
||||
$(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
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -74,5 +75,6 @@ include $(topsrcdir)/config/rules.mk
|
|||
LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \
|
||||
-I$(srcdir)/../../content/src \
|
||||
-I$(srcdir)/../../templates/src \
|
||||
-I$(srcdir)/../../../xml/document/src \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "nsIFormControl.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsIHTMLContentContainer.h"
|
||||
#include "nsIHTMLStyleSheet.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -42,61 +42,22 @@
|
|||
#define nsXULDocument_h__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXMLDocument.h"
|
||||
#include "nsElementMap.h"
|
||||
#include "nsForwardReference.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsICSSLoader.h"
|
||||
#include "nsIContent.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 "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 "nsCOMArray.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWordBreakerFactory.h"
|
||||
#include "nsIXULDocument.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 "pldhash.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIElementFactory;
|
||||
class nsIFile;
|
||||
class nsILoadGroup;
|
||||
class nsIRDFResource;
|
||||
class nsIRDFService;
|
||||
class nsITimer;
|
||||
class nsIXULContentUtils;
|
||||
class nsIXULPrototypeCache;
|
||||
class nsIFocusController;
|
||||
#if 0 // XXXbe save me, scc (need NSCAP_FORWARD_DECL(nsXULPrototypeScript))
|
||||
|
@ -117,35 +78,20 @@ struct PRLogModuleInfo;
|
|||
/**
|
||||
* The XUL document class
|
||||
*/
|
||||
class nsXULDocument : public nsIDocument,
|
||||
class nsXULDocument : public nsXMLDocument,
|
||||
public nsIXULDocument,
|
||||
public nsIDOMXULDocument,
|
||||
public nsIDOMDocumentEvent,
|
||||
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 nsIStreamLoaderObserver
|
||||
{
|
||||
public:
|
||||
nsXULDocument();
|
||||
virtual ~nsXULDocument();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSISTREAMLOADEROBSERVER
|
||||
|
||||
// nsIDocument interface
|
||||
NS_IMETHOD GetArena(nsIArena** aArena);
|
||||
|
||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
||||
NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup* aLoadGroup);
|
||||
|
||||
|
@ -157,144 +103,14 @@ public:
|
|||
PRBool aReset = PR_TRUE,
|
||||
nsIContentSink* aSink = nsnull);
|
||||
|
||||
NS_IMETHOD StopDocumentLoad();
|
||||
|
||||
virtual const nsString* GetDocumentTitle() const;
|
||||
|
||||
NS_IMETHOD GetDocumentURL(nsIURI** aURI) const;
|
||||
|
||||
NS_IMETHOD GetPrincipal(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 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 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,
|
||||
PRInt32 aNewIndexInContainer);
|
||||
|
||||
|
@ -310,54 +126,19 @@ public:
|
|||
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer);
|
||||
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute);
|
||||
|
||||
NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet,
|
||||
nsIStyleRule* aStyleRule,
|
||||
NS_IMETHOD AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute, PRInt32 aModType,
|
||||
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,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement);
|
||||
|
||||
// nsIXMLDocument interface
|
||||
NS_IMETHOD SetDefaultStylesheets(nsIURI* aUrl);
|
||||
NS_IMETHOD SetTitle(const PRUnichar *aTitle);
|
||||
NS_IMETHOD SetXMLDeclaration(const nsAString& aVersion,
|
||||
const nsAString& aEncoding,
|
||||
const nsAString& Standalone);
|
||||
|
@ -368,66 +149,37 @@ public:
|
|||
// nsIXULDocument interface
|
||||
NS_IMETHOD AddElementForID(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 ResolveForwardReferences();
|
||||
NS_IMETHOD SetMasterPrototype(nsIXULPrototypeDocument* aDocument);
|
||||
NS_IMETHOD GetMasterPrototype(nsIXULPrototypeDocument** aDocument);
|
||||
NS_IMETHOD SetCurrentPrototype(nsIXULPrototypeDocument* aDocument);
|
||||
NS_IMETHOD SetDocumentURL(nsIURI* anURL);
|
||||
NS_IMETHOD PrepareStyleSheets(nsIURI* anURL);
|
||||
NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement);
|
||||
NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement);
|
||||
NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder);
|
||||
NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult);
|
||||
NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent,
|
||||
nsIXULTemplateBuilder* aBuilder);
|
||||
NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent,
|
||||
nsIXULTemplateBuilder** aResult);
|
||||
NS_IMETHOD OnPrototypeLoadDone();
|
||||
NS_IMETHOD OnHide();
|
||||
|
||||
// nsIDOMEventReceiver interface
|
||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
||||
NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
|
||||
// nsIDOMNode interface overrides
|
||||
NS_IMETHOD CloneNode(PRBool deep, nsIDOMNode **_retval);
|
||||
|
||||
// nsIDOMEventTarget interface
|
||||
NS_DECL_NSIDOMEVENTTARGET
|
||||
|
||||
// nsIDOM3EventTarget interface
|
||||
NS_DECL_NSIDOM3EVENTTARGET
|
||||
|
||||
// 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
|
||||
// nsIDOMDocument interface overrides
|
||||
NS_IMETHOD CreateElement(const nsAString & tagName,
|
||||
nsIDOMElement **_retval);
|
||||
NS_IMETHOD GetElementById(const nsAString & elementId,
|
||||
nsIDOMElement **_retval);
|
||||
|
||||
// nsIDOMXULDocument interface
|
||||
NS_DECL_NSIDOMXULDOCUMENT
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_DECL_NSIDOMNODE
|
||||
|
||||
// nsIDOM3Node interface
|
||||
NS_DECL_NSIDOM3NODE
|
||||
// nsIDOMNSDocument
|
||||
NS_IMETHOD GetContentType(nsAString& aContentType);
|
||||
|
||||
// nsIHTMLContentContainer interface
|
||||
NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult);
|
||||
|
@ -461,10 +213,6 @@ protected:
|
|||
const nsAString& aValue,
|
||||
nsRDFDOMNodeList* aElements);
|
||||
|
||||
nsresult
|
||||
ParseTagString(const nsAString& aTagName, nsIAtom*& aName,
|
||||
nsIAtom*& aPrefix);
|
||||
|
||||
void SetIsPopup(PRBool isPopup) { mIsPopup = isPopup; };
|
||||
|
||||
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIContent** aResult);
|
||||
|
@ -482,7 +230,8 @@ protected:
|
|||
nsIParser** aResult);
|
||||
|
||||
nsresult ApplyPersistentAttributes();
|
||||
nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource, nsISupportsArray* aElements);
|
||||
nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
|
||||
nsISupportsArray* aElements);
|
||||
|
||||
nsresult
|
||||
AddElementToDocumentPre(nsIContent* aElement);
|
||||
|
@ -511,12 +260,12 @@ protected:
|
|||
static nsIElementFactory* gHTMLElementFactory;
|
||||
static nsIElementFactory* gXMLElementFactory;
|
||||
|
||||
static nsIXULContentUtils* gXULUtils;
|
||||
static nsIXULPrototypeCache* gXULCache;
|
||||
|
||||
static PRLogModuleInfo* gXULLog;
|
||||
|
||||
static void GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResult);
|
||||
static void GetElementFactory(PRInt32 aNameSpaceID,
|
||||
nsIElementFactory** aResult);
|
||||
|
||||
nsresult
|
||||
Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute);
|
||||
|
@ -524,67 +273,30 @@ protected:
|
|||
nsresult
|
||||
DestroyForwardReferences();
|
||||
|
||||
// IMPORTANT: The ownership implicit in the following member variables has been
|
||||
// explicitly checked and set using nsCOMPtr for owning pointers and raw COM interface
|
||||
// pointers for weak (ie, non owning) references. If you add any members to this
|
||||
// IMPORTANT: The ownership implicit in the following member
|
||||
// variables has been explicitly checked and set using nsCOMPtr
|
||||
// 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).
|
||||
// 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
|
||||
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;
|
||||
nsCOMPtr<nsIRDFDataSource> mLocalStore;
|
||||
nsCOMPtr<nsILineBreaker> mLineBreaker; // [OWNER]
|
||||
nsCOMPtr<nsIWordBreaker> mWordBreaker; // [OWNER]
|
||||
PLDHashTable *mSubDocuments; // [OWNER] of subelements
|
||||
nsCOMPtr<nsIRDFDataSource> mLocalStore;
|
||||
PRPackedBool mIsPopup;
|
||||
PRPackedBool mIsFastLoad;
|
||||
PRPackedBool mApplyingPersistedAttrs;
|
||||
PRPackedBool mIsWritingFastLoad;
|
||||
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
|
||||
// content elements
|
||||
nsSupportsHashtable* mTemplateBuilderTable;
|
||||
|
||||
nsVoidArray mForwardReferences;
|
||||
nsForwardReference::Phase mResolutionPhase;
|
||||
PRInt32 mNextContentID;
|
||||
PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery.
|
||||
|
||||
PRBool mBidiEnabled;
|
||||
|
||||
/*
|
||||
* XXX dr
|
||||
|
@ -604,7 +316,6 @@ protected:
|
|||
*/
|
||||
|
||||
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
|
||||
|
@ -722,10 +433,13 @@ protected:
|
|||
PRBool mResolved;
|
||||
|
||||
public:
|
||||
BroadcasterHookup(nsXULDocument* aDocument, nsIContent* aObservesElement) :
|
||||
mDocument(aDocument),
|
||||
mObservesElement(aObservesElement),
|
||||
mResolved(PR_FALSE) {}
|
||||
BroadcasterHookup(nsXULDocument* aDocument,
|
||||
nsIContent* aObservesElement)
|
||||
: mDocument(aDocument),
|
||||
mObservesElement(aObservesElement),
|
||||
mResolved(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~BroadcasterHookup();
|
||||
|
||||
|
@ -797,7 +511,7 @@ protected:
|
|||
* Owning references to all of the prototype documents that were
|
||||
* used to construct this document.
|
||||
*/
|
||||
nsCOMPtr<nsISupportsArray> mPrototypes;
|
||||
nsCOMArray<nsIXULPrototypeDocument> mPrototypes;
|
||||
|
||||
/**
|
||||
* Prepare to walk the current prototype.
|
||||
|
@ -829,7 +543,8 @@ protected:
|
|||
virtual ~CachedChromeStreamListener();
|
||||
|
||||
public:
|
||||
CachedChromeStreamListener(nsXULDocument* aDocument, PRBool aProtoLoaded);
|
||||
CachedChromeStreamListener(nsXULDocument* aDocument,
|
||||
PRBool aProtoLoaded);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
|
@ -853,8 +568,6 @@ protected:
|
|||
|
||||
friend class ParserObserver;
|
||||
|
||||
nsSupportsHashtable mContentWrapperHash;
|
||||
|
||||
/**
|
||||
* A map from a broadcaster element to a list of listener elements.
|
||||
*/
|
||||
|
@ -865,6 +578,4 @@ private:
|
|||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // nsXULDocument_h__
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIBindingManager.h"
|
||||
|
@ -1408,13 +1408,13 @@ nsXULTemplateBuilder::GetTemplateRoot(nsIContent** aResult)
|
|||
if (! doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(doc);
|
||||
NS_ASSERTION(xulDoc != nsnull, "expected a XUL document");
|
||||
if (! xulDoc)
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
|
||||
NS_ASSERTION(domDoc, "expected a XUL document");
|
||||
if (! domDoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
xulDoc->GetElementById(templateID, getter_AddRefs(domElement));
|
||||
domDoc->GetElementById(templateID, getter_AddRefs(domElement));
|
||||
|
||||
if (domElement)
|
||||
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
|
||||
|
||||
EXPORTS = \
|
||||
nsIDOMEventCapturer.h \
|
||||
nsIDOMEventReceiver.h \
|
||||
nsIDOMFocusListener.h \
|
||||
nsIDOMFormListener.h \
|
||||
|
|
|
@ -38,13 +38,13 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMDocument.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIDOMXULCommandDispatcher;
|
||||
|
||||
|
||||
[scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)]
|
||||
interface nsIDOMXULDocument : nsIDOMDocument
|
||||
interface nsIDOMXULDocument : nsISupports
|
||||
{
|
||||
attribute nsIDOMNode popupNode;
|
||||
attribute nsIDOMNode tooltipNode;
|
||||
|
|
|
@ -1892,6 +1892,7 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(XULDocument, nsIDOMXULDocument)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocument)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULDocument)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsIPrefBranchInternal.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsString.h"
|
||||
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "nsIDOMProcessingInstruction.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// Need to determine if these are well-chosen.
|
||||
#define WRAPPER_INITIAL_SIZE 256
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "txAtoms.h"
|
||||
#include "nsString.h"
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(Node)
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "nsIDOMRange.h"
|
||||
#include "nsIModifyableXPointer.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsContentCID.h"
|
||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||
|
|
|
@ -126,7 +126,7 @@ nsXPointerResult::Item(PRUint32 aIndex, nsIDOMRange** aReturn)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
||||
if (aIndex >= mArray.Count()) {
|
||||
if (aIndex >= (PRUint32)mArray.Count()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ nsXPointerSchemeContext::GetSchemeData(PRUint32 aIndex,
|
|||
nsAString &aScheme,
|
||||
nsAString &aData)
|
||||
{
|
||||
if (aIndex >= mSchemes.Count()) {
|
||||
if (aIndex >= (PRUint32)mSchemes.Count()) {
|
||||
aScheme.Truncate();
|
||||
aData.Truncate();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class nsILineBreakerFactory : public nsISupports
|
|||
public:
|
||||
|
||||
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:
|
||||
|
||||
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_RELEASE ( nsLWBreakerFImp );
|
||||
|
||||
nsresult nsLWBreakerFImp::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
nsresult
|
||||
nsLWBreakerFImp::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if( NULL == aInstancePtr) {
|
||||
|
@ -119,7 +120,8 @@ static const PRUnichar gCnNoEnd[] =
|
|||
{
|
||||
0xfffd // to be changed
|
||||
};
|
||||
nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsILineBreaker** oResult)
|
||||
nsresult
|
||||
nsLWBreakerFImp::GetBreaker(const nsAString& aParam, nsILineBreaker** oResult)
|
||||
{
|
||||
if( NULL == oResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -158,7 +160,8 @@ nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsILineBreaker** oResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsIWordBreaker** oResult)
|
||||
nsresult
|
||||
nsLWBreakerFImp::GetBreaker(const nsAString& aParam, nsIWordBreaker** oResult)
|
||||
{
|
||||
if( NULL == oResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -58,8 +58,8 @@ public:
|
|||
nsLWBreakerFImp();
|
||||
virtual ~nsLWBreakerFImp();
|
||||
|
||||
NS_IMETHOD GetBreaker(nsString& aParam, nsILineBreaker** breaker);
|
||||
NS_IMETHOD GetBreaker(nsString& aParam, nsIWordBreaker** breaker);
|
||||
NS_IMETHOD GetBreaker(const nsAString& aParam, nsILineBreaker** breaker);
|
||||
NS_IMETHOD GetBreaker(const nsAString& aParam, nsIWordBreaker** breaker);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1166,7 +1166,7 @@ NS_IMETHODIMP
|
|||
DocumentViewerImpl::GetDOMDocument(nsIDOMDocument **aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
return CallQueryInterface(mDocument.get(), aResult);
|
||||
return CallQueryInterface(mDocument, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -155,7 +155,6 @@ class nsIDocumentLoaderFactory;
|
|||
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIXULContentSink.h"
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIXULPopupListener.h"
|
||||
#include "nsIXULPrototypeCache.h"
|
||||
|
@ -521,7 +520,6 @@ MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewCom
|
|||
MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
|
||||
// NS_NewXULContentBuilder
|
||||
// NS_NewXULTreeBuilder
|
||||
MAKE_CTOR(CreateXULContentSink, nsIXULContentSink, NS_NewXULContentSink)
|
||||
MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
|
||||
MAKE_CTOR(CreateXULPopupListener, nsIXULPopupListener, NS_NewXULPopupListener)
|
||||
// NS_NewXULControllers
|
||||
|
@ -1129,11 +1127,6 @@ static const nsModuleComponentInfo gComponents[] = {
|
|||
"@mozilla.org/xul/xul-tree-builder;1",
|
||||
NS_NewXULTreeBuilder },
|
||||
|
||||
{ "XUL Content Sink",
|
||||
NS_XULCONTENTSINK_CID,
|
||||
"@mozilla.org/xul/xul-content-sink;1",
|
||||
CreateXULContentSink },
|
||||
|
||||
{ "XUL Document",
|
||||
NS_XULDOCUMENT_CID,
|
||||
"@mozilla.org/xul/xul-document;1",
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsDocument.h"
|
||||
#include "nsMarkupDocument.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
@ -188,7 +187,7 @@ void testStrings(nsIDocument* aDoc) {
|
|||
printf("string tests complete\n");
|
||||
}
|
||||
|
||||
class MyDocument : public nsMarkupDocument {
|
||||
class MyDocument : public nsDocument {
|
||||
public:
|
||||
MyDocument();
|
||||
NS_IMETHOD StartDocumentLoad(const char* aCommand,
|
||||
|
|
|
@ -1873,9 +1873,10 @@ nsPrintEngine::GetWebShellTitleAndURL(nsIWebShell* aWebShell,
|
|||
*aTitle = nsnull;
|
||||
*aURLStr = nsnull;
|
||||
|
||||
const nsString* docTitle = aDoc->GetDocumentTitle();
|
||||
if (docTitle && !docTitle->IsEmpty()) {
|
||||
*aTitle = ToNewUnicode(*docTitle);
|
||||
nsAutoString docTitle;
|
||||
aDoc->GetDocumentTitle(docTitle);
|
||||
if (!docTitle.IsEmpty()) {
|
||||
*aTitle = ToNewUnicode(docTitle);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> url;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsButtonBoxFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIDOMText.h"
|
||||
|
@ -1523,13 +1522,13 @@ nsMenuFrame::BuildAcceleratorText()
|
|||
nsCOMPtr<nsIDocument> document;
|
||||
mContent->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
// Turn the document into a XUL document so we can use getElementById
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument(do_QueryInterface(document));
|
||||
if (!xulDocument)
|
||||
// Turn the document into a DOM document so we can use getElementById
|
||||
nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(document));
|
||||
if (!domDocument)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> keyDOMElement;
|
||||
xulDocument->GetElementById(keyValue, getter_AddRefs(keyDOMElement));
|
||||
domDocument->GetElementById(keyValue, getter_AddRefs(keyDOMElement));
|
||||
if (!keyDOMElement)
|
||||
return;
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -579,14 +580,15 @@ nsXULTooltipListener::GetTooltipFor(nsIContent* aTarget, nsIContent** aTooltip)
|
|||
} else {
|
||||
if (!tooltipId.IsEmpty()) {
|
||||
// tooltip must be an id, use getElementById to find it
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
||||
if (!xulDocument) {
|
||||
NS_ERROR("tooltip attached to an element that isn't in XUL!");
|
||||
nsCOMPtr<nsIDOMDocument> domDocument =
|
||||
do_QueryInterface(document);
|
||||
if (!domDocument) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> tooltipEl;
|
||||
xulDocument->GetElementById(tooltipId, getter_AddRefs(tooltipEl));
|
||||
domDocument->GetElementById(tooltipId,
|
||||
getter_AddRefs(tooltipEl));
|
||||
|
||||
if (tooltipEl) {
|
||||
mNeedTitletip = PR_FALSE;
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIChannel.h"
|
||||
|
|
|
@ -56,7 +56,7 @@ interface nsIDOMXULTreeElement : nsIDOMXULElement {};
|
|||
interface nsIDOMXULCommandDispatcher : nsISupports {};
|
||||
|
||||
[scriptable, uuid(17ddd8c0-c5f8-11d2-a6ae-00104bde6048)]
|
||||
interface nsIDOMXULDocument : nsIDOMDocument {};
|
||||
interface nsIDOMXULDocument : nsISupports {};
|
||||
|
||||
%{C++
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsWidgetAtoms.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
|
||||
// for the apple menu. Grovel for the content node with an id of "aboutName"
|
||||
// and call it directly.
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(self->mDocument);
|
||||
if ( xulDoc ) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(self->mDocument);
|
||||
if ( domDoc ) {
|
||||
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) );
|
||||
self->ExecuteCommand(aboutContent);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -875,13 +875,13 @@ void nsMenuX::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent
|
|||
inMenuItemContent->GetDocument(*getter_AddRefs(document));
|
||||
if ( !document )
|
||||
return;
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
||||
if ( !xulDocument )
|
||||
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(document);
|
||||
if ( !domDocument )
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> keyElement;
|
||||
if (!keyValue.IsEmpty())
|
||||
xulDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
||||
domDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
||||
if ( keyElement ) {
|
||||
nsCOMPtr<nsIContent> keyContent ( do_QueryInterface(keyElement) );
|
||||
nsAutoString keyChar(NS_LITERAL_STRING(" "));
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -559,9 +559,9 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
|||
mMenuContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (!doc)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(doc);
|
||||
if (!xulDoc) {
|
||||
NS_ERROR("nsIDOMDocument to nsIDOMXULDocument QI failed.");
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
|
||||
if (!domDoc) {
|
||||
NS_ERROR("nsIDocument to nsIDOMDocument QI failed.");
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,8 @@ nsEventStatus nsMenu::MenuItemSelected(const nsMenuEvent & aMenuEvent)
|
|||
// <menuitem/>. This is the glue code which causes any script code
|
||||
// in the <menuitem/> to be executed.
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
xulDoc->GetElementById(NS_LITERAL_STRING("aboutName"), getter_AddRefs(domElement));
|
||||
domDoc->GetElementById(NS_LITERAL_STRING("aboutName"),
|
||||
getter_AddRefs(domElement));
|
||||
if (!domElement)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
|
@ -1067,13 +1068,13 @@ nsMenu::LoadMenuItem( nsIMenu* inParentMenu, nsIContent* inMenuItemContent )
|
|||
inMenuItemContent->GetDocument(*getter_AddRefs(document));
|
||||
if ( !document )
|
||||
return;
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDocument = do_QueryInterface(document);
|
||||
if ( !xulDocument )
|
||||
nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(document);
|
||||
if ( !domDocument )
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> keyElement;
|
||||
if (!keyValue.IsEmpty())
|
||||
xulDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
||||
domDocument->GetElementById(keyValue, getter_AddRefs(keyElement));
|
||||
if ( keyElement ) {
|
||||
nsCOMPtr<nsIContent> keyContent ( do_QueryInterface(keyElement) );
|
||||
nsAutoString keyChar(NS_LITERAL_STRING(" "));
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#include "nsWidgetAtoms.h"
|
||||
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
#include <Menus.h>
|
||||
#include <TextUtils.h>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsWidgetAtoms.h"
|
||||
|
||||
#include <Menus.h>
|
||||
|
@ -339,13 +339,15 @@ nsMenuBarX :: CommandEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
|||
|
||||
case kHICommandAbout:
|
||||
{
|
||||
// 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"
|
||||
// and call it directly.
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(self->mDocument);
|
||||
if ( xulDoc ) {
|
||||
// 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" and call it
|
||||
// directly.
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(self->mDocument);
|
||||
if ( domDoc ) {
|
||||
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) );
|
||||
self->ExecuteCommand(aboutContent);
|
||||
}
|
||||
|
|
|
@ -197,12 +197,6 @@ nsIDOMWindow = { /* a6cf906b-15b3-11d2-932e-00805f8add32 */
|
|||
0x11d2,
|
||||
{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 */
|
||||
0xa6cf906d,
|
||||
0x15b3,
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIEmbeddingSiteWindow2.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
@ -1414,7 +1413,7 @@ NS_IMETHODIMP nsXULWindow::GetDOMElementById(char* aID, nsIDOMElement** aDOMElem
|
|||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
docv->GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDOMXULDocument> domdoc(do_QueryInterface(doc));
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(doc));
|
||||
if(!domdoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче