Bug 837597 - Part b: Move HTMLMapElement to Paris bindings; r=bz

This commit is contained in:
Ms2ger 2013-02-07 09:08:57 +01:00
parent 52d44d828e
commit 0034b41450
5 changed files with 57 additions and 5 deletions

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/HTMLMapElement.h" #include "mozilla/dom/HTMLMapElement.h"
#include "mozilla/dom/HTMLMapElementBinding.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsStyleConsts.h" #include "nsStyleConsts.h"
#include "nsContentList.h" #include "nsContentList.h"
@ -19,6 +20,7 @@ namespace dom {
HTMLMapElement::HTMLMapElement(already_AddRefed<nsINodeInfo> aNodeInfo) HTMLMapElement::HTMLMapElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo) : nsGenericHTMLElement(aNodeInfo)
{ {
SetIsDOMBinding();
} }
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMapElement, 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_IMPL_ELEMENT_CLONE(HTMLMapElement)
NS_IMETHODIMP nsIHTMLCollection*
HTMLMapElement::GetAreas(nsIDOMHTMLCollection** aAreas) HTMLMapElement::Areas()
{ {
NS_ENSURE_ARG_POINTER(aAreas);
if (!mAreas) { if (!mAreas) {
// Not using NS_GetContentList because this should not be cached // Not using NS_GetContentList because this should not be cached
mAreas = new nsContentList(this, mAreas = new nsContentList(this,
@ -54,12 +54,26 @@ HTMLMapElement::GetAreas(nsIDOMHTMLCollection** aAreas)
false); 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; return NS_OK;
} }
NS_IMPL_STRING_ATTR(HTMLMapElement, Name, name) 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 dom
} // namespace mozilla } // namespace mozilla

View File

@ -9,6 +9,7 @@
#include "nsGenericHTMLElement.h" #include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLMapElement.h" #include "nsIDOMHTMLMapElement.h"
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsGkAtoms.h"
class nsContentList; class nsContentList;
@ -44,6 +45,17 @@ public:
virtual nsXPCClassInfo* GetClassInfo(); virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; } 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: protected:
nsRefPtr<nsContentList> mAreas; nsRefPtr<nsContentList> mAreas;
}; };

View File

@ -419,6 +419,10 @@ DOMInterfaces = {
'hasInstanceInterface': 'nsIDOMHTMLLIElement', 'hasInstanceInterface': 'nsIDOMHTMLLIElement',
}, },
'HTMLMapElement': {
'hasInstanceInterface': 'nsIDOMHTMLMapElement',
},
'HTMLOListElement': { 'HTMLOListElement': {
'headerFile' : 'mozilla/dom/HTMLSharedListElement.h', 'headerFile' : 'mozilla/dom/HTMLSharedListElement.h',
'hasInstanceInterface': 'nsIDOMHTMLOListElement' 'hasInstanceInterface': 'nsIDOMHTMLOListElement'

View File

@ -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;
};

View File

@ -71,6 +71,7 @@ webidl_files = \
HTMLImageElement.webidl \ HTMLImageElement.webidl \
HTMLLabelElement.webidl \ HTMLLabelElement.webidl \
HTMLLIElement.webidl \ HTMLLIElement.webidl \
HTMLMapElement.webidl \
HTMLOListElement.webidl \ HTMLOListElement.webidl \
HTMLOptionsCollection.webidl \ HTMLOptionsCollection.webidl \
HTMLParagraphElement.webidl \ HTMLParagraphElement.webidl \