mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Migrated -Z trace-layout to serde_json
This commit is contained in:
parent
f48b3fe219
commit
8bea421329
19 changed files with 129 additions and 114 deletions
|
@ -28,11 +28,11 @@ use msg::constellation_msg::PipelineId;
|
|||
use net_traits::image::base::{Image, ImageMetadata};
|
||||
use net_traits::image_cache_thread::{ImageOrMetadataAvailable, UsePlaceholder};
|
||||
use range::*;
|
||||
use rustc_serialize::{Encodable, Encoder};
|
||||
use script_layout_interface::HTMLCanvasData;
|
||||
use script_layout_interface::SVGSVGData;
|
||||
use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, RestyleDamage};
|
||||
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use serde::{Serialize, Serializer};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cmp::{max, min};
|
||||
use std::collections::LinkedList;
|
||||
|
@ -133,13 +133,13 @@ pub struct Fragment {
|
|||
pub stacking_context_id: StackingContextId,
|
||||
}
|
||||
|
||||
impl Encodable for Fragment {
|
||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||
e.emit_struct("fragment", 3, |e| {
|
||||
try!(e.emit_struct_field("id", 0, |e| self.debug_id.encode(e)));
|
||||
try!(e.emit_struct_field("border_box", 1, |e| self.border_box.encode(e)));
|
||||
e.emit_struct_field("margin", 2, |e| self.margin.encode(e))
|
||||
})
|
||||
impl Serialize for Fragment {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
let mut state = try!(serializer.serialize_struct("fragment", 3));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "id", &self.debug_id));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "border_box", &self.border_box));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "margin", &self.margin));
|
||||
serializer.serialize_struct_end(state)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ impl ImageFragmentInfo {
|
|||
absolute_anchor_origin,
|
||||
image_size);
|
||||
*tile_spacing = Au(0);
|
||||
*size = image_size;;
|
||||
*size = image_size;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3162,16 +3162,15 @@ impl fmt::Display for DebugId {
|
|||
}
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
impl Encodable for DebugId {
|
||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||
e.emit_str(&format!("{:p}", &self))
|
||||
impl Serialize for DebugId {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
serializer.serialize_str(&format!("{:p}", &self))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
impl Encodable for DebugId {
|
||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||
e.emit_u16(self.0)
|
||||
impl Serialize for DebugId {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
serializer.serialize_u16(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue