mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -31,11 +31,12 @@ parking_lot = {version = "0.3.3", features = ["nightly"]}
|
|||
plugins = {path = "../plugins"}
|
||||
profile_traits = {path = "../profile_traits"}
|
||||
range = {path = "../range"}
|
||||
rustc-serialize = "0.3"
|
||||
script_layout_interface = {path = "../script_layout_interface"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
selectors = "0.14"
|
||||
serde = "0.8"
|
||||
serde_derive = "0.8"
|
||||
serde_json = "0.8"
|
||||
servo_atoms = {path = "../atoms"}
|
||||
smallvec = "0.1"
|
||||
style = {path = "../style"}
|
||||
|
|
|
@ -48,10 +48,10 @@ use gfx_traits::print_tree::PrintTree;
|
|||
use layout_debug;
|
||||
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto};
|
||||
use model::{specified, specified_or_none};
|
||||
use rustc_serialize::{Encodable, Encoder};
|
||||
use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use script_layout_interface::restyle_damage::REPOSITION;
|
||||
use sequential;
|
||||
use serde::{Serialize, Serializer};
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
@ -65,7 +65,7 @@ use style::values::computed::LengthOrPercentageOrAuto;
|
|||
use util::clamp;
|
||||
|
||||
/// Information specific to floated blocks.
|
||||
#[derive(Clone, RustcEncodable)]
|
||||
#[derive(Clone, Serialize)]
|
||||
pub struct FloatedBlockInfo {
|
||||
/// The amount of inline size that is available for the float.
|
||||
pub containing_inline_size: Au,
|
||||
|
@ -502,7 +502,7 @@ pub enum FormattingContextType {
|
|||
}
|
||||
|
||||
// A block formatting context.
|
||||
#[derive(RustcEncodable)]
|
||||
#[derive(Serialize)]
|
||||
pub struct BlockFlow {
|
||||
/// Data common to all flows.
|
||||
pub base: BaseFlow,
|
||||
|
@ -526,9 +526,9 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
impl Encodable for BlockFlowFlags {
|
||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||
self.bits().encode(e)
|
||||
impl Serialize for BlockFlowFlags {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
self.bits().serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
|||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
|
||||
/// The kind of float: left or right.
|
||||
#[derive(Clone, RustcEncodable, Debug, Copy)]
|
||||
#[derive(Clone, Serialize, Debug, Copy)]
|
||||
pub enum FloatKind {
|
||||
Left,
|
||||
Right
|
||||
|
|
|
@ -41,9 +41,9 @@ use inline::InlineFlow;
|
|||
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
|
||||
use multicol::MulticolFlow;
|
||||
use parallel::FlowParallelInfo;
|
||||
use rustc_serialize::{Encodable, Encoder};
|
||||
use script_layout_interface::restyle_damage::{RECONSTRUCT_FLOW, REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use script_layout_interface::restyle_damage::{REPAINT, REPOSITION, RestyleDamage};
|
||||
use serde::{Serialize, Serializer};
|
||||
use std::{fmt, mem, raw};
|
||||
use std::iter::Zip;
|
||||
use std::slice::IterMut;
|
||||
|
@ -551,7 +551,7 @@ pub trait MutableOwnedFlowUtils {
|
|||
absolute_descendants: &mut AbsoluteDescendants);
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, RustcEncodable, PartialEq, Debug)]
|
||||
#[derive(Copy, Clone, Serialize, PartialEq, Debug)]
|
||||
pub enum FlowClass {
|
||||
Block,
|
||||
Inline,
|
||||
|
@ -821,7 +821,7 @@ impl EarlyAbsolutePositionInfo {
|
|||
|
||||
/// Information needed to compute absolute (i.e. viewport-relative) flow positions (not to be
|
||||
/// confused with absolutely-positioned flows) that is computed during final position assignment.
|
||||
#[derive(RustcEncodable, Copy, Clone)]
|
||||
#[derive(Serialize, Copy, Clone)]
|
||||
pub struct LateAbsolutePositionInfo {
|
||||
/// The position of the absolute containing block relative to the nearest ancestor stacking
|
||||
/// context. If the absolute containing block establishes the stacking context for this flow,
|
||||
|
@ -978,44 +978,17 @@ impl fmt::Debug for BaseFlow {
|
|||
}
|
||||
}
|
||||
|
||||
impl Encodable for BaseFlow {
|
||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||
e.emit_struct("base", 5, |e| {
|
||||
try!(e.emit_struct_field("id", 0, |e| self.debug_id().encode(e)));
|
||||
try!(e.emit_struct_field("stacking_relative_position",
|
||||
1,
|
||||
|e| self.stacking_relative_position.encode(e)));
|
||||
try!(e.emit_struct_field("intrinsic_inline_sizes",
|
||||
2,
|
||||
|e| self.intrinsic_inline_sizes.encode(e)));
|
||||
try!(e.emit_struct_field("position", 3, |e| self.position.encode(e)));
|
||||
e.emit_struct_field("children", 4, |e| {
|
||||
e.emit_seq(self.children.len(), |e| {
|
||||
for (i, c) in self.children.iter().enumerate() {
|
||||
try!(e.emit_seq_elt(i, |e| {
|
||||
try!(e.emit_struct("flow", 2, |e| {
|
||||
try!(e.emit_struct_field("class", 0, |e| c.class().encode(e)));
|
||||
e.emit_struct_field("data", 1, |e| {
|
||||
match c.class() {
|
||||
FlowClass::Block => c.as_block().encode(e),
|
||||
FlowClass::Inline => c.as_inline().encode(e),
|
||||
FlowClass::Table => c.as_table().encode(e),
|
||||
FlowClass::TableWrapper => c.as_table_wrapper().encode(e),
|
||||
FlowClass::TableRowGroup => c.as_table_rowgroup().encode(e),
|
||||
FlowClass::TableRow => c.as_table_row().encode(e),
|
||||
FlowClass::TableCell => c.as_table_cell().encode(e),
|
||||
_ => { Ok(()) } // TODO: Support captions
|
||||
}
|
||||
})
|
||||
}));
|
||||
Ok(())
|
||||
}));
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
impl Serialize for BaseFlow {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
let mut state = try!(serializer.serialize_struct("base", 5));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "id", self.debug_id()));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "stacking_relative_position",
|
||||
&self.stacking_relative_position));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "intrinsic_inline_sizes",
|
||||
&self.intrinsic_inline_sizes));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "position", &self.position));
|
||||
try!(serializer.serialize_struct_elt(&mut state, "children", &self.children));
|
||||
serializer.serialize_struct_end(state)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
* 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 flow::Flow;
|
||||
use flow::{Flow, FlowClass};
|
||||
use flow_ref::FlowRef;
|
||||
use serde::{Serialize, Serializer};
|
||||
use serde_json::{to_value, Value};
|
||||
use serde_json::builder::ObjectBuilder;
|
||||
use std::collections::{LinkedList, linked_list};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -20,6 +23,33 @@ pub struct FlowList {
|
|||
flows: LinkedList<FlowRef>,
|
||||
}
|
||||
|
||||
impl Serialize for FlowList {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
let mut state = try!(serializer.serialize_seq(Some(self.len())));
|
||||
for f in self.iter() {
|
||||
let flow_val = ObjectBuilder::new()
|
||||
.insert("class", f.class())
|
||||
.insert("data", match f.class() {
|
||||
FlowClass::Block => to_value(f.as_block()),
|
||||
FlowClass::Inline => to_value(f.as_inline()),
|
||||
FlowClass::Table => to_value(f.as_table()),
|
||||
FlowClass::TableWrapper => to_value(f.as_table_wrapper()),
|
||||
FlowClass::TableRowGroup => to_value(f.as_table_rowgroup()),
|
||||
FlowClass::TableRow => to_value(f.as_table_row()),
|
||||
FlowClass::TableCell => to_value(f.as_table_cell()),
|
||||
FlowClass::ListItem | FlowClass::TableColGroup | FlowClass::TableCaption |
|
||||
FlowClass::Multicol | FlowClass::MulticolColumn | FlowClass::Flex => {
|
||||
Value::Null // Not implemented yet
|
||||
}
|
||||
})
|
||||
.build();
|
||||
|
||||
try!(serializer.serialize_seq_elt(&mut state, flow_val));
|
||||
}
|
||||
serializer.serialize_seq_end(state)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MutFlowListIterator<'a> {
|
||||
it: linked_list::IterMut<'a, FlowRef>,
|
||||
}
|
||||
|
|
|
@ -63,3 +63,4 @@ impl WeakFlowRef {
|
|||
self.0.upgrade().map(FlowRef)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ use unicode_bidi;
|
|||
/// with a float or a horizontal wall of the containing block. The block-start
|
||||
/// inline-start corner of the green zone is the same as that of the line, but
|
||||
/// the green zone can be taller and wider than the line itself.
|
||||
#[derive(RustcEncodable, Debug, Clone)]
|
||||
#[derive(Serialize, Debug, Clone)]
|
||||
pub struct Line {
|
||||
/// A range of line indices that describe line breaks.
|
||||
///
|
||||
|
@ -207,7 +207,7 @@ impl Line {
|
|||
}
|
||||
|
||||
int_range_index! {
|
||||
#[derive(RustcEncodable)]
|
||||
#[derive(Serialize)]
|
||||
#[doc = "The index of a fragment in a flattened vector of DOM elements."]
|
||||
struct FragmentIndex(isize)
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ impl LineBreaker {
|
|||
}
|
||||
|
||||
/// Represents a list of inline fragments, including element ranges.
|
||||
#[derive(RustcEncodable, Clone)]
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct InlineFragments {
|
||||
/// The fragments themselves.
|
||||
pub fragments: Vec<Fragment>,
|
||||
|
@ -828,7 +828,7 @@ impl InlineFragments {
|
|||
}
|
||||
|
||||
/// Flows for inline layout.
|
||||
#[derive(RustcEncodable)]
|
||||
#[derive(Serialize)]
|
||||
pub struct InlineFlow {
|
||||
/// Data common to all flows.
|
||||
pub base: BaseFlow,
|
||||
|
@ -1780,7 +1780,7 @@ fn inline_contexts_are_equal(inline_context_a: &Option<InlineFragmentContext>,
|
|||
///
|
||||
/// Descent is not included in this structure because it can be computed from the fragment's
|
||||
/// border/content box and the ascent.
|
||||
#[derive(Clone, Copy, Debug, RustcEncodable)]
|
||||
#[derive(Clone, Copy, Debug, Serialize)]
|
||||
pub struct InlineMetrics {
|
||||
/// The amount of space above the baseline needed for this fragment.
|
||||
pub space_above_baseline: Au,
|
||||
|
@ -1831,7 +1831,7 @@ enum LineFlushMode {
|
|||
Flush,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, RustcEncodable)]
|
||||
#[derive(Copy, Clone, Debug, Serialize)]
|
||||
pub struct LineMetrics {
|
||||
pub space_above_baseline: Au,
|
||||
pub space_below_baseline: Au,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use flow;
|
||||
use flow_ref::FlowRef;
|
||||
use rustc_serialize::json;
|
||||
use serde_json::{to_string, to_value, Value};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::RefCell;
|
||||
use std::fs::File;
|
||||
|
@ -36,20 +36,20 @@ macro_rules! layout_debug_scope(
|
|||
)
|
||||
);
|
||||
|
||||
#[derive(RustcEncodable)]
|
||||
#[derive(Serialize)]
|
||||
struct ScopeData {
|
||||
name: String,
|
||||
pre: String,
|
||||
post: String,
|
||||
pre: Value,
|
||||
post: Value,
|
||||
children: Vec<Box<ScopeData>>,
|
||||
}
|
||||
|
||||
impl ScopeData {
|
||||
fn new(name: String, pre: String) -> ScopeData {
|
||||
fn new(name: String, pre: Value) -> ScopeData {
|
||||
ScopeData {
|
||||
name: name,
|
||||
pre: pre,
|
||||
post: String::new(),
|
||||
post: Value::Null,
|
||||
children: vec!(),
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ impl Scope {
|
|||
STATE_KEY.with(|ref r| {
|
||||
match *r.borrow_mut() {
|
||||
Some(ref mut state) => {
|
||||
let flow_trace = json::encode(&flow::base(&*state.flow_root)).unwrap();
|
||||
let flow_trace = to_value(&flow::base(&*state.flow_root));
|
||||
let data = box ScopeData::new(name.clone(), flow_trace);
|
||||
state.scope_stack.push(data);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ impl Drop for Scope {
|
|||
match *r.borrow_mut() {
|
||||
Some(ref mut state) => {
|
||||
let mut current_scope = state.scope_stack.pop().unwrap();
|
||||
current_scope.post = json::encode(&flow::base(&*state.flow_root)).unwrap();
|
||||
current_scope.post = to_value(&flow::base(&*state.flow_root));
|
||||
let previous_scope = state.scope_stack.last_mut().unwrap();
|
||||
previous_scope.children.push(current_scope);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ pub fn begin_trace(flow_root: FlowRef) {
|
|||
assert!(STATE_KEY.with(|ref r| r.borrow().is_none()));
|
||||
|
||||
STATE_KEY.with(|ref r| {
|
||||
let flow_trace = json::encode(&flow::base(&*flow_root)).unwrap();
|
||||
let flow_trace = to_value(&flow::base(&*flow_root));
|
||||
let state = State {
|
||||
scope_stack: vec![box ScopeData::new("root".to_owned(), flow_trace)],
|
||||
flow_root: flow_root.clone(),
|
||||
|
@ -125,9 +125,9 @@ pub fn end_trace(generation: u32) {
|
|||
let mut thread_state = STATE_KEY.with(|ref r| r.borrow_mut().take().unwrap());
|
||||
assert!(thread_state.scope_stack.len() == 1);
|
||||
let mut root_scope = thread_state.scope_stack.pop().unwrap();
|
||||
root_scope.post = json::encode(&flow::base(&*thread_state.flow_root)).unwrap();
|
||||
root_scope.post = to_value(&flow::base(&*thread_state.flow_root));
|
||||
|
||||
let result = json::encode(&root_scope).unwrap();
|
||||
let result = to_string(&root_scope).unwrap();
|
||||
let mut file = File::create(format!("layout_trace-{}.json", generation)).unwrap();
|
||||
file.write_all(result.as_bytes()).unwrap();
|
||||
}
|
||||
|
|
|
@ -44,9 +44,12 @@ extern crate plugins as servo_plugins;
|
|||
extern crate profile_traits;
|
||||
#[macro_use]
|
||||
extern crate range;
|
||||
extern crate rustc_serialize;
|
||||
extern crate script_layout_interface;
|
||||
extern crate script_traits;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
#[macro_use] extern crate servo_atoms;
|
||||
extern crate smallvec;
|
||||
extern crate style;
|
||||
|
|
|
@ -301,7 +301,7 @@ pub enum MarginCollapseState {
|
|||
}
|
||||
|
||||
/// Intrinsic inline-sizes, which consist of minimum and preferred.
|
||||
#[derive(RustcEncodable, Copy, Clone)]
|
||||
#[derive(Serialize, Copy, Clone)]
|
||||
pub struct IntrinsicISizes {
|
||||
/// The *minimum inline-size* of the content.
|
||||
pub minimum_inline_size: Au,
|
||||
|
|
|
@ -38,7 +38,7 @@ use table_wrapper::TableLayout;
|
|||
/// A table flow corresponded to the table's internal table fragment under a table wrapper flow.
|
||||
/// The properties `position`, `float`, and `margin-*` are used on the table wrapper fragment,
|
||||
/// not table fragment per CSS 2.1 § 10.5.
|
||||
#[derive(RustcEncodable)]
|
||||
#[derive(Serialize)]
|
||||
pub struct TableFlow {
|
||||
pub block_flow: BlockFlow,
|
||||
|
||||
|
@ -578,7 +578,7 @@ impl ISizeAndMarginsComputer for InternalTable {
|
|||
/// maximum of 100 pixels and 20% of the table), the preceding constraint means that we must
|
||||
/// potentially store both a specified width *and* a specified percentage, so that the inline-size
|
||||
/// assignment phase of layout will know which one to pick.
|
||||
#[derive(Clone, RustcEncodable, Debug, Copy)]
|
||||
#[derive(Clone, Serialize, Debug, Copy)]
|
||||
pub struct ColumnIntrinsicInlineSize {
|
||||
/// The preferred intrinsic inline size.
|
||||
pub preferred: Au,
|
||||
|
@ -615,7 +615,7 @@ impl ColumnIntrinsicInlineSize {
|
|||
///
|
||||
/// TODO(pcwalton): There will probably be some `border-collapse`-related info in here too
|
||||
/// eventually.
|
||||
#[derive(RustcEncodable, Clone, Copy, Debug)]
|
||||
#[derive(Serialize, Clone, Copy, Debug)]
|
||||
pub struct ColumnComputedInlineSize {
|
||||
/// The computed size of this inline column.
|
||||
pub size: Au,
|
||||
|
|
|
@ -30,7 +30,7 @@ use table::InternalTable;
|
|||
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
||||
|
||||
/// A table formatting context.
|
||||
#[derive(RustcEncodable)]
|
||||
#[derive(Serialize)]
|
||||
pub struct TableCellFlow {
|
||||
/// Data common to all block flows.
|
||||
pub block_flow: BlockFlow,
|
||||
|
@ -297,7 +297,7 @@ impl fmt::Debug for TableCellFlow {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, RustcEncodable)]
|
||||
#[derive(Copy, Clone, Debug, Serialize)]
|
||||
pub struct CollapsedBordersForCell {
|
||||
pub inline_start_border: CollapsedBorder,
|
||||
pub inline_end_border: CollapsedBorder,
|
||||
|
|
|
@ -20,8 +20,8 @@ use gfx_traits::ScrollRootId;
|
|||
use gfx_traits::print_tree::PrintTree;
|
||||
use layout_debug;
|
||||
use model::MaybeAuto;
|
||||
use rustc_serialize::{Encodable, Encoder};
|
||||
use script_layout_interface::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
|
||||
use serde::{Serialize, Serializer};
|
||||
use std::cmp::max;
|
||||
use std::fmt;
|
||||
use std::iter::{Enumerate, IntoIterator, Peekable};
|
||||
|
@ -65,14 +65,14 @@ pub struct TableRowFlow {
|
|||
pub collapsed_border_spacing: CollapsedBorderSpacingForRow,
|
||||
}
|
||||
|
||||
impl Encodable for TableRowFlow {
|
||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||
self.block_flow.encode(e)
|
||||
impl Serialize for TableRowFlow {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
self.block_flow.serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about the column inline size and span for each cell.
|
||||
#[derive(RustcEncodable, Copy, Clone)]
|
||||
#[derive(Serialize, Copy, Clone)]
|
||||
pub struct CellIntrinsicInlineSize {
|
||||
/// Inline sizes that this cell contributes to the column.
|
||||
pub column_size: ColumnIntrinsicInlineSize,
|
||||
|
@ -559,8 +559,8 @@ pub struct CollapsedBorder {
|
|||
pub provenance: CollapsedBorderProvenance,
|
||||
}
|
||||
|
||||
impl Encodable for CollapsedBorder {
|
||||
fn encode<S: Encoder>(&self, _: &mut S) -> Result<(), S::Error> {
|
||||
impl Serialize for CollapsedBorder {
|
||||
fn serialize<S: Serializer>(&self, _: &mut S) -> Result<(), S::Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ impl Encodable for CollapsedBorder {
|
|||
// FIXME(#8586): FromTableRow, FromTableRowGroup, FromTableColumn,
|
||||
// FromTableColumnGroup are unused
|
||||
#[allow(dead_code)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, RustcEncodable)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize)]
|
||||
pub enum CollapsedBorderProvenance {
|
||||
FromPreviousTableCell = 6,
|
||||
FromNextTableCell = 5,
|
||||
|
|
|
@ -17,7 +17,7 @@ use gfx::display_list::StackingContext;
|
|||
use gfx_traits::ScrollRootId;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use layout_debug;
|
||||
use rustc_serialize::{Encodable, Encoder};
|
||||
use serde::{Serialize, Serializer};
|
||||
use std::fmt;
|
||||
use std::iter::{IntoIterator, Iterator, Peekable};
|
||||
use std::sync::Arc;
|
||||
|
@ -55,9 +55,9 @@ pub struct TableRowGroupFlow {
|
|||
pub collapsed_block_direction_border_widths_for_table: Vec<Au>,
|
||||
}
|
||||
|
||||
impl Encodable for TableRowGroupFlow {
|
||||
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
|
||||
self.block_flow.encode(e)
|
||||
impl Serialize for TableRowGroupFlow {
|
||||
fn serialize<S: Serializer>(&self, serializer: &mut S) -> Result<(), S::Error> {
|
||||
self.block_flow.serialize(serializer)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,14 +39,14 @@ use style::values::computed::LengthOrPercentageOrAuto;
|
|||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
||||
use table_row;
|
||||
|
||||
#[derive(Copy, Clone, RustcEncodable, Debug)]
|
||||
#[derive(Copy, Clone, Serialize, Debug)]
|
||||
pub enum TableLayout {
|
||||
Fixed,
|
||||
Auto
|
||||
}
|
||||
|
||||
/// A table wrapper flow based on a block formatting context.
|
||||
#[derive(RustcEncodable)]
|
||||
#[derive(Serialize)]
|
||||
pub struct TableWrapperFlow {
|
||||
pub block_flow: BlockFlow,
|
||||
|
||||
|
|
3
components/servo/Cargo.lock
generated
3
components/servo/Cargo.lock
generated
|
@ -1213,11 +1213,12 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"range 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"script_layout_interface 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"selectors 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo_atoms 0.0.1",
|
||||
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
|
|
|
@ -22,9 +22,9 @@ pub enum InlineBaseDirection {
|
|||
RightToLeft
|
||||
}
|
||||
|
||||
// TODO: improve the readability of the WritingMode serialization, refer to the Debug:fmt()
|
||||
bitflags!(
|
||||
#[derive(RustcEncodable)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Serialize))]
|
||||
pub flags WritingMode: u8 {
|
||||
const FLAG_RTL = 1 << 0,
|
||||
const FLAG_VERTICAL = 1 << 1,
|
||||
|
@ -157,11 +157,13 @@ impl fmt::Display for WritingMode {
|
|||
/// (in addition to taking it as a parameter to methods) and check it.
|
||||
/// In non-debug builds, make this storage zero-size and the checks no-ops.
|
||||
#[cfg(not(debug_assertions))]
|
||||
#[derive(RustcEncodable, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(Serialize))]
|
||||
struct DebugWritingMode;
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
#[derive(RustcEncodable, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(Serialize))]
|
||||
struct DebugWritingMode {
|
||||
mode: WritingMode
|
||||
}
|
||||
|
@ -212,7 +214,8 @@ impl Debug for DebugWritingMode {
|
|||
|
||||
|
||||
/// A 2D size in flow-relative dimensions
|
||||
#[derive(RustcEncodable, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(Serialize))]
|
||||
pub struct LogicalSize<T> {
|
||||
pub inline: T, // inline-size, a.k.a. logical width, a.k.a. measure
|
||||
pub block: T, // block-size, a.k.a. logical height, a.k.a. extent
|
||||
|
@ -348,7 +351,8 @@ impl<T: Sub<T, Output=T>> Sub for LogicalSize<T> {
|
|||
|
||||
|
||||
/// A 2D point in flow-relative dimensions
|
||||
#[derive(PartialEq, RustcEncodable, Eq, Clone, Copy)]
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(Serialize))]
|
||||
pub struct LogicalPoint<T> {
|
||||
/// inline-axis coordinate
|
||||
pub i: T,
|
||||
|
@ -520,7 +524,8 @@ impl<T: Copy + Sub<T, Output=T>> Sub<LogicalSize<T>> for LogicalPoint<T> {
|
|||
/// Represents the four sides of the margins, borders, or padding of a CSS box,
|
||||
/// or a combination of those.
|
||||
/// A positive "margin" can be added to a rectangle to obtain a bigger rectangle.
|
||||
#[derive(RustcEncodable, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(Serialize))]
|
||||
pub struct LogicalMargin<T> {
|
||||
pub block_start: T,
|
||||
pub inline_end: T,
|
||||
|
@ -813,7 +818,8 @@ impl<T: Sub<T, Output=T>> Sub for LogicalMargin<T> {
|
|||
|
||||
|
||||
/// A rectangle in flow-relative dimensions
|
||||
#[derive(RustcEncodable, PartialEq, Eq, Clone, Copy)]
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
#[cfg_attr(feature = "servo", derive(Serialize))]
|
||||
pub struct LogicalRect<T> {
|
||||
pub start: LogicalPoint<T>,
|
||||
pub size: LogicalSize<T>,
|
||||
|
|
3
ports/cef/Cargo.lock
generated
3
ports/cef/Cargo.lock
generated
|
@ -1118,11 +1118,12 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"range 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"script_layout_interface 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"selectors 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo_atoms 0.0.1",
|
||||
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style 0.0.1",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue