mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Implement Clipboard Event Api (#33576)
* implement ClipboardEvent interface Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * draft implementation of clipboard events Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * handle received clipboard events inside html elemtents Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * use rustdoc style Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix compilation errors due to rebase Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * update arboard crate Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * improve paste events Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * code cleanup revert arboard crate's update, handle text only Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * restrict visibility of some methods to script crate Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * propagate CanGc argument Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * simplify handle_clipboard_msg Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * remove code duplication Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix potential borrow hazard Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * add clipboard_event pref, restore unit test code Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * retrict visibility of some document's methods Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * check if clipboardevent is trusted Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * enable clipboardevent Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> * fix compilation for egl ports Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com> --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
parent
cd9e831e91
commit
d470f219b1
24 changed files with 581 additions and 26 deletions
|
@ -31,6 +31,10 @@ impl PlainString {
|
|||
pub(crate) fn new(data: DOMString, type_: DOMString) -> Self {
|
||||
Self { data, type_ }
|
||||
}
|
||||
|
||||
pub fn data(&self) -> String {
|
||||
self.data.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -99,7 +103,6 @@ pub(crate) enum Mode {
|
|||
/// <https://html.spec.whatwg.org/multipage/#concept-dnd-rw>
|
||||
ReadWrite,
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-dnd-ro>
|
||||
#[allow(dead_code)] // TODO this used by ClipboardEvent.
|
||||
ReadOnly,
|
||||
/// <https://html.spec.whatwg.org/multipage/#concept-dnd-p>
|
||||
Protected,
|
||||
|
@ -115,6 +118,7 @@ pub(crate) struct DragDataStore {
|
|||
mode: Mode,
|
||||
/// <https://html.spec.whatwg.org/multipage/#drag-data-store-allowed-effects-state>
|
||||
allowed_effects_state: String,
|
||||
pub clear_was_called: bool,
|
||||
}
|
||||
|
||||
impl DragDataStore {
|
||||
|
@ -128,6 +132,7 @@ impl DragDataStore {
|
|||
bitmap: None,
|
||||
mode: Mode::Protected,
|
||||
allowed_effects_state: String::from("uninitialized"),
|
||||
clear_was_called: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,6 +260,10 @@ impl DragDataStore {
|
|||
self.item_list.len()
|
||||
}
|
||||
|
||||
pub(crate) fn iter_item_list(&self) -> std::slice::Iter<'_, Kind> {
|
||||
self.item_list.iter()
|
||||
}
|
||||
|
||||
pub(crate) fn get_item(&self, index: usize) -> Option<Kind> {
|
||||
self.item_list.get(index).cloned()
|
||||
}
|
||||
|
@ -265,6 +274,7 @@ impl DragDataStore {
|
|||
|
||||
pub(crate) fn clear_list(&mut self) {
|
||||
self.item_list.clear();
|
||||
self.clear_was_called = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue