From 17c6dc528bf848edeb55dc5b3d455ed2d159ed93 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Wed, 2 Sep 1998 00:56:01 +0000 Subject: [PATCH] new git-svn-id: svn://10.0.0.236/trunk@9075 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/html/content/src/nsHTMLFont.cpp | 168 +++++++++ .../layout/html/content/src/nsHTMLHeading.cpp | 162 +++++++++ .../layout/html/content/src/nsHTMLHtml.cpp | 159 +++++++++ mozilla/layout/html/content/src/nsHTMLIns.cpp | 165 +++++++++ mozilla/layout/html/content/src/nsHTMLLI.cpp | 165 +++++++++ mozilla/layout/html/content/src/nsHTMLMap.cpp | 178 ++++++++++ .../layout/html/content/src/nsHTMLMenu.cpp | 162 +++++++++ mozilla/layout/html/content/src/nsHTMLMod.cpp | 165 +++++++++ .../layout/html/content/src/nsHTMLOList.cpp | 168 +++++++++ .../layout/html/content/src/nsHTMLOption.cpp | 189 +++++++++++ .../html/content/src/nsHTMLParagraph.cpp | 173 ++++++++++ mozilla/layout/html/content/src/nsHTMLPre.cpp | 173 ++++++++++ .../layout/html/content/src/nsHTMLQuote.cpp | 162 +++++++++ .../layout/html/content/src/nsHTMLSelect.cpp | 168 +++++++++ .../layout/html/content/src/nsHTMLTable.cpp | 321 ++++++++++++++++++ .../html/content/src/nsHTMLTableCaption.cpp | 162 +++++++++ .../html/content/src/nsHTMLTableCell.cpp | 217 ++++++++++++ .../html/content/src/nsHTMLTableCol.cpp | 177 ++++++++++ .../html/content/src/nsHTMLTableRow.cpp | 242 +++++++++++++ .../html/content/src/nsHTMLTableSection.cpp | 199 +++++++++++ .../layout/html/content/src/nsHTMLUList.cpp | 165 +++++++++ 21 files changed, 3840 insertions(+) create mode 100644 mozilla/layout/html/content/src/nsHTMLFont.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLHeading.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLHtml.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLIns.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLLI.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLMap.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLMenu.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLMod.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLOList.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLOption.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLParagraph.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLPre.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLQuote.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLSelect.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLTable.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLTableCaption.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLTableCell.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLTableCol.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLTableRow.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLTableSection.cpp create mode 100644 mozilla/layout/html/content/src/nsHTMLUList.cpp diff --git a/mozilla/layout/html/content/src/nsHTMLFont.cpp b/mozilla/layout/html/content/src/nsHTMLFont.cpp new file mode 100644 index 00000000000..3a0f6fb17d2 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLFont.cpp @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLFontElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLFontElementIID, NS_IDOMHTMLFONTELEMENT_IID); + +class nsHTMLFont : public nsIDOMHTMLFontElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLFont(nsIAtom* aTag); + ~nsHTMLFont(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLFontElement + NS_IMETHOD GetColor(nsString& aColor); + NS_IMETHOD SetColor(const nsString& aColor); + NS_IMETHOD GetFace(nsString& aFace); + NS_IMETHOD SetFace(const nsString& aFace); + NS_IMETHOD GetSize(nsString& aSize); + NS_IMETHOD SetSize(const nsString& aSize); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLFont(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLFont(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLFont::nsHTMLFont(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLFont::~nsHTMLFont() +{ +} + +NS_IMPL_ADDREF(nsHTMLFont) + +NS_IMPL_RELEASE(nsHTMLFont) + +nsresult +nsHTMLFont::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLFontElementIID)) { + nsIDOMHTMLFontElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLFont::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLFont* it = new nsHTMLFont(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLFont, Color, face, eSetAttrNotify_Render) +NS_IMPL_STRING_ATTR(nsHTMLFont, Face, face, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLFont, Size, size, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLFont::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLFont::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLFont::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLFont::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLHeading.cpp b/mozilla/layout/html/content/src/nsHTMLHeading.cpp new file mode 100644 index 00000000000..1582657cb1f --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLHeading.cpp @@ -0,0 +1,162 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLHeadingElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLHeadingElementIID, NS_IDOMHTMLHEADINGELEMENT_IID); + +class nsHTMLHeading : public nsIDOMHTMLHeadingElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLHeading(nsIAtom* aTag); + ~nsHTMLHeading(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLHeadingElement + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLHeading(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLHeading(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLHeading::nsHTMLHeading(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLHeading::~nsHTMLHeading() +{ +} + +NS_IMPL_ADDREF(nsHTMLHeading) + +NS_IMPL_RELEASE(nsHTMLHeading) + +nsresult +nsHTMLHeading::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLHeadingElementIID)) { + nsIDOMHTMLHeadingElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLHeading::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLHeading* it = new nsHTMLHeading(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLHeading, Align, align, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLHeading::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLHeading::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLHeading::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLHeading::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLHtml.cpp b/mozilla/layout/html/content/src/nsHTMLHtml.cpp new file mode 100644 index 00000000000..55a7fe92ab8 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLHtml.cpp @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLHtmlElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLHtmlElementIID, NS_IDOMHTMLHTMLELEMENT_IID); + +class nsHTMLHtml : public nsIDOMHTMLHtmlElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLHtml(nsIAtom* aTag); + ~nsHTMLHtml(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLHtmlElement + NS_IMETHOD GetVersion(nsString& aVersion); + NS_IMETHOD SetVersion(const nsString& aVersion); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLHtml(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLHtml(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLHtml::nsHTMLHtml(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLHtml::~nsHTMLHtml() +{ +} + +NS_IMPL_ADDREF(nsHTMLHtml) + +NS_IMPL_RELEASE(nsHTMLHtml) + +nsresult +nsHTMLHtml::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLHtmlElementIID)) { + nsIDOMHTMLHtmlElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLHtml::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLHtml* it = new nsHTMLHtml(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLHtml, Version, version, eSetAttrNotify_None) + +NS_IMETHODIMP +nsHTMLHtml::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLHtml::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLHtml::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLHtml::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLIns.cpp b/mozilla/layout/html/content/src/nsHTMLIns.cpp new file mode 100644 index 00000000000..4c3e04cca9f --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLIns.cpp @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLInsElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLInsElementIID, NS_IDOMHTMLINSELEMENT_IID); + +class nsHTMLIns : public nsIDOMHTMLInsElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLIns(nsIAtom* aTag); + ~nsHTMLIns(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLInsElement + NS_IMETHOD GetCite(nsString& aCite); + NS_IMETHOD SetCite(const nsString& aCite); + NS_IMETHOD GetDateTime(nsString& aDateTime); + NS_IMETHOD SetDateTime(const nsString& aDateTime); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLIns(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLIns(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLIns::nsHTMLIns(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLIns::~nsHTMLIns() +{ +} + +NS_IMPL_ADDREF(nsHTMLIns) + +NS_IMPL_RELEASE(nsHTMLIns) + +nsresult +nsHTMLIns::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLInsElementIID)) { + nsIDOMHTMLInsElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLIns::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLIns* it = new nsHTMLIns(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLIns, Cite, cite, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLIns, DateTime, datetime, eSetAttrNotify_None) + +NS_IMETHODIMP +nsHTMLIns::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLIns::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLIns::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLIns::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLLI.cpp b/mozilla/layout/html/content/src/nsHTMLLI.cpp new file mode 100644 index 00000000000..130feee53b8 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLLI.cpp @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLLIElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLLIElementIID, NS_IDOMHTMLLIELEMENT_IID); + +class nsHTMLLI : public nsIDOMHTMLLIElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLLI(nsIAtom* aTag); + ~nsHTMLLI(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLLIElement + NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD SetType(const nsString& aType); + NS_IMETHOD GetValue(PRInt32* aValue); + NS_IMETHOD SetValue(PRInt32 aValue); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLLI(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLLI(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLLI::nsHTMLLI(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLLI::~nsHTMLLI() +{ +} + +NS_IMPL_ADDREF(nsHTMLLI) + +NS_IMPL_RELEASE(nsHTMLLI) + +nsresult +nsHTMLLI::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLLIElementIID)) { + nsIDOMHTMLLIElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLLI::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLLI* it = new nsHTMLLI(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLLI, Type, type, eSetAttrNotify_Reflow) +NS_IMPL_INT_ATTR(nsHTMLLI, Value, value, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLLI::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLLI::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLLI::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLLI::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLMap.cpp b/mozilla/layout/html/content/src/nsHTMLMap.cpp new file mode 100644 index 00000000000..97bcc757387 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLMap.cpp @@ -0,0 +1,178 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLMapElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLMapElementIID, NS_IDOMHTMLMAPELEMENT_IID); + +class nsHTMLMap : public nsIDOMHTMLMapElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLMap(nsIAtom* aTag); + ~nsHTMLMap(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLMapElement + NS_IMETHOD GetAreas(nsIDOMHTMLCollection** aAreas); + NS_IMETHOD SetAreas(nsIDOMHTMLCollection* aAreas); + NS_IMETHOD GetName(nsString& aName); + NS_IMETHOD SetName(const nsString& aName); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLMap(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLMap(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLMap::nsHTMLMap(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLMap::~nsHTMLMap() +{ +} + +NS_IMPL_ADDREF(nsHTMLMap) + +NS_IMPL_RELEASE(nsHTMLMap) + +nsresult +nsHTMLMap::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLMapElementIID)) { + nsIDOMHTMLMapElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLMap::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLMap* it = new nsHTMLMap(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMETHODIMP +nsHTMLMap::GetAreas(nsIDOMHTMLCollection** aAreas) +{ + *aAreas = nsnull; + return NS_ERROR_OUT_OF_MEMORY;/* XXX */ +} + +NS_IMETHODIMP +nsHTMLMap::SetAreas(nsIDOMHTMLCollection* aAreas) +{ + // XXX write me + return NS_OK; +} + +NS_IMPL_STRING_ATTR(nsHTMLMap, Name, name, eSetAttrNotify_Restart) + +NS_IMETHODIMP +nsHTMLMap::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLMap::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLMap::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLMap::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLMenu.cpp b/mozilla/layout/html/content/src/nsHTMLMenu.cpp new file mode 100644 index 00000000000..4365ed2e334 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLMenu.cpp @@ -0,0 +1,162 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLMenuElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLMenuElementIID, NS_IDOMHTMLMENUELEMENT_IID); + +class nsHTMLMenu : public nsIDOMHTMLMenuElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLMenu(nsIAtom* aTag); + ~nsHTMLMenu(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLMenuElement + NS_IMETHOD GetCompact(PRBool* aCompact); + NS_IMETHOD SetCompact(PRBool aCompact); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLMenu(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLMenu(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLMenu::nsHTMLMenu(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLMenu::~nsHTMLMenu() +{ +} + +NS_IMPL_ADDREF(nsHTMLMenu) + +NS_IMPL_RELEASE(nsHTMLMenu) + +nsresult +nsHTMLMenu::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLMenuElementIID)) { + nsIDOMHTMLMenuElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLMenu::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLMenu* it = new nsHTMLMenu(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_BOOL_ATTR(nsHTMLMenu, Compact, compact, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLMenu::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLMenu::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLMenu::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLMenu::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLMod.cpp b/mozilla/layout/html/content/src/nsHTMLMod.cpp new file mode 100644 index 00000000000..7fe53ea4f5d --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLMod.cpp @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLModElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLModElementIID, NS_IDOMHTMLMODELEMENT_IID); + +class nsHTMLMod : public nsIDOMHTMLModElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLMod(nsIAtom* aTag); + ~nsHTMLMod(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLModElement + NS_IMETHOD GetCite(nsString& aCite); + NS_IMETHOD SetCite(const nsString& aCite); + NS_IMETHOD GetDateTime(nsString& aDateTime); + NS_IMETHOD SetDateTime(const nsString& aDateTime); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLMod(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLMod(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLMod::nsHTMLMod(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLMod::~nsHTMLMod() +{ +} + +NS_IMPL_ADDREF(nsHTMLMod) + +NS_IMPL_RELEASE(nsHTMLMod) + +nsresult +nsHTMLMod::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLModElementIID)) { + nsIDOMHTMLModElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLMod::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLMod* it = new nsHTMLMod(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLMod, Cite, cite, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLMod, DateTime, datetime, eSetAttrNotify_None) + +NS_IMETHODIMP +nsHTMLMod::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLMod::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLMod::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLMod::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLOList.cpp b/mozilla/layout/html/content/src/nsHTMLOList.cpp new file mode 100644 index 00000000000..d476e9ccecf --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLOList.cpp @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLOListElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLOListElementIID, NS_IDOMHTMLOLISTELEMENT_IID); + +class nsHTMLOList : public nsIDOMHTMLOListElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLOList(nsIAtom* aTag); + ~nsHTMLOList(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLOListElement + NS_IMETHOD GetCompact(PRBool* aCompact); + NS_IMETHOD SetCompact(PRBool aCompact); + NS_IMETHOD GetStart(PRInt32* aStart); + NS_IMETHOD SetStart(PRInt32 aStart); + NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD SetType(const nsString& aType); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLOList(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLOList(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLOList::nsHTMLOList(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLOList::~nsHTMLOList() +{ +} + +NS_IMPL_ADDREF(nsHTMLOList) + +NS_IMPL_RELEASE(nsHTMLOList) + +nsresult +nsHTMLOList::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLOListElementIID)) { + nsIDOMHTMLOListElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLOList::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLOList* it = new nsHTMLOList(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_BOOL_ATTR(nsHTMLOList, Compact, compact, eSetAttrNotify_Reflow) +NS_IMPL_INT_ATTR(nsHTMLOList, Start, compact, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLOList, Type, compact, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLOList::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLOList::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLOList::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLOList::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLOption.cpp b/mozilla/layout/html/content/src/nsHTMLOption.cpp new file mode 100644 index 00000000000..a8a6b7c7c5e --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLOption.cpp @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLOptionElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLOptionElementIID, NS_IDOMHTMLOPTIONELEMENT_IID); + +class nsHTMLOption : public nsIDOMHTMLOptionElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLOption(nsIAtom* aTag); + ~nsHTMLOption(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLOptionElement + NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm); + NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm); + NS_IMETHOD GetDefaultSelected(PRBool* aDefaultSelected); + NS_IMETHOD SetDefaultSelected(PRBool aDefaultSelected); + NS_IMETHOD GetText(nsString& aText); + NS_IMETHOD SetText(const nsString& aText); + NS_IMETHOD GetIndex(PRInt32* aIndex); + NS_IMETHOD SetIndex(PRInt32 aIndex); + NS_IMETHOD GetDisabled(PRBool* aDisabled); + NS_IMETHOD SetDisabled(PRBool aDisabled); + NS_IMETHOD GetLabel(nsString& aLabel); + NS_IMETHOD SetLabel(const nsString& aLabel); + NS_IMETHOD GetSelected(PRBool* aSelected); + NS_IMETHOD SetSelected(PRBool aSelected); + NS_IMETHOD GetValue(nsString& aValue); + NS_IMETHOD SetValue(const nsString& aValue); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLOption(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLOption(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLOption::nsHTMLOption(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLOption::~nsHTMLOption() +{ +} + +NS_IMPL_ADDREF(nsHTMLOption) + +NS_IMPL_RELEASE(nsHTMLOption) + +nsresult +nsHTMLOption::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLOptionElementIID)) { + nsIDOMHTMLOptionElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLOption::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLOption* it = new nsHTMLOption(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMETHODIMP +nsHTMLOption::GetForm(nsIDOMHTMLFormElement** aForm) +{ + *aForm = nsnull;/* XXX */ + return NS_OK; +} + +NS_IMPL_BOOL_ATTR(nsHTMLOption, DefaultSelected, defaultselected, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLOption, Text, text, eSetAttrNotify_Render) +NS_IMPL_INT_ATTR(nsHTMLOption, Index, index, eSetAttrNotify_None) +NS_IMPL_BOOL_ATTR(nsHTMLOption, Disabled, disabled, eSetAttrNotify_Render) +NS_IMPL_STRING_ATTR(nsHTMLOption, Label, label, eSetAttrNotify_Render) +NS_IMPL_BOOL_ATTR(nsHTMLOption, Selected, selected, eSetAttrNotify_Render) +NS_IMPL_STRING_ATTR(nsHTMLOption, Value, value, eSetAttrNotify_Render) + +NS_IMETHODIMP +nsHTMLOption::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLOption::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLOption::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLOption::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLParagraph.cpp b/mozilla/layout/html/content/src/nsHTMLParagraph.cpp new file mode 100644 index 00000000000..4878fbe3b69 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLParagraph.cpp @@ -0,0 +1,173 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLParagraphElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +// XXX missing nav attributes + +static NS_DEFINE_IID(kIDOMHTMLParagraphElementIID, NS_IDOMHTMLPARAGRAPHELEMENT_IID); + +class nsHTMLParagraph : public nsIDOMHTMLParagraphElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLParagraph(nsIAtom* aTag); + ~nsHTMLParagraph(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLParagraphElement + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLParagraph(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLParagraph(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLParagraph::nsHTMLParagraph(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLParagraph::~nsHTMLParagraph() +{ +} + +NS_IMPL_ADDREF(nsHTMLParagraph) + +NS_IMPL_RELEASE(nsHTMLParagraph) + +nsresult +nsHTMLParagraph::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLParagraphElementIID)) { + nsIDOMHTMLParagraphElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLParagraph::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLParagraph* it = new nsHTMLParagraph(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLParagraph, Align, align, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLParagraph::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + if (aAttribute == nsHTMLAtoms::align) { + if (nsHTMLGenericContent::ParseAlignValue(aValue, aResult)) { + return NS_CONTENT_ATTR_HAS_VALUE; + } + } + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLParagraph::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + if (aAttribute == nsHTMLAtoms::align) { + if (eHTMLUnit_Enumerated == aValue.GetUnit()) { + nsHTMLGenericContent::AlignValueToString(aValue, aResult); + return NS_CONTENT_ATTR_HAS_VALUE; + } + } + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLParagraph::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLParagraph::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLPre.cpp b/mozilla/layout/html/content/src/nsHTMLPre.cpp new file mode 100644 index 00000000000..0c096d35c6a --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLPre.cpp @@ -0,0 +1,173 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLPreElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +// XXX missing nav attributes + +static NS_DEFINE_IID(kIDOMHTMLPreElementIID, NS_IDOMHTMLPREELEMENT_IID); + +class nsHTMLPre : public nsIDOMHTMLPreElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLPre(nsIAtom* aTag); + ~nsHTMLPre(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLPreElement + NS_IMETHOD GetWidth(PRInt32* aWidth); + NS_IMETHOD SetWidth(PRInt32 aWidth); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLPre(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLPre(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLPre::nsHTMLPre(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLPre::~nsHTMLPre() +{ +} + +NS_IMPL_ADDREF(nsHTMLPre) + +NS_IMPL_RELEASE(nsHTMLPre) + +nsresult +nsHTMLPre::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLPreElementIID)) { + nsIDOMHTMLPreElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLPre::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLPre* it = new nsHTMLPre(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_INT_ATTR(nsHTMLPre, Width, width, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLPre::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + if (aAttribute == nsHTMLAtoms::align) { + if (nsHTMLGenericContent::ParseAlignValue(aValue, aResult)) { + return NS_CONTENT_ATTR_HAS_VALUE; + } + } + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLPre::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + if (aAttribute == nsHTMLAtoms::align) { + if (eHTMLUnit_Enumerated == aValue.GetUnit()) { + nsHTMLGenericContent::AlignValueToString(aValue, aResult); + return NS_CONTENT_ATTR_HAS_VALUE; + } + } + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLPre::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLPre::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLQuote.cpp b/mozilla/layout/html/content/src/nsHTMLQuote.cpp new file mode 100644 index 00000000000..ee026171b35 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLQuote.cpp @@ -0,0 +1,162 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLQuoteElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLQuoteElementIID, NS_IDOMHTMLQUOTEELEMENT_IID); + +class nsHTMLQuote : public nsIDOMHTMLQuoteElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLQuote(nsIAtom* aTag); + ~nsHTMLQuote(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLQuoteElement + NS_IMETHOD GetCite(nsString& aCite); + NS_IMETHOD SetCite(const nsString& aCite); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLQuote(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLQuote(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLQuote::nsHTMLQuote(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLQuote::~nsHTMLQuote() +{ +} + +NS_IMPL_ADDREF(nsHTMLQuote) + +NS_IMPL_RELEASE(nsHTMLQuote) + +nsresult +nsHTMLQuote::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLQuoteElementIID)) { + nsIDOMHTMLQuoteElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLQuote::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLQuote* it = new nsHTMLQuote(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLQuote, Cite, cite, eSetAttrNotify_None) + +NS_IMETHODIMP +nsHTMLQuote::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLQuote::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLQuote::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLQuote::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLSelect.cpp b/mozilla/layout/html/content/src/nsHTMLSelect.cpp new file mode 100644 index 00000000000..3a0f6fb17d2 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLSelect.cpp @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLFontElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLFontElementIID, NS_IDOMHTMLFONTELEMENT_IID); + +class nsHTMLFont : public nsIDOMHTMLFontElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLFont(nsIAtom* aTag); + ~nsHTMLFont(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLFontElement + NS_IMETHOD GetColor(nsString& aColor); + NS_IMETHOD SetColor(const nsString& aColor); + NS_IMETHOD GetFace(nsString& aFace); + NS_IMETHOD SetFace(const nsString& aFace); + NS_IMETHOD GetSize(nsString& aSize); + NS_IMETHOD SetSize(const nsString& aSize); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLFont(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLFont(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLFont::nsHTMLFont(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLFont::~nsHTMLFont() +{ +} + +NS_IMPL_ADDREF(nsHTMLFont) + +NS_IMPL_RELEASE(nsHTMLFont) + +nsresult +nsHTMLFont::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLFontElementIID)) { + nsIDOMHTMLFontElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLFont::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLFont* it = new nsHTMLFont(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLFont, Color, face, eSetAttrNotify_Render) +NS_IMPL_STRING_ATTR(nsHTMLFont, Face, face, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLFont, Size, size, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLFont::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLFont::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLFont::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLFont::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLTable.cpp b/mozilla/layout/html/content/src/nsHTMLTable.cpp new file mode 100644 index 00000000000..bdefb0380de --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLTable.cpp @@ -0,0 +1,321 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLTableElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLTableElementIID, NS_IDOMHTMLTABLEELEMENT_IID); + +class nsHTMLTable : public nsIDOMHTMLTableElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLTable(nsIAtom* aTag); + ~nsHTMLTable(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLTableElement + NS_IMETHOD GetCaption(nsIDOMHTMLTableCaptionElement** aCaption); + NS_IMETHOD SetCaption(nsIDOMHTMLTableCaptionElement* aCaption); + NS_IMETHOD GetTHead(nsIDOMHTMLTableSectionElement** aTHead); + NS_IMETHOD SetTHead(nsIDOMHTMLTableSectionElement* aTHead); + NS_IMETHOD GetTFoot(nsIDOMHTMLTableSectionElement** aTFoot); + NS_IMETHOD SetTFoot(nsIDOMHTMLTableSectionElement* aTFoot); + NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); + NS_IMETHOD SetRows(nsIDOMHTMLCollection* aRows); + NS_IMETHOD GetTBodies(nsIDOMHTMLCollection** aTBodies); + NS_IMETHOD SetTBodies(nsIDOMHTMLCollection* aTBodies); + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + NS_IMETHOD GetBgColor(nsString& aBgColor); + NS_IMETHOD SetBgColor(const nsString& aBgColor); + NS_IMETHOD GetBorder(nsString& aBorder); + NS_IMETHOD SetBorder(const nsString& aBorder); + NS_IMETHOD GetCellPadding(nsString& aCellPadding); + NS_IMETHOD SetCellPadding(const nsString& aCellPadding); + NS_IMETHOD GetCellSpacing(nsString& aCellSpacing); + NS_IMETHOD SetCellSpacing(const nsString& aCellSpacing); + NS_IMETHOD GetFrame(nsString& aFrame); + NS_IMETHOD SetFrame(const nsString& aFrame); + NS_IMETHOD GetRules(nsString& aRules); + NS_IMETHOD SetRules(const nsString& aRules); + NS_IMETHOD GetSummary(nsString& aSummary); + NS_IMETHOD SetSummary(const nsString& aSummary); + NS_IMETHOD GetWidth(nsString& aWidth); + NS_IMETHOD SetWidth(const nsString& aWidth); + NS_IMETHOD CreateTHead(nsIDOMHTMLElement** aReturn); + NS_IMETHOD DeleteTHead(); + NS_IMETHOD CreateTFoot(nsIDOMHTMLElement** aReturn); + NS_IMETHOD DeleteTFoot(); + NS_IMETHOD CreateCaption(nsIDOMHTMLElement** aReturn); + NS_IMETHOD DeleteCaption(); + NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); + NS_IMETHOD DeleteRow(PRInt32 aIndex); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLTable(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLTable(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLTable::nsHTMLTable(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLTable::~nsHTMLTable() +{ +} + +NS_IMPL_ADDREF(nsHTMLTable) + +NS_IMPL_RELEASE(nsHTMLTable) + +nsresult +nsHTMLTable::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLTableElementIID)) { + nsIDOMHTMLTableElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLTable::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLTable* it = new nsHTMLTable(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLTable, Align, align, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTable, BgColor, bgcolor, eSetAttrNotify_Render) +NS_IMPL_STRING_ATTR(nsHTMLTable, Border, border, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTable, CellPadding, cellpadding, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTable, CellSpacing, cellspacing, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTable, Frame, frame, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLTable, Rules, rules, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLTable, Summary, summary, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLTable, Width, width, eSetAttrNotify_None) + +NS_IMETHODIMP +nsHTMLTable::GetCaption(nsIDOMHTMLTableCaptionElement** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::SetCaption(nsIDOMHTMLTableCaptionElement* aValue) +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::GetTHead(nsIDOMHTMLTableSectionElement** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::SetTHead(nsIDOMHTMLTableSectionElement* aValue) +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::GetTFoot(nsIDOMHTMLTableSectionElement** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::SetTFoot(nsIDOMHTMLTableSectionElement* aValue) +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::GetRows(nsIDOMHTMLCollection** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::SetRows(nsIDOMHTMLCollection* aValue) +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::GetTBodies(nsIDOMHTMLCollection** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::SetTBodies(nsIDOMHTMLCollection* aValue) +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::CreateTHead(nsIDOMHTMLElement** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::DeleteTHead() +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::CreateTFoot(nsIDOMHTMLElement** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::DeleteTFoot() +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::CreateCaption(nsIDOMHTMLElement** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::DeleteCaption() +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue) +{ + *aValue = nsnull; + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::DeleteRow(PRInt32 aValue) +{ + return NS_OK; // XXX write me +} + +NS_IMETHODIMP +nsHTMLTable::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLTable::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLTable::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTable::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLTableCaption.cpp b/mozilla/layout/html/content/src/nsHTMLTableCaption.cpp new file mode 100644 index 00000000000..ca1233ab137 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLTableCaption.cpp @@ -0,0 +1,162 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLTableCaptionElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLTableCaptionElementIID, NS_IDOMHTMLTABLECAPTIONELEMENT_IID); + +class nsHTMLTableCaption : public nsIDOMHTMLTableCaptionElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLTableCaption(nsIAtom* aTag); + ~nsHTMLTableCaption(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLTableCaptionElement + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLTableCaption(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLTableCaption(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLTableCaption::nsHTMLTableCaption(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLTableCaption::~nsHTMLTableCaption() +{ +} + +NS_IMPL_ADDREF(nsHTMLTableCaption) + +NS_IMPL_RELEASE(nsHTMLTableCaption) + +nsresult +nsHTMLTableCaption::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLTableCaptionElementIID)) { + nsIDOMHTMLTableCaptionElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLTableCaption::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLTableCaption* it = new nsHTMLTableCaption(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLTableCaption, Align, align, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLTableCaption::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLTableCaption::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLTableCaption::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableCaption::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLTableCell.cpp b/mozilla/layout/html/content/src/nsHTMLTableCell.cpp new file mode 100644 index 00000000000..5e210a992a3 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLTableCell.cpp @@ -0,0 +1,217 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLTableCellElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID); + +class nsHTMLTableCell : public nsIDOMHTMLTableCellElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLTableCell(nsIAtom* aTag); + ~nsHTMLTableCell(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLTableCellElement + NS_IMETHOD GetCellIndex(PRInt32* aCellIndex); + NS_IMETHOD SetCellIndex(PRInt32 aCellIndex); + NS_IMETHOD GetAbbr(nsString& aAbbr); + NS_IMETHOD SetAbbr(const nsString& aAbbr); + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + NS_IMETHOD GetAxis(nsString& aAxis); + NS_IMETHOD SetAxis(const nsString& aAxis); + NS_IMETHOD GetBgColor(nsString& aBgColor); + NS_IMETHOD SetBgColor(const nsString& aBgColor); + NS_IMETHOD GetCh(nsString& aCh); + NS_IMETHOD SetCh(const nsString& aCh); + NS_IMETHOD GetChOff(nsString& aChOff); + NS_IMETHOD SetChOff(const nsString& aChOff); + NS_IMETHOD GetColSpan(PRInt32* aColSpan); + NS_IMETHOD SetColSpan(PRInt32 aColSpan); + NS_IMETHOD GetHeaders(nsString& aHeaders); + NS_IMETHOD SetHeaders(const nsString& aHeaders); + NS_IMETHOD GetHeight(nsString& aHeight); + NS_IMETHOD SetHeight(const nsString& aHeight); + NS_IMETHOD GetNoWrap(PRBool* aNoWrap); + NS_IMETHOD SetNoWrap(PRBool aNoWrap); + NS_IMETHOD GetRowSpan(PRInt32* aRowSpan); + NS_IMETHOD SetRowSpan(PRInt32 aRowSpan); + NS_IMETHOD GetScope(nsString& aScope); + NS_IMETHOD SetScope(const nsString& aScope); + NS_IMETHOD GetVAlign(nsString& aVAlign); + NS_IMETHOD SetVAlign(const nsString& aVAlign); + NS_IMETHOD GetWidth(nsString& aWidth); + NS_IMETHOD SetWidth(const nsString& aWidth); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLTableCell(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLTableCell(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLTableCell::nsHTMLTableCell(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLTableCell::~nsHTMLTableCell() +{ +} + +NS_IMPL_ADDREF(nsHTMLTableCell) + +NS_IMPL_RELEASE(nsHTMLTableCell) + +nsresult +nsHTMLTableCell::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLTableCellElementIID)) { + nsIDOMHTMLTableCellElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLTableCell::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLTableCell* it = new nsHTMLTableCell(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMETHODIMP +nsHTMLTableCell::GetCellIndex(PRInt32* aCellIndex) +{ + *aCellIndex = 0;/* XXX */ + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableCell::SetCellIndex(PRInt32 aCellIndex) +{ + // XXX write me + return NS_OK; +} + +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Abbr, abbr, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Align, align, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Axis, axis, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, BgColor, bgcolor, eSetAttrNotify_Render) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Ch, ch, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, ChOff, choff, eSetAttrNotify_Reflow) +NS_IMPL_INT_ATTR(nsHTMLTableCell, ColSpan, colspan, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Headers, headers, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Height, height, eSetAttrNotify_Reflow) +NS_IMPL_BOOL_ATTR(nsHTMLTableCell, NoWrap, nowrap, eSetAttrNotify_Reflow) +NS_IMPL_INT_ATTR(nsHTMLTableCell, RowSpan, rowspan, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Scope, scope, eSetAttrNotify_None) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, VAlign, valign, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCell, Width, width, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLTableCell::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLTableCell::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLTableCell::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableCell::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLTableCol.cpp b/mozilla/layout/html/content/src/nsHTMLTableCol.cpp new file mode 100644 index 00000000000..78594520e8a --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLTableCol.cpp @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLTableColElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLTableColElementIID, NS_IDOMHTMLTABLECOLELEMENT_IID); + +class nsHTMLTableCol : public nsIDOMHTMLTableColElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLTableCol(nsIAtom* aTag); + ~nsHTMLTableCol(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLTableColElement + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + NS_IMETHOD GetCh(nsString& aCh); + NS_IMETHOD SetCh(const nsString& aCh); + NS_IMETHOD GetChOff(nsString& aChOff); + NS_IMETHOD SetChOff(const nsString& aChOff); + NS_IMETHOD GetSpan(PRInt32* aSpan); + NS_IMETHOD SetSpan(PRInt32 aSpan); + NS_IMETHOD GetVAlign(nsString& aVAlign); + NS_IMETHOD SetVAlign(const nsString& aVAlign); + NS_IMETHOD GetWidth(nsString& aWidth); + NS_IMETHOD SetWidth(const nsString& aWidth); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLTableCol(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLTableCol(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLTableCol::nsHTMLTableCol(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLTableCol::~nsHTMLTableCol() +{ +} + +NS_IMPL_ADDREF(nsHTMLTableCol) + +NS_IMPL_RELEASE(nsHTMLTableCol) + +nsresult +nsHTMLTableCol::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLTableColElementIID)) { + nsIDOMHTMLTableColElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLTableCol::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLTableCol* it = new nsHTMLTableCol(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLTableCol, Align, align, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCol, Ch, ch, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCol, ChOff, choff, eSetAttrNotify_Reflow) +NS_IMPL_INT_ATTR(nsHTMLTableCol, Span, span, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCol, VAlign, valign, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableCol, Width, width, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLTableCol::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLTableCol::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLTableCol::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableCol::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLTableRow.cpp b/mozilla/layout/html/content/src/nsHTMLTableRow.cpp new file mode 100644 index 00000000000..f2a5780c91f --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLTableRow.cpp @@ -0,0 +1,242 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLTableRowElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLTableRowElementIID, NS_IDOMHTMLTABLEROWELEMENT_IID); + +class nsHTMLTableRow : public nsIDOMHTMLTableRowElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLTableRow(nsIAtom* aTag); + ~nsHTMLTableRow(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLTableRowElement + NS_IMETHOD GetRowIndex(PRInt32* aRowIndex); + NS_IMETHOD SetRowIndex(PRInt32 aRowIndex); + NS_IMETHOD GetSectionRowIndex(PRInt32* aSectionRowIndex); + NS_IMETHOD SetSectionRowIndex(PRInt32 aSectionRowIndex); + NS_IMETHOD GetCells(nsIDOMHTMLCollection** aCells); + NS_IMETHOD SetCells(nsIDOMHTMLCollection* aCells); + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + NS_IMETHOD GetBgColor(nsString& aBgColor); + NS_IMETHOD SetBgColor(const nsString& aBgColor); + NS_IMETHOD GetCh(nsString& aCh); + NS_IMETHOD SetCh(const nsString& aCh); + NS_IMETHOD GetChOff(nsString& aChOff); + NS_IMETHOD SetChOff(const nsString& aChOff); + NS_IMETHOD GetVAlign(nsString& aVAlign); + NS_IMETHOD SetVAlign(const nsString& aVAlign); + NS_IMETHOD InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); + NS_IMETHOD DeleteCell(PRInt32 aIndex); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLTableRow(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLTableRow(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLTableRow::nsHTMLTableRow(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLTableRow::~nsHTMLTableRow() +{ +} + +NS_IMPL_ADDREF(nsHTMLTableRow) + +NS_IMPL_RELEASE(nsHTMLTableRow) + +nsresult +nsHTMLTableRow::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLTableRowElementIID)) { + nsIDOMHTMLTableRowElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLTableRow::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLTableRow* it = new nsHTMLTableRow(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMETHODIMP +nsHTMLTableRow::GetRowIndex(PRInt32* aValue) +{ + *aValue = 0; + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::SetRowIndex(PRInt32 aValue) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::GetSectionRowIndex(PRInt32* aValue) +{ + *aValue = 0; + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::SetSectionRowIndex(PRInt32 aValue) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::GetCells(nsIDOMHTMLCollection** aValue) +{ + *aValue = 0; + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::SetCells(nsIDOMHTMLCollection* aValue) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aValue) +{ + *aValue = 0; + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::DeleteCell(PRInt32 aValue) +{ + // XXX write me + return NS_OK; +} + +NS_IMPL_STRING_ATTR(nsHTMLTableRow, Align, align, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableRow, BgColor, bgcolor, eSetAttrNotify_Render) +NS_IMPL_STRING_ATTR(nsHTMLTableRow, Ch, ch, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableRow, ChOff, choff, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableRow, VAlign, valign, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLTableRow::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLTableRow::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLTableRow::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableRow::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLTableSection.cpp b/mozilla/layout/html/content/src/nsHTMLTableSection.cpp new file mode 100644 index 00000000000..80ff7639d27 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLTableSection.cpp @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLTableSectionElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLTableSectionElementIID, NS_IDOMHTMLTABLESECTIONELEMENT_IID); + +class nsHTMLTableSection : public nsIDOMHTMLTableSectionElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLTableSection(nsIAtom* aTag); + ~nsHTMLTableSection(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLTableSectionElement + NS_IMETHOD GetAlign(nsString& aAlign); + NS_IMETHOD SetAlign(const nsString& aAlign); + NS_IMETHOD GetVAlign(nsString& aVAlign); + NS_IMETHOD SetVAlign(const nsString& aVAlign); + NS_IMETHOD GetRows(nsIDOMHTMLCollection** aRows); + NS_IMETHOD SetRows(nsIDOMHTMLCollection* aRows); + NS_IMETHOD InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aReturn); + NS_IMETHOD DeleteRow(PRInt32 aIndex); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLTableSection(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLTableSection(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLTableSection::nsHTMLTableSection(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLTableSection::~nsHTMLTableSection() +{ +} + +NS_IMPL_ADDREF(nsHTMLTableSection) + +NS_IMPL_RELEASE(nsHTMLTableSection) + +nsresult +nsHTMLTableSection::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLTableSectionElementIID)) { + nsIDOMHTMLTableSectionElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLTableSection::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLTableSection* it = new nsHTMLTableSection(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_STRING_ATTR(nsHTMLTableSection, Align, align, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLTableSection, VAlign, valign, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLTableSection::GetRows(nsIDOMHTMLCollection** aValue) +{ + *aValue = 0; + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableSection::SetRows(nsIDOMHTMLCollection* aValue) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableSection::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue) +{ + *aValue = 0; + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableSection::DeleteRow(PRInt32 aIndex) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableSection::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLTableSection::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLTableSection::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLTableSection::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +} diff --git a/mozilla/layout/html/content/src/nsHTMLUList.cpp b/mozilla/layout/html/content/src/nsHTMLUList.cpp new file mode 100644 index 00000000000..1116c395e82 --- /dev/null +++ b/mozilla/layout/html/content/src/nsHTMLUList.cpp @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ +#include "nsIDOMHTMLUListElement.h" +#include "nsIScriptObjectOwner.h" +#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsHTMLGenericContent.h" +#include "nsHTMLAtoms.h" +#include "nsHTMLIIDs.h" +#include "nsIStyleContext.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" + +static NS_DEFINE_IID(kIDOMHTMLUListElementIID, NS_IDOMHTMLULISTELEMENT_IID); + +class nsHTMLUList : public nsIDOMHTMLUListElement, + public nsIScriptObjectOwner, + public nsIDOMEventReceiver, + public nsIHTMLContent +{ +public: + nsHTMLUList(nsIAtom* aTag); + ~nsHTMLUList(); + + // nsISupports + NS_DECL_ISUPPORTS + + // nsIDOMNode + NS_IMPL_IDOMNODE_USING_GENERIC(mInner) + + // nsIDOMElement + NS_IMPL_IDOMELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLElement + NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner) + + // nsIDOMHTMLUListElement + NS_IMETHOD GetCompact(PRBool* aCompact); + NS_IMETHOD SetCompact(PRBool aCompact); + NS_IMETHOD GetType(nsString& aType); + NS_IMETHOD SetType(const nsString& aType); + + // nsIScriptObjectOwner + NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner) + + // nsIDOMEventReceiver + NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner) + + // nsIContent + NS_IMPL_ICONTENT_USING_GENERIC(mInner) + + // nsIHTMLContent + NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner) + +protected: + nsHTMLGenericContainerContent mInner; +}; + +nsresult +NS_NewHTMLUList(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) +{ + NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr"); + if (nsnull == aInstancePtrResult) { + return NS_ERROR_NULL_POINTER; + } + nsIHTMLContent* it = new nsHTMLUList(aTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); +} + +nsHTMLUList::nsHTMLUList(nsIAtom* aTag) +{ + NS_INIT_REFCNT(); + mInner.Init(this, aTag); +} + +nsHTMLUList::~nsHTMLUList() +{ +} + +NS_IMPL_ADDREF(nsHTMLUList) + +NS_IMPL_RELEASE(nsHTMLUList) + +nsresult +nsHTMLUList::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + NS_IMPL_HTML_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this) + if (aIID.Equals(kIDOMHTMLUListElementIID)) { + nsIDOMHTMLUListElement* tmp = this; + *aInstancePtr = (void*) tmp; + mRefCnt++; + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult +nsHTMLUList::CloneNode(nsIDOMNode** aReturn) +{ + nsHTMLUList* it = new nsHTMLUList(mInner.mTag); + if (nsnull == it) { + return NS_ERROR_OUT_OF_MEMORY; + } + mInner.CopyInnerTo(this, &it->mInner); + return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); +} + +NS_IMPL_BOOL_ATTR(nsHTMLUList, Compact, compact, eSetAttrNotify_Reflow) +NS_IMPL_STRING_ATTR(nsHTMLUList, Type, compact, eSetAttrNotify_Reflow) + +NS_IMETHODIMP +nsHTMLUList::StringToAttribute(nsIAtom* aAttribute, + const nsString& aValue, + nsHTMLValue& aResult) +{ + // XXX write me + return NS_CONTENT_ATTR_NOT_THERE; +} + +NS_IMETHODIMP +nsHTMLUList::AttributeToString(nsIAtom* aAttribute, + nsHTMLValue& aValue, + nsString& aResult) const +{ + // XXX write me + return mInner.AttributeToString(aAttribute, aValue, aResult); +} + +NS_IMETHODIMP +nsHTMLUList::MapAttributesInto(nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + // XXX write me + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLUList::HandleDOMEvent(nsIPresContext& aPresContext, + nsEvent* aEvent, + nsIDOMEvent** aDOMEvent, + PRUint32 aFlags, + nsEventStatus& aEventStatus) +{ + return mInner.HandleDOMEvent(aPresContext, aEvent, aDOMEvent, + aFlags, aEventStatus); +}