Bug 1750871 - run mochitest-remote on fission everywhere. r=releng-reviewers,aki
[gecko.git] / dom / base / AnonymousContent.h
blob5096605a1664570b887196242f0d6261fa11b9bb
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 "nsCycleCollectionParticipant.h"
11 #include "nsISupportsImpl.h"
13 class nsIPrincipal;
15 namespace mozilla {
16 class ErrorResult;
18 namespace dom {
20 class Animation;
21 class DOMRect;
22 class DOMString;
23 class Element;
24 class Event;
25 template <typename T>
26 class Sequence;
27 class UnrestrictedDoubleOrAnonymousKeyframeAnimationOptions;
28 class UnrestrictedDoubleOrKeyframeAnimationOptions;
30 class AnonymousContent final {
31 public:
32 // Ref counting and cycle collection
33 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AnonymousContent)
34 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AnonymousContent)
36 explicit AnonymousContent(already_AddRefed<Element> aContentNode);
37 Element& ContentNode() { return *mContentNode; }
39 Element* GetElementById(const nsAString& aElementId);
40 bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
41 JS::MutableHandle<JSObject*> aReflector);
43 // WebIDL methods
44 void SetTextContentForElement(const nsAString& aElementId,
45 const nsAString& aText, ErrorResult& aRv);
47 void GetTextContentForElement(const nsAString& aElementId, DOMString& aText,
48 ErrorResult& aRv);
50 void SetAttributeForElement(const nsAString& aElementId,
51 const nsAString& aName, const nsAString& aValue,
52 nsIPrincipal* aSubjectPrincipal,
53 ErrorResult& aRv);
55 void GetAttributeForElement(const nsAString& aElementId,
56 const nsAString& aName, DOMString& aValue,
57 ErrorResult& aRv);
59 void RemoveAttributeForElement(const nsAString& aElementId,
60 const nsAString& aName, ErrorResult& aRv);
62 already_AddRefed<nsISupports> GetCanvasContext(const nsAString& aElementId,
63 const nsAString& aContextId,
64 ErrorResult& aRv);
66 already_AddRefed<Animation> SetAnimationForElement(
67 JSContext* aContext, const nsAString& aElementId,
68 JS::Handle<JSObject*> aKeyframes,
69 const UnrestrictedDoubleOrKeyframeAnimationOptions& aOptions,
70 ErrorResult& aError);
72 void SetCutoutRectsForElement(const nsAString& aElementId,
73 const Sequence<OwningNonNull<DOMRect>>& aRects,
74 ErrorResult& aError);
76 void GetComputedStylePropertyValue(const nsAString& aElementId,
77 const nsACString& aPropertyName,
78 nsACString& aResult, ErrorResult& aRv);
80 void GetTargetIdForEvent(Event& aEvent, DOMString& aResult);
82 void SetStyle(const nsACString& aProperty, const nsACString& aValue,
83 ErrorResult& aRv);
85 private:
86 ~AnonymousContent();
87 RefPtr<Element> mContentNode;
90 } // namespace dom
91 } // namespace mozilla
93 #endif // mozilla_dom_AnonymousContent_h