aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/logical_geometry.rs
diff options
context:
space:
mode:
authorShing Lyu <shing.lyu@gmail.com>2016-10-12 11:47:04 +0800
committerShing Lyu <shing.lyu@gmail.com>2016-11-07 15:54:07 +0800
commit8bea421329f584f8394bd9ffe874249d293b8249 (patch)
treeccb1f2e9e55c488b2a138e10321e51139ea64b97 /components/style/logical_geometry.rs
parentf48b3fe2197a59b29bc711fb1b5496cbb97bd330 (diff)
downloadservo-8bea421329f584f8394bd9ffe874249d293b8249.tar.gz
servo-8bea421329f584f8394bd9ffe874249d293b8249.zip
Migrated -Z trace-layout to serde_json
Diffstat (limited to 'components/style/logical_geometry.rs')
-rw-r--r--components/style/logical_geometry.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs
index 0bf47cbc575..94dcd3881db 100644
--- a/components/style/logical_geometry.rs
+++ b/components/style/logical_geometry.rs
@@ -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>,