mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01: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
|
@ -107,7 +107,6 @@ use canvas::canvas_paint_thread::CanvasPaintThread;
|
|||
use canvas::webgl_thread::WebGLThreads;
|
||||
use canvas_traits::canvas::CanvasId;
|
||||
use canvas_traits::canvas::CanvasMsg;
|
||||
use clipboard::{ClipboardContext, ClipboardProvider};
|
||||
use compositing::compositor_thread::CompositorProxy;
|
||||
use compositing::compositor_thread::Msg as ToCompositorMsg;
|
||||
use compositing::SendableFrameTree;
|
||||
|
@ -361,9 +360,6 @@ pub struct Constellation<Message, LTF, STF> {
|
|||
/// The size of the top-level window.
|
||||
window_size: WindowSizeData,
|
||||
|
||||
/// Means of accessing the clipboard
|
||||
clipboard_ctx: Option<ClipboardContext>,
|
||||
|
||||
/// Bits of state used to interact with the webdriver implementation
|
||||
webdriver: WebDriverData,
|
||||
|
||||
|
@ -734,13 +730,6 @@ where
|
|||
device_pixel_ratio: TypedScale::new(device_pixels_per_px.unwrap_or(1.0)),
|
||||
},
|
||||
phantom: PhantomData,
|
||||
clipboard_ctx: match ClipboardContext::new() {
|
||||
Ok(c) => Some(c),
|
||||
Err(e) => {
|
||||
warn!("Error creating clipboard context ({})", e);
|
||||
None
|
||||
},
|
||||
},
|
||||
webdriver: WebDriverData::new(),
|
||||
scheduler_chan: TimerScheduler::start(),
|
||||
document_states: HashMap::new(),
|
||||
|
@ -1524,30 +1513,6 @@ where
|
|||
FromScriptMsg::Focus => {
|
||||
self.handle_focus_msg(source_pipeline_id);
|
||||
},
|
||||
FromScriptMsg::GetClipboardContents(sender) => {
|
||||
let contents = match self.clipboard_ctx {
|
||||
Some(ref mut ctx) => {
|
||||
match ctx.get_contents() {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
warn!("Error getting clipboard contents ({}), defaulting to empty string", e);
|
||||
"".to_owned()
|
||||
},
|
||||
}
|
||||
},
|
||||
None => "".to_owned(),
|
||||
};
|
||||
if let Err(e) = sender.send(contents) {
|
||||
warn!("Failed to send clipboard ({})", e);
|
||||
}
|
||||
},
|
||||
FromScriptMsg::SetClipboardContents(s) => {
|
||||
if let Some(ref mut ctx) = self.clipboard_ctx {
|
||||
if let Err(e) = ctx.set_contents(s) {
|
||||
warn!("Error setting clipboard contents ({})", e);
|
||||
}
|
||||
}
|
||||
},
|
||||
FromScriptMsg::VisibilityChangeComplete(is_visible) => {
|
||||
self.handle_visibility_change_complete(source_pipeline_id, is_visible);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue