diff --git a/content/html/content/src/HTMLMapElement.cpp b/content/html/content/src/HTMLMapElement.cpp
index 2e99d444e0a5..7b2d55e0b669 100644
--- a/content/html/content/src/HTMLMapElement.cpp
+++ b/content/html/content/src/HTMLMapElement.cpp
@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/HTMLMapElement.h"
+#include "mozilla/dom/HTMLMapElementBinding.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsContentList.h"
@@ -19,6 +20,7 @@ namespace dom {
HTMLMapElement::HTMLMapElement(already_AddRefed aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
+ SetIsDOMBinding();
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMapElement,
@@ -40,11 +42,9 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLMapElement)
NS_IMPL_ELEMENT_CLONE(HTMLMapElement)
-NS_IMETHODIMP
-HTMLMapElement::GetAreas(nsIDOMHTMLCollection** aAreas)
+nsIHTMLCollection*
+HTMLMapElement::Areas()
{
- NS_ENSURE_ARG_POINTER(aAreas);
-
if (!mAreas) {
// Not using NS_GetContentList because this should not be cached
mAreas = new nsContentList(this,
@@ -54,12 +54,26 @@ HTMLMapElement::GetAreas(nsIDOMHTMLCollection** aAreas)
false);
}
- NS_ADDREF(*aAreas = mAreas);
+ return mAreas;
+}
+
+NS_IMETHODIMP
+HTMLMapElement::GetAreas(nsIDOMHTMLCollection** aAreas)
+{
+ NS_ENSURE_ARG_POINTER(aAreas);
+ NS_ADDREF(*aAreas = Areas());
return NS_OK;
}
NS_IMPL_STRING_ATTR(HTMLMapElement, Name, name)
+
+JSObject*
+HTMLMapElement::WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
+{
+ return HTMLMapElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
+}
+
} // namespace dom
} // namespace mozilla
diff --git a/content/html/content/src/HTMLMapElement.h b/content/html/content/src/HTMLMapElement.h
index af5577671c67..5c08bfac9543 100644
--- a/content/html/content/src/HTMLMapElement.h
+++ b/content/html/content/src/HTMLMapElement.h
@@ -9,6 +9,7 @@
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsAutoPtr.h"
+#include "nsGkAtoms.h"
class nsContentList;
@@ -44,6 +45,17 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
+
+ // XPCOM GetName is fine.
+ void SetName(const nsAString& aName, ErrorResult& aError)
+ {
+ SetHTMLAttr(nsGkAtoms::name, aName, aError);
+ }
+ nsIHTMLCollection* Areas();
+
+ virtual JSObject*
+ WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
+
protected:
nsRefPtr mAreas;
};
diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
index 70553935e9ec..34528001b3e7 100644
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -419,6 +419,10 @@ DOMInterfaces = {
'hasInstanceInterface': 'nsIDOMHTMLLIElement',
},
+'HTMLMapElement': {
+ 'hasInstanceInterface': 'nsIDOMHTMLMapElement',
+},
+
'HTMLOListElement': {
'headerFile' : 'mozilla/dom/HTMLSharedListElement.h',
'hasInstanceInterface': 'nsIDOMHTMLOListElement'
diff --git a/dom/webidl/HTMLMapElement.webidl b/dom/webidl/HTMLMapElement.webidl
new file mode 100644
index 000000000000..88fe4e54c959
--- /dev/null
+++ b/dom/webidl/HTMLMapElement.webidl
@@ -0,0 +1,21 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * http://www.whatwg.org/specs/web-apps/current-work/#the-map-element
+ * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
+ * Opera Software ASA. You are granted a license to use, reproduce
+ * and create derivative works of this document.
+ */
+
+// http://www.whatwg.org/specs/web-apps/current-work/#the-map-element
+interface HTMLMapElement : HTMLElement {
+ [SetterThrows, Pure]
+ attribute DOMString name;
+ [Constant]
+ readonly attribute HTMLCollection areas;
+ // Not supported yet.
+ //readonly attribute HTMLCollection images;
+};
diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk
index 6d9c4f10ea96..f61728bfac22 100644
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -71,6 +71,7 @@ webidl_files = \
HTMLImageElement.webidl \
HTMLLabelElement.webidl \
HTMLLIElement.webidl \
+ HTMLMapElement.webidl \
HTMLOListElement.webidl \
HTMLOptionsCollection.webidl \
HTMLParagraphElement.webidl \