Changing the way content elements store their name information, previously the elements generally stored a name atom and a namespace ID, now they store a pointer to a shared structure containing the name atom, the prefix atom and the namespace ID. This structure is shared between nodes with unique names (ie same name, prefix and ns ID) within a document. Documents now hold a hash table of the names in the document. The changes to mozilla/rdf are not reviewed but they are approved by waterson@netscape.com and the changes to mozilla/layout are reviewed by buster@netscape.com.
git-svn-id: svn://10.0.0.236/trunk@69034 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINodeInfo.h"
|
||||
|
||||
// XXX TODO:
|
||||
|
||||
@@ -182,10 +184,14 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
|
||||
nsIStreamListener **aDocListener,
|
||||
PRBool aReset)
|
||||
{
|
||||
nsresult rv = nsDocument::StartDocumentLoad(aCommand,
|
||||
aChannel, aLoadGroup,
|
||||
aContainer,
|
||||
aDocListener, aReset);
|
||||
nsresult rv = Init();
|
||||
|
||||
if (NS_FAILED(rv) && rv != NS_ERROR_ALREADY_INITIALIZED) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = nsDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
||||
aContainer, aDocListener, aReset);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@@ -243,34 +249,51 @@ nsImageDocument::CreateSyntheticDocument()
|
||||
{
|
||||
// Synthesize an html document that refers to the image
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::html, nsnull,
|
||||
kNameSpaceID_None,
|
||||
*getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIHTMLContent* root;
|
||||
rv = NS_NewHTMLHtmlElement(&root, nsHTMLAtoms::html);
|
||||
rv = NS_NewHTMLHtmlElement(&root, nodeInfo);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
root->SetDocument(this, PR_FALSE);
|
||||
SetRootContent(root);
|
||||
|
||||
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::body, nsnull,
|
||||
kNameSpaceID_None,
|
||||
*getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIHTMLContent* body;
|
||||
rv = NS_NewHTMLBodyElement(&body, nsHTMLAtoms::body);
|
||||
rv = NS_NewHTMLBodyElement(&body, nodeInfo);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
body->SetDocument(this, PR_FALSE);
|
||||
|
||||
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::p, nsnull, kNameSpaceID_None,
|
||||
*getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIHTMLContent* center;
|
||||
nsIAtom* centerAtom = NS_NewAtom("p");
|
||||
rv = NS_NewHTMLParagraphElement(¢er, centerAtom);
|
||||
NS_RELEASE(centerAtom);
|
||||
rv = NS_NewHTMLParagraphElement(¢er, nodeInfo);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
center->SetDocument(this, PR_FALSE);
|
||||
|
||||
rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::img, nsnull,
|
||||
kNameSpaceID_None,
|
||||
*getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsIHTMLContent* image;
|
||||
nsIAtom* imgAtom = NS_NewAtom("img");
|
||||
rv = NS_NewHTMLImageElement(&image, imgAtom);
|
||||
NS_RELEASE(imgAtom);
|
||||
rv = NS_NewHTMLImageElement(&image, nodeInfo);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user