Bug 1776680 [wpt PR 34603] - [@container] Test invalidation of font-relative units...
[gecko.git] / dom / events / ClipboardItem.h
blobfb043aa20119aebb932c8efed3cc882d2f145b2d
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_ClipboardItem_h_
8 #define mozilla_dom_ClipboardItem_h_
10 #include "mozilla/dom/Blob.h"
11 #include "mozilla/dom/ClipboardBinding.h"
13 #include "nsWrapperCache.h"
15 namespace mozilla::dom {
17 struct ClipboardItemOptions;
18 template <typename KeyType, typename ValueType>
19 class Record;
20 class Promise;
22 class ClipboardItem final : public nsWrapperCache {
23 public:
24 struct ItemEntry {
25 nsString mType;
26 OwningStringOrBlob mData;
29 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(ClipboardItem)
30 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(ClipboardItem)
32 ClipboardItem(nsISupports* aOwner, dom::PresentationStyle aPresentationStyle,
33 nsTArray<ItemEntry>&& aItems);
35 static already_AddRefed<ClipboardItem> Constructor(
36 const GlobalObject& aGlobal,
37 const Record<nsString, OwningStringOrBlob>& aItems,
38 const ClipboardItemOptions& aOptions, ErrorResult& aRv);
40 dom::PresentationStyle PresentationStyle() const {
41 return mPresentationStyle;
43 void GetTypes(nsTArray<nsString>& aTypes) const;
45 already_AddRefed<Promise> GetType(const nsAString& aType, ErrorResult& aRv);
47 nsISupports* GetParentObject() const { return mOwner; }
49 JSObject* WrapObject(JSContext* aCx,
50 JS::Handle<JSObject*> aGivenProto) override;
52 const nsTArray<ItemEntry>& Entries() const { return mItems; }
54 private:
55 ~ClipboardItem() = default;
57 nsCOMPtr<nsISupports> mOwner;
58 dom::PresentationStyle mPresentationStyle;
59 nsTArray<ItemEntry> mItems;
62 } // namespace mozilla::dom
64 #endif // mozilla_dom_ClipboardItem_h_