From 49a4f6901b8654b14a69e1f5a63e23b1ddaddb26 Mon Sep 17 00:00:00 2001 From: "sicking%bigfoot.com" Date: Mon, 12 Apr 2004 22:25:17 +0000 Subject: [PATCH] Bug 236873: Let more elements share classes to save codesize. r/sr=jst git-svn-id: svn://10.0.0.236/trunk@154716 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/content/src/Makefile.in | 10 +- .../html/content/src/nsGenericHTMLElement.cpp | 20 +- .../html/content/src/nsGenericHTMLElement.h | 33 +- .../content/html/content/src/nsHTMLAtomList.h | 5 +- .../content/src/nsHTMLBaseFontElement.cpp | 199 -------- .../html/content/src/nsHTMLDListElement.cpp | 147 ------ .../html/content/src/nsHTMLDelElement.cpp | 34 +- .../content/src/nsHTMLDirectoryElement.cpp | 234 ---------- .../html/content/src/nsHTMLInsElement.cpp | 147 ------ .../html/content/src/nsHTMLMenuElement.cpp | 234 ---------- .../html/content/src/nsHTMLOListElement.cpp | 129 ++++-- .../html/content/src/nsHTMLQuoteElement.cpp | 145 ------ .../html/content/src/nsHTMLSharedElement.cpp | 211 ++++++--- .../content/src/nsHTMLSharedLeafElement.cpp | 435 ------------------ .../html/content/src/nsHTMLSpanElement.cpp | 89 ++++ .../html/content/src/nsHTMLUListElement.cpp | 248 ---------- .../html/content/src/nsHTMLUnknownElement.cpp | 145 ------ .../html/document/src/nsPluginDocument.cpp | 2 +- .../content/shared/public/nsHTMLAtomList.h | 5 +- mozilla/htmlparser/public/nsHTMLTagList.h | 32 +- 20 files changed, 373 insertions(+), 2131 deletions(-) delete mode 100644 mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLDListElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLInsElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLMenuElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLQuoteElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLSharedLeafElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLUListElement.cpp delete mode 100644 mozilla/content/html/content/src/nsHTMLUnknownElement.cpp diff --git a/mozilla/content/html/content/src/Makefile.in b/mozilla/content/html/content/src/Makefile.in index cc9f16e01a4..bbe51641be7 100644 --- a/mozilla/content/html/content/src/Makefile.in +++ b/mozilla/content/html/content/src/Makefile.in @@ -64,12 +64,9 @@ CPPSRCS = \ nsHTMLAppletElement.cpp \ nsHTMLAreaElement.cpp \ nsHTMLBRElement.cpp \ - nsHTMLBaseFontElement.cpp \ nsHTMLBodyElement.cpp \ nsHTMLButtonElement.cpp \ - nsHTMLDListElement.cpp \ nsHTMLDelElement.cpp \ - nsHTMLDirectoryElement.cpp \ nsHTMLDivElement.cpp \ nsHTMLFieldSetElement.cpp \ nsHTMLFontElement.cpp \ @@ -83,13 +80,11 @@ CPPSRCS = \ nsHTMLIFrameElement.cpp \ nsHTMLImageElement.cpp \ nsHTMLInputElement.cpp \ - nsHTMLInsElement.cpp \ nsHTMLLIElement.cpp \ nsHTMLLabelElement.cpp \ nsHTMLLegendElement.cpp \ nsHTMLLinkElement.cpp \ nsHTMLMapElement.cpp \ - nsHTMLMenuElement.cpp \ nsHTMLMetaElement.cpp \ nsHTMLOListElement.cpp \ nsHTMLObjectElement.cpp \ @@ -97,10 +92,9 @@ CPPSRCS = \ nsHTMLOptGroupElement.cpp \ nsHTMLParagraphElement.cpp \ nsHTMLPreElement.cpp \ - nsHTMLQuoteElement.cpp \ nsHTMLScriptElement.cpp \ nsHTMLSelectElement.cpp \ - nsHTMLSharedLeafElement.cpp \ + nsHTMLSharedElement.cpp \ nsHTMLSpanElement.cpp \ nsHTMLStyleElement.cpp \ nsHTMLTableElement.cpp \ @@ -111,8 +105,6 @@ CPPSRCS = \ nsHTMLTableSectionElement.cpp \ nsHTMLTextAreaElement.cpp \ nsHTMLTitleElement.cpp \ - nsHTMLUListElement.cpp \ - nsHTMLUnknownElement.cpp \ $(NULL) EXPORTS = \ diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 3d2e17ad2a7..f804be6aa79 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -2141,27 +2141,11 @@ nsGenericHTMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } -/** - * Handle attributes on the BDO element - */ -static void -MapBdoAttributesInto(const nsMappedAttributes* aAttributes, - nsRuleData* aData) -{ - if (aData->mSID == eStyleStruct_TextReset && - aData->mTextData->mUnicodeBidi.GetUnit() == eCSSUnit_Null) { - aData->mTextData->mUnicodeBidi.SetIntValue(NS_STYLE_UNICODE_BIDI_OVERRIDE, eCSSUnit_Enumerated); - } - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - NS_IMETHODIMP nsGenericHTMLElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const { - if (mNodeInfo->Equals(nsHTMLAtoms::bdo)) - aMapRuleFunc = &MapBdoAttributesInto; - else - aMapRuleFunc = &MapCommonAttributesInto; + aMapRuleFunc = &MapCommonAttributesInto; + return NS_OK; } diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index 0979d5a36da..3e99eaeb13a 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -1029,10 +1029,8 @@ protected: #define NS_INTERFACE_MAP_ENTRY_IF_TAG(_interface, _tag) \ - if (mNodeInfo->Equals(nsHTMLAtoms::_tag) && \ - aIID.Equals(NS_GET_IID(_interface))) \ - foundInterface = NS_STATIC_CAST(_interface *, this); \ - else + NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, \ + mNodeInfo->Equals(nsHTMLAtoms::_tag)) #define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(_class, _tag) \ @@ -1051,7 +1049,7 @@ protected: // Element class factory methods nsresult -NS_NewHTMLSharedLeafElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); +NS_NewHTMLSharedElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewHTMLAnchorElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); @@ -1065,9 +1063,6 @@ NS_NewHTMLAreaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewHTMLBRElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); -nsresult -NS_NewHTMLBaseFontElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); - nsresult NS_NewHTMLBodyElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); @@ -1075,13 +1070,7 @@ nsresult NS_NewHTMLButtonElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult -NS_NewHTMLDListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); - -nsresult -NS_NewHTMLDelElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); - -nsresult -NS_NewHTMLDirectoryElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); +NS_NewHTMLModElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewHTMLDivElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); @@ -1123,9 +1112,6 @@ nsresult NS_NewHTMLInputElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo, PRBool aFromParser); -nsresult -NS_NewHTMLInsElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); - nsresult NS_NewHTMLLIElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); @@ -1141,14 +1127,11 @@ NS_NewHTMLLinkElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewHTMLMapElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); -nsresult -NS_NewHTMLMenuElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); - nsresult NS_NewHTMLMetaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult -NS_NewHTMLOListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); +NS_NewHTMLSharedListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewHTMLObjectElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); @@ -1165,9 +1148,6 @@ NS_NewHTMLParagraphElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewHTMLPreElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); -nsresult -NS_NewHTMLQuoteElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); - nsresult NS_NewHTMLScriptElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); @@ -1214,9 +1194,6 @@ NS_NewHTMLTheadElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewHTMLTitleElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); -nsresult -NS_NewHTMLUListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); - nsresult NS_NewHTMLUnknownElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo); diff --git a/mozilla/content/html/content/src/nsHTMLAtomList.h b/mozilla/content/html/content/src/nsHTMLAtomList.h index 5b4be7af74a..1962b3c707d 100644 --- a/mozilla/content/html/content/src/nsHTMLAtomList.h +++ b/mozilla/content/html/content/src/nsHTMLAtomList.h @@ -74,6 +74,7 @@ HTML_ATOM(autocheck, "autocheck") HTML_ATOM(axis, "axis") HTML_ATOM(background, "background") HTML_ATOM(base, "base") +HTML_ATOM(basefont, "basefont") HTML_ATOM(below, "below") HTML_ATOM(bdo, "bdo") HTML_ATOM(bgcolor, "bgcolor") @@ -119,12 +120,12 @@ HTML_ATOM(defaultselected, "defaultselected") HTML_ATOM(defaultvalue, "defaultvalue") HTML_ATOM(declare, "declare") HTML_ATOM(defer, "defer") +HTML_ATOM(del, "del") HTML_ATOM(dir, "dir") HTML_ATOM(div, "div") HTML_ATOM(disabled, "disabled") HTML_ATOM(dl, "dl") HTML_ATOM(dt, "dt") - HTML_ATOM(datetime, "datetime") HTML_ATOM(data, "data") HTML_ATOM(dfn, "dfn") @@ -172,6 +173,7 @@ HTML_ATOM(ilayer, "ilayer") HTML_ATOM(img, "img") HTML_ATOM(index, "index") HTML_ATOM(input, "input") +HTML_ATOM(ins, "ins") HTML_ATOM(isindex, "isindex") HTML_ATOM(ismap, "ismap") HTML_ATOM(label, "label") @@ -222,6 +224,7 @@ HTML_ATOM(pointSize, "point-size") HTML_ATOM(pre, "pre") HTML_ATOM(profile, "profile") HTML_ATOM(prompt, "prompt") +HTML_ATOM(q, "q") HTML_ATOM(readonly, "readonly") HTML_ATOM(refresh, "refresh") HTML_ATOM(rel, "rel") diff --git a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp b/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp deleted file mode 100644 index 35e8c7b3319..00000000000 --- a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLBaseFontElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" - - -class nsHTMLBaseFontElement : public nsGenericHTMLElement, - public nsIDOMHTMLBaseFontElement -{ -public: - nsHTMLBaseFontElement(); - virtual ~nsHTMLBaseFontElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLBaseElement - NS_DECL_NSIDOMHTMLBASEFONTELEMENT -}; - -nsresult -NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLBaseFontElement* it = new nsHTMLBaseFontElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLBaseFontElement::nsHTMLBaseFontElement() -{ -} - -nsHTMLBaseFontElement::~nsHTMLBaseFontElement() -{ -} - - -NS_IMPL_ADDREF(nsHTMLBaseFontElement) -NS_IMPL_RELEASE(nsHTMLBaseFontElement) - - -// QueryInterface implementation for nsHTMLBaseFontElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBaseFontElement, - nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLBaseFontElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLBaseFontElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLBaseFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLBaseFontElement* it = new nsHTMLBaseFontElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - - -NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Color, color) -NS_IMPL_STRING_ATTR(nsHTMLBaseFontElement, Face, face) - -NS_IMETHODIMP -nsHTMLBaseFontElement::GetSize(PRInt32 *aSize) -{ - *aSize = 3; - - nsHTMLValue value; - if (NS_CONTENT_ATTR_HAS_VALUE != - GetHTMLAttribute(nsHTMLAtoms::size, value)) { - return NS_OK; - } - - if (value.GetUnit() == eHTMLUnit_Integer) { - *aSize = value.GetIntValue(); - - return NS_OK; - } - - if (value.GetUnit() != eHTMLUnit_String) { - return NS_OK; - } - - nsAutoString stringValue; - value.GetStringValue(stringValue); - if (stringValue.IsEmpty()) { - return NS_OK; - } - - PRInt32 ec; - PRInt32 intValue; - intValue = stringValue.ToInteger(&ec); - if (ec != 0) { - return NS_ERROR_FAILURE; - } - - if (stringValue[0] == PRUnichar('+') || - stringValue[0] == PRUnichar('-')) { - *aSize += intValue; - } - else { - *aSize = intValue; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsHTMLBaseFontElement::SetSize(PRInt32 aSize) -{ - return SetIntAttr(nsHTMLAtoms::size, aSize); -} diff --git a/mozilla/content/html/content/src/nsHTMLDListElement.cpp b/mozilla/content/html/content/src/nsHTMLDListElement.cpp deleted file mode 100644 index b99d34cd1df..00000000000 --- a/mozilla/content/html/content/src/nsHTMLDListElement.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLDListElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" - - -class nsHTMLDListElement : public nsGenericHTMLElement, - public nsIDOMHTMLDListElement -{ -public: - nsHTMLDListElement(); - virtual ~nsHTMLDListElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLDListElement - NS_IMETHOD GetCompact(PRBool* aCompact); - NS_IMETHOD SetCompact(PRBool aCompact); -}; - -nsresult -NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLDListElement* it = new nsHTMLDListElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLDListElement::nsHTMLDListElement() -{ -} - -nsHTMLDListElement::~nsHTMLDListElement() -{ -} - - -NS_IMPL_ADDREF(nsHTMLDListElement) -NS_IMPL_RELEASE(nsHTMLDListElement) - - -// QueryInterface implementation for nsHTMLDListElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDListElement, nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLDListElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDListElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLDListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLDListElement* it = new nsHTMLDListElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - - -NS_IMPL_BOOL_ATTR(nsHTMLDListElement, Compact, compact) diff --git a/mozilla/content/html/content/src/nsHTMLDelElement.cpp b/mozilla/content/html/content/src/nsHTMLDelElement.cpp index b5dedf99adb..8b522a690f6 100644 --- a/mozilla/content/html/content/src/nsHTMLDelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDelElement.cpp @@ -44,12 +44,12 @@ #include "nsIPresContext.h" -class nsHTMLDelElement : public nsGenericHTMLElement, +class nsHTMLModElement : public nsGenericHTMLElement, public nsIDOMHTMLModElement { public: - nsHTMLDelElement(); - virtual ~nsHTMLDelElement(); + nsHTMLModElement(); + virtual ~nsHTMLModElement(); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -68,12 +68,12 @@ public: }; nsresult -NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult, +NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult, nsINodeInfo *aNodeInfo) { NS_ENSURE_ARG_POINTER(aInstancePtrResult); - nsHTMLDelElement* it = new nsHTMLDelElement(); + nsHTMLModElement* it = new nsHTMLModElement(); if (!it) { return NS_ERROR_OUT_OF_MEMORY; @@ -94,33 +94,35 @@ NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult, } -nsHTMLDelElement::nsHTMLDelElement() +nsHTMLModElement::nsHTMLModElement() { } -nsHTMLDelElement::~nsHTMLDelElement() +nsHTMLModElement::~nsHTMLModElement() { } -NS_IMPL_ADDREF_INHERITED(nsHTMLDelElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLDelElement, nsGenericElement) +NS_IMPL_ADDREF_INHERITED(nsHTMLModElement, nsGenericElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLModElement, nsGenericElement) -// QueryInterface implementation for nsHTMLDelElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDelElement, nsGenericHTMLElement) +// QueryInterface implementation for nsHTMLModElement +NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLModElement, nsGenericHTMLElement) NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLModElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDelElement) + + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLDelElement, del) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLInsElement, ins) NS_HTML_CONTENT_INTERFACE_MAP_END nsresult -nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +nsHTMLModElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; - nsHTMLDelElement* it = new nsHTMLDelElement(); + nsHTMLModElement* it = new nsHTMLModElement(); if (!it) { return NS_ERROR_OUT_OF_MEMORY; @@ -143,5 +145,5 @@ nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) } -NS_IMPL_STRING_ATTR(nsHTMLDelElement, Cite, cite) -NS_IMPL_STRING_ATTR(nsHTMLDelElement, DateTime, datetime) +NS_IMPL_STRING_ATTR(nsHTMLModElement, Cite, cite) +NS_IMPL_STRING_ATTR(nsHTMLModElement, DateTime, datetime) diff --git a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp deleted file mode 100644 index e135e3d7c11..00000000000 --- a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLDirectoryElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" -#include "nsMappedAttributes.h" -#include "nsRuleNode.h" - -// XXX nav4 has type= start= (same as OL/UL) - -extern nsHTMLValue::EnumTable kListTypeTable[]; - - -class nsHTMLDirectoryElement : public nsGenericHTMLElement, - public nsIDOMHTMLDirectoryElement -{ -public: - nsHTMLDirectoryElement(); - virtual ~nsHTMLDirectoryElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLDirectoryElement - NS_DECL_NSIDOMHTMLDIRECTORYELEMENT - - virtual PRBool ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult); - NS_IMETHOD AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const; - NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; - NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; -}; - -nsresult -NS_NewHTMLDirectoryElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLDirectoryElement* it = new nsHTMLDirectoryElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLDirectoryElement::nsHTMLDirectoryElement() -{ -} - -nsHTMLDirectoryElement::~nsHTMLDirectoryElement() -{ -} - -NS_IMPL_ADDREF_INHERITED(nsHTMLDirectoryElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLDirectoryElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLDirectoryElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDirectoryElement, - nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLDirectoryElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDirectoryElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLDirectoryElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLDirectoryElement* it = new nsHTMLDirectoryElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - - -NS_IMPL_BOOL_ATTR(nsHTMLDirectoryElement, Compact, compact) - - -PRBool -nsHTMLDirectoryElement::ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) -{ - if (aAttribute == nsHTMLAtoms::type) { - return aResult.ParseEnumValue(aValue, kListTypeTable); - } - if (aAttribute == nsHTMLAtoms::start) { - return aResult.ParseIntWithBounds(aValue, 1); - } - - return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult); -} - -NS_IMETHODIMP -nsHTMLDirectoryElement::AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const -{ - if (aAttribute == nsHTMLAtoms::type) { - aValue.EnumValueToString(kListTypeTable, aResult); - return NS_CONTENT_ATTR_HAS_VALUE; - } - return nsGenericHTMLElement::AttributeToString(aAttribute, aValue, aResult); -} - -static void -MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) -{ - if (aData->mSID == eStyleStruct_List) { - if (aData->mListData->mType.GetUnit() == eCSSUnit_Null) { - nsHTMLValue value; - // type: enum - if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) != - NS_CONTENT_ATTR_NOT_THERE) { - if (value.GetUnit() == eHTMLUnit_Enumerated) - aData->mListData->mType.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated); - else - aData->mListData->mType.SetIntValue(NS_STYLE_LIST_STYLE_DISC, eCSSUnit_Enumerated); - } - } - } - - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - -NS_IMETHODIMP_(PRBool) -nsHTMLDirectoryElement::IsAttributeMapped(const nsIAtom* aAttribute) const -{ - static const MappedAttributeEntry attributes[] = { - { &nsHTMLAtoms::type }, - // { &nsHTMLAtoms::compact }, // XXX - { nsnull} - }; - - static const MappedAttributeEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; - - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); -} - - -NS_IMETHODIMP -nsHTMLDirectoryElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const -{ - aMapRuleFunc = &MapAttributesIntoRule; - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLInsElement.cpp b/mozilla/content/html/content/src/nsHTMLInsElement.cpp deleted file mode 100644 index 62c940b08a2..00000000000 --- a/mozilla/content/html/content/src/nsHTMLInsElement.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLModElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" - - -class nsHTMLInsElement : public nsGenericHTMLElement, - public nsIDOMHTMLModElement -{ -public: - nsHTMLInsElement(); - virtual ~nsHTMLInsElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLModElement - NS_DECL_NSIDOMHTMLMODELEMENT -}; - -nsresult -NS_NewHTMLInsElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLInsElement* it = new nsHTMLInsElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLInsElement::nsHTMLInsElement() -{ -} - -nsHTMLInsElement::~nsHTMLInsElement() -{ -} - - -NS_IMPL_ADDREF_INHERITED(nsHTMLInsElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLInsElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLInsElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLInsElement, nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLModElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLInsElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLInsElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLInsElement* it = new nsHTMLInsElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - - -NS_IMPL_STRING_ATTR(nsHTMLInsElement, Cite, cite) -NS_IMPL_STRING_ATTR(nsHTMLInsElement, DateTime, datetime) diff --git a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp deleted file mode 100644 index e301481cfe2..00000000000 --- a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLMenuElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" -#include "nsMappedAttributes.h" -#include "nsRuleNode.h" - -// XXX nav4 has type= start= (same as OL/UL) - -extern nsHTMLValue::EnumTable kListTypeTable[]; - - -class nsHTMLMenuElement : public nsGenericHTMLElement, - public nsIDOMHTMLMenuElement -{ -public: - nsHTMLMenuElement(); - virtual ~nsHTMLMenuElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLMenuElement - NS_IMETHOD GetCompact(PRBool* aCompact); - NS_IMETHOD SetCompact(PRBool aCompact); - - virtual PRBool ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult); - NS_IMETHOD AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const; - NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; -}; - -nsresult -NS_NewHTMLMenuElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLMenuElement* it = new nsHTMLMenuElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLMenuElement::nsHTMLMenuElement() -{ -} - -nsHTMLMenuElement::~nsHTMLMenuElement() -{ -} - - -NS_IMPL_ADDREF_INHERITED(nsHTMLMenuElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLMenuElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLMenuElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLMenuElement, nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLMenuElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLMenuElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLMenuElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLMenuElement* it = new nsHTMLMenuElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - - -NS_IMPL_BOOL_ATTR(nsHTMLMenuElement, Compact, compact) - - -PRBool -nsHTMLMenuElement::ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) -{ - if (aAttribute == nsHTMLAtoms::type) { - return aResult.ParseEnumValue(aValue, kListTypeTable); - } - if (aAttribute == nsHTMLAtoms::start) { - return aResult.ParseIntWithBounds(aValue, 1); - } - - return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult); -} - -NS_IMETHODIMP -nsHTMLMenuElement::AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const -{ - if (aAttribute == nsHTMLAtoms::type) { - aValue.EnumValueToString(kListTypeTable, aResult); - return NS_CONTENT_ATTR_HAS_VALUE; - } - - return nsGenericHTMLElement::AttributeToString(aAttribute, aValue, aResult); -} - -static void -MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) -{ - if (aData->mSID == eStyleStruct_List) { - if (aData->mListData->mType.GetUnit() == eCSSUnit_Null) { - nsHTMLValue value; - // type: enum - if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) != - NS_CONTENT_ATTR_NOT_THERE) { - if (value.GetUnit() == eHTMLUnit_Enumerated) - aData->mListData->mType.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated); - else - aData->mListData->mType.SetIntValue(NS_STYLE_LIST_STYLE_DISC, eCSSUnit_Enumerated); - } - } - } - - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - -NS_IMETHODIMP_(PRBool) -nsHTMLMenuElement::IsAttributeMapped(const nsIAtom* aAttribute) const -{ - static const MappedAttributeEntry attributes[] = { - { &nsHTMLAtoms::type }, - { nsnull } - }; - - static const MappedAttributeEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; - - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); -} - -NS_IMETHODIMP -nsHTMLMenuElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const -{ - aMapRuleFunc = &MapAttributesIntoRule; - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLOListElement.cpp b/mozilla/content/html/content/src/nsHTMLOListElement.cpp index 8dced46b064..dc47de9c8c7 100644 --- a/mozilla/content/html/content/src/nsHTMLOListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOListElement.cpp @@ -36,6 +36,8 @@ * * ***** END LICENSE BLOCK ***** */ #include "nsIDOMHTMLOListElement.h" +#include "nsIDOMHTMLDListElement.h" +#include "nsIDOMHTMLUListElement.h" #include "nsIDOMEventReceiver.h" #include "nsIHTMLContent.h" #include "nsGenericHTMLElement.h" @@ -45,12 +47,14 @@ #include "nsMappedAttributes.h" #include "nsRuleNode.h" -class nsHTMLOListElement : public nsGenericHTMLElement, - public nsIDOMHTMLOListElement +class nsHTMLSharedListElement : public nsGenericHTMLElement, + public nsIDOMHTMLOListElement, + public nsIDOMHTMLDListElement, + public nsIDOMHTMLUListElement { public: - nsHTMLOListElement(); - virtual ~nsHTMLOListElement(); + nsHTMLSharedListElement(); + virtual ~nsHTMLSharedListElement(); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -67,6 +71,12 @@ public: // nsIDOMHTMLOListElement NS_DECL_NSIDOMHTMLOLISTELEMENT + // nsIDOMHTMLDListElement + // fully declared by NS_DECL_NSIDOMHTMLOLISTELEMENT + + // nsIDOMHTMLUListElement + // fully declared by NS_DECL_NSIDOMHTMLOLISTELEMENT + virtual PRBool ParseAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult); @@ -78,12 +88,12 @@ public: }; nsresult -NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) +NS_NewHTMLSharedListElement(nsIHTMLContent** aInstancePtrResult, + nsINodeInfo *aNodeInfo) { NS_ENSURE_ARG_POINTER(aInstancePtrResult); - nsHTMLOListElement* it = new nsHTMLOListElement(); + nsHTMLSharedListElement* it = new nsHTMLSharedListElement(); if (!it) { return NS_ERROR_OUT_OF_MEMORY; @@ -104,39 +114,45 @@ NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult, } -nsHTMLOListElement::nsHTMLOListElement() +nsHTMLSharedListElement::nsHTMLSharedListElement() { } -nsHTMLOListElement::~nsHTMLOListElement() +nsHTMLSharedListElement::~nsHTMLSharedListElement() { } -NS_IMPL_ADDREF_INHERITED(nsHTMLOListElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLOListElement, nsGenericElement) +NS_IMPL_ADDREF_INHERITED(nsHTMLSharedListElement, nsGenericElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLSharedListElement, nsGenericElement) -// QueryInterface implementation for nsHTMLOListElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLOListElement, nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLOListElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLOListElement) +// QueryInterface implementation for nsHTMLSharedListElement +NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedListElement, + nsGenericHTMLElement, + nsIDOMHTMLOListElement) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLOListElement, ol) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLDListElement, dl) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLUListElement, ul) + + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLOListElement, ol) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLDListElement, dl) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLUListElement, ul) NS_HTML_CONTENT_INTERFACE_MAP_END - nsresult -nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +nsHTMLSharedListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; - nsHTMLOListElement* it = new nsHTMLOListElement(); + nsHTMLSharedListElement* it = new nsHTMLSharedListElement(); if (!it) { return NS_ERROR_OUT_OF_MEMORY; } - nsCOMPtr kungFuDeathGrip(it); + nsCOMPtr kungFuDeathGrip(it); nsresult rv = it->Init(mNodeInfo); @@ -145,7 +161,7 @@ nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) CopyInnerTo(it, aDeep); - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); + *aReturn = NS_STATIC_CAST(nsIDOMHTMLOListElement *, it); NS_ADDREF(*aReturn); @@ -153,9 +169,9 @@ nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) } -NS_IMPL_BOOL_ATTR(nsHTMLOListElement, Compact, compact) -NS_IMPL_INT_ATTR(nsHTMLOListElement, Start, start) -NS_IMPL_STRING_ATTR(nsHTMLOListElement, Type, type) +NS_IMPL_BOOL_ATTR(nsHTMLSharedListElement, Compact, compact) +NS_IMPL_INT_ATTR(nsHTMLSharedListElement, Start, start) +NS_IMPL_STRING_ATTR(nsHTMLSharedListElement, Type, type) nsHTMLValue::EnumTable kListTypeTable[] = { @@ -182,27 +198,32 @@ nsHTMLValue::EnumTable kOldListTypeTable[] = { }; PRBool -nsHTMLOListElement::ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) +nsHTMLSharedListElement::ParseAttribute(nsIAtom* aAttribute, + const nsAString& aValue, + nsAttrValue& aResult) { - if (aAttribute == nsHTMLAtoms::type) { - return aResult.ParseEnumValue(aValue, kListTypeTable) || - aResult.ParseEnumValue(aValue, kOldListTypeTable, PR_TRUE); - } - if (aAttribute == nsHTMLAtoms::start) { - return aResult.ParseIntValue(aValue); + if (mNodeInfo->Equals(nsHTMLAtoms::ol) || + mNodeInfo->Equals(nsHTMLAtoms::ul)) { + if (aAttribute == nsHTMLAtoms::type) { + return aResult.ParseEnumValue(aValue, kListTypeTable) || + aResult.ParseEnumValue(aValue, kOldListTypeTable, PR_TRUE); + } + if (aAttribute == nsHTMLAtoms::start) { + return aResult.ParseIntValue(aValue); + } } return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult); } NS_IMETHODIMP -nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const +nsHTMLSharedListElement::AttributeToString(nsIAtom* aAttribute, + const nsHTMLValue& aValue, + nsAString& aResult) const { - if (aAttribute == nsHTMLAtoms::type) { + if (aAttribute == nsHTMLAtoms::type && + (mNodeInfo->Equals(nsHTMLAtoms::ol) || + mNodeInfo->Equals(nsHTMLAtoms::ul))) { PRInt32 v = aValue.GetIntValue(); switch (v) { case NS_STYLE_LIST_STYLE_OLD_DECIMAL: @@ -244,25 +265,35 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) } NS_IMETHODIMP_(PRBool) -nsHTMLOListElement::IsAttributeMapped(const nsIAtom* aAttribute) const +nsHTMLSharedListElement::IsAttributeMapped(const nsIAtom* aAttribute) const { - static const MappedAttributeEntry attributes[] = { - { &nsHTMLAtoms::type }, - { nsnull } - }; + if (mNodeInfo->Equals(nsHTMLAtoms::ol) || + mNodeInfo->Equals(nsHTMLAtoms::ul)) { + static const MappedAttributeEntry attributes[] = { + { &nsHTMLAtoms::type }, + { nsnull } + }; - static const MappedAttributeEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; + static const MappedAttributeEntry* const map[] = { + attributes, + sCommonAttributeMap, + }; - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); + } + + return nsGenericHTMLElement::IsAttributeMapped(aAttribute); } - NS_IMETHODIMP -nsHTMLOListElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const +nsHTMLSharedListElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const { - aMapRuleFunc = &MapAttributesIntoRule; + if (mNodeInfo->Equals(nsHTMLAtoms::ol) || + mNodeInfo->Equals(nsHTMLAtoms::ul)) { + aMapRuleFunc = &MapAttributesIntoRule; + } + else { + nsGenericHTMLElement::GetAttributeMappingFunction(aMapRuleFunc); + } return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp b/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp deleted file mode 100644 index 7c277837c2c..00000000000 --- a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLQuoteElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" - - -class nsHTMLQuoteElement : public nsGenericHTMLElement, - public nsIDOMHTMLQuoteElement -{ -public: - nsHTMLQuoteElement(); - virtual ~nsHTMLQuoteElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLQuoteElement - NS_DECL_NSIDOMHTMLQUOTEELEMENT -}; - -nsresult -NS_NewHTMLQuoteElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLQuoteElement* it = new nsHTMLQuoteElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLQuoteElement::nsHTMLQuoteElement() -{ -} - -nsHTMLQuoteElement::~nsHTMLQuoteElement() -{ -} - -NS_IMPL_ADDREF_INHERITED(nsHTMLQuoteElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLQuoteElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLQuoteElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLQuoteElement, nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLQuoteElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLQuoteElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLQuoteElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLQuoteElement* it = new nsHTMLQuoteElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - - -NS_IMPL_URI_ATTR(nsHTMLQuoteElement, Cite, cite) diff --git a/mozilla/content/html/content/src/nsHTMLSharedElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedElement.cpp index 60ac01840a2..b728f733f9e 100644 --- a/mozilla/content/html/content/src/nsHTMLSharedElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSharedElement.cpp @@ -39,6 +39,10 @@ #include "nsIDOMHTMLIsIndexElement.h" #include "nsIDOMHTMLParamElement.h" #include "nsIDOMHTMLBaseElement.h" +#include "nsIDOMHTMLDirectoryElement.h" +#include "nsIDOMHTMLMenuElement.h" +#include "nsIDOMHTMLQuoteElement.h" +#include "nsIDOMHTMLBaseFontElement.h" #include "nsIDOMEventReceiver.h" #include "nsIHTMLContent.h" #include "nsGenericHTMLElement.h" @@ -50,17 +54,23 @@ #include "nsMappedAttributes.h" #include "nsStyleContext.h" +// XXX nav4 has type= start= (same as OL/UL) +extern nsHTMLValue::EnumTable kListTypeTable[]; -class nsHTMLSharedLeafElement : public nsGenericHTMLElement, - public nsImageLoadingContent, - public nsIDOMHTMLEmbedElement, - public nsIDOMHTMLIsIndexElement, - public nsIDOMHTMLParamElement, - public nsIDOMHTMLBaseElement +class nsHTMLSharedElement : public nsGenericHTMLElement, + public nsImageLoadingContent, + public nsIDOMHTMLEmbedElement, + public nsIDOMHTMLIsIndexElement, + public nsIDOMHTMLParamElement, + public nsIDOMHTMLBaseElement, + public nsIDOMHTMLDirectoryElement, + public nsIDOMHTMLMenuElement, + public nsIDOMHTMLQuoteElement, + public nsIDOMHTMLBaseFontElement { public: - nsHTMLSharedLeafElement(); - virtual ~nsHTMLSharedLeafElement(); + nsHTMLSharedElement(); + virtual ~nsHTMLSharedElement(); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -84,7 +94,6 @@ public: // NS_DECL_NSIDOMHTMLPARAMELEMENT since some of the methods in // nsIDOMHTMLParamElement clashes with methods in // nsIDOMHTMLEmbedElement - NS_IMETHOD GetValue(nsAString& aValue); NS_IMETHOD SetValue(const nsAString& aValue); NS_IMETHOD GetValueType(nsAString& aValueType); @@ -93,6 +102,18 @@ public: // nsIDOMHTMLBaseElement NS_DECL_NSIDOMHTMLBASEELEMENT + // nsIDOMHTMLDirectoryElement + NS_DECL_NSIDOMHTMLDIRECTORYELEMENT + + // nsIDOMHTMLMenuElement + // Same as directoryelement + + // nsIDOMHTMLQuoteElement + NS_DECL_NSIDOMHTMLQUOTEELEMENT + + // nsIDOMHTMLBaseFontElement + NS_DECL_NSIDOMHTMLBASEFONTELEMENT + virtual PRBool ParseAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult); @@ -104,12 +125,12 @@ public: }; nsresult -NS_NewHTMLSharedLeafElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) +NS_NewHTMLSharedElement(nsIHTMLContent** aInstancePtrResult, + nsINodeInfo *aNodeInfo) { NS_ENSURE_ARG_POINTER(aInstancePtrResult); - nsHTMLSharedLeafElement* it = new nsHTMLSharedLeafElement(); + nsHTMLSharedElement* it = new nsHTMLSharedElement(); if (!it) { return NS_ERROR_OUT_OF_MEMORY; @@ -130,30 +151,34 @@ NS_NewHTMLSharedLeafElement(nsIHTMLContent** aInstancePtrResult, } -nsHTMLSharedLeafElement::nsHTMLSharedLeafElement() +nsHTMLSharedElement::nsHTMLSharedElement() { } -nsHTMLSharedLeafElement::~nsHTMLSharedLeafElement() +nsHTMLSharedElement::~nsHTMLSharedElement() { } -NS_IMPL_ADDREF_INHERITED(nsHTMLSharedLeafElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLSharedLeafElement, nsGenericElement) +NS_IMPL_ADDREF_INHERITED(nsHTMLSharedElement, nsGenericElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLSharedElement, nsGenericElement) -// QueryInterface implementation for nsHTMLSharedLeafElement -NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedLeafElement, +// QueryInterface implementation for nsHTMLSharedElement +NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedElement, nsGenericHTMLElement, nsIDOMHTMLEmbedElement) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMHTMLElement, nsIDOMHTMLEmbedElement) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed) NS_INTERFACE_MAP_ENTRY_IF_TAG(imgIDecoderObserver, embed) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIImageLoadingContent, embed) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLParamElement, param) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLIsIndexElement, isindex) NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseElement, base) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLDirectoryElement, dir) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLMenuElement, menu) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, q) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, blockquote) + NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseFontElement, basefont) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLEmbedElement, embed) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLParamElement, param) @@ -161,16 +186,20 @@ NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedLeafElement, NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLIsIndexElement, isindex) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLBaseElement, base) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLSpacerElement, spacer) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLDirectoryElement, dir) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLMenuElement, menu) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLQuoteElement, q) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLQuoteElement, blockquote) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLBaseFontElement, basefont) NS_HTML_CONTENT_INTERFACE_MAP_END - nsresult -nsHTMLSharedLeafElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +nsHTMLSharedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = nsnull; - nsHTMLSharedLeafElement* it = new nsHTMLSharedLeafElement(); + nsHTMLSharedElement* it = new nsHTMLSharedElement(); if (!it) { return NS_ERROR_OUT_OF_MEMORY; @@ -195,23 +224,36 @@ nsHTMLSharedLeafElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) ///////////////////////////////////////////// // Implement nsIDOMHTMLEmbedElement interface -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Align, align) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Height, height) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Width, width) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Name, name) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Type, type) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Src, src) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Align, align) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Height, height) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Width, width) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Name, name) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Type, type) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Src, src) // nsIDOMHTMLParamElement -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Value, value) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, ValueType, valuetype) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Value, value) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, ValueType, valuetype) // nsIDOMHTMLIsIndexElement -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Prompt, prompt) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Prompt, prompt) +// nsIDOMHTMLDirectoryElement +NS_IMPL_BOOL_ATTR(nsHTMLSharedElement, Compact, compact) + +// nsIDOMHTMLMenuElement +//NS_IMPL_BOOL_ATTR(nsHTMLSharedElement, Compact, compact) + +// nsIDOMHTMLQuoteElement +NS_IMPL_URI_ATTR(nsHTMLSharedElement, Cite, cite) + +// nsIDOMHTMLBaseFontElement +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Color, color) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Face, face) +NS_IMPL_INT_ATTR(nsHTMLSharedElement, Size, size) NS_IMETHODIMP -nsHTMLSharedLeafElement::GetForm(nsIDOMHTMLFormElement** aForm) +nsHTMLSharedElement::GetForm(nsIDOMHTMLFormElement** aForm) { *aForm = FindForm().get(); @@ -219,15 +261,15 @@ nsHTMLSharedLeafElement::GetForm(nsIDOMHTMLFormElement** aForm) } // nsIDOMHTMLBaseElement -NS_IMPL_URI_ATTR(nsHTMLSharedLeafElement, Href, href) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Target, target) +NS_IMPL_URI_ATTR(nsHTMLSharedElement, Href, href) +NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Target, target) // spacer element code PRBool -nsHTMLSharedLeafElement::ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) +nsHTMLSharedElement::ParseAttribute(nsIAtom* aAttribute, + const nsAString& aValue, + nsAttrValue& aResult) { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { if (aAttribute == nsHTMLAtoms::align) { @@ -236,7 +278,8 @@ nsHTMLSharedLeafElement::ParseAttribute(nsIAtom* aAttribute, if (ParseImageAttribute(aAttribute, aValue, aResult)) { return PR_TRUE; } - } else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { + } + else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { if (aAttribute == nsHTMLAtoms::size) { return aResult.ParseIntWithBounds(aValue, 0); } @@ -248,14 +291,28 @@ nsHTMLSharedLeafElement::ParseAttribute(nsIAtom* aAttribute, return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE); } } + else if (mNodeInfo->Equals(nsHTMLAtoms::dir) || + mNodeInfo->Equals(nsHTMLAtoms::menu)) { + if (aAttribute == nsHTMLAtoms::type) { + return aResult.ParseEnumValue(aValue, kListTypeTable); + } + if (aAttribute == nsHTMLAtoms::start) { + return aResult.ParseIntWithBounds(aValue, 1); + } + } + else if (mNodeInfo->Equals(nsHTMLAtoms::basefont)) { + if (aAttribute == nsHTMLAtoms::size) { + return aResult.ParseIntValue(aValue); + } + } return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult); } NS_IMETHODIMP -nsHTMLSharedLeafElement::AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const +nsHTMLSharedElement::AttributeToString(nsIAtom* aAttribute, + const nsHTMLValue& aValue, + nsAString& aResult) const { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { if (aAttribute == nsHTMLAtoms::align) { @@ -264,7 +321,8 @@ nsHTMLSharedLeafElement::AttributeToString(nsIAtom* aAttribute, return NS_CONTENT_ATTR_HAS_VALUE; } } - } else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { + } + else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { if (aAttribute == nsHTMLAtoms::align) { if (eHTMLUnit_Enumerated == aValue.GetUnit()) { AlignValueToString(aValue, aResult); @@ -272,6 +330,13 @@ nsHTMLSharedLeafElement::AttributeToString(nsIAtom* aAttribute, } } } + else if (mNodeInfo->Equals(nsHTMLAtoms::dir) || + mNodeInfo->Equals(nsHTMLAtoms::menu)) { + if (aAttribute == nsHTMLAtoms::type) { + aValue.EnumValueToString(kListTypeTable, aResult); + return NS_CONTENT_ATTR_HAS_VALUE; + } + } return nsGenericHTMLElement::AttributeToString(aAttribute, aValue, aResult); } @@ -365,9 +430,6 @@ static void EmbedMapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) { - if (!aData) - return; - nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); @@ -375,17 +437,29 @@ EmbedMapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } - static void -PlainMapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) +DirectoryMenuMapAttributesIntoRule(const nsMappedAttributes* aAttributes, + nsRuleData* aData) { + if (aData->mSID == eStyleStruct_List) { + if (aData->mListData->mType.GetUnit() == eCSSUnit_Null) { + nsHTMLValue value; + // type: enum + if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) != + NS_CONTENT_ATTR_NOT_THERE) { + if (value.GetUnit() == eHTMLUnit_Enumerated) + aData->mListData->mType.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated); + else + aData->mListData->mType.SetIntValue(NS_STYLE_LIST_STYLE_DISC, eCSSUnit_Enumerated); + } + } + } + nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } - NS_IMETHODIMP_(PRBool) -nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const +nsHTMLSharedElement::IsAttributeMapped(const nsIAtom* aAttribute) const { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { static const MappedAttributeEntry* const map[] = { @@ -394,7 +468,7 @@ nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const sImageAlignAttributeMap, sImageBorderAttributeMap }; - + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } @@ -413,7 +487,22 @@ nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const sImageMarginSizeAttributeMap, sImageBorderAttributeMap, }; - + + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); + } + + if (mNodeInfo->Equals(nsHTMLAtoms::dir)) { + static const MappedAttributeEntry attributes[] = { + { &nsHTMLAtoms::type }, + // { &nsHTMLAtoms::compact }, // XXX + { nsnull} + }; + + static const MappedAttributeEntry* const map[] = { + attributes, + sCommonAttributeMap, + }; + return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); } @@ -421,15 +510,21 @@ nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const } NS_IMETHODIMP -nsHTMLSharedLeafElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const +nsHTMLSharedElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { aMapRuleFunc = &EmbedMapAttributesIntoRule; - } else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { - aMapRuleFunc = &SpacerMapAttributesIntoRule; - } else { - aMapRuleFunc = &PlainMapAttributesIntoRule; } - + else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { + aMapRuleFunc = &SpacerMapAttributesIntoRule; + } + else if (mNodeInfo->Equals(nsHTMLAtoms::dir) || + mNodeInfo->Equals(nsHTMLAtoms::menu)) { + aMapRuleFunc = &DirectoryMenuMapAttributesIntoRule; + } + else { + nsGenericHTMLElement::GetAttributeMappingFunction(aMapRuleFunc); + } + return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLSharedLeafElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedLeafElement.cpp deleted file mode 100644 index 60ac01840a2..00000000000 --- a/mozilla/content/html/content/src/nsHTMLSharedLeafElement.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLEmbedElement.h" -#include "nsIDOMHTMLIsIndexElement.h" -#include "nsIDOMHTMLParamElement.h" -#include "nsIDOMHTMLBaseElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsImageLoadingContent.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" -#include "nsRuleNode.h" -#include "nsMappedAttributes.h" -#include "nsStyleContext.h" - - -class nsHTMLSharedLeafElement : public nsGenericHTMLElement, - public nsImageLoadingContent, - public nsIDOMHTMLEmbedElement, - public nsIDOMHTMLIsIndexElement, - public nsIDOMHTMLParamElement, - public nsIDOMHTMLBaseElement -{ -public: - nsHTMLSharedLeafElement(); - virtual ~nsHTMLSharedLeafElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLEmbedElement - NS_DECL_NSIDOMHTMLEMBEDELEMENT - - // nsIDOMHTMLIsIndexElement - NS_DECL_NSIDOMHTMLISINDEXELEMENT - - // nsIDOMHTMLParamElement Can't use the macro - // NS_DECL_NSIDOMHTMLPARAMELEMENT since some of the methods in - // nsIDOMHTMLParamElement clashes with methods in - // nsIDOMHTMLEmbedElement - - NS_IMETHOD GetValue(nsAString& aValue); - NS_IMETHOD SetValue(const nsAString& aValue); - NS_IMETHOD GetValueType(nsAString& aValueType); - NS_IMETHOD SetValueType(const nsAString& aValueType); - - // nsIDOMHTMLBaseElement - NS_DECL_NSIDOMHTMLBASEELEMENT - - virtual PRBool ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult); - NS_IMETHOD AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const; - NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; -}; - -nsresult -NS_NewHTMLSharedLeafElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLSharedLeafElement* it = new nsHTMLSharedLeafElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLSharedLeafElement::nsHTMLSharedLeafElement() -{ -} - -nsHTMLSharedLeafElement::~nsHTMLSharedLeafElement() -{ -} - - -NS_IMPL_ADDREF_INHERITED(nsHTMLSharedLeafElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLSharedLeafElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLSharedLeafElement -NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedLeafElement, - nsGenericHTMLElement, - nsIDOMHTMLEmbedElement) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMHTMLElement, nsIDOMHTMLEmbedElement) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(imgIDecoderObserver, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIImageLoadingContent, embed) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLParamElement, param) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLIsIndexElement, isindex) - NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseElement, base) - - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLEmbedElement, embed) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLParamElement, param) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLWBRElement, wbr) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLIsIndexElement, isindex) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLBaseElement, base) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLSpacerElement, spacer) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLSharedLeafElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLSharedLeafElement* it = new nsHTMLSharedLeafElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip = - NS_STATIC_CAST(nsIDOMHTMLEmbedElement *, it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMHTMLEmbedElement *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - -///////////////////////////////////////////// -// Implement nsIDOMHTMLEmbedElement interface -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Align, align) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Height, height) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Width, width) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Name, name) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Type, type) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Src, src) - -// nsIDOMHTMLParamElement -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Value, value) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, ValueType, valuetype) - -// nsIDOMHTMLIsIndexElement -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Prompt, prompt) - - -NS_IMETHODIMP -nsHTMLSharedLeafElement::GetForm(nsIDOMHTMLFormElement** aForm) -{ - *aForm = FindForm().get(); - - return NS_OK; -} - -// nsIDOMHTMLBaseElement -NS_IMPL_URI_ATTR(nsHTMLSharedLeafElement, Href, href) -NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Target, target) - -// spacer element code - -PRBool -nsHTMLSharedLeafElement::ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - if (aAttribute == nsHTMLAtoms::align) { - return ParseAlignValue(aValue, aResult); - } - if (ParseImageAttribute(aAttribute, aValue, aResult)) { - return PR_TRUE; - } - } else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { - if (aAttribute == nsHTMLAtoms::size) { - return aResult.ParseIntWithBounds(aValue, 0); - } - if (aAttribute == nsHTMLAtoms::align) { - return ParseAlignValue(aValue, aResult); - } - if (aAttribute == nsHTMLAtoms::width || - aAttribute == nsHTMLAtoms::height) { - return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE); - } - } - - return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult); -} - -NS_IMETHODIMP -nsHTMLSharedLeafElement::AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - if (aAttribute == nsHTMLAtoms::align) { - if (eHTMLUnit_Enumerated == aValue.GetUnit()) { - AlignValueToString(aValue, aResult); - return NS_CONTENT_ATTR_HAS_VALUE; - } - } - } else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { - if (aAttribute == nsHTMLAtoms::align) { - if (eHTMLUnit_Enumerated == aValue.GetUnit()) { - AlignValueToString(aValue, aResult); - return NS_CONTENT_ATTR_HAS_VALUE; - } - } - } - - return nsGenericHTMLElement::AttributeToString(aAttribute, aValue, aResult); -} - -static void -SpacerMapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) -{ - nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); - - if (aData->mSID == eStyleStruct_Position) { - nsHTMLValue value; - - const nsStyleDisplay* display = aData->mStyleContext->GetStyleDisplay(); - - PRBool typeIsBlock = (display->mDisplay == NS_STYLE_DISPLAY_BLOCK); - - if (typeIsBlock) { - // width: value - if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) { - aAttributes->GetAttribute(nsHTMLAtoms::width, value); - if (value.GetUnit() == eHTMLUnit_Integer) { - aData->mPositionData-> - mWidth.SetFloatValue((float)value.GetIntValue(), eCSSUnit_Pixel); - } else if (value.GetUnit() == eHTMLUnit_Percent) { - aData->mPositionData-> - mWidth.SetPercentValue(value.GetPercentValue()); - } - } - - // height: value - if (aData->mPositionData->mHeight.GetUnit() == eCSSUnit_Null) { - aAttributes->GetAttribute(nsHTMLAtoms::height, value); - if (value.GetUnit() == eHTMLUnit_Integer) { - aData->mPositionData-> - mHeight.SetFloatValue((float)value.GetIntValue(), - eCSSUnit_Pixel); - } else if (value.GetUnit() == eHTMLUnit_Percent) { - aData->mPositionData-> - mHeight.SetPercentValue(value.GetPercentValue()); - } - } - } else { - // size: value - if (aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) { - aAttributes->GetAttribute(nsHTMLAtoms::size, value); - if (value.GetUnit() == eHTMLUnit_Integer) - aData->mPositionData-> - mWidth.SetFloatValue((float)value.GetIntValue(), - eCSSUnit_Pixel); - } - } - } else if (aData->mSID == eStyleStruct_Display) { - nsHTMLValue value; - aAttributes->GetAttribute(nsHTMLAtoms::align, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - PRUint8 align = (PRUint8)(value.GetIntValue()); - if (aData->mDisplayData->mFloat.GetUnit() == eCSSUnit_Null) { - if (align == NS_STYLE_TEXT_ALIGN_LEFT) - aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_LEFT, - eCSSUnit_Enumerated); - else if (align == NS_STYLE_TEXT_ALIGN_RIGHT) - aData->mDisplayData->mFloat.SetIntValue(NS_STYLE_FLOAT_RIGHT, - eCSSUnit_Enumerated); - } - } - - if (aData->mDisplayData->mDisplay == eCSSUnit_Null) { - if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) != - NS_CONTENT_ATTR_NOT_THERE && - eHTMLUnit_String == value.GetUnit()) { - nsAutoString tmp; - value.GetStringValue(tmp); - if (tmp.EqualsIgnoreCase("line") || - tmp.EqualsIgnoreCase("vert") || - tmp.EqualsIgnoreCase("vertical") || - tmp.EqualsIgnoreCase("block")) { - // This is not strictly 100% compatible: if the spacer is given - // a width of zero then it is basically ignored. - aData->mDisplayData->mDisplay = NS_STYLE_DISPLAY_BLOCK; - } - } - } - } - - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - -static void -EmbedMapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) -{ - if (!aData) - return; - - nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); - nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - - -static void -PlainMapAttributesIntoRule(const nsMappedAttributes* aAttributes, - nsRuleData* aData) -{ - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - - -NS_IMETHODIMP_(PRBool) -nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - static const MappedAttributeEntry* const map[] = { - sCommonAttributeMap, - sImageMarginSizeAttributeMap, - sImageAlignAttributeMap, - sImageBorderAttributeMap - }; - - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); - } - - if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { - static const MappedAttributeEntry attributes[] = { - // XXXldb This is just wrong. - { &nsHTMLAtoms::usemap }, - { &nsHTMLAtoms::ismap }, - { &nsHTMLAtoms::align }, - { nsnull } - }; - - static const MappedAttributeEntry* const map[] = { - attributes, - sCommonAttributeMap, - sImageMarginSizeAttributeMap, - sImageBorderAttributeMap, - }; - - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); - } - - return nsGenericHTMLElement::IsAttributeMapped(aAttribute); -} - -NS_IMETHODIMP -nsHTMLSharedLeafElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const -{ - if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { - aMapRuleFunc = &EmbedMapAttributesIntoRule; - } else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { - aMapRuleFunc = &SpacerMapAttributesIntoRule; - } else { - aMapRuleFunc = &PlainMapAttributesIntoRule; - } - - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp index 9a9bf9c1ce6..d41216cb6b8 100644 --- a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp @@ -43,6 +43,7 @@ #include "nsStyleConsts.h" #include "nsIPresContext.h" #include "nsIAtom.h" +#include "nsRuleNode.h" class nsHTMLSpanElement : public nsGenericHTMLElement, public nsIDOMHTMLElement @@ -63,6 +64,7 @@ public: // nsIDOMHTMLElement NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) + NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; virtual nsresult GetInnerHTML(nsAString& aInnerHTML); virtual nsresult SetInnerHTML(const nsAString& aInnerHTML); }; @@ -141,6 +143,30 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) return NS_OK; } +static void +BdoMapAttributesIntoRule(const nsMappedAttributes* aAttributes, + nsRuleData* aData) +{ + if (aData->mSID == eStyleStruct_TextReset && + aData->mTextData->mUnicodeBidi.GetUnit() == eCSSUnit_Null) { + aData->mTextData->mUnicodeBidi.SetIntValue(NS_STYLE_UNICODE_BIDI_OVERRIDE, eCSSUnit_Enumerated); + } + nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); +} + +NS_IMETHODIMP +nsHTMLSpanElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const +{ + if (mNodeInfo->Equals(nsHTMLAtoms::bdo)) { + aMapRuleFunc = &BdoMapAttributesIntoRule; + } + else { + nsGenericHTMLElement::GetAttributeMappingFunction(aMapRuleFunc); + } + + return NS_OK; +} + nsresult nsHTMLSpanElement::GetInnerHTML(nsAString& aInnerHTML) { @@ -162,3 +188,66 @@ nsHTMLSpanElement::SetInnerHTML(const nsAString& aInnerHTML) return nsGenericHTMLElement::SetInnerHTML(aInnerHTML); } + +// ------------------------------------------------------------------ + +class nsHTMLUnknownElement : public nsHTMLSpanElement +{ + NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); + NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); +}; + +NS_INTERFACE_MAP_BEGIN(nsHTMLUnknownElement) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLUnknownElement) +NS_INTERFACE_MAP_END_INHERITING(nsHTMLSpanElement) + +nsresult +NS_NewHTMLUnknownElement(nsIHTMLContent** aInstancePtrResult, + nsINodeInfo *aNodeInfo) +{ + NS_ENSURE_ARG_POINTER(aInstancePtrResult); + + nsHTMLUnknownElement* it = new nsHTMLUnknownElement(); + + if (!it) { + return NS_ERROR_OUT_OF_MEMORY; + } + + nsresult rv = it->Init(aNodeInfo); + + if (NS_FAILED(rv)) { + delete it; + + return rv; + } + + NS_ADDREF(*aInstancePtrResult = it); + + return NS_OK; +} + +nsresult +nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) +{ + NS_ENSURE_ARG_POINTER(aReturn); + *aReturn = nsnull; + + nsHTMLUnknownElement* it = new nsHTMLUnknownElement(); + + if (!it) { + return NS_ERROR_OUT_OF_MEMORY; + } + + nsCOMPtr kungFuDeathGrip(it); + + nsresult rv = it->Init(mNodeInfo); + + if (NS_FAILED(rv)) + return rv; + + CopyInnerTo(it, aDeep); + + NS_ADDREF(*aReturn = it); + + return NS_OK; +} diff --git a/mozilla/content/html/content/src/nsHTMLUListElement.cpp b/mozilla/content/html/content/src/nsHTMLUListElement.cpp deleted file mode 100644 index 909ea005f8b..00000000000 --- a/mozilla/content/html/content/src/nsHTMLUListElement.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMHTMLUListElement.h" -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" -#include "nsMappedAttributes.h" -#include "nsRuleNode.h" - -extern nsHTMLValue::EnumTable kListTypeTable[]; -extern nsHTMLValue::EnumTable kOldListTypeTable[]; - -class nsHTMLUListElement : public nsGenericHTMLElement, - public nsIDOMHTMLUListElement -{ -public: - nsHTMLUListElement(); - virtual ~nsHTMLUListElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLUListElement - NS_DECL_NSIDOMHTMLULISTELEMENT - - virtual PRBool ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult); - NS_IMETHOD AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const; - NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; - NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; -}; - -nsresult -NS_NewHTMLUListElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLUListElement* it = new nsHTMLUListElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLUListElement::nsHTMLUListElement() -{ -} - -nsHTMLUListElement::~nsHTMLUListElement() -{ -} - - -NS_IMPL_ADDREF_INHERITED(nsHTMLUListElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLUListElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLUListElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLUListElement, nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLUListElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLUListElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLUListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLUListElement* it = new nsHTMLUListElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} - - -NS_IMPL_BOOL_ATTR(nsHTMLUListElement, Compact, compact) -NS_IMPL_STRING_ATTR(nsHTMLUListElement, Type, type) - - -PRBool -nsHTMLUListElement::ParseAttribute(nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) -{ - if (aAttribute == nsHTMLAtoms::type) { - return aResult.ParseEnumValue(aValue, kListTypeTable) || - aResult.ParseEnumValue(aValue, kOldListTypeTable, PR_TRUE); - } - if (aAttribute == nsHTMLAtoms::start) { - return aResult.ParseIntWithBounds(aValue, 1); - } - - return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult); -} - -NS_IMETHODIMP -nsHTMLUListElement::AttributeToString(nsIAtom* aAttribute, - const nsHTMLValue& aValue, - nsAString& aResult) const -{ - if (aAttribute == nsHTMLAtoms::type) { - PRInt32 v = aValue.GetIntValue(); - switch (v) { - case NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN: - case NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN: - case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA: - case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA: - aValue.EnumValueToString(kOldListTypeTable, aResult); - - break; - default: - aValue.EnumValueToString(kListTypeTable, aResult); - - break; - } - - return NS_CONTENT_ATTR_HAS_VALUE; - } - - return nsGenericHTMLElement::AttributeToString(aAttribute, aValue, aResult); -} - -static void -MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) -{ - if (aData->mSID == eStyleStruct_List) { - if (aData->mListData->mType.GetUnit() == eCSSUnit_Null) { - nsHTMLValue value; - // type: enum - if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) != - NS_CONTENT_ATTR_NOT_THERE) { - if (value.GetUnit() == eHTMLUnit_Enumerated) - aData->mListData->mType.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated); - else - aData->mListData->mType.SetIntValue(NS_STYLE_LIST_STYLE_DISC, eCSSUnit_Enumerated); - } - } - } - - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); -} - -NS_IMETHODIMP_(PRBool) -nsHTMLUListElement::IsAttributeMapped(const nsIAtom* aAttribute) const -{ - static const MappedAttributeEntry attributes[] = { - { &nsHTMLAtoms::type }, - { nsnull } - }; - - static const MappedAttributeEntry* const map[] = { - attributes, - sCommonAttributeMap, - }; - - return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map)); -} - - -NS_IMETHODIMP -nsHTMLUListElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const -{ - aMapRuleFunc = &MapAttributesIntoRule; - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLUnknownElement.cpp b/mozilla/content/html/content/src/nsHTMLUnknownElement.cpp deleted file mode 100644 index 3080f582e6d..00000000000 --- a/mozilla/content/html/content/src/nsHTMLUnknownElement.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (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 the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMEventReceiver.h" -#include "nsIHTMLContent.h" -#include "nsGenericHTMLElement.h" -#include "nsHTMLAtoms.h" -#include "nsStyleConsts.h" -#include "nsIPresContext.h" -#include "nsLayoutAtoms.h" -#include "nsHTMLAtoms.h" -#include "nsIEventListenerManager.h" -#include "nsIDOMEventReceiver.h" -#include "nsIDocument.h" -#include "nsHTMLStyleSheet.h" -#include "nsIDOMMutationEvent.h" - -class nsHTMLUnknownElement : public nsGenericHTMLElement, - public nsIDOMHTMLElement -{ -public: - nsHTMLUnknownElement(); - virtual ~nsHTMLUnknownElement(); - - // nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIDOMNode - NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLElement::) - - // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) - - // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) -}; - -nsresult -NS_NewHTMLUnknownElement(nsIHTMLContent** aInstancePtrResult, - nsINodeInfo *aNodeInfo) -{ - NS_ENSURE_ARG_POINTER(aInstancePtrResult); - - nsHTMLUnknownElement* it = new nsHTMLUnknownElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsresult rv = it->Init(aNodeInfo); - - if (NS_FAILED(rv)) { - delete it; - - return rv; - } - - *aInstancePtrResult = NS_STATIC_CAST(nsIHTMLContent *, it); - NS_ADDREF(*aInstancePtrResult); - - return NS_OK; -} - - -nsHTMLUnknownElement::nsHTMLUnknownElement() -{ -} - -nsHTMLUnknownElement::~nsHTMLUnknownElement() -{ -} - - -NS_IMPL_ADDREF_INHERITED(nsHTMLUnknownElement, nsGenericElement) -NS_IMPL_RELEASE_INHERITED(nsHTMLUnknownElement, nsGenericElement) - - -// QueryInterface implementation for nsHTMLUnknownElement -NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLUnknownElement, - nsGenericHTMLElement) - NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLUnknownElement) -NS_HTML_CONTENT_INTERFACE_MAP_END - - -nsresult -nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = nsnull; - - nsHTMLUnknownElement* it = new nsHTMLUnknownElement(); - - if (!it) { - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr kungFuDeathGrip(it); - - nsresult rv = it->Init(mNodeInfo); - - if (NS_FAILED(rv)) - return rv; - - CopyInnerTo(it, aDeep); - - *aReturn = NS_STATIC_CAST(nsIDOMNode *, it); - - NS_ADDREF(*aReturn); - - return NS_OK; -} diff --git a/mozilla/content/html/document/src/nsPluginDocument.cpp b/mozilla/content/html/document/src/nsPluginDocument.cpp index 10c125727de..d5ec1aed2e9 100644 --- a/mozilla/content/html/document/src/nsPluginDocument.cpp +++ b/mozilla/content/html/document/src/nsPluginDocument.cpp @@ -175,7 +175,7 @@ nsPluginDocument::CreateSyntheticPluginDocument() kNameSpaceID_None, getter_AddRefs(nodeInfo)); NS_ENSURE_SUCCESS(rv, rv); - rv = NS_NewHTMLSharedLeafElement(getter_AddRefs(mPluginContent), nodeInfo); + rv = NS_NewHTMLSharedElement(getter_AddRefs(mPluginContent), nodeInfo); if (NS_FAILED(rv)) { return rv; } diff --git a/mozilla/content/shared/public/nsHTMLAtomList.h b/mozilla/content/shared/public/nsHTMLAtomList.h index 5b4be7af74a..1962b3c707d 100644 --- a/mozilla/content/shared/public/nsHTMLAtomList.h +++ b/mozilla/content/shared/public/nsHTMLAtomList.h @@ -74,6 +74,7 @@ HTML_ATOM(autocheck, "autocheck") HTML_ATOM(axis, "axis") HTML_ATOM(background, "background") HTML_ATOM(base, "base") +HTML_ATOM(basefont, "basefont") HTML_ATOM(below, "below") HTML_ATOM(bdo, "bdo") HTML_ATOM(bgcolor, "bgcolor") @@ -119,12 +120,12 @@ HTML_ATOM(defaultselected, "defaultselected") HTML_ATOM(defaultvalue, "defaultvalue") HTML_ATOM(declare, "declare") HTML_ATOM(defer, "defer") +HTML_ATOM(del, "del") HTML_ATOM(dir, "dir") HTML_ATOM(div, "div") HTML_ATOM(disabled, "disabled") HTML_ATOM(dl, "dl") HTML_ATOM(dt, "dt") - HTML_ATOM(datetime, "datetime") HTML_ATOM(data, "data") HTML_ATOM(dfn, "dfn") @@ -172,6 +173,7 @@ HTML_ATOM(ilayer, "ilayer") HTML_ATOM(img, "img") HTML_ATOM(index, "index") HTML_ATOM(input, "input") +HTML_ATOM(ins, "ins") HTML_ATOM(isindex, "isindex") HTML_ATOM(ismap, "ismap") HTML_ATOM(label, "label") @@ -222,6 +224,7 @@ HTML_ATOM(pointSize, "point-size") HTML_ATOM(pre, "pre") HTML_ATOM(profile, "profile") HTML_ATOM(prompt, "prompt") +HTML_ATOM(q, "q") HTML_ATOM(readonly, "readonly") HTML_ATOM(refresh, "refresh") HTML_ATOM(rel, "rel") diff --git a/mozilla/htmlparser/public/nsHTMLTagList.h b/mozilla/htmlparser/public/nsHTMLTagList.h index d8e4d7609cb..b3f828d03cd 100644 --- a/mozilla/htmlparser/public/nsHTMLTagList.h +++ b/mozilla/htmlparser/public/nsHTMLTagList.h @@ -71,13 +71,13 @@ HTML_TAG(address, Span) HTML_TAG(applet, Applet) HTML_TAG(area, Area) HTML_TAG(b, Span) -HTML_TAG(base, SharedLeaf) -HTML_TAG(basefont, BaseFont) +HTML_TAG(base, Shared) +HTML_TAG(basefont, Shared) HTML_TAG(bdo, Span) HTML_TAG(bgsound, Span) HTML_TAG(big, Span) HTML_TAG(blink, Span) -HTML_TAG(blockquote, Quote) +HTML_TAG(blockquote, Shared) HTML_TAG(body, Body) HTML_TAG(br, BR) HTML_TAG(button, Button) @@ -89,14 +89,14 @@ HTML_TAG(col, TableCol) HTML_TAG(colgroup, TableCol) HTML_TAG(counter, Span) HTML_TAG(dd, Span) -HTML_TAG(del, Del) +HTML_TAG(del, Mod) HTML_TAG(dfn, Span) -HTML_TAG(dir, Directory) +HTML_TAG(dir, Shared) HTML_TAG(div, Div) -HTML_TAG(dl, DList) +HTML_TAG(dl, SharedList) HTML_TAG(dt, Span) HTML_TAG(em, Span) -HTML_TAG(embed, SharedLeaf) +HTML_TAG(embed, Shared) HTML_TAG(endnote, Span) HTML_TAG(fieldset, FieldSet) HTML_TAG(font, Font) @@ -117,8 +117,8 @@ HTML_TAG(iframe, IFrame) HTML_TAG(image, Span) HTML_TAG(img, Image) HTML_TAG(input, NOTUSED) -HTML_TAG(ins, Ins) -HTML_TAG(isindex, SharedLeaf) +HTML_TAG(ins, Mod) +HTML_TAG(isindex, Shared) HTML_TAG(kbd, Span) HTML_TAG(keygen, Span) HTML_TAG(label, Label) @@ -128,7 +128,7 @@ HTML_TAG(link, Link) HTML_TAG(listing, Span) HTML_TAG(map, Map) HTML_TAG(marquee, Div) -HTML_TAG(menu, Menu) +HTML_TAG(menu, Shared) HTML_TAG(meta, Meta) HTML_TAG(multicol, Span) HTML_TAG(nobr, Span) @@ -136,15 +136,15 @@ HTML_TAG(noembed, Div) HTML_TAG(noframes, Div) HTML_TAG(noscript, Div) HTML_TAG(object, Object) -HTML_TAG(ol, OList) +HTML_TAG(ol, SharedList) HTML_TAG(optgroup, OptGroup) HTML_TAG(option, Option) HTML_TAG(p, Paragraph) -HTML_TAG(param, SharedLeaf) +HTML_TAG(param, Shared) HTML_TAG(parsererror, Div) HTML_TAG(plaintext, Span) HTML_TAG(pre, Pre) -HTML_TAG(q, Quote) +HTML_TAG(q, Shared) HTML_TAG(s, Span) HTML_TAG(samp, Span) HTML_TAG(script, Script) @@ -153,7 +153,7 @@ HTML_TAG(server, Span) HTML_TAG(small, Span) HTML_TAG(sound, Span) HTML_TAG(sourcetext, Div) -HTML_TAG(spacer, SharedLeaf) +HTML_TAG(spacer, Shared) HTML_TAG(span, Span) HTML_TAG(strike, Span) HTML_TAG(strong, Span) @@ -171,9 +171,9 @@ HTML_TAG(title, Title) HTML_TAG(tr, TableRow) HTML_TAG(tt, Span) HTML_TAG(u, Span) -HTML_TAG(ul, UList) +HTML_TAG(ul, SharedList) HTML_TAG(var, Span) -HTML_TAG(wbr, SharedLeaf) +HTML_TAG(wbr, Shared) HTML_TAG(xmp, Span)