aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_interface.rs
diff options
context:
space:
mode:
authorbenshu <benshu@benshu.de>2015-08-18 15:11:09 +0200
committerJosh Matthews <josh@joshmatthews.net>2016-02-24 13:51:47 -0500
commit0785d91ae460dc0702dc1cd8f5e00d0c0446269c (patch)
treef62a9d56e106c751eb0dc4b6eb2c54de0b6b2ffa /components/script/layout_interface.rs
parent9ab2da3cd111eb619d5ed779b6bb42c750a99f00 (diff)
downloadservo-0785d91ae460dc0702dc1cd8f5e00d0c0446269c.tar.gz
servo-0785d91ae460dc0702dc1cd8f5e00d0c0446269c.zip
Completed implementation of devtools' `getLayout`.
Diffstat (limited to 'components/script/layout_interface.rs')
-rw-r--r--components/script/layout_interface.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index 831c04a9516..17f553d43e8 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -23,6 +23,7 @@ use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender, channel};
use string_cache::Atom;
use style::context::ReflowGoal;
+use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left};
use style::selector_impl::PseudoElement;
use style::servo::Stylesheet;
use url::Url;
@@ -109,8 +110,28 @@ pub trait LayoutRPC {
/// Query layout for the resolved value of a given CSS property
fn resolved_style(&self) -> ResolvedStyleResponse;
fn offset_parent(&self) -> OffsetParentResponse;
+ /// Query layout for the resolve values of the margin properties for an element.
+ fn margin_style(&self) -> MarginStyleResponse;
}
+#[derive(Clone)]
+pub struct MarginStyleResponse {
+ pub top: margin_top::computed_value::T,
+ pub right: margin_right::computed_value::T,
+ pub bottom: margin_bottom::computed_value::T,
+ pub left: margin_left::computed_value::T,
+}
+
+impl MarginStyleResponse {
+ pub fn empty() -> MarginStyleResponse {
+ MarginStyleResponse {
+ top: margin_top::computed_value::T::Auto,
+ right: margin_right::computed_value::T::Auto,
+ bottom: margin_bottom::computed_value::T::Auto,
+ left: margin_left::computed_value::T::Auto,
+ }
+ }
+}
pub struct ContentBoxResponse(pub Rect<Au>);
pub struct ContentBoxesResponse(pub Vec<Rect<Au>>);
@@ -145,6 +166,7 @@ pub enum ReflowQueryType {
NodeGeometryQuery(TrustedNodeAddress),
ResolvedStyleQuery(TrustedNodeAddress, Option<PseudoElement>, Atom),
OffsetParentQuery(TrustedNodeAddress),
+ MarginStyleQuery(TrustedNodeAddress),
}
/// Information needed for a reflow.