mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
633c2172a9
Fix: #17226 #17200 #17201 This is work in progress. Some tests still fail. I'd like to get early feedback as it's a pretty large PR. There is nothing fundamentally new. Basically, I added TopLevelBrowsingContrextId to the relevant messages between the embedder, the compositor and the constellation, and enforced the PipelineId to be attached to each ScriptMsg (see #17201). I unaliased all the ScriptMsg. It was getting difficult to understand the nature of the message as ScriptMsg was used aliased CompositorMsg sometimes (CompositorMsg is an actually type of message already). I renamed constellation_chan to script_to_constellation_chan, again, for clarification. This cleanup code is necessary for #15934 and for tabs support. /cc @asajeffrey can I ask you to look at this? No need for a formal review, I need feedback at this stage. Source-Repo: https://github.com/servo/servo Source-Revision: 74558990b258cb55f230ebe8ec3fc557fd286f94 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : e254fc37d5b07b98c035873e2269f89acb3fafa0
47 lines
1.3 KiB
Rust
47 lines
1.3 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
use ipc_channel::ipc::channel;
|
|
use script_traits::{ScriptToConstellationChan, ScriptMsg};
|
|
use std::borrow::ToOwned;
|
|
|
|
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, String);
|
|
}
|
|
|
|
impl ClipboardProvider for ScriptToConstellationChan {
|
|
fn clipboard_contents(&mut self) -> String {
|
|
let (tx, rx) = channel().unwrap();
|
|
self.send(ScriptMsg::GetClipboardContents(tx)).unwrap();
|
|
rx.recv().unwrap()
|
|
}
|
|
fn set_clipboard_contents(&mut self, s: String) {
|
|
self.send(ScriptMsg::SetClipboardContents(s)).unwrap();
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|