mirror of
https://github.com/servo/servo.git
synced 2025-08-22 05:45:33 +01:00
Auto merge of #23564 - mmiecz:clipboard-refactoring, r=jdm
Clipboard refactoring <!-- Please describe your changes on the following line: --> This PR removes clipboard handling from the constellation. Instead, now embedder handles it. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #23440 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because it is enough to test manually in input box, if copying and pasting still works . <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23564) <!-- Reviewable:end -->
This commit is contained in:
commit
e382266b22
12 changed files with 117 additions and 66 deletions
|
@ -8,13 +8,34 @@
|
|||
// except according to those terms.
|
||||
|
||||
use keyboard_types::{Key, Modifiers};
|
||||
use script::clipboard_provider::DummyClipboardContext;
|
||||
use script::clipboard_provider::ClipboardProvider;
|
||||
use script::test::DOMString;
|
||||
use script::textinput::{
|
||||
Direction, Lines, Selection, SelectionDirection, TextInput, TextPoint, UTF16CodeUnits,
|
||||
UTF8Bytes,
|
||||
};
|
||||
|
||||
pub struct DummyClipboardContext {
|
||||
content: String,
|
||||
}
|
||||
|
||||
impl DummyClipboardContext {
|
||||
pub fn new(s: &str) -> DummyClipboardContext {
|
||||
DummyClipboardContext {
|
||||
content: s.to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ClipboardProvider for DummyClipboardContext {
|
||||
fn clipboard_contents(&mut self) -> String {
|
||||
self.content.clone()
|
||||
}
|
||||
fn set_clipboard_contents(&mut self, s: String) {
|
||||
self.content = s;
|
||||
}
|
||||
}
|
||||
|
||||
fn text_input(lines: Lines, s: &str) -> TextInput<DummyClipboardContext> {
|
||||
TextInput::new(
|
||||
lines,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue