diff options
author | Martin Robinson <mrobinson@igalia.com> | 2025-02-07 11:43:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-07 10:43:46 +0000 |
commit | 19e41ab9f9b4217f5d07f8ab84a15e0454251a1a (patch) | |
tree | 4cffde4e7526bb46a4b32beb25502198017a54ba /tests/unit/script/textinput.rs | |
parent | b5b69988ccd68c70050225d75694ae9eb0bb95f7 (diff) | |
download | servo-19e41ab9f9b4217f5d07f8ab84a15e0454251a1a.tar.gz servo-19e41ab9f9b4217f5d07f8ab84a15e0454251a1a.zip |
libservo: Add a `ClipboardDelegate` and a default implementation (#35297)
Add a `ClipboardDelegate` to the `WebView` API and a default
implementation in libservo for this delegate that works on Mac, Windows,
and Linux. Support for Android will be added in the future. This means
that embedders do not need to do anything special to get clipboard
support, but can choose to override it or implement it for other
platforms.
In addition, this adds support for handling fetches of clipboard contents
and renames things to reflect that eventually other types of clipboard
content will be supported. Part of this is removing the string
argument from the `ClipboardEventType::Paste` enum because script will
need to get other types of content from the clipboard than just a
string. It now talks to the embedder to get this information directly.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'tests/unit/script/textinput.rs')
-rw-r--r-- | tests/unit/script/textinput.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/unit/script/textinput.rs b/tests/unit/script/textinput.rs index 9d8c0dda3a9..7822dbd785e 100644 --- a/tests/unit/script/textinput.rs +++ b/tests/unit/script/textinput.rs @@ -27,10 +27,10 @@ impl DummyClipboardContext { } impl ClipboardProvider for DummyClipboardContext { - fn clipboard_contents(&mut self) -> String { - self.content.clone() + fn get_text(&mut self) -> Result<String, String> { + Ok(self.content.clone()) } - fn set_clipboard_contents(&mut self, s: String) { + fn set_text(&mut self, s: String) { self.content = s; } } |