зеркало из https://github.com/mozilla/pjs.git
Backing out latest checkins due to them not working on linux and other unix systems with broken compilers.
This commit is contained in:
Родитель
e03a509640
Коммит
96d1e84dc6
|
@ -130,28 +130,17 @@ nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIW
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell,
|
||||
nsIPresShell **aOwnerShell,
|
||||
nsIContent **aOwnerContent)
|
||||
void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent)
|
||||
{
|
||||
*aOwnerShell = nsnull;
|
||||
*aOwnerContent = nsnull;
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
aPresShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!presContext)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aPresShell->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsISupports> pcContainer;
|
||||
presContext->GetContainer(getter_AddRefs(pcContainer));
|
||||
if (!pcContainer)
|
||||
return;
|
||||
nsCOMPtr<nsISupports> docShellSupports(do_QueryInterface(pcContainer));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(pcContainer));
|
||||
if (!treeItem)
|
||||
|
@ -177,11 +166,17 @@ void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell,
|
|||
if (!parentDoc)
|
||||
return;
|
||||
|
||||
parentDoc->FindContentForSubDocument(doc, aOwnerContent);
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
parentDoc->GetRootContent(getter_AddRefs(rootContent));
|
||||
|
||||
if (*aOwnerContent) {
|
||||
nsCOMPtr<nsIContent> tempContent;
|
||||
parentPresShell->FindContentForShell(docShellSupports, getter_AddRefs(tempContent));
|
||||
|
||||
if (tempContent) {
|
||||
*aOwnerContent = tempContent;
|
||||
*aOwnerShell = parentPresShell;
|
||||
NS_ADDREF(*aOwnerShell);
|
||||
NS_ADDREF(*aOwnerContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,46 +250,46 @@ nsAccessibilityService::CreateIFrameAccessible(nsIDOMNode* aDOMNode, nsIAccessib
|
|||
NS_WARNING("No outer pres shell in CreateHTMLIFrameAccessible!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIPresContext> outerPresContext;
|
||||
outerPresShell->GetPresContext(getter_AddRefs(outerPresContext));
|
||||
if (!outerPresContext) {
|
||||
NS_WARNING("No outer pres context in CreateHTMLIFrameAccessible!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
|
||||
nsCOMPtr<nsIDocument> sub_doc;
|
||||
doc->GetSubDocumentFor(content, getter_AddRefs(sub_doc));
|
||||
|
||||
if (sub_doc) {
|
||||
nsCOMPtr<nsIPresShell> innerPresShell;
|
||||
sub_doc->GetShellAt(0, getter_AddRefs(innerPresShell));
|
||||
|
||||
if (innerPresShell) {
|
||||
nsCOMPtr<nsIWeakReference> innerWeakShell =
|
||||
do_GetWeakReference(innerPresShell);
|
||||
|
||||
nsCOMPtr<nsIAccessible> innerRootAccessible =
|
||||
new nsHTMLIFrameRootAccessible(aDOMNode, innerWeakShell);
|
||||
|
||||
if (innerRootAccessible) {
|
||||
nsHTMLIFrameAccessible* outerRootAccessible =
|
||||
new nsHTMLIFrameAccessible(aDOMNode, innerRootAccessible,
|
||||
outerWeakShell, sub_doc);
|
||||
|
||||
if (outerRootAccessible) {
|
||||
*_retval = outerRootAccessible;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
if (outerPresShell) {
|
||||
nsCOMPtr<nsISupports> supps;
|
||||
outerPresShell->GetSubShellFor(content, getter_AddRefs(supps));
|
||||
if (supps) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(supps));
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIPresShell> innerPresShell;
|
||||
docShell->GetPresShell(getter_AddRefs(innerPresShell));
|
||||
if (innerPresShell) {
|
||||
nsCOMPtr<nsIWeakReference> innerWeakShell(do_GetWeakReference(innerPresShell));
|
||||
nsCOMPtr<nsIDocument> innerDoc;
|
||||
innerPresShell->GetDocument(getter_AddRefs(innerDoc));
|
||||
if (innerDoc) {
|
||||
nsCOMPtr<nsIAccessible> innerRootAccessible(new nsHTMLIFrameRootAccessible(aDOMNode, innerWeakShell));
|
||||
if (innerRootAccessible) {
|
||||
nsHTMLIFrameAccessible* outerRootAccessible = new nsHTMLIFrameAccessible(aDOMNode, innerRootAccessible, outerWeakShell, innerDoc);
|
||||
if (outerRootAccessible) {
|
||||
*_retval = NS_STATIC_CAST(nsIAccessible*, outerRootAccessible);
|
||||
if (*_retval) {
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,4 +27,3 @@ nsIStyleSheet.h
|
|||
nsIStyleSheetLinkingElement.h
|
||||
nsITextContent.h
|
||||
nsIContentList.h
|
||||
nsIFrameLoader.h
|
||||
|
|
|
@ -56,7 +56,6 @@ nsIPrivateDOMImplementation.h \
|
|||
nsIContentSerializer.h \
|
||||
nsIHTMLToTextSink.h \
|
||||
nsIContentList.h \
|
||||
nsIFrameLoader.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
|
|
@ -48,7 +48,6 @@ EXPORTS = \
|
|||
nsIContentSerializer.h \
|
||||
nsIHTMLToTextSink.h \
|
||||
nsIContentList.h \
|
||||
nsIFrameLoader.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=content
|
||||
|
|
|
@ -227,32 +227,13 @@ public:
|
|||
|
||||
/**
|
||||
* Return the parent document of this document. Will return null
|
||||
* unless this document is within a compound document and has a
|
||||
* parent. Note that this parent chain may cross chrome boundaries.
|
||||
* unless this document is within a compound document and has a parent.
|
||||
*/
|
||||
NS_IMETHOD GetParentDocument(nsIDocument** aParent) = 0;
|
||||
|
||||
/**
|
||||
* Set the parent document of this document.
|
||||
*/
|
||||
NS_IMETHOD SetParentDocument(nsIDocument* aParent) = 0;
|
||||
|
||||
/**
|
||||
* Set the sub document for aContent to aSubDoc.
|
||||
*/
|
||||
NS_IMETHOD SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc) = 0;
|
||||
|
||||
/**
|
||||
* Get the sub document for aContent
|
||||
*/
|
||||
NS_IMETHOD GetSubDocumentFor(nsIContent *aContent,
|
||||
nsIDocument** aSubDoc) = 0;
|
||||
|
||||
/**
|
||||
* Find the content node for which aDocument is a sub document.
|
||||
*/
|
||||
NS_IMETHOD FindContentForSubDocument(nsIDocument *aDocument,
|
||||
nsIContent **aContent) = 0;
|
||||
NS_IMETHOD AddSubDocument(nsIDocument* aSubDoc) = 0;
|
||||
NS_IMETHOD GetNumberOfSubDocuments(PRInt32* aCount) = 0;
|
||||
NS_IMETHOD GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc) = 0;
|
||||
|
||||
/**
|
||||
* Return the root content object for this document.
|
||||
|
@ -392,16 +373,6 @@ public:
|
|||
|
||||
NS_IMETHOD AddReference(void *aKey, nsISupports *aReference) = 0;
|
||||
NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference) = 0;
|
||||
|
||||
/**
|
||||
* Set the container (docshell) for this document.
|
||||
*/
|
||||
NS_IMETHOD SetContainer(nsISupports *aContainer) = 0;
|
||||
|
||||
/**
|
||||
* Get the container (docshell) for this document.
|
||||
*/
|
||||
NS_IMETHOD GetContainer(nsISupports **aContainer) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsAString.h"
|
||||
|
||||
// Forward declarations
|
||||
class nsIContent;
|
||||
class nsIDOMElement;
|
||||
class nsIDocShell;
|
||||
class nsIURI;
|
||||
|
||||
|
@ -57,42 +57,18 @@ class nsIURI;
|
|||
{ 0x0080d493, 0x96b4, 0x4606, \
|
||||
{0xa7, 0x43, 0x0f, 0x47, 0xee, 0x87, 0x14, 0xd1} }
|
||||
|
||||
// CID for the nsIFrameLoader implementation
|
||||
#define NS_FRAMELOADER_CID \
|
||||
{ 0x712603da, 0xf245, 0x4503, \
|
||||
{0xa5, 0x41, 0xb0, 0x49, 0xcb, 0x06, 0x81, 0xae} }
|
||||
|
||||
#define NS_FRAMELOADER_CONTRACTID "@mozilla.org/content/frameloader"
|
||||
|
||||
class nsIFrameLoader : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMELOADER_IID)
|
||||
|
||||
/**
|
||||
* Initialize the frame loader, hand it the owner content. Note that
|
||||
* the owner content reference is a weak reference, if the owner
|
||||
* content is destroyed before the frame loader goes away the owner
|
||||
* content must call the Destroy() method to clear the owner content
|
||||
* reference.
|
||||
*/
|
||||
NS_IMETHOD Init(nsIContent *aOwner) = 0;
|
||||
NS_IMETHOD Init(nsIDOMElement *aOwner) = 0;
|
||||
|
||||
/**
|
||||
* Start loading the frame. This method figures out what to load
|
||||
* from the owner content in the frame loader.
|
||||
*/
|
||||
NS_IMETHOD LoadFrame() = 0;
|
||||
NS_IMETHOD LoadURI(nsIURI *aURI) = 0;
|
||||
|
||||
/**
|
||||
* Get the docshell from the frame loader.
|
||||
*/
|
||||
NS_IMETHOD GetDocShell(nsIDocShell **aDocShell) = 0;
|
||||
|
||||
/**
|
||||
* Destroy the frame loader and everything inside it. This will
|
||||
* clear the weak owner content reference.
|
||||
*/
|
||||
NS_IMETHOD Destroy() = 0;
|
||||
};
|
||||
|
||||
|
@ -102,9 +78,6 @@ class nsIFrameLoaderOwner : public nsISupports
|
|||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMELOADEROWNER_IID)
|
||||
|
||||
/**
|
||||
* Get the frame loader from the frame loader owner.
|
||||
*/
|
||||
NS_IMETHOD GetFrameLoader(nsIFrameLoader **aFrameLoader) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ REQUIRES = xpcom \
|
|||
imglib2 \
|
||||
gfx2 \
|
||||
uriloader \
|
||||
webbrwsr \
|
||||
webBrowser_core \
|
||||
webbrwsr \
|
||||
webBrowser_core \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
@ -97,11 +97,9 @@ CPPSRCS = \
|
|||
nsScriptLoader.cpp \
|
||||
nsStyleLinkElement.cpp \
|
||||
nsContentAreaDragDrop.cpp \
|
||||
nsFrameLoader.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
|
||||
|
|
|
@ -43,7 +43,6 @@ REQUIRES = xpcom \
|
|||
uconv \
|
||||
chrome \
|
||||
docshell \
|
||||
uriloader \
|
||||
pref \
|
||||
xpconnect \
|
||||
util \
|
||||
|
@ -69,10 +68,10 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsCommentNode.obj \
|
||||
.\$(OBJDIR)\nsGenericDOMDataNode.obj \
|
||||
.\$(OBJDIR)\nsGenericDOMNodeList.obj \
|
||||
.\$(OBJDIR)\nsGenericElement.obj \
|
||||
.\$(OBJDIR)\nsContentList.obj \
|
||||
.\$(OBJDIR)\nsContentIterator.obj \
|
||||
.\$(OBJDIR)\nsContentPolicy.obj \
|
||||
.\$(OBJDIR)\nsGenericElement.obj \
|
||||
.\$(OBJDIR)\nsContentList.obj \
|
||||
.\$(OBJDIR)\nsContentIterator.obj \
|
||||
.\$(OBJDIR)\nsContentPolicy.obj \
|
||||
.\$(OBJDIR)\nsDocument.obj \
|
||||
.\$(OBJDIR)\nsDocumentEncoder.obj \
|
||||
.\$(OBJDIR)\nsDocumentFragment.obj \
|
||||
|
@ -80,7 +79,7 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsDOMAttribute.obj \
|
||||
.\$(OBJDIR)\nsDOMAttributeMap.obj \
|
||||
.\$(OBJDIR)\nsDOMDocumentType.obj \
|
||||
.\$(OBJDIR)\nsGeneratedIterator.obj \
|
||||
.\$(OBJDIR)\nsGeneratedIterator.obj \
|
||||
.\$(OBJDIR)\nsNameSpaceManager.obj \
|
||||
.\$(OBJDIR)\nsNodeInfo.obj \
|
||||
.\$(OBJDIR)\nsNodeInfoManager.obj \
|
||||
|
@ -92,13 +91,12 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsTreeWalker.obj \
|
||||
.\$(OBJDIR)\nsXMLContentSerializer.obj \
|
||||
.\$(OBJDIR)\nsHTMLContentSerializer.obj \
|
||||
.\$(OBJDIR)\nsParserUtils.obj \
|
||||
.\$(OBJDIR)\nsPlainTextSerializer.obj \
|
||||
.\$(OBJDIR)\nsContentUtils.obj \
|
||||
.\$(OBJDIR)\nsScriptLoader.obj \
|
||||
.\$(OBJDIR)\nsStyleLinkElement.obj \
|
||||
.\$(OBJDIR)\nsContentAreaDragDrop.obj \
|
||||
.\$(OBJDIR)\nsFrameLoader.obj \
|
||||
.\$(OBJDIR)\nsParserUtils.obj \
|
||||
.\$(OBJDIR)\nsPlainTextSerializer.obj \
|
||||
.\$(OBJDIR)\nsContentUtils.obj \
|
||||
.\$(OBJDIR)\nsScriptLoader.obj \
|
||||
.\$(OBJDIR)\nsStyleLinkElement.obj \
|
||||
.\$(OBJDIR)\nsContentAreaDragDrop.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS=-I..\..\html\base\src -I..\..\html\style\src \
|
||||
|
|
|
@ -445,7 +445,7 @@ nsDocumentChildNodes::DropReference()
|
|||
// ==================================================================
|
||||
|
||||
nsDocument::nsDocument() : mIsGoingAway(PR_FALSE),
|
||||
mCSSLoader(nsnull), mSubDocuments(nsnull)
|
||||
mCSSLoader(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
|
@ -476,7 +476,6 @@ nsDocument::nsDocument() : mIsGoingAway(PR_FALSE),
|
|||
mObservers.InsertElementAt(observer, 0);
|
||||
}
|
||||
|
||||
|
||||
nsDocument::~nsDocument()
|
||||
{
|
||||
// XXX Inform any remaining observers that we are going away.
|
||||
|
@ -502,12 +501,11 @@ nsDocument::~nsDocument()
|
|||
|
||||
mParentDocument = nsnull;
|
||||
|
||||
// Kill the subdocument map, doing this will release its strong
|
||||
// references, if any.
|
||||
if (mSubDocuments) {
|
||||
PL_DHashTableDestroy(mSubDocuments);
|
||||
|
||||
mSubDocuments = nsnull;
|
||||
// Delete references to sub-documents
|
||||
indx = mSubDocuments.Count();
|
||||
while (--indx >= 0) {
|
||||
nsIDocument* subdoc = (nsIDocument*) mSubDocuments.ElementAt(indx);
|
||||
NS_RELEASE(subdoc);
|
||||
}
|
||||
|
||||
if (mRootContent) {
|
||||
|
@ -673,28 +671,25 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
|
|||
NS_IF_RELEASE(mPrincipal);
|
||||
mDocumentLoadGroup = nsnull;
|
||||
|
||||
// Delete references to sub-documents and kill the subdocument map,
|
||||
// if any. It holds strong references
|
||||
if (mSubDocuments) {
|
||||
PL_DHashTableDestroy(mSubDocuments);
|
||||
|
||||
mSubDocuments = nsnull;
|
||||
// Delete references to sub-documents
|
||||
PRInt32 indx = mSubDocuments.Count();
|
||||
while (--indx >= 0) {
|
||||
nsIDocument* subdoc = (nsIDocument*) mSubDocuments.ElementAt(indx);
|
||||
NS_RELEASE(subdoc);
|
||||
}
|
||||
|
||||
mRootContent = nsnull;
|
||||
PRUint32 count, i;
|
||||
mChildren->Count(&count);
|
||||
for (i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsIContent> content =
|
||||
dont_AddRef(NS_STATIC_CAST(nsIContent *, mChildren->ElementAt(i)));
|
||||
|
||||
nsCOMPtr<nsIContent> content(dont_AddRef(NS_STATIC_CAST(nsIContent*,mChildren->ElementAt(i))));
|
||||
content->SetDocument(nsnull, PR_TRUE, PR_TRUE);
|
||||
ContentRemoved(nsnull, content, i);
|
||||
ContentRemoved(nsnull, content, indx);
|
||||
}
|
||||
mChildren->Clear();
|
||||
|
||||
// Delete references to style sheets
|
||||
PRInt32 indx = mStyleSheets.Count();
|
||||
indx = mStyleSheets.Count();
|
||||
while (--indx >= 0) {
|
||||
nsIStyleSheet* sheet = (nsIStyleSheet*) mStyleSheets.ElementAt(indx);
|
||||
sheet->SetOwningDocument(nsnull);
|
||||
|
@ -728,9 +723,8 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup)
|
|||
|
||||
if (aLoadGroup) {
|
||||
mDocumentLoadGroup = getter_AddRefs(NS_GetWeakReference(aLoadGroup));
|
||||
// there was an assertion here that aLoadGroup was not null. This
|
||||
// is no longer valid nsWebShell::SetDocument does not create a
|
||||
// load group, and it works just fine.
|
||||
// there was an assertion here that aLoadGroup was not null. This is no longer valid
|
||||
// nsWebShell::SetDocument does not create a load group, and it works just fine.
|
||||
}
|
||||
|
||||
if (NS_OK == rv)
|
||||
|
@ -1165,151 +1159,26 @@ nsDocument::SetParentDocument(nsIDocument* aParent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
SubDocClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
||||
{
|
||||
SubDocMapEntry *e = NS_STATIC_CAST(SubDocMapEntry *, entry);
|
||||
|
||||
NS_RELEASE(e->mKey);
|
||||
NS_IF_RELEASE(e->mSubDocument);
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
SubDocInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key)
|
||||
{
|
||||
SubDocMapEntry *e =
|
||||
NS_CONST_CAST(SubDocMapEntry *,
|
||||
NS_STATIC_CAST(const SubDocMapEntry *, entry));
|
||||
|
||||
e->mKey = NS_CONST_CAST(nsIContent *,
|
||||
NS_STATIC_CAST(const nsIContent *, key));
|
||||
NS_ADDREF(e->mKey);
|
||||
|
||||
e->mSubDocument = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc)
|
||||
nsDocument::AddSubDocument(nsIDocument* aSubDoc)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent, NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (!aSubDoc) {
|
||||
// aSubDoc is nsnull, remove the mapping
|
||||
|
||||
if (mSubDocuments) {
|
||||
SubDocMapEntry *entry =
|
||||
NS_STATIC_CAST(SubDocMapEntry*,
|
||||
PL_DHashTableOperate(mSubDocuments, aContent,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_LIVE(entry)) {
|
||||
entry->mSubDocument->SetParentDocument(nsnull);
|
||||
|
||||
PL_DHashTableRawRemove(mSubDocuments, entry);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!mSubDocuments) {
|
||||
// Create a new hashtable
|
||||
|
||||
static PLDHashTableOps hash_table_ops =
|
||||
{
|
||||
PL_DHashAllocTable,
|
||||
PL_DHashFreeTable,
|
||||
PL_DHashGetKeyStub,
|
||||
PL_DHashVoidPtrKeyStub,
|
||||
PL_DHashMatchEntryStub,
|
||||
PL_DHashMoveEntryStub,
|
||||
SubDocClearEntry,
|
||||
PL_DHashFinalizeStub,
|
||||
SubDocInitEntry
|
||||
};
|
||||
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, nsnull,
|
||||
sizeof(SubDocMapEntry), 16);
|
||||
if (!mSubDocuments) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a mapping to the hash table
|
||||
SubDocMapEntry *entry =
|
||||
NS_STATIC_CAST(SubDocMapEntry*,
|
||||
PL_DHashTableOperate(mSubDocuments, aContent,
|
||||
PL_DHASH_ADD));
|
||||
|
||||
if (!entry) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (entry->mSubDocument) {
|
||||
entry->mSubDocument->SetParentDocument(nsnull);
|
||||
|
||||
// Release the old sub document
|
||||
NS_RELEASE(entry->mSubDocument);
|
||||
}
|
||||
|
||||
entry->mSubDocument = aSubDoc;
|
||||
NS_ADDREF(entry->mSubDocument);
|
||||
|
||||
aSubDoc->SetParentDocument(this);
|
||||
}
|
||||
|
||||
NS_ADDREF(aSubDoc);
|
||||
mSubDocuments.AppendElement(aSubDoc);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetSubDocumentFor(nsIContent *aContent, nsIDocument** aSubDoc)
|
||||
nsDocument::GetNumberOfSubDocuments(PRInt32* aCount)
|
||||
{
|
||||
*aSubDoc = nsnull;
|
||||
|
||||
if (mSubDocuments) {
|
||||
SubDocMapEntry *entry =
|
||||
NS_STATIC_CAST(SubDocMapEntry*,
|
||||
PL_DHashTableOperate(mSubDocuments, aContent,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_LIVE(entry)) {
|
||||
*aSubDoc = entry->mSubDocument;
|
||||
NS_ADDREF(*aSubDoc);
|
||||
}
|
||||
}
|
||||
|
||||
*aCount = mSubDocuments.Count();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
FindContentEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
PRUint32 number, void *arg)
|
||||
{
|
||||
SubDocMapEntry *entry = NS_STATIC_CAST(SubDocMapEntry*, hdr);
|
||||
FindContentData *data = NS_STATIC_CAST(FindContentData*, arg);
|
||||
|
||||
if (entry->mSubDocument == data->mSubDocument) {
|
||||
data->mResult = entry->mKey;
|
||||
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::FindContentForSubDocument(nsIDocument *aDocument,
|
||||
nsIContent **aContent)
|
||||
nsDocument::GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocument);
|
||||
|
||||
if (!mSubDocuments) {
|
||||
*aContent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
FindContentData data(aDocument);
|
||||
PL_DHashTableEnumerate(mSubDocuments, FindContentEnumerator, &data);
|
||||
|
||||
*aContent = data.mResult;
|
||||
NS_IF_ADDREF(*aContent);
|
||||
*aSubDoc = (nsIDocument*) mSubDocuments.SafeElementAt(aIndex);
|
||||
NS_IF_ADDREF(*aSubDoc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1871,18 +1740,23 @@ nsDocument::EndLoad()
|
|||
if (docShellAsItem) {
|
||||
docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));
|
||||
|
||||
nsCOMPtr<nsIDocument> parent_doc;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
||||
GetDocumentFromDocShellTreeItem(docShellParent,
|
||||
getter_AddRefs(parent_doc));
|
||||
GetDocumentFromDocShellTreeItem(docShellParent, getter_AddRefs(doc));
|
||||
|
||||
if (parent_doc) {
|
||||
nsCOMPtr<nsIContent> target_content;
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
|
||||
parent_doc->FindContentForSubDocument(this,
|
||||
getter_AddRefs(target_content));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIContent> target_content;
|
||||
|
||||
target_frame = do_QueryInterface(target_content);
|
||||
nsCOMPtr<nsISupports> docshell_identity(docShell);
|
||||
shell->FindContentForShell(docshell_identity,
|
||||
getter_AddRefs(target_content));
|
||||
|
||||
target_frame = do_QueryInterface(target_content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2271,8 +2145,8 @@ nsDocument::GetDocumentElement(nsIDOMElement** aDocumentElement)
|
|||
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (mRootContent) {
|
||||
res = CallQueryInterface(mRootContent, aDocumentElement);
|
||||
if (nsnull != mRootContent) {
|
||||
res = mRootContent->QueryInterface(NS_GET_IID(nsIDOMElement), (void**)aDocumentElement);
|
||||
NS_ASSERTION(NS_OK == res, "Must be a DOM Element");
|
||||
} else {
|
||||
*aDocumentElement = nsnull;
|
||||
|
@ -3597,25 +3471,6 @@ nsDocument::RemoveReference(void *aKey, nsISupports **aOldReference)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::SetContainer(nsISupports *aContainer)
|
||||
{
|
||||
mDocumentContainer = dont_AddRef(NS_GetWeakReference(aContainer));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetContainer(nsISupports **aContainer)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = do_QueryReferent(mDocumentContainer);
|
||||
|
||||
*aContainer = container;
|
||||
NS_IF_ADDREF(*aContainer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef IBMBIDI
|
||||
/**
|
||||
* Check if bidi enabled (set depending on the presence of RTL
|
||||
|
|
|
@ -69,8 +69,6 @@
|
|||
#include "nsScriptLoader.h"
|
||||
#include "nsICSSLoader.h"
|
||||
|
||||
#include "pldhash.h"
|
||||
|
||||
class nsIEventListenerManager;
|
||||
class nsDOMStyleSheetList;
|
||||
class nsIOutputStream;
|
||||
|
@ -214,29 +212,6 @@ protected:
|
|||
void* mScriptObject;
|
||||
};
|
||||
|
||||
|
||||
// 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
|
||||
|
@ -392,11 +367,9 @@ public:
|
|||
*/
|
||||
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 AddSubDocument(nsIDocument* aSubDoc);
|
||||
NS_IMETHOD GetNumberOfSubDocuments(PRInt32* aCount);
|
||||
NS_IMETHOD GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc);
|
||||
|
||||
/**
|
||||
* Return the root content object for this document.
|
||||
|
@ -519,8 +492,6 @@ public:
|
|||
NS_IMETHOD GetNodeInfoManager(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);
|
||||
|
||||
// nsIDOMNode
|
||||
NS_DECL_NSIDOMNODE
|
||||
|
@ -602,16 +573,13 @@ protected:
|
|||
nsCOMPtr<nsIURI> mDocumentBaseURL;
|
||||
nsIPrincipal* mPrincipal;
|
||||
nsWeakPtr mDocumentLoadGroup;
|
||||
nsWeakPtr mDocumentContainer;
|
||||
|
||||
|
||||
nsString mCharacterSet;
|
||||
PRInt32 mCharacterSetSource;
|
||||
|
||||
nsVoidArray mCharSetObservers;
|
||||
nsIDocument* mParentDocument;
|
||||
|
||||
PLDHashTable *mSubDocuments;
|
||||
|
||||
nsVoidArray mSubDocuments;
|
||||
nsVoidArray mPresShells;
|
||||
nsCOMPtr<nsISupportsArray> mChildren; // contains owning references
|
||||
nsIContent* mRootContent; // a weak reference to the only element in
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -40,14 +40,13 @@
|
|||
#include "nsIFrameLoader.h"
|
||||
#include "nsIDOMHTMLIFrameElement.h"
|
||||
#include "nsIDOMHTMLFrameElement.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIChromeEventHandler.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -57,6 +56,9 @@
|
|||
#include "nsIDocShellLoadInfo.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsICodebasePrincipal.h"
|
||||
|
@ -64,17 +66,10 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
|
||||
// Bug 8065: Limit content frame depth to some reasonable level. This
|
||||
// does not count chrome frames when determining depth, nor does it
|
||||
// prevent chrome recursion.
|
||||
#define MAX_DEPTH_CONTENT_FRAMES 25
|
||||
|
||||
|
||||
class nsFrameLoader : public nsIFrameLoader
|
||||
class nsFrameLoader : public nsIFrameLoader,
|
||||
public nsIDOMEventListener,
|
||||
public nsIWebProgressListener,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
nsFrameLoader();
|
||||
|
@ -84,19 +79,26 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIFrameLoader
|
||||
NS_IMETHOD Init(nsIContent *aOwner);
|
||||
NS_IMETHOD LoadFrame();
|
||||
NS_IMETHOD Init(nsIDOMElement *aOwner);
|
||||
NS_IMETHOD LoadURI(nsIURI *aURI);
|
||||
NS_IMETHOD GetDocShell(nsIDocShell **aDocShell);
|
||||
NS_IMETHOD Destroy();
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
// nsIWebProgressListener
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
protected:
|
||||
nsresult GetPresContext(nsIPresContext **aPresContext);
|
||||
nsresult EnsureDocShell();
|
||||
void GetURL(nsAString& aURL);
|
||||
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
|
||||
nsIContent *mOwnerContent; // WEAK
|
||||
nsCOMPtr<nsIDOMElement> mOwnerElement;
|
||||
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
};
|
||||
|
||||
nsresult
|
||||
|
@ -110,22 +112,26 @@ NS_NewFrameLoader(nsIFrameLoader **aFrameLoader)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsFrameLoader::nsFrameLoader()
|
||||
: mOwnerContent(nsnull)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsFrameLoader::~nsFrameLoader()
|
||||
{
|
||||
Destroy();
|
||||
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin(do_QueryInterface(mDocShell));
|
||||
|
||||
if (treeOwnerAsWin) {
|
||||
treeOwnerAsWin->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// QueryInterface implementation for nsFrameLoader
|
||||
NS_INTERFACE_MAP_BEGIN(nsFrameLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
|
@ -133,49 +139,27 @@ NS_IMPL_ADDREF(nsFrameLoader);
|
|||
NS_IMPL_RELEASE(nsFrameLoader);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::Init(nsIContent *aOwner)
|
||||
nsFrameLoader::Init(nsIDOMElement *aOwner)
|
||||
{
|
||||
mOwnerContent = aOwner; // WEAK
|
||||
mOwnerElement = aOwner;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::LoadFrame()
|
||||
nsFrameLoader::LoadURI(nsIURI *aURI)
|
||||
{
|
||||
NS_ENSURE_TRUE(mOwnerContent, NS_ERROR_NOT_INITIALIZED);
|
||||
mURI = aURI;
|
||||
|
||||
nsresult rv = EnsureDocShell();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mOwnerContent->GetDocument(*getter_AddRefs(doc));
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsAutoString src;
|
||||
GetURL(src);
|
||||
// Prevent recursion
|
||||
|
||||
src.Trim(" \t\n\r");
|
||||
|
||||
if (src.IsEmpty()) {
|
||||
// about:blank will be synthesized into a frame if not URL is
|
||||
// loaded into it (bug 35986)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
// mCreatingViewer=PR_TRUE;
|
||||
|
||||
// Make an absolute URI
|
||||
nsCOMPtr<nsIURI> base_uri;
|
||||
doc->GetBaseURL(*getter_AddRefs(base_uri));
|
||||
|
||||
nsAutoString doc_charset;
|
||||
doc->GetDocumentCharacterSet(doc_charset);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), src,
|
||||
doc_charset.IsEmpty() ? nsnull :
|
||||
NS_ConvertUCS2toUTF8(doc_charset).get(), base_uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Check for security
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
|
@ -213,21 +197,31 @@ nsFrameLoader::LoadFrame()
|
|||
|
||||
loadInfo->SetInheritOwner(PR_TRUE);
|
||||
|
||||
referrer = base_uri;
|
||||
nsCOMPtr<nsIDOMDocument> dom_doc;
|
||||
mOwnerElement->GetOwnerDocument(getter_AddRefs(dom_doc));
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(dom_doc));
|
||||
|
||||
if (doc) {
|
||||
doc->GetBaseURL(*getter_AddRefs(referrer));
|
||||
}
|
||||
}
|
||||
|
||||
loadInfo->SetReferrer(referrer);
|
||||
|
||||
// Check if we are allowed to load absURL
|
||||
rv = secMan->CheckLoadURI(referrer, uri,
|
||||
rv = secMan->CheckLoadURI(referrer, mURI,
|
||||
nsIScriptSecurityManager::STANDARD);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv; // We're not
|
||||
}
|
||||
|
||||
// Kick off the load...
|
||||
rv = mDocShell->LoadURI(uri, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE,
|
||||
PR_FALSE);
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mDocShell));
|
||||
|
||||
if (webProgress) {
|
||||
webProgress->AddProgressListener(this);
|
||||
}
|
||||
|
||||
rv = mDocShell->LoadURI(mURI, loadInfo, nsIWebNavigation::LOAD_FLAGS_NONE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to load URL");
|
||||
|
||||
return rv;
|
||||
|
@ -247,25 +241,12 @@ nsFrameLoader::GetDocShell(nsIDocShell **aDocShell)
|
|||
NS_IMETHODIMP
|
||||
nsFrameLoader::Destroy()
|
||||
{
|
||||
if (mOwnerContent) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mOwnerContent->GetDocument(*getter_AddRefs(doc));
|
||||
|
||||
if (doc) {
|
||||
doc->SetSubDocumentFor(mOwnerContent, nsnull);
|
||||
}
|
||||
|
||||
mOwnerContent = nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> base_win(do_QueryInterface(mDocShell));
|
||||
|
||||
if (base_win) {
|
||||
base_win->Destroy();
|
||||
}
|
||||
|
||||
mDocShell = nsnull;
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::HandleEvent(nsIDOMEvent *aEvent)
|
||||
{
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -275,8 +256,10 @@ nsFrameLoader::GetPresContext(nsIPresContext **aPresContext)
|
|||
{
|
||||
*aPresContext = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
mOwnerContent->GetDocument(*getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIDOMDocument> dom_doc;
|
||||
mOwnerElement->GetOwnerDocument(getter_AddRefs(dom_doc));
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(dom_doc));
|
||||
|
||||
while (doc) {
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
@ -304,15 +287,16 @@ nsFrameLoader::EnsureDocShell()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
GetPresContext(getter_AddRefs(presContext));
|
||||
NS_ENSURE_TRUE(presContext, NS_ERROR_UNEXPECTED);
|
||||
#if 0
|
||||
|
||||
|
||||
|
||||
|
||||
// Bug 8065: Don't exceed some maximum depth in content frames
|
||||
// (MAX_DEPTH_CONTENT_FRAMES)
|
||||
PRInt32 depth = 0;
|
||||
nsCOMPtr<nsISupports> parentAsSupports;
|
||||
presContext->GetContainer(getter_AddRefs(parentAsSupports));
|
||||
aPresContext->GetContainer(getter_AddRefs(parentAsSupports));
|
||||
|
||||
if (parentAsSupports) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem =
|
||||
|
@ -337,16 +321,32 @@ nsFrameLoader::EnsureDocShell()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create the docshell...
|
||||
mDocShell = do_CreateInstance("@mozilla.org/webshell;1");
|
||||
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
|
||||
|
||||
// Get the frame name and tell the docshell about it.
|
||||
#if 0
|
||||
// notify the pres shell that a docshell has been created
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext->GetShell(getter_AddRefs(presShell));
|
||||
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsISupports> subShellAsSupports(do_QueryInterface(mDocShell));
|
||||
NS_ENSURE_TRUE(subShellAsSupports, NS_ERROR_FAILURE);
|
||||
|
||||
presShell->SetSubShellFor(mContent, subShellAsSupports);
|
||||
|
||||
// We need to be able to get back to the presShell to unset the
|
||||
// subshell at destruction
|
||||
mPresShellWeak = getter_AddRefs(NS_GetWeakReference(presShell));
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
nsAutoString frameName;
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::name, frameName);
|
||||
mOwnerElement->GetAttribute(NS_LITERAL_STRING("name"), frameName);
|
||||
|
||||
if (!frameName.IsEmpty()) {
|
||||
docShellAsItem->SetName(frameName.get());
|
||||
|
@ -356,148 +356,178 @@ nsFrameLoader::EnsureDocShell()
|
|||
// child. If it's not a web-shell then some things will not operate
|
||||
// properly.
|
||||
|
||||
|
||||
nsCOMPtr<nsIPresContext> presContext;
|
||||
GetPresContext(getter_AddRefs(presContext));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// what if !presContext ?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
presContext->GetContainer(getter_AddRefs(container));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(container));
|
||||
if (parentAsNode) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem =
|
||||
do_QueryInterface(parentAsNode);
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShellTreeNode> parentAsNode(do_QueryInterface(container));
|
||||
if (parentAsNode) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem =
|
||||
do_QueryInterface(parentAsNode);
|
||||
|
||||
PRInt32 parentType;
|
||||
parentAsItem->GetItemType(&parentType);
|
||||
PRInt32 parentType;
|
||||
parentAsItem->GetItemType(&parentType);
|
||||
|
||||
nsAutoString value;
|
||||
PRBool isContent;
|
||||
nsAutoString value, valuePiece;
|
||||
PRBool isContent;
|
||||
|
||||
isContent = PR_FALSE;
|
||||
isContent = PR_FALSE;
|
||||
mOwnerElement->GetAttribute(NS_LITERAL_STRING("type"), value);
|
||||
|
||||
if (mOwnerContent->IsContentOfType(nsIContent::eXUL)) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, value);
|
||||
}
|
||||
if (!value.IsEmpty()) {
|
||||
// we accept "content" and "content-xxx" values.
|
||||
// at time of writing, we expect "xxx" to be "primary", but
|
||||
// someday it might be an integer expressing priority
|
||||
|
||||
if (!value.IsEmpty()) {
|
||||
// we accept "content" and "content-xxx" values.
|
||||
// at time of writing, we expect "xxx" to be "primary", but
|
||||
// someday it might be an integer expressing priority
|
||||
|
||||
if (value.Length() >= 7) {
|
||||
ToLowerCase(value);
|
||||
|
||||
nsAutoString::const_iterator start, end;
|
||||
value.BeginReading(start);
|
||||
value.EndReading(end);
|
||||
|
||||
nsAutoString::const_iterator iter(start);
|
||||
iter.advance(7);
|
||||
// string iterators!
|
||||
|
||||
const nsAString& valuePiece = Substring(start, iter);
|
||||
|
||||
if (valuePiece.Equals(NS_LITERAL_STRING("content")) &&
|
||||
(iter == end || *iter == '-')) {
|
||||
value.Left(valuePiece, 7);
|
||||
if (valuePiece.EqualsIgnoreCase("content") &&
|
||||
(value.Length() == 7 ||
|
||||
value.Mid(valuePiece, 7, 1) == 1 &&
|
||||
valuePiece.EqualsWithConversion("-"))) {
|
||||
isContent = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isContent) {
|
||||
// The web shell's type is content.
|
||||
|
||||
docShellAsItem->SetItemType(nsIDocShellTreeItem::typeContent);
|
||||
} else {
|
||||
// Inherit our type from our parent webshell. If it is
|
||||
// chrome, we'll be chrome. If it is content, we'll be
|
||||
// content.
|
||||
|
||||
docShellAsItem->SetItemType(parentType);
|
||||
}
|
||||
|
||||
parentAsNode->AddChild(docShellAsItem);
|
||||
|
||||
if (isContent) {
|
||||
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
||||
parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||
|
||||
if(parentTreeOwner) {
|
||||
// value is lowercased above.
|
||||
PRBool is_primary = value.Equals(NS_LITERAL_STRING("content-primary"));
|
||||
|
||||
parentTreeOwner->ContentShellAdded(docShellAsItem, is_primary,
|
||||
value.get());
|
||||
if (isContent) {
|
||||
// The web shell's type is content.
|
||||
docShellAsItem->SetItemType(nsIDocShellTreeItem::typeContent);
|
||||
} else {
|
||||
// Inherit our type from our parent webshell. If it is
|
||||
// chrome, we'll be chrome. If it is content, we'll be
|
||||
// content.
|
||||
docShellAsItem->SetItemType(parentType);
|
||||
}
|
||||
|
||||
parentAsNode->AddChild(docShellAsItem);
|
||||
|
||||
if (isContent) {
|
||||
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
||||
parentAsItem->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||
if(parentTreeOwner) {
|
||||
PRBool is_primary = value.EqualsIgnoreCase("content-primary");
|
||||
|
||||
parentTreeOwner->ContentShellAdded(docShellAsItem, is_primary,
|
||||
value.get());
|
||||
}
|
||||
}
|
||||
|
||||
// connect the container...
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
nsCOMPtr<nsIWebShellContainer> outerContainer =
|
||||
do_QueryInterface(container);
|
||||
|
||||
if (outerContainer) {
|
||||
webShell->SetContainer(outerContainer);
|
||||
}
|
||||
|
||||
// Make sure all shells have links back to the content element
|
||||
// in the nearest enclosing chrome shell.
|
||||
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
|
||||
|
||||
if (parentType == nsIDocShellTreeItem::typeChrome) {
|
||||
// Our parent shell is a chrome shell. It is therefore our nearest
|
||||
// enclosing chrome shell.
|
||||
chromeEventHandler = do_QueryInterface(mOwnerElement);
|
||||
NS_WARN_IF_FALSE(chromeEventHandler,
|
||||
"This mContent should implement this.");
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
|
||||
|
||||
// Our parent shell is a content shell. Get the chrome info from
|
||||
// it and use that for our shell as well.
|
||||
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Should this be in the layout code?
|
||||
|
||||
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
||||
}
|
||||
|
||||
// connect the container...
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
nsCOMPtr<nsIWebShellContainer> outerContainer =
|
||||
do_QueryInterface(container);
|
||||
|
||||
if (outerContainer) {
|
||||
webShell->SetContainer(outerContainer);
|
||||
}
|
||||
|
||||
// Make sure all shells have links back to the content element
|
||||
// in the nearest enclosing chrome shell.
|
||||
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
|
||||
|
||||
if (parentType == nsIDocShellTreeItem::typeChrome) {
|
||||
// Our parent shell is a chrome shell. It is therefore our nearest
|
||||
// enclosing chrome shell.
|
||||
|
||||
chromeEventHandler = do_QueryInterface(mOwnerContent);
|
||||
NS_WARN_IF_FALSE(chromeEventHandler,
|
||||
"This mContent should implement this.");
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShell> parentShell(do_QueryInterface(parentAsNode));
|
||||
|
||||
// Our parent shell is a content shell. Get the chrome event
|
||||
// handler from it and use that for our shell as well.
|
||||
|
||||
parentShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
|
||||
}
|
||||
|
||||
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
||||
}
|
||||
|
||||
// This is nasty, this code (the do_GetInterface(mDocShell) below)
|
||||
// *must* come *after* the above call to
|
||||
// mDocShell->SetChromeEventHandler() for the global window to get
|
||||
// the right chrome event handler.
|
||||
|
||||
// Tell the window about the frame that hosts it.
|
||||
nsCOMPtr<nsIDOMElement> frame_element(do_QueryInterface(mOwnerContent));
|
||||
NS_ASSERTION(frame_element, "frame loader owner element not a DOM element!");
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(mDocShell));
|
||||
nsCOMPtr<nsPIDOMWindow> win_private(do_QueryInterface(win));
|
||||
NS_ENSURE_TRUE(win_private, NS_ERROR_UNEXPECTED);
|
||||
|
||||
win_private->SetFrameElementInternal(frame_element);
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> base_win(do_QueryInterface(mDocShell));
|
||||
NS_ENSURE_TRUE(base_win, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// This is kinda whacky, this call doesn't really create anything,
|
||||
// but it must be called to make sure things are properly
|
||||
// initialized
|
||||
|
||||
base_win->Create();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameLoader::GetURL(nsAString& aURI)
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aStateFlags, PRUint32 aStatus)
|
||||
{
|
||||
aURI.Truncate();
|
||||
if (!((~aStateFlags) & (nsIWebProgressListener::STATE_IS_DOCUMENT |
|
||||
nsIWebProgressListener::STATE_TRANSFERRING))) {
|
||||
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(mDocShell));
|
||||
nsCOMPtr<nsIDOMEventTarget> eventTarget(do_QueryInterface(win));
|
||||
|
||||
nsCOMPtr<nsIAtom> type;
|
||||
mOwnerContent->GetTag(*getter_AddRefs(type));
|
||||
|
||||
if (type == nsHTMLAtoms::object) {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aURI);
|
||||
} else {
|
||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aURI);
|
||||
if (eventTarget) {
|
||||
eventTarget->AddEventListener(NS_LITERAL_STRING("load"), this,
|
||||
PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::OnLocationChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsIURI *location)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::OnStatusChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, nsresult aStatus,
|
||||
const PRUnichar *aMessage)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::OnSecurityChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest, PRInt32 state)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1620,8 +1620,8 @@ nsGenericElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||
|
||||
PRBool intermediateCapture = PR_FALSE;
|
||||
//Capturing stage evaluation
|
||||
if (NS_EVENT_FLAG_BUBBLE != aFlags && aEvent->message != NS_PAGE_LOAD &&
|
||||
aEvent->message != NS_SCRIPT_LOAD &&
|
||||
if (NS_EVENT_FLAG_BUBBLE != aFlags && aEvent->message != NS_PAGE_LOAD
|
||||
&& aEvent->message != NS_SCRIPT_LOAD &&
|
||||
aEvent->message != NS_IMAGE_ERROR && aEvent->message != NS_IMAGE_LOAD) {
|
||||
//Initiate capturing phase. Special case first call to document
|
||||
if (parent) {
|
||||
|
|
|
@ -91,16 +91,15 @@ private:
|
|||
// objects for each of these instance variables, we put them off
|
||||
// in a side structure that's only allocated when the content is
|
||||
// accessed through the DOM.
|
||||
struct nsDOMSlots
|
||||
{
|
||||
typedef struct {
|
||||
nsChildContentList *mChildNodes;
|
||||
nsDOMCSSDeclaration *mStyle;
|
||||
nsDOMAttributeMap* mAttributeMap;
|
||||
nsVoidArray *mRangeList;
|
||||
nsIEventListenerManager* mListenerManager;
|
||||
nsIContent* mBindingParent; // The nearest enclosing content node with a
|
||||
// binding that created us. [Weak]
|
||||
};
|
||||
nsIContent* mBindingParent; // The nearest enclosing content node with a binding
|
||||
// that created us. [Weak]
|
||||
} nsDOMSlots;
|
||||
|
||||
|
||||
class nsNode3Tearoff : public nsIDOM3Node
|
||||
|
|
|
@ -416,8 +416,6 @@ nsContentDLF::CreateDocument(const char* aCommand,
|
|||
break;
|
||||
docv->SetUAStyleSheet(gUAStyleSheet);
|
||||
|
||||
doc->SetContainer(aContainer);
|
||||
|
||||
// Initialize the document to begin loading the data. An
|
||||
// nsIStreamListener connected to the parser is returned in
|
||||
// aDocListener.
|
||||
|
@ -514,9 +512,6 @@ nsContentDLF::CreateRDFDocument(const char* aCommand,
|
|||
* An nsIStreamListener connected to the parser is returned in
|
||||
* aDocListener.
|
||||
*/
|
||||
|
||||
doc->SetContainer(aContainer);
|
||||
|
||||
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
/*
|
||||
|
|
|
@ -97,7 +97,6 @@
|
|||
#include "nsISelection.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsPlainTextSerializer.h"
|
||||
#include "nsRange.h"
|
||||
|
@ -276,7 +275,6 @@ extern nsresult NS_NewXBLService(nsIXBLService** aResult);
|
|||
extern nsresult NS_NewBindingManager(nsIBindingManager** aResult);
|
||||
extern nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult);
|
||||
extern nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
|
||||
extern nsresult NS_NewFrameLoader(nsIFrameLoader** aResult);
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
extern nsresult NS_NewXULElementFactory(nsIElementFactory** aResult);
|
||||
|
@ -344,7 +342,6 @@ MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPla
|
|||
MAKE_CTOR(CreateXBLService, nsIXBLService, NS_NewXBLService)
|
||||
MAKE_CTOR(CreateBindingManager, nsIBindingManager, NS_NewBindingManager)
|
||||
MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy)
|
||||
MAKE_CTOR(CreateFrameLoader, nsIFrameLoader, NS_NewFrameLoader)
|
||||
MAKE_CTOR(CreateNodeInfoManager, nsINodeInfoManager, NS_NewNodeInfoManager)
|
||||
MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewComputedDOMStyle)
|
||||
#ifdef MOZ_XUL
|
||||
|
@ -731,11 +728,6 @@ static const nsModuleComponentInfo gComponents[] = {
|
|||
NS_CONTENTPOLICY_CONTRACTID,
|
||||
CreateContentPolicy },
|
||||
|
||||
{ "Frame Loader",
|
||||
NS_FRAMELOADER_CID,
|
||||
NS_FRAMELOADER_CONTRACTID,
|
||||
CreateFrameLoader },
|
||||
|
||||
{ "NodeInfoManager",
|
||||
NS_NODEINFOMANAGER_CID,
|
||||
NS_NODEINFOMANAGER_CONTRACTID,
|
||||
|
|
|
@ -1531,36 +1531,39 @@ nsEventStateManager::GetParentScrollingView(nsMouseScrollEvent *aEvent,
|
|||
{
|
||||
if (!aEvent) return NS_ERROR_FAILURE;
|
||||
if (!aPresContext) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISupports> shell;
|
||||
aPresContext->GetContainer(getter_AddRefs(shell));
|
||||
if (!shell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(shell);
|
||||
if (!treeItem) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aPresContext->GetShell(getter_AddRefs(presShell));
|
||||
NS_ASSERTION(presShell, "No presshell in prescontext!");
|
||||
|
||||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
|
||||
NS_ASSERTION(doc, "No document in prescontext!");
|
||||
|
||||
nsCOMPtr<nsIDocument> parentDoc;
|
||||
doc->GetParentDocument(getter_AddRefs(parentDoc));
|
||||
|
||||
if (!parentDoc) {
|
||||
return NS_OK;
|
||||
}
|
||||
/* get our docshell's parent */
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
treeItem->GetParent(getter_AddRefs(parent));
|
||||
if (!parent) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocShell> pDocShell = do_QueryInterface(parent);
|
||||
if (!pDocShell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPresShell> pPresShell;
|
||||
parentDoc->GetShellAt(0, getter_AddRefs(pPresShell));
|
||||
NS_ENSURE_TRUE(pPresShell, NS_ERROR_FAILURE);
|
||||
pDocShell->GetPresShell(getter_AddRefs(pPresShell));
|
||||
if (!pPresShell) return NS_ERROR_FAILURE;
|
||||
|
||||
/* now find the content node in our parent docshell's document that
|
||||
corresponds to our docshell */
|
||||
nsCOMPtr<nsIDocument> parentDoc;
|
||||
pPresShell->GetDocument(getter_AddRefs(parentDoc));
|
||||
|
||||
nsCOMPtr<nsIContent> rootContent;
|
||||
parentDoc->GetRootContent(getter_AddRefs(rootContent));
|
||||
|
||||
nsCOMPtr<nsIDocShell> ourDS = do_QueryInterface(shell);
|
||||
|
||||
/* now find the content node in our parent docshell's document that corresponds
|
||||
to our docshell */
|
||||
nsCOMPtr<nsIContent> frameContent;
|
||||
|
||||
parentDoc->FindContentForSubDocument(doc, getter_AddRefs(frameContent));
|
||||
NS_ENSURE_TRUE(frameContent, NS_ERROR_FAILURE);
|
||||
pPresShell->FindContentForShell(ourDS, getter_AddRefs(frameContent));
|
||||
if (!frameContent) return NS_ERROR_FAILURE;
|
||||
|
||||
/*
|
||||
get this content node's frame, and use it as the new event target,
|
||||
|
@ -1568,7 +1571,6 @@ nsEventStateManager::GetParentScrollingView(nsMouseScrollEvent *aEvent,
|
|||
Note that we don't actually need to translate the event coordinates
|
||||
because they are not used by DoWheelScroll().
|
||||
*/
|
||||
|
||||
nsIFrame* frameFrame = nsnull;
|
||||
pPresShell->GetPrimaryFrameFor(frameContent, &frameFrame);
|
||||
if (!frameFrame) return NS_ERROR_FAILURE;
|
||||
|
@ -2743,7 +2745,7 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
|
|||
nsCOMPtr<nsISupports> pcContainer;
|
||||
mPresContext->GetContainer(getter_AddRefs(pcContainer));
|
||||
NS_ASSERTION(pcContainer, "no container for presContext");
|
||||
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(pcContainer));
|
||||
PRBool docHasFocus = PR_FALSE;
|
||||
|
||||
|
@ -2836,32 +2838,19 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
|
|||
// Check to see if the next focused element has a subshell.
|
||||
// This is the case for an IFRAME or FRAME element. If it
|
||||
// does, we send focus into the subshell.
|
||||
nsCOMPtr<nsISupports> shellObject;
|
||||
presShell->GetSubShellFor(nextFocus, getter_AddRefs(shellObject));
|
||||
if (shellObject) {
|
||||
nsCOMPtr<nsIDocShell> subShell = do_QueryInterface(shellObject);
|
||||
if (subShell) {
|
||||
SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
|
||||
|
||||
nsCOMPtr<nsIDocShell> sub_shell;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc, sub_doc;
|
||||
nextFocus->GetDocument(*getter_AddRefs(doc));
|
||||
|
||||
if (doc) {
|
||||
doc->GetSubDocumentFor(nextFocus, getter_AddRefs(sub_doc));
|
||||
|
||||
if (sub_doc) {
|
||||
nsCOMPtr<nsISupports> container;
|
||||
sub_doc->GetContainer(getter_AddRefs(container));
|
||||
|
||||
sub_shell = do_QueryInterface(container);
|
||||
nsIFrame* nextFocusFrame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(nextFocus, &nextFocusFrame);
|
||||
presShell->ScrollFrameIntoView(nextFocusFrame, NS_PRESSHELL_SCROLL_ANYWHERE,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
TabIntoDocument(subShell, aForward);
|
||||
}
|
||||
}
|
||||
|
||||
if (sub_shell) {
|
||||
SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
|
||||
|
||||
nsIFrame* nextFocusFrame = nsnull;
|
||||
presShell->GetPrimaryFrameFor(nextFocus, &nextFocusFrame);
|
||||
presShell->ScrollFrameIntoView(nextFocusFrame,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
TabIntoDocument(sub_shell, aForward);
|
||||
} else {
|
||||
// there is no subshell, so just focus nextFocus
|
||||
#ifdef DEBUG_DOCSHELL_FOCUS
|
||||
|
@ -2938,28 +2927,23 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
|
|||
if (parentDS) {
|
||||
nsCOMPtr<nsIPresShell> parentShell;
|
||||
parentDS->GetPresShell(getter_AddRefs(parentShell));
|
||||
|
||||
nsCOMPtr<nsIContent> docContent;
|
||||
nsCOMPtr<nsIDocument> parent_doc;
|
||||
|
||||
parentShell->GetDocument(getter_AddRefs(parent_doc));
|
||||
|
||||
parent_doc->FindContentForSubDocument(mDocument,
|
||||
getter_AddRefs(docContent));
|
||||
|
||||
|
||||
nsCOMPtr<nsIContent> shellContent;
|
||||
parentShell->FindContentForShell(docShell, getter_AddRefs(shellContent));
|
||||
|
||||
nsCOMPtr<nsIPresContext> parentPC;
|
||||
parentShell->GetPresContext(getter_AddRefs(parentPC));
|
||||
|
||||
|
||||
nsCOMPtr<nsIEventStateManager> parentESM;
|
||||
parentPC->GetEventStateManager(getter_AddRefs(parentESM));
|
||||
|
||||
|
||||
SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
|
||||
|
||||
#ifdef DEBUG_DOCSHELL_FOCUS
|
||||
printf("popping out focus to parent docshell\n");
|
||||
#endif
|
||||
parentESM->MoveCaretToFocus();
|
||||
parentESM->ShiftFocus(aForward, docContent);
|
||||
parentESM->ShiftFocus(aForward, shellContent);
|
||||
}
|
||||
} else {
|
||||
PRBool tookFocus = PR_FALSE;
|
||||
|
@ -4663,14 +4647,6 @@ PRBool
|
|||
nsEventStateManager::IsIFrameDoc(nsIDocShell* aDocShell)
|
||||
{
|
||||
NS_ASSERTION(aDocShell, "docshell is null");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
aDocShell->GetPresShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "No document in presshell!");
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(aDocShell);
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentItem));
|
||||
|
@ -4678,17 +4654,12 @@ nsEventStateManager::IsIFrameDoc(nsIDocShell* aDocShell)
|
|||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDocShell> parentDS = do_QueryInterface(parentItem);
|
||||
nsCOMPtr<nsIPresShell> parentPresShell;
|
||||
parentDS->GetPresShell(getter_AddRefs(parentPresShell));
|
||||
NS_ASSERTION(parentPresShell, "presshell is null");
|
||||
|
||||
nsCOMPtr<nsIDocument> parentDoc;
|
||||
parentPresShell->GetDocument(getter_AddRefs(parentDoc));
|
||||
|
||||
nsCOMPtr<nsIPresShell> parentShell;
|
||||
parentDS->GetPresShell(getter_AddRefs(parentShell));
|
||||
NS_ASSERTION(parentShell, "presshell is null");
|
||||
|
||||
nsCOMPtr<nsIContent> docContent;
|
||||
|
||||
parentDoc->FindContentForSubDocument(doc, getter_AddRefs(docContent));
|
||||
|
||||
parentShell->FindContentForShell(aDocShell, getter_AddRefs(docContent));
|
||||
if (!docContent)
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -32,10 +32,10 @@ REQUIRES = xpcom \
|
|||
webshell \
|
||||
htmlparser \
|
||||
necko \
|
||||
uriloader \
|
||||
view \
|
||||
pref \
|
||||
docshell \
|
||||
uriloader \
|
||||
xpconnect \
|
||||
caps \
|
||||
editor \
|
||||
|
|
|
@ -2335,12 +2335,12 @@ nsGenericHTMLElement::GetBaseURL(const nsHTMLValue& aBaseHref,
|
|||
baseHref.Trim(" \t\n\r");
|
||||
|
||||
nsIURI* url = nsnull;
|
||||
result = NS_NewURI(&url, baseHref, nsnull, docBaseURL);
|
||||
|
||||
{
|
||||
result = NS_NewURI(&url, baseHref, nsnull, docBaseURL);
|
||||
}
|
||||
NS_IF_RELEASE(docBaseURL);
|
||||
*aBaseURL = url;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -4575,6 +4575,32 @@ nsGenericHTMLElement::SetElementFocus(PRBool aDoFocus)
|
|||
return RemoveFocus(presContext);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::HandleFrameOnloadEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
NS_ENSURE_TRUE(aEvent, NS_OK);
|
||||
|
||||
nsAutoString type;
|
||||
aEvent->GetType(type);
|
||||
|
||||
if (!type.EqualsIgnoreCase("load")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresContext> ctx;
|
||||
|
||||
GetPresContext(this, getter_AddRefs(ctx));
|
||||
NS_ENSURE_TRUE(ctx, NS_OK);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event;
|
||||
|
||||
event.eventStructType = NS_EVENT;
|
||||
event.message = NS_PAGE_LOAD;
|
||||
|
||||
return HandleDOMEvent(ctx, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsGenericHTMLElement::SetProtocolInHrefString(const nsAString &aHref,
|
||||
|
|
|
@ -465,6 +465,8 @@ public:
|
|||
protected:
|
||||
nsresult SetElementFocus(PRBool aDoFocus);
|
||||
|
||||
nsresult HandleFrameOnloadEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
PRBool IsEventName(nsIAtom* aName);
|
||||
};
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsIDOMHTMLFrameElement.h"
|
||||
#include "nsIDOMNSHTMLFrameElement.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -48,14 +49,14 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIChromeEventHandler.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
|
||||
class nsHTMLFrameElement : public nsGenericHTMLLeafElement,
|
||||
public nsIDOMHTMLFrameElement,
|
||||
public nsIDOMNSHTMLFrameElement,
|
||||
public nsIChromeEventHandler
|
||||
public nsIChromeEventHandler,
|
||||
public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
nsHTMLFrameElement();
|
||||
|
@ -82,6 +83,9 @@ public:
|
|||
// nsIChromeEventHandler
|
||||
NS_DECL_NSICHROMEEVENTHANDLER
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsHTMLValue& aResult);
|
||||
|
@ -139,6 +143,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFrameElement,
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFrameElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLFrameElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIChromeEventHandler)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLFrameElement)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
|
@ -186,21 +191,33 @@ NS_IMETHODIMP
|
|||
nsHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentDocument);
|
||||
|
||||
*aContentDocument = nsnull;
|
||||
|
||||
if (!mDocument) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_ENSURE_TRUE(mDocument, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDocument> content_document;
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
||||
mDocument->GetSubDocumentFor(this, getter_AddRefs(content_document));
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
|
||||
if (!content_document) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsISupports> tmp;
|
||||
|
||||
return CallQueryInterface(content_document, aContentDocument);
|
||||
presShell->GetSubShellFor(this, getter_AddRefs(tmp));
|
||||
NS_ENSURE_TRUE(tmp, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(tmp);
|
||||
NS_ENSURE_TRUE(webNav, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
webNav->GetDocument(getter_AddRefs(domDoc));
|
||||
|
||||
*aContentDocument = domDoc;
|
||||
|
||||
NS_IF_ADDREF(*aContentDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -312,3 +329,8 @@ nsHTMLFrameElement::HandleChromeEvent(nsIPresContext* aPresContext,
|
|||
return HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags,aEventStatus);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLFrameElement::HandleEvent(nsIDOMEvent *aEvent)
|
||||
{
|
||||
return HandleFrameOnloadEvent(aEvent);
|
||||
}
|
||||
|
|
|
@ -37,10 +37,11 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsIDOMHTMLIFrameElement.h"
|
||||
#include "nsIDOMNSHTMLFrameElement.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
@ -53,14 +54,12 @@
|
|||
#include "nsIChromeEventHandler.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
|
||||
class nsHTMLIFrameElement : public nsGenericHTMLContainerElement,
|
||||
public nsIDOMHTMLIFrameElement,
|
||||
public nsIDOMNSHTMLFrameElement,
|
||||
public nsIChromeEventHandler,
|
||||
public nsIFrameLoaderOwner
|
||||
public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
nsHTMLIFrameElement();
|
||||
|
@ -87,11 +86,8 @@ public:
|
|||
// nsIChromeEventHandler
|
||||
NS_DECL_NSICHROMEEVENTHANDLER
|
||||
|
||||
// nsIFrameLoaderOwner
|
||||
NS_IMETHOD GetFrameLoader(nsIFrameLoader **aFrameLoader);
|
||||
|
||||
// nsIContent
|
||||
NS_IMETHOD SetParent(nsIContent *aParent);
|
||||
// nsIDOMEventListener
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
|
@ -105,14 +101,6 @@ public:
|
|||
#ifdef DEBUG
|
||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// This doesn't really ensure a frame loade in all cases, only when
|
||||
// it makes sense.
|
||||
nsresult EnsureFrameLoader();
|
||||
nsresult LoadSrc();
|
||||
|
||||
nsCOMPtr<nsIFrameLoader> mFrameLoader;
|
||||
};
|
||||
|
||||
nsresult
|
||||
|
@ -148,9 +136,6 @@ nsHTMLIFrameElement::nsHTMLIFrameElement()
|
|||
|
||||
nsHTMLIFrameElement::~nsHTMLIFrameElement()
|
||||
{
|
||||
if (mFrameLoader) {
|
||||
mFrameLoader->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,7 +148,7 @@ NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLIFrameElement,
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLIFrameElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLFrameElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIChromeEventHandler)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoaderOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLIFrameElement)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
|
@ -204,123 +189,71 @@ NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, MarginHeight, marginheight)
|
|||
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, MarginWidth, marginwidth)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Name, name)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Scrolling, scrolling)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Src, src)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLIFrameElement, Width, width)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::GetSrc(nsAString& aSrc)
|
||||
{
|
||||
nsGenericHTMLContainerElement::GetAttr(kNameSpaceID_None, nsHTMLAtoms::src,
|
||||
aSrc);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::SetSrc(const nsAString& aSrc)
|
||||
{
|
||||
SetAttribute(NS_LITERAL_STRING("src"), aSrc);
|
||||
|
||||
return LoadSrc();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentDocument);
|
||||
|
||||
*aContentDocument = nsnull;
|
||||
|
||||
nsresult rv = EnsureFrameLoader();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(mDocument, NS_OK);
|
||||
|
||||
if (!mFrameLoader) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
||||
nsCOMPtr<nsIDocShell> doc_shell;
|
||||
mFrameLoader->GetDocShell(getter_AddRefs(doc_shell));
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(doc_shell));
|
||||
nsCOMPtr<nsISupports> tmp;
|
||||
|
||||
if (!win) {
|
||||
return NS_OK;
|
||||
}
|
||||
presShell->GetSubShellFor(this, getter_AddRefs(tmp));
|
||||
NS_ENSURE_TRUE(tmp, NS_OK);
|
||||
|
||||
return win->GetDocument(aContentDocument);
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(tmp);
|
||||
NS_ENSURE_TRUE(webNav, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
webNav->GetDocument(getter_AddRefs(domDoc));
|
||||
|
||||
*aContentDocument = domDoc;
|
||||
|
||||
NS_IF_ADDREF(*aContentDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::GetContentWindow(nsIDOMWindow** aContentWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentWindow);
|
||||
*aContentWindow = nsnull;
|
||||
|
||||
nsresult rv = EnsureFrameLoader();
|
||||
nsCOMPtr<nsIDOMDocument> content_doc;
|
||||
|
||||
nsresult rv = GetContentDocument(getter_AddRefs(content_doc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mFrameLoader) {
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(content_doc));
|
||||
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> doc_shell;
|
||||
mFrameLoader->GetDocShell(getter_AddRefs(doc_shell));
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj;
|
||||
doc->GetScriptGlobalObject(getter_AddRefs(globalObj));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(doc_shell));
|
||||
nsCOMPtr<nsIDOMWindow> window (do_QueryInterface(globalObj));
|
||||
|
||||
*aContentWindow = win;
|
||||
*aContentWindow = window;
|
||||
NS_IF_ADDREF(*aContentWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLIFrameElement::EnsureFrameLoader()
|
||||
{
|
||||
if (mFrameLoader || !mParent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NewFrameLoader(getter_AddRefs(mFrameLoader));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mFrameLoader->Init(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::GetFrameLoader(nsIFrameLoader **aFrameLoader)
|
||||
{
|
||||
*aFrameLoader = mFrameLoader;
|
||||
NS_IF_ADDREF(*aFrameLoader);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLIFrameElement::LoadSrc()
|
||||
{
|
||||
nsresult rv = EnsureFrameLoader();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mFrameLoader) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = mFrameLoader->LoadFrame();
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to load URL");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::SetParent(nsIContent *aParent)
|
||||
{
|
||||
nsresult rv = nsGenericHTMLContainerElement::SetParent(aParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return LoadSrc();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
|
@ -433,7 +366,7 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
|
|||
if (aData->mPositionData->mHeight.GetUnit() == eCSSUnit_Null) {
|
||||
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
||||
if (value.GetUnit() == eHTMLUnit_Pixel)
|
||||
aData->mPositionData->mHeight.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
|
||||
aData->mPositionData->mHeight.SetFloatValue((float)value.GetPixelValue(), eCSSUnit_Pixel);
|
||||
else if (value.GetUnit() == eHTMLUnit_Percent)
|
||||
aData->mPositionData->mHeight.SetPercentValue(value.GetPercentValue());
|
||||
}
|
||||
|
@ -444,8 +377,7 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
PRInt32& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::width) ||
|
||||
|
@ -487,15 +419,20 @@ nsHTMLIFrameElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
|||
|
||||
//*****************************************************************************
|
||||
// nsHTMLIFrameElement::nsIChromeEventHandler
|
||||
//*****************************************************************************
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLIFrameElement::HandleChromeEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
return HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags,aEventStatus);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLIFrameElement::HandleEvent(nsIDOMEvent *aEvent)
|
||||
{
|
||||
return HandleFrameOnloadEvent(aEvent);
|
||||
}
|
||||
|
|
|
@ -190,18 +190,30 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
|||
|
||||
*aContentDocument = nsnull;
|
||||
|
||||
if (!mDocument) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_ENSURE_TRUE(mDocument, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDocument> sub_doc;
|
||||
mDocument->GetSubDocumentFor(this, getter_AddRefs(sub_doc));
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
||||
if (!sub_doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
|
||||
return CallQueryInterface(sub_doc, aContentDocument);
|
||||
nsCOMPtr<nsISupports> tmp;
|
||||
|
||||
presShell->GetSubShellFor(this, getter_AddRefs(tmp));
|
||||
if (!tmp) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(tmp);
|
||||
NS_ENSURE_TRUE(webNav, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
webNav->GetDocument(getter_AddRefs(domDoc));
|
||||
|
||||
*aContentDocument = domDoc;
|
||||
|
||||
NS_IF_ADDREF(*aContentDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -190,18 +190,30 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
|||
|
||||
*aContentDocument = nsnull;
|
||||
|
||||
if (!mDocument) {
|
||||
return NS_OK;
|
||||
}
|
||||
NS_ENSURE_TRUE(mDocument, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDocument> sub_doc;
|
||||
mDocument->GetSubDocumentFor(this, getter_AddRefs(sub_doc));
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
|
||||
if (!sub_doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
mDocument->GetShellAt(0, getter_AddRefs(presShell));
|
||||
NS_ENSURE_TRUE(presShell, NS_OK);
|
||||
|
||||
return CallQueryInterface(sub_doc, aContentDocument);
|
||||
nsCOMPtr<nsISupports> tmp;
|
||||
|
||||
presShell->GetSubShellFor(this, getter_AddRefs(tmp));
|
||||
if (!tmp) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(tmp);
|
||||
NS_ENSURE_TRUE(webNav, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
webNav->GetDocument(getter_AddRefs(domDoc));
|
||||
|
||||
*aContentDocument = domDoc;
|
||||
|
||||
NS_IF_ADDREF(*aContentDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1503,7 +1503,7 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
|
|||
// Flush any collected text content. Release the last text
|
||||
// node to indicate that no more should be added to it.
|
||||
FlushTextAndRelease();
|
||||
|
||||
|
||||
SINK_TRACE_NODE(SINK_TRACE_CALLS,
|
||||
"SinkContext::CloseContainer", aNode, mStackPos-1, mSink);
|
||||
|
||||
|
@ -1604,8 +1604,7 @@ SinkContext::CloseContainer(const nsIParserNode& aNode)
|
|||
|
||||
case eHTMLTag_select:
|
||||
{
|
||||
nsCOMPtr<nsISelectElement> select = do_QueryInterface(content);
|
||||
|
||||
nsCOMPtr<nsISelectElement> select = do_QueryInterface(content, &result);
|
||||
if (select) {
|
||||
result = select->DoneAddingChildren();
|
||||
}
|
||||
|
@ -3815,57 +3814,43 @@ HTMLContentSink::DidProcessAToken(void)
|
|||
PRInt32 oldMaxTokenProcessingTime = GetMaxTokenProcessingTime();
|
||||
#endif
|
||||
|
||||
// There is both a high frequency interrupt mode and a low
|
||||
// frequency interupt mode controlled by the flag
|
||||
// NS_SINK_FLAG_DYNAMIC_LOWER_VALUE The high frequency mode
|
||||
// interupts the parser frequently to provide UI responsiveness at
|
||||
// the expense of page load time. The low frequency mode
|
||||
// interrupts the parser and samples the system clock infrequently
|
||||
// to provide fast page load time. When the user moves the mouse,
|
||||
// clicks or types the mode switches to the high frequency
|
||||
// interrupt mode. If the user stops moving the mouse or typing
|
||||
// for a duration of time (mDynamicIntervalSwitchThreshold) it
|
||||
// switches to low frequency interrupt mode.
|
||||
// There is both a high frequency interrupt mode and a low frequency
|
||||
// interupt mode controlled by the flag NS_SINK_FLAG_DYNAMIC_LOWER_VALUE
|
||||
// The high frequency mode interupts the parser frequently to provide
|
||||
// UI responsiveness at the expense of page load time. The low frequency mode
|
||||
// interrupts the parser and samples the system clock infrequently to provide fast
|
||||
// page load time. When the user moves the mouse, clicks or types the mode switches
|
||||
// to the high frequency interrupt mode. If the user stops moving the mouse or typing
|
||||
// for a duration of time (mDynamicIntervalSwitchThreshold) it switches to low
|
||||
// frequency interrupt mode.
|
||||
|
||||
// Get the current user event time
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
mDocument->GetShellAt(0, getter_AddRefs(shell));
|
||||
|
||||
if (!shell) {
|
||||
// If there's no pres shell in the document, return early since
|
||||
// we're not laying anything out here.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
NS_ENSURE_TRUE(vm, NS_ERROR_FAILURE);
|
||||
PRUint32 eventTime;
|
||||
nsresult rv = vm->GetLastUserEventTime(eventTime);
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv), NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
if ((!(mFlags & NS_SINK_FLAG_DYNAMIC_LOWER_VALUE)) &&
|
||||
(mLastSampledUserEventTime == eventTime)) {
|
||||
// The magic value of NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE
|
||||
// was selected by empirical testing. It provides reasonable
|
||||
// user response and prevents us from sampling the clock too
|
||||
// frequently.
|
||||
// The magic value of NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE was selected by
|
||||
// empirical testing. It provides reasonable
|
||||
// user response and prevents us from sampling the clock too frequently.
|
||||
if (mDeflectedCount < NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE) {
|
||||
mDeflectedCount++;
|
||||
|
||||
// return early to prevent sampling the clock. Note: This
|
||||
// prevents us from switching to higher frequency (better UI
|
||||
// responsive) mode, so limit ourselves to doing for no more
|
||||
// than NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE tokens.
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK; // return early to prevent sampling the clock. Note: This prevents
|
||||
// us from switching to higher frequency (better UI responsive) mode, so
|
||||
// limit ourselves to doing for no more than
|
||||
// NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE tokens.
|
||||
} else {
|
||||
// reset count and drop through to the code which samples the
|
||||
// clock and does the dynamic switch between the high
|
||||
// frequency and low frequency interruption of the parser.
|
||||
|
||||
mDeflectedCount = 0;
|
||||
mDeflectedCount = 0; // reset count and drop through to the code which samples the clock and
|
||||
// does the dynamic switch between the high frequency and low frequency
|
||||
// interruption of the parser.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3873,49 +3858,48 @@ PRInt32 oldMaxTokenProcessingTime = GetMaxTokenProcessingTime();
|
|||
|
||||
PRUint32 currentTime = PR_IntervalToMicroseconds(PR_IntervalNow());
|
||||
|
||||
// Get the last user event time and compare it with the current
|
||||
// time to determine if the lower value for content notification
|
||||
// and max token processing should be used. But only consider
|
||||
// using the lower value if the document has already been loading
|
||||
// for 2 seconds. 2 seconds was chosen because it is greater than
|
||||
// the default 3/4 of second that is used to determine when to
|
||||
// switch between the modes and it gives the document a little
|
||||
// time to create windows. This is important because on some
|
||||
// systems (Windows, for example) when a window is created and the
|
||||
// mouse is over it, a mouse move event is sent, which will kick
|
||||
// us into interactive mode otherwise. It also supresses reaction
|
||||
// to pressing the ENTER key in the URL bar...
|
||||
// Get the last user event time and compare it with
|
||||
// the current time to determine if the lower value
|
||||
// for content notification and max token processing
|
||||
// should be used. But only consider using the lower
|
||||
// value if the document has already been loading
|
||||
// for 2 seconds. 2 seconds was chosen because it is
|
||||
// greater than the default 3/4 of second that is used
|
||||
// to determine when to switch between the modes and it
|
||||
// gives the document a little time to create windows.
|
||||
// This is important because on some systems (Windows,
|
||||
// for example) when a window is created and the mouse
|
||||
// is over it, a mouse move event is sent, which will kick
|
||||
// us into interactive mode otherwise. It also supresses
|
||||
// reaction to pressing the ENTER key in the URL bar...
|
||||
|
||||
PRUint32 delayBeforeLoweringThreshold = NS_STATIC_CAST(PRUint32, ((2 * mDynamicIntervalSwitchThreshold) + NS_DELAY_FOR_WINDOW_CREATION));
|
||||
|
||||
if ((currentTime - mBeginLoadTime) > delayBeforeLoweringThreshold) {
|
||||
if ((currentTime - eventTime) <
|
||||
NS_STATIC_CAST(PRUint32, mDynamicIntervalSwitchThreshold)) {
|
||||
// lower the dynamic values to favor application
|
||||
// responsiveness over page load time.
|
||||
|
||||
mFlags |= NS_SINK_FLAG_DYNAMIC_LOWER_VALUE;
|
||||
} else {
|
||||
// raise the content notification and MaxTokenProcessing time
|
||||
// to favor overall page load speed over responsiveness
|
||||
|
||||
mFlags &= ~NS_SINK_FLAG_DYNAMIC_LOWER_VALUE;
|
||||
if (((currentTime - mBeginLoadTime) > delayBeforeLoweringThreshold) && mDocument) {
|
||||
if ((currentTime - eventTime) < NS_STATIC_CAST(PRUint32, mDynamicIntervalSwitchThreshold)) {
|
||||
// lower the dynamic values to favor
|
||||
// application responsiveness over page load
|
||||
// time.
|
||||
mFlags |= NS_SINK_FLAG_DYNAMIC_LOWER_VALUE;
|
||||
}
|
||||
else {
|
||||
// raise the content notification and
|
||||
// MaxTokenProcessing time to favor overall
|
||||
// page load speed over responsiveness
|
||||
mFlags &= ~NS_SINK_FLAG_DYNAMIC_LOWER_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
PRInt32 newMaxTokenProcessingTime = GetMaxTokenProcessingTime();
|
||||
PRInt32 newMaxTokenProcessingTime = GetMaxTokenProcessingTime();
|
||||
|
||||
if (newMaxTokenProcessingTime != oldMaxTokenProcessingTime) {
|
||||
// printf("Changed dynamic interval : MaxTokenProcessingTime %d\n",
|
||||
// GetMaxTokenProcessingTime());
|
||||
}
|
||||
if (newMaxTokenProcessingTime != oldMaxTokenProcessingTime) {
|
||||
// printf("Changed dynamic interval : MaxTokenProcessingTime %d\n", GetMaxTokenProcessingTime());
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((currentTime - mDelayTimerStart) >
|
||||
NS_STATIC_CAST(PRUint32, GetMaxTokenProcessingTime())) {
|
||||
return NS_ERROR_HTMLPARSER_INTERRUPTED;
|
||||
}
|
||||
if ((currentTime - mDelayTimerStart) > NS_STATIC_CAST(PRUint32, GetMaxTokenProcessingTime())) {
|
||||
return NS_ERROR_HTMLPARSER_INTERRUPTED;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -4162,7 +4146,7 @@ nsresult
|
|||
HTMLContentSink::ProcessAREATag(const nsIParserNode& aNode)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mCurrentMap) {
|
||||
if (nsnull != mCurrentMap) {
|
||||
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
|
||||
nsIHTMLContent* area;
|
||||
rv = CreateContentObject(aNode, nodeType, nsnull, nsnull, &area);
|
||||
|
|
|
@ -1477,7 +1477,7 @@ nsHTMLDocument::FlushPendingNotifications(PRBool aFlushReflows,
|
|||
}
|
||||
}
|
||||
|
||||
if (isSafeToFlush && mParser) {
|
||||
if ((isSafeToFlush) && (mParser)) {
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
|
||||
// XXX Ack! Parser doesn't addref sink before passing it back
|
||||
|
@ -3750,33 +3750,34 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
|
|||
PRBool
|
||||
nsHTMLDocument::GetBodyContent()
|
||||
{
|
||||
nsCOMPtr<nsIContent> root;
|
||||
nsCOMPtr<nsIDOMElement> root;
|
||||
|
||||
GetRootContent(getter_AddRefs(root));
|
||||
GetDocumentElement(getter_AddRefs(root));
|
||||
|
||||
if (!root) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRInt32 i, child_count;
|
||||
root->ChildCount(child_count);
|
||||
NS_NAMED_LITERAL_STRING(bodyStr, "BODY");
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
root->GetFirstChild(getter_AddRefs(child));
|
||||
|
||||
for (i = 0; i < child_count; i++) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
while (child) {
|
||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(child));
|
||||
|
||||
root->ChildAt(i, *getter_AddRefs(child));
|
||||
NS_ENSURE_TRUE(child, NS_ERROR_UNEXPECTED);
|
||||
if (domElement) {
|
||||
nsAutoString tagName;
|
||||
domElement->GetTagName(tagName);
|
||||
|
||||
nsCOMPtr<nsINodeInfo> ni;
|
||||
child->GetNodeInfo(*getter_AddRefs(ni));
|
||||
ToUpperCase(tagName);
|
||||
if (bodyStr.Equals(tagName)) {
|
||||
mBodyContent = child;
|
||||
|
||||
if (ni && ni->Equals(nsHTMLAtoms::body) &&
|
||||
(ni->NamespaceEquals(kNameSpaceID_None) ||
|
||||
ni->NamespaceEquals(kNameSpaceID_HTML))) {
|
||||
mBodyContent = do_QueryInterface(child);
|
||||
|
||||
return PR_TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
nsIDOMNode *tmpNode = child;
|
||||
tmpNode->GetNextSibling(getter_AddRefs(child));
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -2657,7 +2657,7 @@ CSSStyleSheetImpl::SetDisabled(PRBool aDisabled)
|
|||
PRBool oldState = mDisabled;
|
||||
mDisabled = aDisabled;
|
||||
|
||||
if (mDocument && (mDisabled != oldState)) {
|
||||
if ((nsnull != mDocument) && (mDisabled != oldState)) {
|
||||
mDocument->SetStyleSheetDisabledState(this, mDisabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -2310,13 +2310,6 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFrameLoader.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>UnicharUtilsStatic.o</PATH>
|
||||
|
@ -3452,11 +3445,6 @@
|
|||
<PATH>nsContentAreaDragDrop.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFrameLoader.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>UnicharUtilsStatic.o</PATH>
|
||||
|
@ -5811,13 +5799,6 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFrameLoader.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>UnicharUtilsStaticDebug.o</PATH>
|
||||
|
@ -6953,11 +6934,6 @@
|
|||
<PATH>nsContentAreaDragDrop.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFrameLoader.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>UnicharUtilsStaticDebug.o</PATH>
|
||||
|
@ -7286,12 +7262,6 @@
|
|||
<PATH>nsContentAreaDragDrop.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>content.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsFrameLoader.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
</GROUP>
|
||||
<GROUP><NAME>build</NAME>
|
||||
<FILEREF>
|
||||
|
|
|
@ -445,8 +445,6 @@ nsXULDocument::nsXULDocument(void)
|
|||
#ifdef IBMBIDI
|
||||
mBidiEnabled = PR_FALSE;
|
||||
#endif // IBMBIDI
|
||||
|
||||
mSubDocuments = nsnull;
|
||||
}
|
||||
|
||||
nsIFastLoadService* nsXULDocument::gFastLoadService = nsnull;
|
||||
|
@ -474,11 +472,14 @@ nsXULDocument::~nsXULDocument()
|
|||
observer->DocumentWillBeDestroyed(this);
|
||||
}
|
||||
|
||||
// Delete references to sub-documents and kill the subdocument map,
|
||||
// if any. It holds strong references
|
||||
if (mSubDocuments) {
|
||||
PL_DHashTableDestroy(mSubDocuments);
|
||||
mSubDocuments = nsnull;
|
||||
// mParentDocument is never refcounted
|
||||
// Delete references to sub-documents
|
||||
{
|
||||
i = mSubDocuments.Count();
|
||||
while (--i >= 0) {
|
||||
nsIDocument* subdoc = (nsIDocument*) mSubDocuments.ElementAt(i);
|
||||
NS_RELEASE(subdoc);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete references to style sheets but only if we aren't a popup document.
|
||||
|
@ -525,8 +526,7 @@ nsXULDocument::~nsXULDocument()
|
|||
NS_IF_RELEASE(gXMLElementFactory);
|
||||
|
||||
if (gNameSpaceManager) {
|
||||
nsServiceManager::ReleaseService(kNameSpaceManagerCID,
|
||||
gNameSpaceManager);
|
||||
nsServiceManager::ReleaseService(kNameSpaceManagerCID, gNameSpaceManager);
|
||||
gNameSpaceManager = nsnull;
|
||||
}
|
||||
|
||||
|
@ -1122,154 +1122,27 @@ nsXULDocument::SetParentDocument(nsIDocument* aParent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
SubDocClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
|
||||
{
|
||||
SubDocMapEntry *e = NS_STATIC_CAST(SubDocMapEntry *, entry);
|
||||
|
||||
NS_RELEASE(e->mKey);
|
||||
NS_IF_RELEASE(e->mSubDocument);
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(void)
|
||||
SubDocInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry, const void *key)
|
||||
{
|
||||
SubDocMapEntry *e =
|
||||
NS_CONST_CAST(SubDocMapEntry *,
|
||||
NS_STATIC_CAST(const SubDocMapEntry *, entry));
|
||||
|
||||
e->mKey = NS_CONST_CAST(nsIContent *,
|
||||
NS_STATIC_CAST(const nsIContent *, key));
|
||||
NS_ADDREF(e->mKey);
|
||||
|
||||
e->mSubDocument = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc)
|
||||
nsXULDocument::AddSubDocument(nsIDocument* aSubDoc)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent, NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (!aSubDoc) {
|
||||
// aSubDoc is nsnull, remove the mapping
|
||||
|
||||
if (mSubDocuments) {
|
||||
SubDocMapEntry *entry =
|
||||
NS_STATIC_CAST(SubDocMapEntry*,
|
||||
PL_DHashTableOperate(mSubDocuments, aContent,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_LIVE(entry)) {
|
||||
entry->mSubDocument->SetParentDocument(nsnull);
|
||||
|
||||
PL_DHashTableRawRemove(mSubDocuments, entry);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!mSubDocuments) {
|
||||
// Create a new hashtable
|
||||
|
||||
static PLDHashTableOps hash_table_ops =
|
||||
{
|
||||
PL_DHashAllocTable,
|
||||
PL_DHashFreeTable,
|
||||
PL_DHashGetKeyStub,
|
||||
PL_DHashVoidPtrKeyStub,
|
||||
PL_DHashMatchEntryStub,
|
||||
PL_DHashMoveEntryStub,
|
||||
SubDocClearEntry,
|
||||
PL_DHashFinalizeStub,
|
||||
SubDocInitEntry
|
||||
};
|
||||
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, nsnull,
|
||||
sizeof(SubDocMapEntry), 16);
|
||||
if (!mSubDocuments) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a mapping to the hash table
|
||||
SubDocMapEntry *entry =
|
||||
NS_STATIC_CAST(SubDocMapEntry*,
|
||||
PL_DHashTableOperate(mSubDocuments, aContent,
|
||||
PL_DHASH_ADD));
|
||||
|
||||
if (!entry) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (entry->mSubDocument) {
|
||||
entry->mSubDocument->SetParentDocument(nsnull);
|
||||
|
||||
// Release the old sub document
|
||||
NS_RELEASE(entry->mSubDocument);
|
||||
}
|
||||
|
||||
entry->mSubDocument = aSubDoc;
|
||||
NS_ADDREF(entry->mSubDocument);
|
||||
|
||||
aSubDoc->SetParentDocument(this);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetSubDocumentFor(nsIContent *aContent, nsIDocument** aSubDoc)
|
||||
{
|
||||
*aSubDoc = nsnull;
|
||||
|
||||
if (mSubDocuments) {
|
||||
SubDocMapEntry *entry =
|
||||
NS_STATIC_CAST(SubDocMapEntry*,
|
||||
PL_DHashTableOperate(mSubDocuments, aContent,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
*aSubDoc = entry->mSubDocument;
|
||||
NS_ADDREF(*aSubDoc);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
FindContentEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
PRUint32 number, void *arg)
|
||||
{
|
||||
SubDocMapEntry *entry = NS_STATIC_CAST(SubDocMapEntry*, hdr);
|
||||
FindContentData *data = NS_STATIC_CAST(FindContentData*, arg);
|
||||
|
||||
if (entry->mSubDocument == data->mSubDocument) {
|
||||
data->mResult = NS_CONST_CAST(nsIContent *, entry->mKey);
|
||||
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::FindContentForSubDocument(nsIDocument *aDocument,
|
||||
nsIContent **aContent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocument);
|
||||
|
||||
if (!mSubDocuments) {
|
||||
*aContent = nsnull;
|
||||
|
||||
NS_ADDREF(aSubDoc);
|
||||
mSubDocuments.AppendElement(aSubDoc);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
FindContentData data(aDocument);
|
||||
PL_DHashTableEnumerate(mSubDocuments, FindContentEnumerator, &data);
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetNumberOfSubDocuments(PRInt32 *aCount)
|
||||
{
|
||||
*aCount = mSubDocuments.Count();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aContent = data.mResult;
|
||||
NS_IF_ADDREF(*aContent);
|
||||
|
||||
return NS_OK;
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc)
|
||||
{
|
||||
*aSubDoc = (nsIDocument*) mSubDocuments.SafeElementAt(aIndex);
|
||||
NS_IF_ADDREF(*aSubDoc);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2531,25 +2404,6 @@ nsXULDocument::RemoveReference(void *aKey, nsISupports **aOldReference)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::SetContainer(nsISupports *aContainer)
|
||||
{
|
||||
mDocumentContainer = dont_AddRef(NS_GetWeakReference(aContainer));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULDocument::GetContainer(nsISupports **aContainer)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = do_QueryReferent(mDocumentContainer);
|
||||
|
||||
*aContainer = container;
|
||||
NS_IF_ADDREF(*aContainer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULDocument::SetDisplaySelection(PRInt8 aToggle)
|
||||
{
|
||||
|
|
|
@ -222,12 +222,11 @@ public:
|
|||
|
||||
NS_IMETHOD SetParentDocument(nsIDocument* aParent);
|
||||
|
||||
NS_IMETHOD SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc);
|
||||
NS_IMETHOD AddSubDocument(nsIDocument* aSubDoc);
|
||||
|
||||
NS_IMETHOD GetSubDocumentFor(nsIContent *aContent, nsIDocument** aSubDoc);
|
||||
NS_IMETHOD GetNumberOfSubDocuments(PRInt32* aCount);
|
||||
|
||||
NS_IMETHOD FindContentForSubDocument(nsIDocument *aDocument,
|
||||
nsIContent **aContent);
|
||||
NS_IMETHOD GetSubDocumentAt(PRInt32 aIndex, nsIDocument** aSubDoc);
|
||||
|
||||
NS_IMETHOD GetRootContent(nsIContent** aRoot);
|
||||
|
||||
|
@ -334,8 +333,6 @@ public:
|
|||
|
||||
NS_IMETHOD AddReference(void *aKey, nsISupports *aReference);
|
||||
NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference);
|
||||
NS_IMETHOD SetContainer(nsISupports *aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports **aContainer);
|
||||
|
||||
virtual void SetDisplaySelection(PRInt8 aToggle);
|
||||
|
||||
|
@ -565,7 +562,6 @@ protected:
|
|||
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]
|
||||
|
@ -594,7 +590,7 @@ protected:
|
|||
nsCOMPtr<nsIRDFDataSource> mLocalStore;
|
||||
nsCOMPtr<nsILineBreaker> mLineBreaker; // [OWNER]
|
||||
nsCOMPtr<nsIWordBreaker> mWordBreaker; // [OWNER]
|
||||
PLDHashTable *mSubDocuments; // [OWNER] of subelements
|
||||
nsVoidArray mSubDocuments; // [OWNER] of subelements
|
||||
PRPackedBool mIsPopup;
|
||||
PRPackedBool mIsFastLoad;
|
||||
PRPackedBool mApplyingPersistedAttrs;
|
||||
|
|
|
@ -1158,14 +1158,6 @@ nsDocShell::SetChromeEventHandler(nsIChromeEventHandler * aChromeEventHandler)
|
|||
{
|
||||
// Weak reference. Don't addref.
|
||||
mChromeEventHandler = aChromeEventHandler;
|
||||
|
||||
NS_ASSERTION(!mScriptGlobal,
|
||||
"SetChromeEventHandler() called after the script global "
|
||||
"object was created! This means that the script global "
|
||||
"object in this docshell won't get the right chrome event "
|
||||
"handler. You really don't want to see this assert, FIX "
|
||||
"YOUR CODE!");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2449,6 +2441,7 @@ nsDocShell::Stop(PRUint32 aStopFlags)
|
|||
if (nsIWebNavigation::STOP_CONTENT & aStopFlags) {
|
||||
if (mContentViewer)
|
||||
mContentViewer->Stop();
|
||||
|
||||
}
|
||||
|
||||
if (nsIWebNavigation::STOP_NETWORK & aStopFlags) {
|
||||
|
@ -2657,6 +2650,7 @@ nsDocShell::InitWindow(nativeWindow parentNativeWindow,
|
|||
NS_IMETHODIMP
|
||||
nsDocShell::Create()
|
||||
{
|
||||
NS_ENSURE_STATE(!mContentViewer);
|
||||
mPrefs = do_GetService(NS_PREF_CONTRACTID);
|
||||
//GlobalHistory is now set in SetGlobalHistory
|
||||
// mGlobalHistory = do_GetService(NS_GLOBALHISTORY_CONTRACTID);
|
||||
|
@ -2841,6 +2835,8 @@ nsDocShell::GetParentWidget(nsIWidget ** parentWidget)
|
|||
NS_IMETHODIMP
|
||||
nsDocShell::SetParentWidget(nsIWidget * aParentWidget)
|
||||
{
|
||||
NS_ENSURE_STATE(!mContentViewer);
|
||||
|
||||
mParentWidget = aParentWidget;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3964,7 +3960,6 @@ nsDocShell::CreateAboutBlankContentViewer()
|
|||
// generate (about:blank) document to load
|
||||
docFactory->CreateBlankDocument(loadGroup, getter_AddRefs(blankDoc));
|
||||
if (blankDoc) {
|
||||
blankDoc->SetContainer(NS_STATIC_CAST(nsIDocShell *, this));
|
||||
|
||||
// create a content viewer for us and the new document
|
||||
docFactory->CreateInstanceForDocument(NS_ISUPPORTS_CAST(nsIDocShell *, this),
|
||||
|
@ -4306,13 +4301,13 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
|
|||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
|
||||
|
||||
if (widget) {
|
||||
NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE);
|
||||
if (!widget) {
|
||||
NS_ERROR("GetMainWidget coughed up a null widget");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRect bounds(x, y, cx, cy);
|
||||
|
||||
NS_ENSURE_SUCCESS(EnsureDeviceContext(), NS_ERROR_FAILURE);
|
||||
if (NS_FAILED(mContentViewer->Init(widget, mDeviceContext, bounds))) {
|
||||
mContentViewer = nsnull;
|
||||
NS_ERROR("ContentViewer Initialization failed");
|
||||
|
@ -4335,7 +4330,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
|
|||
focusController->SetSuppressFocus(PR_FALSE,
|
||||
"Win32-Only Link Traversal Issue");
|
||||
|
||||
if (bgSet && widget) {
|
||||
if (bgSet) {
|
||||
// Stuff the bgcolor from the last view manager into the new
|
||||
// view manager. This improves page load continuity.
|
||||
nsCOMPtr<nsIDocumentViewer> docviewer =
|
||||
|
|
|
@ -1254,7 +1254,7 @@ NS_IMETHODIMP nsWebShell::Create()
|
|||
// Set the webshell as the default IContentViewerContainer for the loader...
|
||||
mDocLoader->SetContainer(shellAsContainer);
|
||||
|
||||
return nsDocShell::Create();
|
||||
return nsDocShell::Create();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebShell::Destroy()
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "nsIDOMLocation.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsIDOMWindowInternal;
|
||||
|
@ -67,7 +66,7 @@ public:
|
|||
|
||||
NS_IMETHOD GetObjectProperty(const PRUnichar* aProperty,
|
||||
nsISupports** aObject) = 0;
|
||||
|
||||
|
||||
// This is private because activate/deactivate events are not part
|
||||
// of the DOM spec.
|
||||
NS_IMETHOD Activate() = 0;
|
||||
|
@ -85,12 +84,6 @@ public:
|
|||
NS_IMETHOD GetExtantDocument(nsIDOMDocument** aDocument) = 0;
|
||||
|
||||
NS_IMETHOD ReallyCloseWindow() = 0;
|
||||
|
||||
// Internal getter/setter for the frame element, this version of the
|
||||
// getter crosses chrome boundaries whereas the public scriptable
|
||||
// one doesn't for security reasons.
|
||||
NS_IMETHOD GetFrameElementInternal(nsIDOMElement** aFrameElement) = 0;
|
||||
NS_IMETHOD SetFrameElementInternal(nsIDOMElement* aFrameElement) = 0;
|
||||
};
|
||||
|
||||
#endif // nsPIDOMWindow_h__
|
||||
|
|
|
@ -185,6 +185,4 @@ interface nsIDOMWindowInternal : nsIDOMWindow
|
|||
// Ascii base64 data to binary data and vice versa...
|
||||
DOMString atob(in DOMString aAsciiString);
|
||||
DOMString btoa(in DOMString aBase64Data);
|
||||
|
||||
readonly attribute nsIDOMElement frameElement;
|
||||
};
|
||||
|
|
|
@ -185,8 +185,7 @@ GlobalWindowImpl::GlobalWindowImpl() :
|
|||
mLastMouseButtonAction(LL_ZERO), mFullScreen(PR_FALSE),
|
||||
mOriginalPos(nsnull), mOriginalSize(nsnull),
|
||||
mGlobalObjectOwner(nsnull),
|
||||
mDocShell(nsnull), mMutationBits(0), mChromeEventHandler(nsnull),
|
||||
mFrameElement(nsnull)
|
||||
mDocShell(nsnull), mMutationBits(0), mChromeEventHandler(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
// We could have failed the first time through trying
|
||||
|
@ -717,38 +716,6 @@ GlobalWindowImpl::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (aEvent->message == NS_PAGE_LOAD) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mFrameElement));
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> parent;
|
||||
GetParentInternal(getter_AddRefs(parent));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(mDocShell));
|
||||
|
||||
PRInt32 itemType = nsIDocShellTreeItem::typeChrome;
|
||||
|
||||
if (treeItem) {
|
||||
treeItem->GetItemType(&itemType);
|
||||
}
|
||||
|
||||
if (content && parent && itemType != nsIDocShellTreeItem::typeChrome) {
|
||||
// If we're not in chrome, or at a chrome boundary, fire the
|
||||
// onload event for the frame element.
|
||||
|
||||
nsCOMPtr<nsIPresContext> ctx;
|
||||
mDocShell->GetPresContext(getter_AddRefs(ctx));
|
||||
NS_ENSURE_TRUE(ctx, NS_OK);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event;
|
||||
|
||||
event.eventStructType = NS_EVENT;
|
||||
event.message = NS_PAGE_LOAD;
|
||||
|
||||
return content->HandleDOMEvent(ctx, &event, nsnull, NS_EVENT_FLAG_INIT,
|
||||
&status);
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_EVENT_FLAG_INIT & aFlags) {
|
||||
// We're leaving the DOM event loop so if we created an event,
|
||||
|
@ -2846,53 +2813,6 @@ GlobalWindowImpl::ReallyCloseWindow()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::GetFrameElement(nsIDOMElement** aFrameElement)
|
||||
{
|
||||
*aFrameElement = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
GetDocShell(getter_AddRefs(docShell));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTI(do_QueryInterface(docShell));
|
||||
|
||||
if (!docShellTI) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
docShellTI->GetSameTypeParent(getter_AddRefs(parent));
|
||||
|
||||
if (!parent || parent == docShellTI) {
|
||||
// We're at a chrome boundary, don't expose the chrome iframe
|
||||
// element to content code.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aFrameElement = mFrameElement;
|
||||
NS_IF_ADDREF(*aFrameElement);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::GetFrameElementInternal(nsIDOMElement** aFrameElement)
|
||||
{
|
||||
*aFrameElement = mFrameElement;
|
||||
NS_IF_ADDREF(*aFrameElement);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::SetFrameElementInternal(nsIDOMElement* aFrameElement)
|
||||
{
|
||||
mFrameElement = aFrameElement;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GlobalWindowImpl::UpdateCommands(const nsAString& anAction)
|
||||
{
|
||||
|
@ -4852,7 +4772,6 @@ nsGlobalChromeWindow::GetWindowState(PRUint16* aWindowState)
|
|||
break;
|
||||
case nsSizeMode_Normal:
|
||||
*aWindowState = nsIDOMChromeWindow::STATE_NORMAL;
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Illegal window state for this chrome window");
|
||||
break;
|
||||
|
|
|
@ -188,9 +188,6 @@ public:
|
|||
|
||||
NS_IMETHOD ReallyCloseWindow();
|
||||
|
||||
NS_IMETHOD GetFrameElementInternal(nsIDOMElement** aFrameElement);
|
||||
NS_IMETHOD SetFrameElementInternal(nsIDOMElement* aFrameElement);
|
||||
|
||||
// nsIDOMViewCSS
|
||||
NS_DECL_NSIDOMVIEWCSS
|
||||
|
||||
|
@ -305,8 +302,6 @@ protected:
|
|||
nsCOMPtr<nsIDOMPkcs11> mPkcs11;
|
||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
||||
|
||||
nsIDOMElement* mFrameElement; // WEAK
|
||||
|
||||
friend class nsDOMScriptableHelper;
|
||||
static nsIXPConnect *sXPConnect;
|
||||
};
|
||||
|
|
|
@ -151,11 +151,9 @@ nsresult nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
nsEvent* event;
|
||||
priv->GetInternalNSEvent(&event);
|
||||
if (event->message == NS_SCRIPT_ERROR) {
|
||||
nsScriptErrorEvent *scriptEvent =
|
||||
NS_STATIC_CAST(nsScriptErrorEvent*, event);
|
||||
|
||||
nsScriptErrorEvent *scriptEvent = NS_STATIC_CAST(nsScriptErrorEvent*, event);
|
||||
argv = ::JS_PushArguments(cx, &stackPtr, "WWi", scriptEvent->errorMsg,
|
||||
scriptEvent->fileName, scriptEvent->lineNr);
|
||||
scriptEvent->fileName, scriptEvent->lineNr);
|
||||
NS_ENSURE_TRUE(argv, NS_ERROR_OUT_OF_MEMORY);
|
||||
argc = 3;
|
||||
handledScriptError = PR_TRUE;
|
||||
|
|
|
@ -261,8 +261,6 @@ nsEditor::~nsEditor()
|
|||
IMETextTxn::ClassShutdown();
|
||||
|
||||
PR_AtomicDecrement(&gInstanceCount);
|
||||
|
||||
NS_IF_RELEASE(mViewManager);
|
||||
}
|
||||
|
||||
|
||||
|
@ -306,6 +304,7 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot
|
|||
|
||||
ps->GetViewManager(&mViewManager);
|
||||
if (!mViewManager) {return NS_ERROR_NULL_POINTER;}
|
||||
mViewManager->Release(); //we want a weak link
|
||||
|
||||
mUpdateCount=0;
|
||||
InsertTextTxn::ClassInit();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -253,12 +253,22 @@ inLayoutUtils::GetSubDocumentFor(nsIDOMNode* aNode)
|
|||
nsCOMPtr<nsIDocument> doc;
|
||||
content->GetDocument(*getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDocument> sub_doc;
|
||||
doc->GetSubDocumentFor(content, getter_AddRefs(sub_doc));
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(sub_doc));
|
||||
|
||||
return domdoc;
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
doc->GetShellAt(0, getter_AddRefs(shell));
|
||||
if (shell) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
shell->GetSubShellFor(content, getter_AddRefs(supports));
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(supports);
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIContentViewer> contentViewer;
|
||||
docShell->GetContentViewer(getter_AddRefs(contentViewer));
|
||||
if (contentViewer) {
|
||||
nsCOMPtr<nsIDOMDocument> domdoc;
|
||||
contentViewer->GetDOMDocument(getter_AddRefs(domdoc));
|
||||
return domdoc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +279,6 @@ nsIDOMNode*
|
|||
inLayoutUtils::GetContainerFor(nsIDOMDocument* aDoc)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> container;
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDoc));
|
||||
|
||||
// get the doc shell for this document and look for the parent doc shell
|
||||
nsCOMPtr<nsIDOMWindowInternal> win = inLayoutUtils::GetWindowFor(aDoc);
|
||||
|
@ -288,17 +297,9 @@ inLayoutUtils::GetContainerFor(nsIDOMDocument* aDoc)
|
|||
nsCOMPtr<nsIPresShell> presShell;
|
||||
parentDocShell->GetPresShell(getter_AddRefs(presShell));
|
||||
|
||||
nsCOMPtr<nsIDocument> parent_doc;
|
||||
presShell->GetDocument(getter_AddRefs(parent_doc));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
|
||||
if (parent_doc) {
|
||||
nsCOMPtr<nsIContent> content;
|
||||
parent_doc->FindContentForSubDocument(doc, getter_AddRefs(content));
|
||||
|
||||
node = do_QueryInterface(content);
|
||||
}
|
||||
nsCOMPtr<nsIContent> content;
|
||||
presShell->FindContentForShell(docShell, getter_AddRefs(content));
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -265,6 +265,28 @@ public:
|
|||
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the object that acts as a subshell for aContent.
|
||||
* For example, for an html frame aResult will be an nsIDocShell.
|
||||
*/
|
||||
NS_IMETHOD GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Establish a relationship between aContent and aSubShell.
|
||||
* aSubShell will be returned from GetSubShellFor(aContent, ...);
|
||||
*/
|
||||
NS_IMETHOD SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell) = 0;
|
||||
|
||||
/**
|
||||
* Find the content in the map that has aSubShell set
|
||||
* as its subshell. If there is more than one mapping for
|
||||
* aSubShell, the result is undefined.
|
||||
*/
|
||||
NS_IMETHOD FindContentForShell(nsISupports* aSubShell,
|
||||
nsIContent** aContent) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the placeholder frame associated with the specified frame. This is
|
||||
* a helper frame that forwards the request to the frame manager.
|
||||
|
|
|
@ -166,6 +166,9 @@
|
|||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
||||
// SubShell map
|
||||
#include "pldhash.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIBidiKeyboard.h"
|
||||
#endif // IBMBIDI
|
||||
|
@ -806,6 +809,14 @@ DummyLayoutRequest::Cancel(nsresult status)
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class SubShellMapEntry : public PLDHashEntryHdr {
|
||||
public:
|
||||
nsIContent *key; // must be first, to look like PLDHashEntryStub
|
||||
nsISupports *subShell;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class PresShell : public nsIPresShell, public nsIViewObserver,
|
||||
private nsIDocumentObserver, public nsIFocusTracker,
|
||||
public nsISelectionController,
|
||||
|
@ -866,6 +877,12 @@ public:
|
|||
nsIStyleContext** aStyleContext) const;
|
||||
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const;
|
||||
NS_IMETHOD GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const;
|
||||
NS_IMETHOD SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell);
|
||||
NS_IMETHOD FindContentForShell(nsISupports* aSubShell,
|
||||
nsIContent** aContent) const;
|
||||
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aPlaceholderFrame) const;
|
||||
NS_IMETHOD AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand);
|
||||
|
@ -1218,6 +1235,9 @@ protected:
|
|||
|
||||
static void sPaintSuppressionCallback(nsITimer* aTimer, void* aPresShell); // A callback for the timer.
|
||||
|
||||
// subshell map
|
||||
PLDHashTable* mSubShellMap; // map of content/subshell pairs
|
||||
|
||||
MOZ_TIMER_DECLARE(mReflowWatch) // Used for measuring time spent in reflow
|
||||
MOZ_TIMER_DECLARE(mFrameCreationWatch) // Used for measuring time spent in frame creation
|
||||
|
||||
|
@ -1655,6 +1675,13 @@ PresShell::Destroy()
|
|||
// Clobber weak leaks in case of re-entrancy during tear down
|
||||
mHistoryState = nsnull;
|
||||
|
||||
// kill subshell map, if any. It holds only weak references
|
||||
if (mSubShellMap)
|
||||
{
|
||||
PL_DHashTableDestroy(mSubShellMap);
|
||||
mSubShellMap = nsnull;
|
||||
}
|
||||
|
||||
// release current event content and any content on event stack
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
|
||||
|
@ -5502,6 +5529,94 @@ PresShell::GetLayoutObjectFor(nsIContent* aContent,
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContent);
|
||||
|
||||
if (mSubShellMap) {
|
||||
SubShellMapEntry *entry = NS_STATIC_CAST(SubShellMapEntry*,
|
||||
PL_DHashTableOperate(mSubShellMap, aContent, PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
NS_ADDREF(*aResult = entry->subShell);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContent);
|
||||
|
||||
// If aSubShell is NULL, then remove the mapping
|
||||
if (!aSubShell) {
|
||||
if (mSubShellMap)
|
||||
PL_DHashTableOperate(mSubShellMap, aContent, PL_DHASH_REMOVE);
|
||||
} else {
|
||||
// Create a new hashtable if necessary
|
||||
if (!mSubShellMap) {
|
||||
mSubShellMap = PL_NewDHashTable(PL_DHashGetStubOps(), nsnull,
|
||||
sizeof(SubShellMapEntry), 16);
|
||||
if (!mSubShellMap)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Add a mapping to the hash table
|
||||
SubShellMapEntry *entry = NS_STATIC_CAST(SubShellMapEntry*,
|
||||
PL_DHashTableOperate(mSubShellMap, aContent, PL_DHASH_ADD));
|
||||
entry->key = aContent;
|
||||
entry->subShell = aSubShell;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
struct FindContentData {
|
||||
FindContentData(nsISupports *aSubShell)
|
||||
: subShell(aSubShell), result(nsnull) {}
|
||||
|
||||
nsISupports *subShell;
|
||||
nsIContent *result;
|
||||
};
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
FindContentEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
PRUint32 number, void *arg)
|
||||
{
|
||||
SubShellMapEntry *entry = NS_STATIC_CAST(SubShellMapEntry*, hdr);
|
||||
FindContentData *data = NS_STATIC_CAST(FindContentData*, arg);
|
||||
|
||||
if (entry->subShell == data->subShell) {
|
||||
data->result = entry->key;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::FindContentForShell(nsISupports* aSubShell,
|
||||
nsIContent** aContent) const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSubShell);
|
||||
|
||||
if (!mSubShellMap) {
|
||||
*aContent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
FindContentData data(aSubShell);
|
||||
PL_DHashTableEnumerate(mSubShellMap, FindContentEnumerator, &data);
|
||||
NS_IF_ADDREF(*aContent = data.result);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aResult) const
|
||||
|
|
|
@ -265,6 +265,28 @@ public:
|
|||
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the object that acts as a subshell for aContent.
|
||||
* For example, for an html frame aResult will be an nsIDocShell.
|
||||
*/
|
||||
NS_IMETHOD GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const = 0;
|
||||
|
||||
/**
|
||||
* Establish a relationship between aContent and aSubShell.
|
||||
* aSubShell will be returned from GetSubShellFor(aContent, ...);
|
||||
*/
|
||||
NS_IMETHOD SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell) = 0;
|
||||
|
||||
/**
|
||||
* Find the content in the map that has aSubShell set
|
||||
* as its subshell. If there is more than one mapping for
|
||||
* aSubShell, the result is undefined.
|
||||
*/
|
||||
NS_IMETHOD FindContentForShell(nsISupports* aSubShell,
|
||||
nsIContent** aContent) const = 0;
|
||||
|
||||
/**
|
||||
* Gets the placeholder frame associated with the specified frame. This is
|
||||
* a helper frame that forwards the request to the frame manager.
|
||||
|
|
|
@ -416,8 +416,6 @@ nsContentDLF::CreateDocument(const char* aCommand,
|
|||
break;
|
||||
docv->SetUAStyleSheet(gUAStyleSheet);
|
||||
|
||||
doc->SetContainer(aContainer);
|
||||
|
||||
// Initialize the document to begin loading the data. An
|
||||
// nsIStreamListener connected to the parser is returned in
|
||||
// aDocListener.
|
||||
|
@ -514,9 +512,6 @@ nsContentDLF::CreateRDFDocument(const char* aCommand,
|
|||
* An nsIStreamListener connected to the parser is returned in
|
||||
* aDocListener.
|
||||
*/
|
||||
|
||||
doc->SetContainer(aContainer);
|
||||
|
||||
rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, PR_TRUE);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
/*
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -63,6 +63,7 @@
|
|||
#define ALL_VIS 0x000F
|
||||
#define NONE_VIS 0x0000
|
||||
|
||||
static NS_DEFINE_IID(kIFramesetFrameIID, NS_IFRAMESETFRAME_IID);
|
||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -251,7 +252,7 @@ nsresult nsHTMLFramesetFrame::QueryInterface(const nsIID& aIID,
|
|||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
} else if (aIID.Equals(NS_GET_IID(nsHTMLFramesetFrame))) {
|
||||
} else if (aIID.Equals(kIFramesetFrameIID)) {
|
||||
*aInstancePtr = (void*)this;
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(NS_GET_IID(nsIObserver))) {
|
||||
|
@ -326,8 +327,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
mTopLevelFrameset = (nsHTMLFramesetFrame*)this;
|
||||
while (parentFrame) {
|
||||
nsHTMLFramesetFrame* frameset;
|
||||
rv = parentFrame->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame),
|
||||
(void**)&frameset);
|
||||
rv = parentFrame->QueryInterface(kIFramesetFrameIID, (void**)&frameset);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mTopLevelFrameset = frameset;
|
||||
parentFrame->GetParent((nsIFrame**)&parentFrame);
|
||||
|
@ -1404,7 +1404,7 @@ PRBool
|
|||
nsHTMLFramesetFrame::ChildIsFrameset(nsIFrame* aChild)
|
||||
{
|
||||
nsIFrame* childFrame = nsnull;
|
||||
aChild->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame), (void**)&childFrame);
|
||||
aChild->QueryInterface(kIFramesetFrameIID, (void**)&childFrame);
|
||||
if (childFrame) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -57,8 +57,7 @@ struct nsGUIEvent;
|
|||
class nsHTMLFramesetFrame;
|
||||
|
||||
#define NS_IFRAMESETFRAME_IID \
|
||||
{ 0xf47deac0, 0x4200, 0x11d2, \
|
||||
{ 0x80, 0x3c, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
|
||||
{ 0xf47deac0, 0x4200, 0x11d2, { 0x80, 0x3c, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
|
||||
|
||||
#define NO_COLOR 0xFFFFFFFA
|
||||
|
||||
|
@ -116,10 +115,8 @@ struct nsFramesetDrag {
|
|||
class nsHTMLFramesetFrame : public nsHTMLContainerFrame,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
// Woohoo, concrete class with an IID!
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMESETFRAME_IID)
|
||||
|
||||
public:
|
||||
nsHTMLFramesetFrame();
|
||||
|
||||
virtual ~nsHTMLFramesetFrame();
|
||||
|
|
|
@ -166,6 +166,9 @@
|
|||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
||||
// SubShell map
|
||||
#include "pldhash.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsIBidiKeyboard.h"
|
||||
#endif // IBMBIDI
|
||||
|
@ -806,6 +809,14 @@ DummyLayoutRequest::Cancel(nsresult status)
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class SubShellMapEntry : public PLDHashEntryHdr {
|
||||
public:
|
||||
nsIContent *key; // must be first, to look like PLDHashEntryStub
|
||||
nsISupports *subShell;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class PresShell : public nsIPresShell, public nsIViewObserver,
|
||||
private nsIDocumentObserver, public nsIFocusTracker,
|
||||
public nsISelectionController,
|
||||
|
@ -866,6 +877,12 @@ public:
|
|||
nsIStyleContext** aStyleContext) const;
|
||||
NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const;
|
||||
NS_IMETHOD GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const;
|
||||
NS_IMETHOD SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell);
|
||||
NS_IMETHOD FindContentForShell(nsISupports* aSubShell,
|
||||
nsIContent** aContent) const;
|
||||
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aPlaceholderFrame) const;
|
||||
NS_IMETHOD AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand);
|
||||
|
@ -1218,6 +1235,9 @@ protected:
|
|||
|
||||
static void sPaintSuppressionCallback(nsITimer* aTimer, void* aPresShell); // A callback for the timer.
|
||||
|
||||
// subshell map
|
||||
PLDHashTable* mSubShellMap; // map of content/subshell pairs
|
||||
|
||||
MOZ_TIMER_DECLARE(mReflowWatch) // Used for measuring time spent in reflow
|
||||
MOZ_TIMER_DECLARE(mFrameCreationWatch) // Used for measuring time spent in frame creation
|
||||
|
||||
|
@ -1655,6 +1675,13 @@ PresShell::Destroy()
|
|||
// Clobber weak leaks in case of re-entrancy during tear down
|
||||
mHistoryState = nsnull;
|
||||
|
||||
// kill subshell map, if any. It holds only weak references
|
||||
if (mSubShellMap)
|
||||
{
|
||||
PL_DHashTableDestroy(mSubShellMap);
|
||||
mSubShellMap = nsnull;
|
||||
}
|
||||
|
||||
// release current event content and any content on event stack
|
||||
NS_IF_RELEASE(mCurrentEventContent);
|
||||
|
||||
|
@ -5502,6 +5529,94 @@ PresShell::GetLayoutObjectFor(nsIContent* aContent,
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetSubShellFor(nsIContent* aContent,
|
||||
nsISupports** aResult) const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContent);
|
||||
|
||||
if (mSubShellMap) {
|
||||
SubShellMapEntry *entry = NS_STATIC_CAST(SubShellMapEntry*,
|
||||
PL_DHashTableOperate(mSubShellMap, aContent, PL_DHASH_LOOKUP));
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
NS_ADDREF(*aResult = entry->subShell);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::SetSubShellFor(nsIContent* aContent,
|
||||
nsISupports* aSubShell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContent);
|
||||
|
||||
// If aSubShell is NULL, then remove the mapping
|
||||
if (!aSubShell) {
|
||||
if (mSubShellMap)
|
||||
PL_DHashTableOperate(mSubShellMap, aContent, PL_DHASH_REMOVE);
|
||||
} else {
|
||||
// Create a new hashtable if necessary
|
||||
if (!mSubShellMap) {
|
||||
mSubShellMap = PL_NewDHashTable(PL_DHashGetStubOps(), nsnull,
|
||||
sizeof(SubShellMapEntry), 16);
|
||||
if (!mSubShellMap)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Add a mapping to the hash table
|
||||
SubShellMapEntry *entry = NS_STATIC_CAST(SubShellMapEntry*,
|
||||
PL_DHashTableOperate(mSubShellMap, aContent, PL_DHASH_ADD));
|
||||
entry->key = aContent;
|
||||
entry->subShell = aSubShell;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
struct FindContentData {
|
||||
FindContentData(nsISupports *aSubShell)
|
||||
: subShell(aSubShell), result(nsnull) {}
|
||||
|
||||
nsISupports *subShell;
|
||||
nsIContent *result;
|
||||
};
|
||||
|
||||
PR_STATIC_CALLBACK(PLDHashOperator)
|
||||
FindContentEnumerator(PLDHashTable *table, PLDHashEntryHdr *hdr,
|
||||
PRUint32 number, void *arg)
|
||||
{
|
||||
SubShellMapEntry *entry = NS_STATIC_CAST(SubShellMapEntry*, hdr);
|
||||
FindContentData *data = NS_STATIC_CAST(FindContentData*, arg);
|
||||
|
||||
if (entry->subShell == data->subShell) {
|
||||
data->result = entry->key;
|
||||
return PL_DHASH_STOP;
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::FindContentForShell(nsISupports* aSubShell,
|
||||
nsIContent** aContent) const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSubShell);
|
||||
|
||||
if (!mSubShellMap) {
|
||||
*aContent = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
FindContentData data(aSubShell);
|
||||
PL_DHashTableEnumerate(mSubShellMap, FindContentEnumerator, &data);
|
||||
NS_IF_ADDREF(*aContent = data.result);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame,
|
||||
nsIFrame** aResult) const
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -63,6 +63,7 @@
|
|||
#define ALL_VIS 0x000F
|
||||
#define NONE_VIS 0x0000
|
||||
|
||||
static NS_DEFINE_IID(kIFramesetFrameIID, NS_IFRAMESETFRAME_IID);
|
||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -251,7 +252,7 @@ nsresult nsHTMLFramesetFrame::QueryInterface(const nsIID& aIID,
|
|||
{
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
} else if (aIID.Equals(NS_GET_IID(nsHTMLFramesetFrame))) {
|
||||
} else if (aIID.Equals(kIFramesetFrameIID)) {
|
||||
*aInstancePtr = (void*)this;
|
||||
return NS_OK;
|
||||
} else if (aIID.Equals(NS_GET_IID(nsIObserver))) {
|
||||
|
@ -326,8 +327,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
mTopLevelFrameset = (nsHTMLFramesetFrame*)this;
|
||||
while (parentFrame) {
|
||||
nsHTMLFramesetFrame* frameset;
|
||||
rv = parentFrame->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame),
|
||||
(void**)&frameset);
|
||||
rv = parentFrame->QueryInterface(kIFramesetFrameIID, (void**)&frameset);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mTopLevelFrameset = frameset;
|
||||
parentFrame->GetParent((nsIFrame**)&parentFrame);
|
||||
|
@ -1404,7 +1404,7 @@ PRBool
|
|||
nsHTMLFramesetFrame::ChildIsFrameset(nsIFrame* aChild)
|
||||
{
|
||||
nsIFrame* childFrame = nsnull;
|
||||
aChild->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame), (void**)&childFrame);
|
||||
aChild->QueryInterface(kIFramesetFrameIID, (void**)&childFrame);
|
||||
if (childFrame) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -57,8 +57,7 @@ struct nsGUIEvent;
|
|||
class nsHTMLFramesetFrame;
|
||||
|
||||
#define NS_IFRAMESETFRAME_IID \
|
||||
{ 0xf47deac0, 0x4200, 0x11d2, \
|
||||
{ 0x80, 0x3c, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
|
||||
{ 0xf47deac0, 0x4200, 0x11d2, { 0x80, 0x3c, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
|
||||
|
||||
#define NO_COLOR 0xFFFFFFFA
|
||||
|
||||
|
@ -116,10 +115,8 @@ struct nsFramesetDrag {
|
|||
class nsHTMLFramesetFrame : public nsHTMLContainerFrame,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
// Woohoo, concrete class with an IID!
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMESETFRAME_IID)
|
||||
|
||||
public:
|
||||
nsHTMLFramesetFrame();
|
||||
|
||||
virtual ~nsHTMLFramesetFrame();
|
||||
|
|
|
@ -2657,7 +2657,7 @@ CSSStyleSheetImpl::SetDisabled(PRBool aDisabled)
|
|||
PRBool oldState = mDisabled;
|
||||
mDisabled = aDisabled;
|
||||
|
||||
if (mDocument && (mDisabled != oldState)) {
|
||||
if ((nsnull != mDocument) && (mDisabled != oldState)) {
|
||||
mDocument->SetStyleSheetDisabledState(this, mDisabled);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIBrowserBoxObject.h"
|
||||
#include "nsBoxObject.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
class nsBrowserBoxObject : public nsIBrowserBoxObject, public nsBoxObject
|
||||
|
@ -91,27 +91,15 @@ nsBrowserBoxObject::~nsBrowserBoxObject()
|
|||
NS_IMETHODIMP nsBrowserBoxObject::GetDocShell(nsIDocShell** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
if (!mPresShell)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc, sub_doc;
|
||||
mPresShell->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
doc->GetSubDocumentFor(mContent, getter_AddRefs(sub_doc));
|
||||
|
||||
if (!sub_doc) {
|
||||
nsCOMPtr<nsISupports> subShell;
|
||||
mPresShell->GetSubShellFor(mContent, getter_AddRefs(subShell));
|
||||
if(!subShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
sub_doc->GetContainer(getter_AddRefs(container));
|
||||
|
||||
if (!container) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(container, aResult);
|
||||
return CallQueryInterface(subShell, aResult); //Addref happens here.
|
||||
}
|
||||
|
||||
// Creation Routine ///////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIEditorBoxObject.h"
|
||||
#include "nsBoxObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIEditorShell.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -128,27 +128,15 @@ NS_IMETHODIMP nsEditorBoxObject::GetEditorShell(nsIEditorShell** aResult)
|
|||
NS_IMETHODIMP nsEditorBoxObject::GetDocShell(nsIDocShell** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
if (!mPresShell)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc, sub_doc;
|
||||
mPresShell->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
doc->GetSubDocumentFor(mContent, getter_AddRefs(sub_doc));
|
||||
|
||||
if (!sub_doc) {
|
||||
nsCOMPtr<nsISupports> subShell;
|
||||
mPresShell->GetSubShellFor(mContent, getter_AddRefs(subShell));
|
||||
if(!subShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
sub_doc->GetContainer(getter_AddRefs(container));
|
||||
|
||||
if (!container) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(container, aResult);
|
||||
return CallQueryInterface(subShell, aResult); //Addref happens here.
|
||||
}
|
||||
|
||||
// Creation Routine ///////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIIFrameBoxObject.h"
|
||||
#include "nsBoxObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
@ -88,27 +87,15 @@ nsIFrameBoxObject::~nsIFrameBoxObject()
|
|||
NS_IMETHODIMP nsIFrameBoxObject::GetDocShell(nsIDocShell** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
if (!mPresShell)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc, sub_doc;
|
||||
mPresShell->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
doc->GetSubDocumentFor(mContent, getter_AddRefs(sub_doc));
|
||||
|
||||
if (!sub_doc) {
|
||||
nsCOMPtr<nsISupports> subShell;
|
||||
mPresShell->GetSubShellFor(mContent, getter_AddRefs(subShell));
|
||||
if(!subShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> container;
|
||||
sub_doc->GetContainer(getter_AddRefs(container));
|
||||
|
||||
if (!container) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(container, aResult);
|
||||
return CallQueryInterface(subShell, aResult); //Addref happens here.
|
||||
}
|
||||
|
||||
// Creation Routine ///////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -804,7 +804,7 @@ nsDocLoaderImpl::GetDOMWindow(nsIDOMWindow **aResult)
|
|||
*aResult = window;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
} else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче