From d81e61b1ff448a8cbe403ff53f2014ca9dba4f99 Mon Sep 17 00:00:00 2001 From: "vidur%netscape.com" Date: Thu, 14 Jan 1999 23:14:02 +0000 Subject: [PATCH] Moved text and comment code out of HTML-specific directories. Completed CloneNode for elements. Completed factory methods for intersection of XML and HTML. git-svn-id: svn://10.0.0.236/trunk@17775 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/public/nsITextContent.h | 9 + .../base}/src/nsCommentNode.cpp | 36 +- mozilla/content/base/src/nsDOMAttribute.cpp | 7 +- mozilla/content/base/src/nsDOMAttributeMap.h | 2 + mozilla/content/base/src/nsDocument.cpp | 29 +- .../base}/src/nsGenericDOMDataNode.cpp | 13 +- .../base}/src/nsGenericDOMDataNode.h | 107 +-- mozilla/content/base/src/nsGenericElement.cpp | 57 +- mozilla/content/base/src/nsGenericElement.h | 4 +- .../base}/src/nsTextNode.cpp | 30 +- mozilla/content/html/content/src/Makefile.in | 3 - mozilla/content/html/content/src/makefile.win | 8 +- .../html/content/src/nsGenericHTMLElement.cpp | 73 +- .../html/content/src/nsGenericHTMLElement.h | 10 +- .../html/content/src/nsHTMLAnchorElement.cpp | 4 +- .../html/content/src/nsHTMLAppletElement.cpp | 4 +- .../html/content/src/nsHTMLAreaElement.cpp | 2 +- .../html/content/src/nsHTMLBRElement.cpp | 4 +- .../html/content/src/nsHTMLBaseElement.cpp | 4 +- .../content/src/nsHTMLBaseFontElement.cpp | 4 +- .../html/content/src/nsHTMLBodyElement.cpp | 4 +- .../html/content/src/nsHTMLButtonElement.cpp | 4 +- .../html/content/src/nsHTMLDListElement.cpp | 4 +- .../html/content/src/nsHTMLDelElement.cpp | 4 +- .../content/src/nsHTMLDirectoryElement.cpp | 4 +- .../html/content/src/nsHTMLDivElement.cpp | 4 +- .../html/content/src/nsHTMLEmbedElement.cpp | 4 +- .../content/src/nsHTMLFieldSetElement.cpp | 4 +- .../html/content/src/nsHTMLFontElement.cpp | 4 +- .../html/content/src/nsHTMLFormElement.cpp | 2 +- .../html/content/src/nsHTMLFrameElement.cpp | 2 +- .../content/src/nsHTMLFrameSetElement.cpp | 2 +- .../html/content/src/nsHTMLHRElement.cpp | 2 +- .../html/content/src/nsHTMLHeadElement.cpp | 2 +- .../html/content/src/nsHTMLHeadingElement.cpp | 2 +- .../html/content/src/nsHTMLHtmlElement.cpp | 2 +- .../html/content/src/nsHTMLIFrameElement.cpp | 2 +- .../html/content/src/nsHTMLImageElement.cpp | 2 +- .../html/content/src/nsHTMLInputElement.cpp | 2 +- .../html/content/src/nsHTMLInsElement.cpp | 2 +- .../html/content/src/nsHTMLIsIndexElement.cpp | 2 +- .../html/content/src/nsHTMLLIElement.cpp | 2 +- .../html/content/src/nsHTMLLabelElement.cpp | 2 +- .../html/content/src/nsHTMLLegendElement.cpp | 2 +- .../html/content/src/nsHTMLLinkElement.cpp | 2 +- .../html/content/src/nsHTMLMapElement.cpp | 2 +- .../html/content/src/nsHTMLMenuElement.cpp | 2 +- .../html/content/src/nsHTMLMetaElement.cpp | 2 +- .../html/content/src/nsHTMLModElement.cpp | 2 +- .../html/content/src/nsHTMLOListElement.cpp | 2 +- .../html/content/src/nsHTMLObjectElement.cpp | 2 +- .../content/src/nsHTMLOptGroupElement.cpp | 2 +- .../html/content/src/nsHTMLOptionElement.cpp | 2 +- .../content/src/nsHTMLParagraphElement.cpp | 2 +- .../html/content/src/nsHTMLParamElement.cpp | 2 +- .../html/content/src/nsHTMLPreElement.cpp | 2 +- .../html/content/src/nsHTMLQuoteElement.cpp | 2 +- .../html/content/src/nsHTMLScriptElement.cpp | 2 +- .../html/content/src/nsHTMLSelectElement.cpp | 2 +- .../content/src/nsHTMLSharedObjectElement.cpp | 2 +- .../html/content/src/nsHTMLSpacerElement.cpp | 2 +- .../html/content/src/nsHTMLSpanElement.cpp | 2 +- .../html/content/src/nsHTMLStyleElement.cpp | 2 +- .../content/src/nsHTMLTableCaptionElement.cpp | 2 +- .../content/src/nsHTMLTableCellElement.cpp | 2 +- .../content/src/nsHTMLTableColElement.cpp | 2 +- .../src/nsHTMLTableColGroupElement.cpp | 2 +- .../html/content/src/nsHTMLTableElement.cpp | 2 +- .../content/src/nsHTMLTableRowElement.cpp | 2 +- .../content/src/nsHTMLTableSectionElement.cpp | 2 +- .../content/src/nsHTMLTextAreaElement.cpp | 2 +- .../html/content/src/nsHTMLTitleElement.cpp | 2 +- .../html/content/src/nsHTMLUListElement.cpp | 2 +- .../html/content/src/nsHTMLWBRElement.cpp | 2 +- .../html/document/src/nsHTMLContentSink.cpp | 2 +- .../html/document/src/nsHTMLDocument.cpp | 30 - .../html/document/src/nsHTMLDocument.h | 6 +- .../content/xml/content/src/nsXMLElement.cpp | 2 +- .../xml/document/src/nsXMLContentSink.cpp | 4 +- .../xml/document/src/nsXMLDocument.cpp | 30 - .../content/xml/document/src/nsXMLDocument.h | 2 - mozilla/layout/base/public/nsITextContent.h | 9 + mozilla/layout/base/src/Makefile.in | 3 + mozilla/layout/base/src/makefile.win | 8 +- mozilla/layout/base/src/nsCommentNode.cpp | 169 +++++ mozilla/layout/base/src/nsDOMAttribute.cpp | 7 +- mozilla/layout/base/src/nsDOMAttributeMap.h | 2 + mozilla/layout/base/src/nsDocument.cpp | 29 +- .../layout/base/src/nsGenericDOMDataNode.cpp | 696 ++++++++++++++++++ .../layout/base/src/nsGenericDOMDataNode.h | 506 +++++++++++++ mozilla/layout/base/src/nsGenericElement.cpp | 57 +- mozilla/layout/base/src/nsGenericElement.h | 4 +- mozilla/layout/base/src/nsTextNode.cpp | 245 ++++++ mozilla/layout/build/nsLayoutFactory.cpp | 3 +- mozilla/layout/generic/nsHTMLParts.h | 6 - mozilla/layout/html/base/src/nsHTMLParts.h | 6 - mozilla/layout/html/content/src/Makefile.in | 3 - mozilla/layout/html/content/src/makefile.win | 8 +- .../html/content/src/nsGenericHTMLElement.cpp | 73 +- .../html/content/src/nsGenericHTMLElement.h | 10 +- .../html/content/src/nsHTMLAnchorElement.cpp | 4 +- .../html/content/src/nsHTMLAppletElement.cpp | 4 +- .../html/content/src/nsHTMLAreaElement.cpp | 2 +- .../html/content/src/nsHTMLBRElement.cpp | 4 +- .../html/content/src/nsHTMLBaseElement.cpp | 4 +- .../content/src/nsHTMLBaseFontElement.cpp | 4 +- .../html/content/src/nsHTMLBodyElement.cpp | 4 +- .../html/content/src/nsHTMLButtonElement.cpp | 4 +- .../html/content/src/nsHTMLDListElement.cpp | 4 +- .../html/content/src/nsHTMLDelElement.cpp | 4 +- .../content/src/nsHTMLDirectoryElement.cpp | 4 +- .../html/content/src/nsHTMLDivElement.cpp | 4 +- .../html/content/src/nsHTMLEmbedElement.cpp | 4 +- .../content/src/nsHTMLFieldSetElement.cpp | 4 +- .../html/content/src/nsHTMLFontElement.cpp | 4 +- .../html/content/src/nsHTMLFormElement.cpp | 2 +- .../html/content/src/nsHTMLFrameElement.cpp | 2 +- .../content/src/nsHTMLFrameSetElement.cpp | 2 +- .../html/content/src/nsHTMLHRElement.cpp | 2 +- .../html/content/src/nsHTMLHeadElement.cpp | 2 +- .../html/content/src/nsHTMLHeadingElement.cpp | 2 +- .../html/content/src/nsHTMLHtmlElement.cpp | 2 +- .../html/content/src/nsHTMLIFrameElement.cpp | 2 +- .../html/content/src/nsHTMLImageElement.cpp | 2 +- .../html/content/src/nsHTMLInputElement.cpp | 2 +- .../html/content/src/nsHTMLInsElement.cpp | 2 +- .../html/content/src/nsHTMLIsIndexElement.cpp | 2 +- .../html/content/src/nsHTMLLIElement.cpp | 2 +- .../html/content/src/nsHTMLLabelElement.cpp | 2 +- .../html/content/src/nsHTMLLayerElement.cpp | 2 +- .../html/content/src/nsHTMLLegendElement.cpp | 2 +- .../html/content/src/nsHTMLLinkElement.cpp | 2 +- .../html/content/src/nsHTMLMapElement.cpp | 2 +- .../html/content/src/nsHTMLMenuElement.cpp | 2 +- .../html/content/src/nsHTMLMetaElement.cpp | 2 +- .../html/content/src/nsHTMLModElement.cpp | 2 +- .../html/content/src/nsHTMLOListElement.cpp | 2 +- .../html/content/src/nsHTMLObjectElement.cpp | 2 +- .../content/src/nsHTMLOptGroupElement.cpp | 2 +- .../html/content/src/nsHTMLOptionElement.cpp | 2 +- .../content/src/nsHTMLParagraphElement.cpp | 2 +- .../html/content/src/nsHTMLParamElement.cpp | 2 +- .../html/content/src/nsHTMLPreElement.cpp | 2 +- .../html/content/src/nsHTMLQuoteElement.cpp | 2 +- .../html/content/src/nsHTMLScriptElement.cpp | 2 +- .../html/content/src/nsHTMLSelectElement.cpp | 2 +- .../html/content/src/nsHTMLSpacerElement.cpp | 2 +- .../html/content/src/nsHTMLSpanElement.cpp | 2 +- .../html/content/src/nsHTMLStyleElement.cpp | 2 +- .../content/src/nsHTMLTableCaptionElement.cpp | 2 +- .../content/src/nsHTMLTableCellElement.cpp | 2 +- .../content/src/nsHTMLTableColElement.cpp | 2 +- .../src/nsHTMLTableColGroupElement.cpp | 2 +- .../html/content/src/nsHTMLTableElement.cpp | 2 +- .../content/src/nsHTMLTableRowElement.cpp | 2 +- .../content/src/nsHTMLTableSectionElement.cpp | 2 +- .../content/src/nsHTMLTextAreaElement.cpp | 2 +- .../html/content/src/nsHTMLTitleElement.cpp | 2 +- .../html/content/src/nsHTMLUListElement.cpp | 2 +- .../html/content/src/nsHTMLWBRElement.cpp | 2 +- .../html/document/src/nsHTMLContentSink.cpp | 2 +- .../html/document/src/nsHTMLDocument.cpp | 30 - .../layout/html/document/src/nsHTMLDocument.h | 6 +- mozilla/layout/html/tests/TestAttributes.cpp | 2 +- .../xml/content/src/nsGenericXMLElement.cpp | 5 +- .../xml/content/src/nsGenericXMLElement.h | 3 +- .../layout/xml/content/src/nsXMLElement.cpp | 2 +- .../xml/document/src/nsXMLContentSink.cpp | 4 +- .../layout/xml/document/src/nsXMLDocument.cpp | 30 - .../layout/xml/document/src/nsXMLDocument.h | 2 - 170 files changed, 2142 insertions(+), 548 deletions(-) rename mozilla/{layout/html/content => content/base}/src/nsCommentNode.cpp (84%) rename mozilla/{layout/html/content => content/base}/src/nsGenericDOMDataNode.cpp (98%) rename mozilla/{layout/html/content => content/base}/src/nsGenericDOMDataNode.h (83%) rename mozilla/{layout/html/content => content/base}/src/nsTextNode.cpp (91%) create mode 100644 mozilla/layout/base/src/nsCommentNode.cpp create mode 100644 mozilla/layout/base/src/nsGenericDOMDataNode.cpp create mode 100644 mozilla/layout/base/src/nsGenericDOMDataNode.h create mode 100644 mozilla/layout/base/src/nsTextNode.cpp diff --git a/mozilla/content/base/public/nsITextContent.h b/mozilla/content/base/public/nsITextContent.h index 8db2ba59533..d698ae08453 100644 --- a/mozilla/content/base/public/nsITextContent.h +++ b/mozilla/content/base/public/nsITextContent.h @@ -21,6 +21,7 @@ #include "nslayout.h" class nsString; class nsTextFragment; +class nsIContent; // IID for the nsITextContent interface #define NS_ITEXT_CONTENT_IID \ @@ -55,4 +56,12 @@ public: PRBool aNotify) = 0; }; +// XXX These belong elsewhere +extern nsresult +NS_NewTextNode(nsIContent** aResult); + +extern nsresult +NS_NewCommentNode(nsIContent** aResult); + + #endif /* nsITextContent_h___ */ diff --git a/mozilla/layout/html/content/src/nsCommentNode.cpp b/mozilla/content/base/src/nsCommentNode.cpp similarity index 84% rename from mozilla/layout/html/content/src/nsCommentNode.cpp rename to mozilla/content/base/src/nsCommentNode.cpp index bc3ce1ed1d9..cdc525ff2e8 100644 --- a/mozilla/layout/html/content/src/nsCommentNode.cpp +++ b/mozilla/content/base/src/nsCommentNode.cpp @@ -20,7 +20,7 @@ #include "nsGenericDOMDataNode.h" #include "nsIScriptObjectOwner.h" #include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" +#include "nsIContent.h" #include "nsFrame.h" static NS_DEFINE_IID(kIDOMCommentIID, NS_IDOMCOMMENT_IID); @@ -28,7 +28,7 @@ static NS_DEFINE_IID(kIDOMCommentIID, NS_IDOMCOMMENT_IID); class nsCommentNode : public nsIDOMComment, public nsIScriptObjectOwner, public nsIDOMEventReceiver, - public nsIHTMLContent + public nsIContent { public: nsCommentNode(); @@ -54,26 +54,23 @@ public: // nsIContent NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner) - // nsIHTMLContent - NS_IMPL_IHTMLCONTENT_USING_GENERIC_DOM_DATA(mInner) - protected: nsGenericDOMDataNode mInner; }; -nsresult NS_NewCommentNode(nsIHTMLContent** aInstancePtrResult); +nsresult NS_NewCommentNode(nsIContent** aInstancePtrResult); nsresult -NS_NewCommentNode(nsIHTMLContent** aInstancePtrResult) +NS_NewCommentNode(nsIContent** aInstancePtrResult) { NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); if (nsnull == aInstancePtrResult) { return NS_ERROR_NULL_POINTER; } - nsIHTMLContent* it = new nsCommentNode(); + nsIContent* it = new nsCommentNode(); if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } - return it->QueryInterface(kIHTMLContentIID, (void **) aInstancePtrResult); + return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } nsCommentNode::nsCommentNode() @@ -147,27 +144,6 @@ nsCommentNode::List(FILE* out, PRInt32 aIndent) const return NS_OK; } -NS_IMETHODIMP -nsCommentNode::ToHTML(FILE* out) const -{ - nsAutoString tmp; - tmp.Append("