Bug 827214. Fix HTML lists to really be webidl. r=peterv

This commit is contained in:
Boris Zbarsky 2013-01-07 08:34:16 -05:00
parent fc9352b6d6
commit fd28879969
6 changed files with 40 additions and 13 deletions

View File

@ -16,7 +16,9 @@
#include "nsMappedAttributes.h"
#include "nsRuleData.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(SharedList)
NS_IMPL_NS_NEW_HTML_ELEMENT(OList)
NS_IMPL_NS_NEW_HTML_ELEMENT(DList)
NS_IMPL_NS_NEW_HTML_ELEMENT(UList)
DOMCI_DATA(HTMLOListElement, mozilla::dom::HTMLSharedListElement)
DOMCI_DATA(HTMLDListElement, mozilla::dom::HTMLSharedListElement)
DOMCI_DATA(HTMLUListElement, mozilla::dom::HTMLSharedListElement)
@ -62,7 +64,9 @@ NS_INTERFACE_TABLE_HEAD(HTMLSharedListElement)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_IMPL_ELEMENT_CLONE(HTMLSharedListElement)
NS_IMPL_ELEMENT_CLONE(HTMLOListElement)
NS_IMPL_ELEMENT_CLONE(HTMLDListElement)
NS_IMPL_ELEMENT_CLONE(HTMLUListElement)
NS_IMPL_BOOL_ATTR(HTMLSharedListElement, Compact, compact)

View File

@ -55,7 +55,6 @@ public:
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo()
{
return static_cast<nsXPCClassInfo*>(GetClassInfoInternal());
@ -99,10 +98,20 @@ public:
{
SetHTMLBoolAttr(nsGkAtoms::compact, aCompact, rv);
}
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE = 0;
};
class HTMLDListElement MOZ_FINAL : public HTMLSharedListElement
{
public:
HTMLDListElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: HTMLSharedListElement(aNodeInfo)
{
}
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
@ -110,6 +119,12 @@ protected:
class HTMLOListElement MOZ_FINAL : public HTMLSharedListElement
{
public:
HTMLOListElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: HTMLSharedListElement(aNodeInfo)
{
}
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
@ -117,6 +132,12 @@ protected:
class HTMLUListElement MOZ_FINAL : public HTMLSharedListElement
{
public:
HTMLUListElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: HTMLSharedListElement(aNodeInfo)
{
}
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;

View File

@ -1910,7 +1910,6 @@ NS_NewHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Anchor)
@ -1925,6 +1924,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Canvas)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Mod)
NS_DECLARE_NS_NEW_HTML_ELEMENT(DataList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Div)
NS_DECLARE_NS_NEW_HTML_ELEMENT(DList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(FieldSet)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Font)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Form)
@ -1947,6 +1947,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(MenuItem)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Meta)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Meter)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Object)
NS_DECLARE_NS_NEW_HTML_ELEMENT(OList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Option)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Output)
@ -1971,6 +1972,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(TextArea)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Tfoot)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Thead)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Title)
NS_DECLARE_NS_NEW_HTML_ELEMENT(UList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Unknown)
#if defined(MOZ_MEDIA)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Video)

View File

@ -42,7 +42,7 @@ function test() {
HTML_TAG("dfn", "Span")
HTML_TAG("dir", "Shared")
HTML_TAG("div", "Div")
HTML_TAG("dl", "SharedList")
HTML_TAG("dl", "DList")
HTML_TAG("dt", "Span")
HTML_TAG("em", "Span")
HTML_TAG("embed", "SharedObject")
@ -84,7 +84,7 @@ function test() {
HTML_TAG("noframes", "Div")
HTML_TAG("noscript", "Div")
HTML_TAG("object", "Object")
HTML_TAG("ol", "SharedList")
HTML_TAG("ol", "OList")
HTML_TAG("optgroup", "OptGroup")
HTML_TAG("option", "Option")
HTML_TAG("p", "Paragraph")
@ -115,7 +115,7 @@ function test() {
HTML_TAG("tr", "TableRow")
HTML_TAG("tt", "Span")
HTML_TAG("u", "Span")
HTML_TAG("ul", "SharedList")
HTML_TAG("ul", "UList")
HTML_TAG("var", "Span")
HTML_TAG("wbr", "Shared")
HTML_TAG("xmp", "Span")

View File

@ -60,7 +60,7 @@ HTML_TAG("del", "Mod")
HTML_TAG("dfn", "Span")
HTML_TAG("dir", "Shared")
HTML_TAG("div", "Div")
HTML_TAG("dl", "SharedList")
HTML_TAG("dl", "DList")
HTML_TAG("dt", "Span")
HTML_TAG("em", "Span")
HTML_TAG("embed", "SharedObject")
@ -102,7 +102,7 @@ HTML_TAG("noembed", "Div")
HTML_TAG("noframes", "Div")
HTML_TAG("noscript", "Div")
HTML_TAG("object", "Object")
HTML_TAG("ol", "SharedList")
HTML_TAG("ol", "OList")
HTML_TAG("optgroup", "OptGroup")
HTML_TAG("option", "Option")
HTML_TAG("p", "Paragraph")
@ -133,7 +133,7 @@ HTML_TAG("title", "Title")
HTML_TAG("tr", "TableRow")
HTML_TAG("tt", "Span")
HTML_TAG("u", "Span")
HTML_TAG("ul", "SharedList")
HTML_TAG("ul", "UList")
HTML_TAG("var", "Span")
HTML_TAG("wbr", "Shared")
HTML_TAG("xmp", "Span")

View File

@ -70,7 +70,7 @@ HTML_TAG(del, Mod)
HTML_HTMLELEMENT_TAG(dfn)
HTML_TAG(dir, Shared)
HTML_TAG(div, Div)
HTML_TAG(dl, SharedList)
HTML_TAG(dl, DList)
HTML_HTMLELEMENT_TAG(dt)
HTML_HTMLELEMENT_TAG(em)
HTML_TAG(embed, SharedObject)
@ -120,7 +120,7 @@ HTML_HTMLELEMENT_TAG(noembed)
HTML_HTMLELEMENT_TAG(noframes)
HTML_HTMLELEMENT_TAG(noscript)
HTML_TAG(object, Object)
HTML_TAG(ol, SharedList)
HTML_TAG(ol, OList)
HTML_TAG(optgroup, OptGroup)
HTML_TAG(option, Option)
HTML_TAG(output, Output)
@ -156,7 +156,7 @@ HTML_TAG(title, Title)
HTML_TAG(tr, TableRow)
HTML_HTMLELEMENT_TAG(tt)
HTML_HTMLELEMENT_TAG(u)
HTML_TAG(ul, SharedList)
HTML_TAG(ul, UList)
HTML_HTMLELEMENT_TAG(var)
#if defined(MOZ_MEDIA)
HTML_TAG(video, Video)