summaryrefslogtreecommitdiffstats
path: root/dom/events/ClipboardItem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/events/ClipboardItem.cpp')
-rw-r--r--dom/events/ClipboardItem.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/events/ClipboardItem.cpp b/dom/events/ClipboardItem.cpp
index 76196be3b6..0d5df85492 100644
--- a/dom/events/ClipboardItem.cpp
+++ b/dom/events/ClipboardItem.cpp
@@ -6,6 +6,7 @@
#include "mozilla/dom/ClipboardItem.h"
+#include "mozilla/dom/Clipboard.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/Record.h"
#include "nsComponentManagerUtils.h"
@@ -290,6 +291,17 @@ already_AddRefed<ClipboardItem> ClipboardItem::Constructor(
return item.forget();
}
+// static
+bool ClipboardItem::Supports(const GlobalObject& aGlobal,
+ const nsAString& aType) {
+ for (const auto& mandatoryType : Clipboard::MandatoryDataTypes()) {
+ if (CompareUTF8toUTF16(mandatoryType, aType) == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
void ClipboardItem::GetTypes(nsTArray<nsString>& aTypes) const {
for (const auto& item : mItems) {
aTypes.AppendElement(item->Type());