aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_bindings
diff options
context:
space:
mode:
authorGae24 <96017547+Gae24@users.noreply.github.com>2025-04-07 01:47:57 +0200
committerGitHub <noreply@github.com>2025-04-06 23:47:57 +0000
commitd1243a1867bdef5106ee016f6f3575488d73f030 (patch)
tree3c937a522f213f94adcb214124d01c28fe6e1db0 /components/script_bindings
parent33b00dbe405ec6b432e465b9ee28d433382d9f32 (diff)
downloadservo-d1243a1867bdef5106ee016f6f3575488d73f030.tar.gz
servo-d1243a1867bdef5106ee016f6f3575488d73f030.zip
dom: Implement `ClipboardItem` (#36336)
implement the `ClipboardItem` interface Testing: covered by existing wpt tests part of #36084 --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
Diffstat (limited to 'components/script_bindings')
-rw-r--r--components/script_bindings/codegen/Bindings.conf4
-rw-r--r--components/script_bindings/webidls/Clipboard.webidl26
2 files changed, 30 insertions, 0 deletions
diff --git a/components/script_bindings/codegen/Bindings.conf b/components/script_bindings/codegen/Bindings.conf
index b6105c2d43a..5a95a6131a6 100644
--- a/components/script_bindings/codegen/Bindings.conf
+++ b/components/script_bindings/codegen/Bindings.conf
@@ -87,6 +87,10 @@ DOMInterfaces = {
'canGc': ['Before', 'After', 'Remove', 'ReplaceWith']
},
+'ClipboardItem': {
+ 'canGc': ['Types']
+},
+
'CountQueuingStrategy': {
'canGc': ['GetSize'],
},
diff --git a/components/script_bindings/webidls/Clipboard.webidl b/components/script_bindings/webidls/Clipboard.webidl
new file mode 100644
index 00000000000..2d2bb409e1a
--- /dev/null
+++ b/components/script_bindings/webidls/Clipboard.webidl
@@ -0,0 +1,26 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://w3c.github.io/clipboard-apis/#clipboard-item-interface
+
+typedef Promise<(DOMString or Blob)> ClipboardItemData;
+
+[SecureContext, Exposed=Window, Pref="dom_async_clipboard_enabled"]
+interface ClipboardItem {
+ [Throws] constructor(record<DOMString, ClipboardItemData> items,
+ optional ClipboardItemOptions options = {});
+
+ readonly attribute PresentationStyle presentationStyle;
+ readonly attribute /* FrozenArray<DOMString> */ any types;
+
+ // Promise<Blob> getType(DOMString type);
+
+ // static boolean supports(DOMString type);
+};
+
+enum PresentationStyle { "unspecified", "inline", "attachment" };
+
+dictionary ClipboardItemOptions {
+ PresentationStyle presentationStyle = "unspecified";
+};