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/dom/Element.h"
11 #include "mozilla/dom/Event.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsICSSDeclaration.h"
14 #include "mozilla/dom/Document.h"
20 class UnrestrictedDoubleOrAnonymousKeyframeAnimationOptions
;
22 class AnonymousContent final
{
24 // Ref counting and cycle collection
25 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AnonymousContent
)
26 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AnonymousContent
)
28 explicit AnonymousContent(already_AddRefed
<Element
> aContentNode
);
29 Element
& ContentNode() { return *mContentNode
; }
31 Element
* GetElementById(const nsAString
& aElementId
);
32 bool WrapObject(JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
,
33 JS::MutableHandle
<JSObject
*> aReflector
);
36 void SetTextContentForElement(const nsAString
& aElementId
,
37 const nsAString
& aText
, ErrorResult
& aRv
);
39 void GetTextContentForElement(const nsAString
& aElementId
, DOMString
& aText
,
42 void SetAttributeForElement(const nsAString
& aElementId
,
43 const nsAString
& aName
, const nsAString
& aValue
,
44 nsIPrincipal
* aSubjectPrincipal
,
47 void GetAttributeForElement(const nsAString
& aElementId
,
48 const nsAString
& aName
, DOMString
& aValue
,
51 void RemoveAttributeForElement(const nsAString
& aElementId
,
52 const nsAString
& aName
, ErrorResult
& aRv
);
54 already_AddRefed
<nsISupports
> GetCanvasContext(const nsAString
& aElementId
,
55 const nsAString
& aContextId
,
58 already_AddRefed
<Animation
> SetAnimationForElement(
59 JSContext
* aContext
, const nsAString
& aElementId
,
60 JS::Handle
<JSObject
*> aKeyframes
,
61 const UnrestrictedDoubleOrKeyframeAnimationOptions
& aOptions
,
64 void SetCutoutRectsForElement(const nsAString
& aElementId
,
65 const Sequence
<OwningNonNull
<DOMRect
>>& aRects
,
68 void GetComputedStylePropertyValue(const nsAString
& aElementId
,
69 const nsAString
& aPropertyName
,
70 DOMString
& aResult
, ErrorResult
& aRv
);
72 void GetTargetIdForEvent(Event
& aEvent
, DOMString
& aResult
);
76 RefPtr
<Element
> mContentNode
;
80 } // namespace mozilla
82 #endif // mozilla_dom_AnonymousContent_h