From f0d5139d7d31bbb74de51793525e29efc741a8e0 Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Fri, 6 Aug 2004 11:56:46 +0000 Subject: [PATCH] Fix for bug 252589 (Textbox attribute "multiline" seems broken). r+sr=jst. --- content/base/public/nsIDocument.h | 6 ++++++ content/xul/content/src/nsXULElement.cpp | 10 +++++----- editor/libeditor/base/nsEditor.cpp | 11 ++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index a9876bc6ee07..e680d12514d9 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -619,6 +619,12 @@ public: return mSecurityInfo; } + /** + * Returns the default namespace ID used for elements created in this + * document. + */ + virtual PRInt32 GetDefaultNamespaceID() const = 0; + protected: nsString mDocumentTitle; nsCOMPtr mDocumentURI; diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index b72f53f87fcf..fd40df81fc41 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -895,11 +895,11 @@ nsXULElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) NS_ENSURE_TRUE(mSlots, NS_ERROR_UNEXPECTED); rv = NS_NewXULElement(getter_AddRefs(result), mSlots->mNodeInfo); - if (NS_SUCCEEDED(rv)) { - // XXX setting document on nodes not in a document so XBL will bind - // and chrome won't break. Make XBL bind to document-less nodes! - result->SetDocument(mDocument, PR_TRUE, PR_TRUE); - } + NS_ENSURE_SUCCESS(rv, rv); + + // XXX setting document on nodes not in a document so XBL will bind + // and chrome won't break. Make XBL bind to document-less nodes! + result->SetDocument(mDocument, PR_TRUE, PR_TRUE); } // Copy attributes diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 8b7d254a8b9d..22d3bc6a5481 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -102,6 +102,7 @@ #include "nsEditorUtils.h" #include "nsISelectionDisplay.h" #include "nsINameSpaceManager.h" +#include "nsIHTMLDocument.h" #define NS_ERROR_EDITOR_NO_SELECTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,1) #define NS_ERROR_EDITOR_NO_TEXTNODE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,2) @@ -5069,9 +5070,13 @@ nsEditor::CreateHTMLContent(const nsAString& aTag, nsIContent** aContent) if (!tag) return NS_ERROR_OUT_OF_MEMORY; - // XXX If editor starts supporting XHTML documents, the kNameSpaceID_None - // should be kNameSpaceID_XHTML for those documents. - return doc->CreateElem(tag, nsnull, kNameSpaceID_None, PR_TRUE, aContent); + nsCOMPtr htmlDoc = do_QueryInterface(tempDoc); + if (htmlDoc) { + return doc->CreateElem(tag, nsnull, doc->GetDefaultNamespaceID(), + PR_TRUE, aContent); + } + + return doc->CreateElem(tag, nsnull, kNameSpaceID_XHTML, PR_FALSE, aContent); } nsresult