gfx: Make display lists serializable using serde.

This commit introduces the `serde` dependency, which we will use to
serialize messages going between processes in multiprocess Servo.

This also adds a new debugging flag, `-Z print-display-list-json`,
allowing the output of display list serialization to be visualized.
This will be useful for our experiments with alternate rasterizers.
This commit is contained in:
Patrick Walton 2015-07-08 16:15:23 -07:00
parent b6b95085fb
commit 6eacb0c995
30 changed files with 320 additions and 124 deletions

View file

@ -71,3 +71,6 @@ smallvec = "0.1"
string_cache = "0.1"
string_cache_plugin = "0.1"
euclid = "0.1"
serde = "*"
serde_macros = "*"

View file

@ -829,7 +829,9 @@ impl FragmentDisplayListBuilding for Fragment {
let line_display_item = box LineDisplayItem {
base: BaseDisplayItem::new(baseline,
DisplayItemMetadata::new(self.node, style, Cursor::DefaultCursor),
DisplayItemMetadata::new(self.node,
style,
Cursor::DefaultCursor),
(*clip).clone()),
color: color::rgb(0, 200, 0),
style: border_style::T::dashed,

View file

@ -58,6 +58,7 @@ use script::layout_interface::{NewLayoutTaskInfo, Msg, Reflow, ReflowGoal, Reflo
use script::layout_interface::{ScriptLayoutChan, ScriptReflow, TrustedNodeAddress};
use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayoutChannel};
use script_traits::{ScriptControlChan, StylesheetLoadResponder};
use serde::json;
use std::borrow::ToOwned;
use std::cell::Cell;
use std::collections::HashMap;
@ -907,6 +908,9 @@ impl LayoutTask {
println!("#### start printing display list.");
stacking_context.print("#".to_owned());
}
if opts::get().dump_display_list_json {
println!("{}", json::to_string_pretty(&stacking_context).unwrap());
}
rw_data.stacking_context = Some(stacking_context.clone());

View file

@ -5,6 +5,7 @@
#![feature(append)]
#![feature(arc_unique)]
#![feature(box_syntax)]
#![feature(custom_derive)]
#![feature(filling_drop)]
#![feature(hashmap_hasher)]
#![feature(heap_api)]
@ -36,7 +37,6 @@ extern crate profile_traits;
#[macro_use]
extern crate util;
extern crate rustc_serialize;
extern crate azure;
extern crate canvas_traits;
extern crate clock_ticks;
@ -50,9 +50,11 @@ extern crate ipc_channel;
extern crate layout_traits;
extern crate libc;
extern crate msg;
extern crate rustc_serialize;
extern crate script;
extern crate script_traits;
extern crate selectors;
extern crate serde;
extern crate smallvec;
extern crate string_cache;
extern crate style;