Bug 1494333 - index crons just like artifacts r=Callek
[gecko.git] / dom / html / HTMLElement.cpp
blob76caa73cf8c7d455620e1c5e5740a3a05d574abd
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/. */
7 #include "nsGenericHTMLElement.h"
8 #include "mozilla/dom/HTMLElementBinding.h"
9 #include "nsContentUtils.h"
11 namespace mozilla {
12 namespace dom {
14 class HTMLElement final : public nsGenericHTMLElement
16 public:
17 explicit HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
18 virtual ~HTMLElement();
20 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
22 protected:
23 JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
26 HTMLElement::HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
27 : nsGenericHTMLElement(std::move(aNodeInfo))
29 if (NodeInfo()->Equals(nsGkAtoms::bdi)) {
30 AddStatesSilently(NS_EVENT_STATE_DIR_ATTR_LIKE_AUTO);
34 HTMLElement::~HTMLElement()
38 NS_IMPL_ELEMENT_CLONE(HTMLElement)
40 JSObject*
41 HTMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
43 return dom::HTMLElement_Binding::Wrap(aCx, this, aGivenProto);
46 } // namespace dom
47 } // namespace mozilla
49 // Here, we expand 'NS_IMPL_NS_NEW_HTML_ELEMENT()' by hand.
50 // (Calling the macro directly (with no args) produces compiler warnings.)
51 nsGenericHTMLElement*
52 NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
53 mozilla::dom::FromParser aFromParser)
55 return new mozilla::dom::HTMLElement(std::move(aNodeInfo));
58 // Distinct from the above in order to have function pointer that compared unequal
59 // to a function pointer to the above.
60 nsGenericHTMLElement*
61 NS_NewCustomElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
62 mozilla::dom::FromParser aFromParser)
64 return new mozilla::dom::HTMLElement(std::move(aNodeInfo));