mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +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
|
@ -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>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue