Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "mozilla/dom/HTMLMapElement.h"
8 : #include "mozilla/dom/HTMLMapElementBinding.h"
9 : #include "nsGkAtoms.h"
10 : #include "nsStyleConsts.h"
11 : #include "nsContentList.h"
12 : #include "nsCOMPtr.h"
13 :
14 0 : NS_IMPL_NS_NEW_HTML_ELEMENT(Map)
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 0 : HTMLMapElement::HTMLMapElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
20 0 : : nsGenericHTMLElement(aNodeInfo)
21 : {
22 0 : }
23 :
24 : NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLMapElement)
25 :
26 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLMapElement,
27 : nsGenericHTMLElement)
28 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAreas)
29 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
30 :
31 0 : NS_IMPL_ADDREF_INHERITED(HTMLMapElement, Element)
32 0 : NS_IMPL_RELEASE_INHERITED(HTMLMapElement, Element)
33 :
34 :
35 : // QueryInterface implementation for HTMLMapElement
36 0 : NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLMapElement)
37 0 : NS_INTERFACE_TABLE_INHERITED(HTMLMapElement, nsIDOMHTMLMapElement)
38 0 : NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement)
39 :
40 0 : NS_IMPL_ELEMENT_CLONE(HTMLMapElement)
41 :
42 :
43 : nsIHTMLCollection*
44 0 : HTMLMapElement::Areas()
45 : {
46 0 : if (!mAreas) {
47 : // Not using NS_GetContentList because this should not be cached
48 : mAreas = new nsContentList(this,
49 : kNameSpaceID_XHTML,
50 : nsGkAtoms::area,
51 : nsGkAtoms::area,
52 0 : false);
53 : }
54 :
55 0 : return mAreas;
56 : }
57 :
58 : NS_IMETHODIMP
59 0 : HTMLMapElement::GetAreas(nsIDOMHTMLCollection** aAreas)
60 : {
61 0 : NS_ENSURE_ARG_POINTER(aAreas);
62 0 : NS_ADDREF(*aAreas = Areas());
63 0 : return NS_OK;
64 : }
65 :
66 :
67 0 : NS_IMPL_STRING_ATTR(HTMLMapElement, Name, name)
68 :
69 :
70 : JSObject*
71 0 : HTMLMapElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
72 : {
73 0 : return HTMLMapElementBinding::Wrap(aCx, this, aGivenProto);
74 : }
75 :
76 : } // namespace dom
77 9 : } // namespace mozilla
|