aboutsummaryrefslogtreecommitdiffstats
path: root/components/msg
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2016-02-18 07:57:31 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2016-02-18 10:35:29 +1000
commitc0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f (patch)
treeced94496eb3f3b4149f1c2d3b0b02422bb3b5471 /components/msg
parentf7f0eea47035f4316d09db26315bf8ebb72637c9 (diff)
downloadservo-c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f.tar.gz
servo-c0531c312fdb0783e4d121b4c2d7f15d4f5cdc1f.zip
Add WebRender integration to Servo.
WebRender is an experimental GPU accelerated rendering backend for Servo. The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used). WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!
Diffstat (limited to 'components/msg')
-rw-r--r--components/msg/Cargo.toml3
-rw-r--r--components/msg/constellation_msg.rs30
-rw-r--r--components/msg/lib.rs1
3 files changed, 33 insertions, 1 deletions
diff --git a/components/msg/Cargo.toml b/components/msg/Cargo.toml
index b96bdeb953a..05f84756a5f 100644
--- a/components/msg/Cargo.toml
+++ b/components/msg/Cargo.toml
@@ -20,6 +20,9 @@ git = "https://github.com/servo/ipc-channel"
[dependencies.plugins]
path = "../plugins"
+[dependencies.webrender_traits]
+git = "https://github.com/glennw/webrender_traits"
+
[dependencies]
bitflags = "0.3"
cssparser = {version = "0.5.3", features = ["heap_size", "serde-serialization"]}
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index adefb76010c..83f308b26fd 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -17,6 +17,7 @@ use std::fmt;
use url::Url;
use util::geometry::{PagePx, ViewportPx};
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
+use webrender_traits;
#[derive(Deserialize, Serialize)]
pub struct ConstellationChan<T: Deserialize + Serialize>(pub IpcSender<T>);
@@ -207,7 +208,7 @@ pub enum WebDriverCommandMsg {
TakeScreenshot(PipelineId, IpcSender<Option<Image>>),
}
-#[derive(Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)]
+#[derive(Clone, Copy, Deserialize, Eq, PartialEq, Serialize, HeapSizeOf)]
pub enum PixelFormat {
K8, // Luminance channel only
KA8, // Luminance + alpha
@@ -228,6 +229,8 @@ pub struct Image {
pub format: PixelFormat,
#[ignore_heap_size_of = "Defined in ipc-channel"]
pub bytes: IpcSharedMemory,
+ #[ignore_heap_size_of = "Defined in webrender_traits"]
+ pub id: Option<webrender_traits::ImageKey>,
}
/// Similar to net::resource_thread::LoadData
@@ -353,3 +356,28 @@ impl fmt::Display for PipelineId {
#[derive(Clone, PartialEq, Eq, Copy, Hash, Debug, Deserialize, Serialize, HeapSizeOf)]
pub struct SubpageId(pub u32);
+
+pub trait ConvertPipelineIdToWebRender {
+ fn to_webrender(&self) -> webrender_traits::PipelineId;
+}
+
+pub trait ConvertPipelineIdFromWebRender {
+ fn from_webrender(&self) -> PipelineId;
+}
+
+impl ConvertPipelineIdToWebRender for PipelineId {
+ fn to_webrender(&self) -> webrender_traits::PipelineId {
+ let PipelineNamespaceId(namespace_id) = self.namespace_id;
+ let PipelineIndex(index) = self.index;
+ webrender_traits::PipelineId(namespace_id, index)
+ }
+}
+
+impl ConvertPipelineIdFromWebRender for webrender_traits::PipelineId {
+ fn from_webrender(&self) -> PipelineId {
+ PipelineId {
+ namespace_id: PipelineNamespaceId(self.0),
+ index: PipelineIndex(self.1),
+ }
+ }
+}
diff --git a/components/msg/lib.rs b/components/msg/lib.rs
index febf188fd77..93a513ef742 100644
--- a/components/msg/lib.rs
+++ b/components/msg/lib.rs
@@ -16,6 +16,7 @@ extern crate rustc_serialize;
extern crate serde;
extern crate url;
extern crate util;
+extern crate webrender_traits;
pub mod constellation_msg;
pub mod webdriver_msg;