diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-07-27 20:45:05 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-07-27 20:45:05 -0600 |
commit | e0bd80f80715bdbdf30de1de9c79a99a41cfd99e (patch) | |
tree | 9a7c7bb8825e07b755ad7dd7aa36863db56951a2 /components/script/layout_interface.rs | |
parent | 2672f2bbe46fd833c6a84b70edaa99dcaf092b5c (diff) | |
parent | 126938a963e79e5dc50ad748bb590df3c9bfdd35 (diff) | |
download | servo-e0bd80f80715bdbdf30de1de9c79a99a41cfd99e.tar.gz servo-e0bd80f80715bdbdf30de1de9c79a99a41cfd99e.zip |
Auto merge of #6662 - tschneidereit:client-geometry, r=glennw,pcwatson
Implement Element.client{Top,Left,Width,Height}
This isn't done, but contains a working implementation of at least `clientTop`. Feedback would be much appreciated: it's probably far from ideal.
Implementing `clientLeft` is straight-forward, I think, but `clientWidth` and `clientHeight` require accessing the `border_box` - and I don't know how that works, yet.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6662)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/layout_interface.rs')
-rw-r--r-- | components/script/layout_interface.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index b94758f56b7..d94f6e4a581 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -95,6 +95,8 @@ pub trait LayoutRPC { fn content_box(&self) -> ContentBoxResponse; /// Requests the dimensions of all the content boxes, as in the `getClientRects()` call. fn content_boxes(&self) -> ContentBoxesResponse; + /// Requests the geometry of this node. Used by APIs such as `clientTop`. + fn node_geometry(&self) -> NodeGeometryResponse; /// Requests the node containing the point of interest fn hit_test(&self, node: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()>; fn mouse_over(&self, node: TrustedNodeAddress, point: Point2D<f32>) -> Result<MouseOverResponse, ()>; @@ -102,6 +104,9 @@ pub trait LayoutRPC { pub struct ContentBoxResponse(pub Rect<Au>); pub struct ContentBoxesResponse(pub Vec<Rect<Au>>); +pub struct NodeGeometryResponse { + pub client_rect: Rect<i32>, +} pub struct HitTestResponse(pub UntrustedNodeAddress); pub struct MouseOverResponse(pub Vec<UntrustedNodeAddress>); @@ -120,6 +125,7 @@ pub enum ReflowQueryType { NoQuery, ContentBoxQuery(TrustedNodeAddress), ContentBoxesQuery(TrustedNodeAddress), + NodeGeometryQuery(TrustedNodeAddress), } /// Information needed for a reflow. |