aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-07-27 20:45:05 -0600
committerbors-servo <metajack+bors@gmail.com>2015-07-27 20:45:05 -0600
commite0bd80f80715bdbdf30de1de9c79a99a41cfd99e (patch)
tree9a7c7bb8825e07b755ad7dd7aa36863db56951a2 /components/script/dom/node.rs
parent2672f2bbe46fd833c6a84b70edaa99dcaf092b5c (diff)
parent126938a963e79e5dc50ad748bb590df3c9bfdd35 (diff)
downloadservo-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/dom/node.rs')
-rw-r--r--components/script/dom/node.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 42ad7608580..54535fdb7af 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -492,6 +492,7 @@ pub trait NodeHelpers {
fn get_bounding_content_box(self) -> Rect<Au>;
fn get_content_boxes(self) -> Vec<Rect<Au>>;
+ fn get_client_rect(self) -> Rect<i32>;
fn before(self, nodes: Vec<NodeOrString>) -> ErrorResult;
fn after(self, nodes: Vec<NodeOrString>) -> ErrorResult;
@@ -794,6 +795,10 @@ impl<'a> NodeHelpers for &'a Node {
window_from_node(self).r().content_boxes_query(self.to_trusted_node_address())
}
+ fn get_client_rect(self) -> Rect<i32> {
+ window_from_node(self).r().client_rect_query(self.to_trusted_node_address())
+ }
+
// https://dom.spec.whatwg.org/#dom-childnode-before
fn before(self, nodes: Vec<NodeOrString>) -> ErrorResult {
match self.parent_node.get() {