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/. */
#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<nsINodeInfo> 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

View File

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

View File

@ -419,6 +419,10 @@ DOMInterfaces = {
'hasInstanceInterface': 'nsIDOMHTMLLIElement',
},
'HTMLMapElement': {
'hasInstanceInterface': 'nsIDOMHTMLMapElement',
},
'HTMLOListElement': {
'headerFile' : 'mozilla/dom/HTMLSharedListElement.h',
'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 \
HTMLLabelElement.webidl \
HTMLLIElement.webidl \
HTMLMapElement.webidl \
HTMLOListElement.webidl \
HTMLOptionsCollection.webidl \
HTMLParagraphElement.webidl \