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 "nsGenericHTMLElement.h"
8 : #include "mozilla/dom/HTMLElementBinding.h"
9 : #include "nsContentUtils.h"
10 :
11 : namespace mozilla {
12 : namespace dom {
13 :
14 : class HTMLElement final : public nsGenericHTMLElement
15 : {
16 : public:
17 : explicit HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
18 : virtual ~HTMLElement();
19 :
20 : virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo,
21 : nsINode** aResult,
22 : bool aPreallocateChildren) const override;
23 :
24 : protected:
25 : virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
26 : };
27 :
28 4 : HTMLElement::HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
29 4 : : nsGenericHTMLElement(aNodeInfo)
30 : {
31 4 : }
32 :
33 0 : HTMLElement::~HTMLElement()
34 : {
35 0 : }
36 :
37 0 : NS_IMPL_ELEMENT_CLONE(HTMLElement)
38 :
39 : JSObject*
40 0 : HTMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
41 : {
42 0 : return dom::HTMLElementBinding::Wrap(aCx, this, aGivenProto);
43 : }
44 :
45 : } // namespace dom
46 : } // namespace mozilla
47 :
48 : // Here, we expand 'NS_IMPL_NS_NEW_HTML_ELEMENT()' by hand.
49 : // (Calling the macro directly (with no args) produces compiler warnings.)
50 : nsGenericHTMLElement*
51 4 : NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
52 : mozilla::dom::FromParser aFromParser)
53 : {
54 4 : return new mozilla::dom::HTMLElement(aNodeInfo);
55 : }
|