mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -48,6 +48,7 @@ use crate::dom::bindings::inheritance::Castable;
|
|||
use crate::dom::bindings::reflector::DomObject;
|
||||
use crate::dom::bindings::root::{DomRoot, LayoutDom, MutNullableDom};
|
||||
use crate::dom::bindings::str::{DOMString, USVString};
|
||||
use crate::dom::clipboardevent::ClipboardEvent;
|
||||
use crate::dom::compositionevent::CompositionEvent;
|
||||
use crate::dom::document::Document;
|
||||
use crate::dom::element::{AttributeMutation, Element, LayoutElementHelpers};
|
||||
|
@ -79,7 +80,10 @@ use crate::textinput::KeyReaction::{
|
|||
DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction,
|
||||
};
|
||||
use crate::textinput::Lines::Single;
|
||||
use crate::textinput::{Direction, SelectionDirection, TextInput, UTF16CodeUnits, UTF8Bytes};
|
||||
use crate::textinput::{
|
||||
handle_text_clipboard_action, Direction, SelectionDirection, TextInput, UTF16CodeUnits,
|
||||
UTF8Bytes,
|
||||
};
|
||||
|
||||
const DEFAULT_SUBMIT_VALUE: &str = "Submit";
|
||||
const DEFAULT_RESET_VALUE: &str = "Reset";
|
||||
|
@ -2648,6 +2652,10 @@ impl VirtualMethods for HTMLInputElement {
|
|||
}
|
||||
event.mark_as_handled();
|
||||
}
|
||||
} else if let Some(clipboard_event) = event.downcast::<ClipboardEvent>() {
|
||||
if !event.DefaultPrevented() {
|
||||
handle_text_clipboard_action(self, &self.textinput, clipboard_event, CanGc::note());
|
||||
}
|
||||
}
|
||||
|
||||
self.validity_state()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue