mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add set_clipboard_context function and relevant plumbing. Use Option more consistantly (less unwraps) in textinput's selection handling.
This commit is contained in:
parent
52c2049f2a
commit
f86252a60b
5 changed files with 83 additions and 48 deletions
|
@ -13,7 +13,7 @@ pub trait ClipboardProvider {
|
|||
// blocking method to get the clipboard contents
|
||||
fn clipboard_contents(&mut self) -> String;
|
||||
// blocking method to set the clipboard contents
|
||||
fn set_clipboard_contents(&mut self, &str);
|
||||
fn set_clipboard_contents(&mut self, String);
|
||||
}
|
||||
|
||||
impl ClipboardProvider for ConstellationChan {
|
||||
|
@ -22,8 +22,8 @@ impl ClipboardProvider for ConstellationChan {
|
|||
self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
|
||||
rx.recv().unwrap()
|
||||
}
|
||||
fn set_clipboard_contents(&mut self, _: &str) {
|
||||
panic!("not yet implemented");
|
||||
fn set_clipboard_contents(&mut self, s: String) {
|
||||
self.0.send(ConstellationMsg::SetClipboardContents(s)).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ impl ClipboardProvider for DummyClipboardContext {
|
|||
fn clipboard_contents(&mut self) -> String {
|
||||
self.content.clone()
|
||||
}
|
||||
fn set_clipboard_contents(&mut self, s: &str) {
|
||||
self.content = s.to_owned();
|
||||
fn set_clipboard_contents(&mut self, s: String) {
|
||||
self.content = s;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue