Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / base / AnonymousContent.h
blob024b315cada5654663395cc2a6e667c3f3c55a53
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 #ifndef mozilla_dom_AnonymousContent_h
8 #define mozilla_dom_AnonymousContent_h
10 #include "mozilla/AlreadyAddRefed.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsISupportsImpl.h"
14 namespace mozilla::dom {
16 class Element;
17 class Document;
18 class ShadowRoot;
20 class AnonymousContent final {
21 public:
22 // Ref counting and cycle collection
23 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AnonymousContent)
24 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AnonymousContent)
26 static already_AddRefed<AnonymousContent> Create(Document&);
28 Element* Host() const { return mHost.get(); }
29 ShadowRoot* Root() const { return mRoot.get(); }
31 bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
32 JS::MutableHandle<JSObject*> aReflector);
34 private:
35 ~AnonymousContent();
37 explicit AnonymousContent(already_AddRefed<Element> aHost,
38 already_AddRefed<ShadowRoot> aRoot);
39 RefPtr<Element> mHost;
40 RefPtr<ShadowRoot> mRoot;
43 } // namespace mozilla::dom
45 #endif // mozilla_dom_AnonymousContent_h