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"
27 class UnrestrictedDoubleOrAnonymousKeyframeAnimationOptions
;
28 class UnrestrictedDoubleOrKeyframeAnimationOptions
;
30 class AnonymousContent final
{
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
);
44 void SetTextContentForElement(const nsAString
& aElementId
,
45 const nsAString
& aText
, ErrorResult
& aRv
);
47 void GetTextContentForElement(const nsAString
& aElementId
, DOMString
& aText
,
50 void SetAttributeForElement(const nsAString
& aElementId
,
51 const nsAString
& aName
, const nsAString
& aValue
,
52 nsIPrincipal
* aSubjectPrincipal
,
55 void GetAttributeForElement(const nsAString
& aElementId
,
56 const nsAString
& aName
, DOMString
& aValue
,
59 void RemoveAttributeForElement(const nsAString
& aElementId
,
60 const nsAString
& aName
, ErrorResult
& aRv
);
62 already_AddRefed
<nsISupports
> GetCanvasContext(const nsAString
& aElementId
,
63 const nsAString
& aContextId
,
66 already_AddRefed
<Animation
> SetAnimationForElement(
67 JSContext
* aContext
, const nsAString
& aElementId
,
68 JS::Handle
<JSObject
*> aKeyframes
,
69 const UnrestrictedDoubleOrKeyframeAnimationOptions
& aOptions
,
72 void SetCutoutRectsForElement(const nsAString
& aElementId
,
73 const Sequence
<OwningNonNull
<DOMRect
>>& aRects
,
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
,
87 RefPtr
<Element
> mContentNode
;
91 } // namespace mozilla
93 #endif // mozilla_dom_AnonymousContent_h